Skip to content

Commit

Permalink
Use recommended pydantic+mypy settings and fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jan 29, 2024
1 parent 459de56 commit 58557dd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ repos:
- tokenize-rt==4.1.0
- types-pkg_resources==0.1.2
- types-paramiko
- pydantic~=2.0
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,19 @@ rst-roles = "class, func, ref, obj"

[tool.mypy]
ignore_missing_imports = true
no_strict_optional = true
follow_imports = "skip"
strict_optional = false
plugins = "pydantic.mypy"
follow_imports = "ignore"
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = false
no_implicit_reexport = true
disallow_untyped_defs = false

[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true

[tool.pytest.ini_options]
filterwarnings = [
Expand Down
2 changes: 1 addition & 1 deletion src/jobflow_remote/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class JobflowRemoteSettings(BaseSettings):

@model_validator(mode="before")
@classmethod
def load_default_settings(cls, values):
def load_default_settings(cls, values: dict) -> dict:
"""
Load settings from file or environment variables.
Expand Down
4 changes: 3 additions & 1 deletion src/jobflow_remote/jobs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ def from_query_dict(cls, d) -> "FlowInfo":
parents.append(job_doc["parents"] or [])
job_hosts.append(job_doc["job"]["hosts"] or [])
else:
db_ids, job_ids, job_indexes = list(zip(*d["ids"]))
db_ids, job_ids, job_indexes = list( # type:ignore[assignment]
zip(*d["ids"])
)
# parents could be determined in this case as well from the Flow document.
# However, to match the correct order it would require lopping over them.
# To keep the generation faster add this only if a use case shows up.
Expand Down
1 change: 1 addition & 0 deletions src/jobflow_remote/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A series of toy workflows that can be used for testing."""

from typing import Callable, Optional, Union

from jobflow import job
Expand Down

0 comments on commit 58557dd

Please sign in to comment.