Skip to content

Commit

Permalink
Update typings for Server 2.10.1 and mypy 1.7 (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 16, 2023
1 parent 240cbb3 commit 20a463e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
rev: "v3.1.0"
hooks:
- id: prettier
types_or: [yaml, json]
Expand All @@ -58,7 +58,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
rev: "v1.7.0"
hooks:
- id: mypy
files: "^jupyterlab_server"
Expand All @@ -67,7 +67,7 @@ repos:
additional_dependencies:
[
"traitlets>=5.3",
"jupyter_server>=2.10",
"jupyter_server>=2.10.1",
"openapi_core",
"json5",
"pytest",
Expand Down
4 changes: 2 additions & 2 deletions jupyterlab_server/settings_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def _get_user_settings(settings_dir: str, schema_name: str, schema: Any) -> dict

if os.path.exists(path):
stat = os.stat(path)
last_modified = tz.utcfromtimestamp(stat.st_mtime).isoformat() # type:ignore[no-untyped-call]
created = tz.utcfromtimestamp(stat.st_ctime).isoformat() # type:ignore[no-untyped-call]
last_modified = tz.utcfromtimestamp(stat.st_mtime).isoformat()
created = tz.utcfromtimestamp(stat.st_ctime).isoformat()
with open(path, encoding="utf-8") as fid:
try: # to load and parse the settings file.
raw = fid.read() or raw
Expand Down
8 changes: 3 additions & 5 deletions jupyterlab_server/workspaces_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def _load_with_file_times(workspace_path: Path) -> dict:
with workspace_path.open(encoding="utf-8") as fid:
workspace = json.load(fid)
workspace["metadata"].update(
last_modified=tz.utcfromtimestamp(stat.st_mtime).isoformat(), # type:ignore[no-untyped-call]
created=tz.utcfromtimestamp(stat.st_ctime).isoformat(), # type:ignore[no-untyped-call]
last_modified=tz.utcfromtimestamp(stat.st_mtime).isoformat(),
created=tz.utcfromtimestamp(stat.st_ctime).isoformat(),
)
return workspace

Expand Down Expand Up @@ -170,9 +170,7 @@ def save(self, space_name: str, raw: str) -> Path:
class WorkspacesHandler(ExtensionHandlerMixin, ExtensionHandlerJinjaMixin, APIHandler):
"""A workspaces API handler."""

def initialize( # type:ignore[override]
self, name: str, manager: WorkspacesManager, **kwargs: Any
) -> None:
def initialize(self, name: str, manager: WorkspacesManager, **kwargs: Any) -> None:
"""Initialize the handler."""
super().initialize(name)
self.manager = manager
Expand Down

0 comments on commit 20a463e

Please sign in to comment.