|
132 | 132 | url_path_join,
|
133 | 133 | check_pid,
|
134 | 134 | url_escape,
|
135 |
| - pathname2url, |
136 | 135 | unix_socket_in_use,
|
137 | 136 | urlencode_unix_socket_path,
|
138 | 137 | fetch,
|
@@ -198,7 +197,7 @@ def random_ports(port, n):
|
198 | 197 | """
|
199 | 198 | for i in range(min(5, n)):
|
200 | 199 | yield port + i
|
201 |
| - for i in range(n - 5): |
| 200 | + for _ in range(n - 5): |
202 | 201 | yield max(1, port + random.randint(-2 * n, 2 * n))
|
203 | 202 |
|
204 | 203 |
|
@@ -292,11 +291,7 @@ def init_settings(
|
292 | 291 | )
|
293 | 292 | sys_info = get_sys_info()
|
294 | 293 |
|
295 |
| - # If the user is running the server in a git directory, make the assumption |
296 |
| - # that this is a dev install and suggest to the developer `npm run build:watch`. |
297 | 294 | base_dir = os.path.realpath(os.path.join(__file__, "..", ".."))
|
298 |
| - dev_mode = os.path.exists(os.path.join(base_dir, ".git")) |
299 |
| - |
300 | 295 | nbui = gettext.translation(
|
301 | 296 | "nbui",
|
302 | 297 | localedir=os.path.join(base_dir, "jupyter_server/i18n"),
|
@@ -423,7 +418,7 @@ def init_handlers(self, default_services, settings):
|
423 | 418 | # for each handler required for gateway, locate its pattern
|
424 | 419 | # in the current list and replace that entry...
|
425 | 420 | gateway_handlers = load_handlers("jupyter_server.gateway.handlers")
|
426 |
| - for i, gwh in enumerate(gateway_handlers): |
| 421 | + for _, gwh in enumerate(gateway_handlers): |
427 | 422 | for j, h in enumerate(handlers):
|
428 | 423 | if gwh[0] == h[0]:
|
429 | 424 | handlers[j] = (gwh[0], gwh[1])
|
@@ -517,7 +512,7 @@ def shutdown_server(server_info, timeout=5, log=None):
|
517 | 512 | if log:
|
518 | 513 | log.debug("POST request to %sapi/shutdown", url)
|
519 | 514 |
|
520 |
| - r = fetch(url, method="POST", headers={"Authorization": "token " + server_info["token"]}) |
| 515 | + fetch(url, method="POST", headers={"Authorization": "token " + server_info["token"]}) |
521 | 516 | # Poll to see if it shut down.
|
522 | 517 | for _ in range(timeout * 10):
|
523 | 518 | if not check_pid(pid):
|
@@ -581,7 +576,7 @@ def _shutdown_or_exit(self, target_endpoint, server):
|
581 | 576 | def _maybe_remove_unix_socket(socket_path):
|
582 | 577 | try:
|
583 | 578 | os.unlink(socket_path)
|
584 |
| - except (OSError, IOError): |
| 579 | + except OSError: |
585 | 580 | pass
|
586 | 581 |
|
587 | 582 | def start(self):
|
@@ -1293,7 +1288,7 @@ def _default_allow_remote(self):
|
1293 | 1288 | tornado_settings = Dict(
|
1294 | 1289 | config=True,
|
1295 | 1290 | help=_i18n(
|
1296 |
| - "Supply overrides for the tornado.web.Application that the " "Jupyter server uses." |
| 1291 | + "Supply overrides for the tornado.web.Application that the Jupyter server uses." |
1297 | 1292 | ),
|
1298 | 1293 | )
|
1299 | 1294 |
|
@@ -1948,7 +1943,6 @@ def init_webapp(self):
|
1948 | 1943 | )
|
1949 | 1944 | if self.ssl_options.get("ca_certs", False):
|
1950 | 1945 | self.ssl_options.setdefault("cert_reqs", ssl.CERT_REQUIRED)
|
1951 |
| - ssl_options = self.ssl_options |
1952 | 1946 |
|
1953 | 1947 | self.login_handler_class.validate_security(self, ssl_options=self.ssl_options)
|
1954 | 1948 |
|
@@ -2655,8 +2649,10 @@ def launch_browser(self):
|
2655 | 2649 |
|
2656 | 2650 | assembled_url, _ = self._prepare_browser_open()
|
2657 | 2651 |
|
2658 |
| - b = lambda: browser.open(assembled_url, new=self.webbrowser_open_new) |
2659 |
| - threading.Thread(target=b).start() |
| 2652 | + def target(): |
| 2653 | + browser.open(assembled_url, new=self.webbrowser_open_new) |
| 2654 | + |
| 2655 | + threading.Thread(target=target).start() |
2660 | 2656 |
|
2661 | 2657 | def start_app(self):
|
2662 | 2658 | super(ServerApp, self).start()
|
|
0 commit comments