diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py index 127a6ba20..3963eea9c 100644 --- a/notebook/base/handlers.py +++ b/notebook/base/handlers.py @@ -284,7 +284,7 @@ class IPythonHandler(AuthenticatedHandler): # No CORS headers deny the request allow = False if not allow: - self.log.warn("Blocking Cross Origin API request. Origin: %s, Host: %s", + self.log.warning("Blocking Cross Origin API request. Origin: %s, Host: %s", origin, host, ) return allow @@ -460,7 +460,7 @@ def json_errors(method): self.set_header('Content-Type', 'application/json') status = e.status_code message = e.log_message - self.log.warn(message) + self.log.warning(message) self.set_status(e.status_code) reply = dict(message=message, reason=e.reason) self.finish(json.dumps(reply)) @@ -583,7 +583,7 @@ class FilesRedirectHandler(IPythonHandler): if not cm.file_exists(path=path) and 'files' in parts: # redirect without files/ iff it would 404 # this preserves pre-2.0-style 'files/' links - self.log.warn("Deprecated files/ URL: %s", orig_path) + self.log.warning("Deprecated files/ URL: %s", orig_path) parts.remove('files') path = '/'.join(parts) diff --git a/notebook/base/zmqhandlers.py b/notebook/base/zmqhandlers.py index 1cfa8ecb3..88b332542 100644 --- a/notebook/base/zmqhandlers.py +++ b/notebook/base/zmqhandlers.py @@ -135,10 +135,10 @@ class WebSocketMixin(object): # If no header is provided, assume we can't verify origin if origin is None: - self.log.warn("Missing Origin header, rejecting WebSocket connection.") + self.log.warning("Missing Origin header, rejecting WebSocket connection.") return False if host is None: - self.log.warn("Missing Host header, rejecting WebSocket connection.") + self.log.warning("Missing Host header, rejecting WebSocket connection.") return False origin = origin.lower() @@ -157,7 +157,7 @@ class WebSocketMixin(object): # No CORS headers deny the request allow = False if not allow: - self.log.warn("Blocking Cross Origin WebSocket Attempt. Origin: %s, Host: %s", + self.log.warning("Blocking Cross Origin WebSocket Attempt. Origin: %s, Host: %s", origin, host, ) return allow @@ -192,7 +192,7 @@ class WebSocketMixin(object): since_last_pong = 1e3 * (now - self.last_pong) since_last_ping = 1e3 * (now - self.last_ping) if since_last_ping < 2*self.ping_interval and since_last_pong > self.ping_timeout: - self.log.warn("WebSocket ping timeout after %i ms.", since_last_pong) + self.log.warning("WebSocket ping timeout after %i ms.", since_last_pong) self.close() return @@ -248,7 +248,7 @@ class ZMQStreamHandler(WebSocketMixin, WebSocketHandler): # Sometimes this gets triggered when the on_close method is scheduled in the # eventloop but hasn't been called. if self.stream.closed() or stream.closed(): - self.log.warn("zmq message arrived on closed channel") + self.log.warning("zmq message arrived on closed channel") self.close() return channel = getattr(stream, 'channel', None) @@ -277,13 +277,13 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler): """ # authenticate the request before opening the websocket if self.get_current_user() is None: - self.log.warn("Couldn't authenticate WebSocket connection") + self.log.warning("Couldn't authenticate WebSocket connection") raise web.HTTPError(403) if self.get_argument('session_id', False): self.session.session = cast_unicode(self.get_argument('session_id')) else: - self.log.warn("No session ID specified") + self.log.warning("No session ID specified") @gen.coroutine def get(self, *args, **kwargs): diff --git a/notebook/services/api/handlers.py b/notebook/services/api/handlers.py index 76c662edd..f09263203 100644 --- a/notebook/services/api/handlers.py +++ b/notebook/services/api/handlers.py @@ -14,7 +14,7 @@ class APISpecHandler(web.StaticFileHandler, IPythonHandler): @web.authenticated def get(self): - self.log.warn("Serving api spec (experimental, incomplete)") + self.log.warning("Serving api spec (experimental, incomplete)") self.set_header('Content-Type', 'text/x-yaml') return web.StaticFileHandler.get(self, 'api.yaml') diff --git a/notebook/services/contents/filemanager.py b/notebook/services/contents/filemanager.py index 239eadbe7..d82bba403 100644 --- a/notebook/services/contents/filemanager.py +++ b/notebook/services/contents/filemanager.py @@ -66,7 +66,7 @@ class FileContentsManager(FileManagerMixin, ContentsManager): save_script = Bool(False, config=True, help='DEPRECATED, use post_save_hook. Will be removed in Notebook 5.0') def _save_script_changed(self): - self.log.warn(""" + self.log.warning(""" `--script` is deprecated and will be removed in notebook 5.0. You can trigger nbconvert via pre- or post-save hooks: @@ -252,12 +252,12 @@ class FileContentsManager(FileManagerMixin, ContentsManager): try: os_path = os.path.join(os_dir, name) except UnicodeDecodeError as e: - self.log.warn( + self.log.warning( "failed to decode filename '%s': %s", name, e) continue # skip over broken symlinks in listing if not os.path.exists(os_path): - self.log.warn("%s doesn't exist", os_path) + self.log.warning("%s doesn't exist", os_path) continue elif not os.path.isfile(os_path) and not os.path.isdir(os_path): self.log.debug("%s not a regular file", os_path) diff --git a/notebook/services/contents/handlers.py b/notebook/services/contents/handlers.py index 185649a96..672ff37f7 100644 --- a/notebook/services/contents/handlers.py +++ b/notebook/services/contents/handlers.py @@ -249,7 +249,7 @@ class ContentsHandler(APIHandler): def delete(self, path=''): """delete a file in the given path""" cm = self.contents_manager - self.log.warn('delete %s', path) + self.log.warning('delete %s', path) yield gen.maybe_future(cm.delete(path)) self.set_status(204) self.finish() @@ -310,7 +310,7 @@ class NotebooksRedirectHandler(IPythonHandler): SUPPORTED_METHODS = ('GET', 'PUT', 'PATCH', 'POST', 'DELETE') def get(self, path): - self.log.warn("/api/notebooks is deprecated, use /api/contents") + self.log.warning("/api/notebooks is deprecated, use /api/contents") self.redirect(url_path_join( self.base_url, 'api/contents', diff --git a/notebook/services/contents/manager.py b/notebook/services/contents/manager.py index 76db41c0b..b4e563724 100644 --- a/notebook/services/contents/manager.py +++ b/notebook/services/contents/manager.py @@ -411,7 +411,7 @@ class ContentsManager(LoggingConfigurable): """ model = self.get(path) nb = model['content'] - self.log.warn("Trusting notebook %s", path) + self.log.warning("Trusting notebook %s", path) self.notary.mark_cells(nb, True) self.save(model, path) @@ -430,7 +430,7 @@ class ContentsManager(LoggingConfigurable): if self.notary.check_cells(nb): self.notary.sign(nb) else: - self.log.warn("Saving untrusted notebook %s", path) + self.log.warning("Saving untrusted notebook %s", path) def mark_trusted_cells(self, nb, path=''): """Mark cells as trusted if the notebook signature matches. @@ -446,7 +446,7 @@ class ContentsManager(LoggingConfigurable): """ trusted = self.notary.check_signature(nb) if not trusted: - self.log.warn("Notebook %s is not trusted", path) + self.log.warning("Notebook %s is not trusted", path) self.notary.mark_cells(nb, trusted) def should_list(self, name): diff --git a/notebook/services/kernels/handlers.py b/notebook/services/kernels/handlers.py index aa5b31979..3b50a10c2 100644 --- a/notebook/services/kernels/handlers.py +++ b/notebook/services/kernels/handlers.py @@ -220,7 +220,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler): """Don't wait forever for the kernel to reply""" if future.done(): return - self.log.warn("Timeout waiting for kernel_info reply from %s", self.kernel_id) + self.log.warning("Timeout waiting for kernel_info reply from %s", self.kernel_id) future.set_result({}) loop = IOLoop.current() loop.add_timeout(loop.time() + self.kernel_info_timeout, give_up) @@ -259,10 +259,10 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler): msg = json.loads(msg) channel = msg.pop('channel', None) if channel is None: - self.log.warn("No channel specified, assuming shell: %s", msg) + self.log.warning("No channel specified, assuming shell: %s", msg) channel = 'shell' if channel not in self.channels: - self.log.warn("No such channel: %r", channel) + self.log.warning("No such channel: %r", channel) return stream = self.channels[channel] self.session.send(stream, msg) @@ -272,7 +272,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler): msg = self.session.deserialize(fed_msg_list) parent = msg['parent_header'] def write_stderr(error_message): - self.log.warn(error_message) + self.log.warning(error_message) msg = self.session.msg("stream", content={"text": error_message, "name": "stderr"}, parent=parent @@ -325,7 +325,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler): if self._iopub_msgs_exceeded: self._iopub_msgs_exceeded = False if not self._iopub_data_exceeded: - self.log.warn("iopub messages resumed") + self.log.warning("iopub messages resumed") # Check the data rate if self.iopub_data_rate_limit is not None and data_rate > self.iopub_data_rate_limit and self.iopub_data_rate_limit > 0: @@ -341,7 +341,7 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler): if self._iopub_data_exceeded: self._iopub_data_exceeded = False if not self._iopub_msgs_exceeded: - self.log.warn("iopub messages resumed") + self.log.warning("iopub messages resumed") # If either of the limit flags are set, do not send the message. if self._iopub_msgs_exceeded or self._iopub_data_exceeded: diff --git a/notebook/services/kernels/kernelmanager.py b/notebook/services/kernels/kernelmanager.py index ccf2738a7..cc739afec 100644 --- a/notebook/services/kernels/kernelmanager.py +++ b/notebook/services/kernels/kernelmanager.py @@ -51,7 +51,7 @@ class MappingKernelManager(MultiKernelManager): def _handle_kernel_died(self, kernel_id): """notice that a kernel died""" - self.log.warn("Kernel %s died, removing from map.", kernel_id) + self.log.warning("Kernel %s died, removing from map.", kernel_id) self.remove_kernel(kernel_id) def cwd_for_path(self, path): @@ -127,13 +127,13 @@ class MappingKernelManager(MultiKernelManager): future.set_result(msg) def on_timeout(): - self.log.warn("Timeout waiting for kernel_info_reply: %s", kernel_id) + self.log.warning("Timeout waiting for kernel_info_reply: %s", kernel_id) finish() if not future.done(): future.set_exception(gen.TimeoutError("Timeout waiting for restart")) def on_restart_failed(): - self.log.warn("Restarting kernel failed: %s", kernel_id) + self.log.warning("Restarting kernel failed: %s", kernel_id) finish() if not future.done(): future.set_exception(RuntimeError("Restart failed")) diff --git a/notebook/services/security/handlers.py b/notebook/services/security/handlers.py index c34ddf9ab..2431c1787 100644 --- a/notebook/services/security/handlers.py +++ b/notebook/services/security/handlers.py @@ -15,7 +15,7 @@ class CSPReportHandler(APIHandler): def post(self): '''Log a content security policy violation report''' csp_report = self.get_json_body() - self.log.warn("Content security violation: %s", + self.log.warning("Content security violation: %s", self.request.body.decode('utf8', 'replace')) default_handlers = [ diff --git a/notebook/services/sessions/handlers.py b/notebook/services/sessions/handlers.py index b7a7f11de..f70c17a58 100644 --- a/notebook/services/sessions/handlers.py +++ b/notebook/services/sessions/handlers.py @@ -60,7 +60,7 @@ class SessionRootHandler(APIHandler): msg = ("The '%s' kernel is not available. Please pick another " "suitable kernel instead, or install that kernel." % kernel_name) status_msg = '%s not found' % kernel_name - self.log.warn('Kernel not found: %s' % kernel_name) + self.log.warning('Kernel not found: %s' % kernel_name) self.set_status(501) self.finish(json.dumps(dict(message=msg, short_message=status_msg))) return diff --git a/setupbase.py b/setupbase.py index 6e90cec07..8c8da4758 100644 --- a/setupbase.py +++ b/setupbase.py @@ -536,11 +536,11 @@ def css_js_prerelease(command, strict=False): # die if strict or any targets didn't build prefix = os.path.commonprefix([repo_root + os.sep] + missing) missing = [ m[len(prefix):] for m in missing ] - log.warn("rebuilding js and css failed. The following required files are missing: %s" % missing) + log.warning("rebuilding js and css failed. The following required files are missing: %s" % missing) raise e else: - log.warn("rebuilding js and css failed (not a problem)") - log.warn(str(e)) + log.warning("rebuilding js and css failed (not a problem)") + log.warning(str(e)) # check again for missing targets, just in case: missing = [ t for t in targets if not os.path.exists(t) ]