mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 23:12:56 +00:00
Merge pull request #1580 from mathbunnyru/asalikhov/fix_typing
Fix all typing issues
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
# mypy: ignore-errors
|
||||
from jupyter_core.paths import jupyter_data_dir
|
||||
import subprocess
|
||||
import os
|
||||
import errno
|
||||
import stat
|
||||
|
||||
|
||||
c = get_config() # noqa: F821
|
||||
c.NotebookApp.ip = "0.0.0.0"
|
||||
c.NotebookApp.port = 8888
|
||||
@@ -16,28 +16,21 @@ c.NotebookApp.open_browser = False
|
||||
c.FileContentsManager.delete_to_trash = False
|
||||
|
||||
# Generate a self-signed certificate
|
||||
OPENSSL_CONFIG = """\
|
||||
[req]
|
||||
distinguished_name = req_distinguished_name
|
||||
[req_distinguished_name]
|
||||
"""
|
||||
if "GEN_CERT" in os.environ:
|
||||
dir_name = jupyter_data_dir()
|
||||
pem_file = os.path.join(dir_name, "notebook.pem")
|
||||
try:
|
||||
os.makedirs(dir_name)
|
||||
except OSError as exc: # Python >2.5
|
||||
if exc.errno == errno.EEXIST and os.path.isdir(dir_name):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
os.makedirs(dir_name, exist_ok=True)
|
||||
|
||||
# Generate an openssl.cnf file to set the distinguished name
|
||||
cnf_file = os.path.join(os.getenv("CONDA_DIR", "/usr/lib"), "ssl", "openssl.cnf")
|
||||
if not os.path.isfile(cnf_file):
|
||||
with open(cnf_file, "w") as fh:
|
||||
fh.write(
|
||||
"""\
|
||||
[req]
|
||||
distinguished_name = req_distinguished_name
|
||||
[req_distinguished_name]
|
||||
"""
|
||||
)
|
||||
fh.write(OPENSSL_CONFIG)
|
||||
|
||||
# Generate a certificate if one doesn't exist on disk
|
||||
subprocess.check_call(
|
||||
|
@@ -4,7 +4,7 @@ import pathlib
|
||||
import time
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
import pytest # type: ignore
|
||||
import requests
|
||||
|
||||
from conftest import TrackedContainer
|
||||
@@ -303,6 +303,6 @@ def test_jupyter_env_vars_to_unset_as_root(
|
||||
"-c",
|
||||
"echo I like $FRUIT and ${SECRET_FRUIT:-stuff}, and love ${SECRET_ANIMAL:-to keep secrets}!",
|
||||
],
|
||||
**root_args,
|
||||
**root_args, # type: ignore
|
||||
)
|
||||
assert "I like bananas and stuff, and love to keep secrets!" in logs
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import logging
|
||||
import pytest
|
||||
import pytest # type: ignore
|
||||
|
||||
from conftest import TrackedContainer
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
import logging
|
||||
|
||||
from packaging import version
|
||||
from packaging import version # type: ignore
|
||||
|
||||
from conftest import TrackedContainer
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
import pytest
|
||||
import pytest # type: ignore
|
||||
import requests
|
||||
import time
|
||||
|
||||
|
Reference in New Issue
Block a user