Skip to content

Commit 3e64fa5

Browse files
authored
Add mypy check (#779)
1 parent eff1b08 commit 3e64fa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+266
-141
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ repos:
2828
files: \.py$
2929
args: [--profile=black]
3030

31+
- repo: https://github.com/pre-commit/mirrors-mypy
32+
rev: v0.942
33+
hooks:
34+
- id: mypy
35+
exclude: examples/simple/setup.py
36+
additional_dependencies: [types-requests]
37+
3138
- repo: https://github.com/pre-commit/mirrors-prettier
3239
rev: v2.6.2
3340
hooks:

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import shutil
1717
import sys
1818

19-
from pkg_resources import parse_version
19+
from packaging.version import parse as parse_version
2020

2121
HERE = osp.abspath(osp.dirname(__file__))
2222

examples/authorization/jupyter_nbclassic_readonly_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def is_authorized(self, handler, user, action, resource):
1111
return True
1212

1313

14-
c.ServerApp.authorizer_class = ReadOnly
14+
c.ServerApp.authorizer_class = ReadOnly # type:ignore[name-defined]

examples/authorization/jupyter_nbclassic_rw_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def is_authorized(self, handler, user, action, resource):
1111
return True
1212

1313

14-
c.ServerApp.authorizer_class = ReadWriteOnly
14+
c.ServerApp.authorizer_class = ReadWriteOnly # type:ignore[name-defined]

examples/authorization/jupyter_temporary_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def is_authorized(self, handler, user, action, resource):
1111
return True
1212

1313

14-
c.ServerApp.authorizer_class = TemporaryServerPersonality
14+
c.ServerApp.authorizer_class = TemporaryServerPersonality # type:ignore[name-defined]

examples/simple/jupyter_server_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
# Application(SingletonConfigurable) configuration
44
# ------------------------------------------------------------------------------
55
# The date format used by logging formatters for %(asctime)s
6-
c.Application.log_datefmt = "%Y-%m-%d %H:%M:%S Simple_Extensions_Example"
6+
c.Application.log_datefmt = ( # type:ignore[name-defined]
7+
"%Y-%m-%d %H:%M:%S Simple_Extensions_Example"
8+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c.SimpleApp11.ignore_js = True
1+
c.SimpleApp11.ignore_js = True # type:ignore[name-defined]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
c.SimpleApp1.configA = "ConfigA from file"
2-
c.SimpleApp1.configB = "ConfigB from file"
3-
c.SimpleApp1.configC = "ConfigC from file"
4-
c.SimpleApp1.configD = "ConfigD from file"
1+
c.SimpleApp1.configA = "ConfigA from file" # type:ignore[name-defined]
2+
c.SimpleApp1.configB = "ConfigB from file" # type:ignore[name-defined]
3+
c.SimpleApp1.configC = "ConfigC from file" # type:ignore[name-defined]
4+
c.SimpleApp1.configD = "ConfigD from file" # type:ignore[name-defined]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c.SimpleApp2.configD = "ConfigD from file"
1+
c.SimpleApp2.configD = "ConfigD from file" # type:ignore[name-defined]

jupyter_server/auth/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def post(self):
8383
elif self.token and self.token == typed_password:
8484
self.set_login_cookie(self, uuid.uuid4().hex)
8585
if new_password and self.settings.get("allow_password_change"):
86-
config_dir = self.settings.get("config_dir")
86+
config_dir = self.settings.get("config_dir", "")
8787
config_file = os.path.join(config_dir, "jupyter_server_config.json")
8888
set_password(new_password, config_file=config_file)
8989
self.log.info("Wrote hashed password to %s" % config_file)

0 commit comments

Comments
 (0)