From 7b7849c2d287c2ed02b332f76a17c97e038ee8e0 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 15 Oct 2024 12:24:29 -0600 Subject: [PATCH 1/3] update version of pre-commit hooks --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd590d3..46a785a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.10.0 hooks: - id: black name: black @@ -13,7 +13,7 @@ repos: types_or: [python, pyi] - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 additional_dependencies: @@ -22,19 +22,19 @@ repos: - flake8-simplify - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.18.0 hooks: - id: pyupgrade args: [--py310-plus] - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + rev: v3.14.0 hooks: - id: reorder-python-imports args: [--py310-plus, --add-import, "from __future__ import annotations"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-builtin-literals - id: check-added-large-files @@ -66,7 +66,7 @@ repos: # additional_dependencies: [".[toml]"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.12.0 hooks: - id: mypy language_version: python3.12 From 4785d87989d20c0d4cedda2be200d3c32cafbe42 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 15 Oct 2024 12:34:22 -0600 Subject: [PATCH 2/3] add type-pyyaml for mypy hook --- .pre-commit-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46a785a..f95bbfb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,5 +70,7 @@ repos: hooks: - id: mypy language_version: python3.12 - additional_dependencies: [types-all] + additional_dependencies: + - tokenize-rt==3.2.0 + - types-PyYAML files: src/.*\.py$ From 2bfbbc5ff1be04d283de7b8e3912bb26358072c8 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Tue, 15 Oct 2024 12:36:18 -0600 Subject: [PATCH 3/3] remove newly-found lint --- src/model_metadata/_utils.py | 2 +- src/model_metadata/errors.py | 5 ----- src/model_metadata/main.py | 2 +- src/model_metadata/model_info.py | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/model_metadata/_utils.py b/src/model_metadata/_utils.py index b0877c6..7e9ff70 100644 --- a/src/model_metadata/_utils.py +++ b/src/model_metadata/_utils.py @@ -45,7 +45,7 @@ def load_component(module_name: str, class_name: str) -> type[Any]: @contextlib.contextmanager -def as_cwd(path: str, create: bool = True) -> Generator[None, None, None]: +def as_cwd(path: str, create: bool = True) -> Generator[None]: prev_cwd = os.getcwd() if create: diff --git a/src/model_metadata/errors.py b/src/model_metadata/errors.py index d5bcce7..7c8739b 100644 --- a/src/model_metadata/errors.py +++ b/src/model_metadata/errors.py @@ -3,14 +3,12 @@ class ModelMetadataError(Exception): - """Base error for model_metadata package.""" pass class MetadataNotFoundError(ModelMetadataError): - """Raise if metadata cannot be found.""" def __init__(self, path_to_metadata: str): @@ -21,7 +19,6 @@ def __str__(self) -> str: class MissingSectionError(ModelMetadataError): - """Raise if a section in not found in the metadata.""" def __init__(self, name: str): @@ -36,7 +33,6 @@ def __str__(self) -> str: class MissingValueError(ModelMetadataError): - """Raise if a value is not found in a metadata section.""" def __init__(self, name: str): @@ -51,7 +47,6 @@ def __str__(self) -> str: class BadEntryPointError(ModelMetadataError): - """Raise if an entry-point string is bad, in some way.""" def __init__(self, entry_point: str, msg: str | None = None): diff --git a/src/model_metadata/main.py b/src/model_metadata/main.py index cb78821..255d6df 100644 --- a/src/model_metadata/main.py +++ b/src/model_metadata/main.py @@ -87,7 +87,7 @@ def _add_cmd(name: str, *, help: str) -> argparse.ArgumentParser: help="Also emit status messages to stderr.", ) parser.add_argument( - "--silent", action="store_true", help="Suppress status status messages" + "--silent", action="store_true", help="Suppress status messages" ) return parser diff --git a/src/model_metadata/model_info.py b/src/model_metadata/model_info.py index 803fbba..3ea7925 100644 --- a/src/model_metadata/model_info.py +++ b/src/model_metadata/model_info.py @@ -137,7 +137,6 @@ def object_properties(obj: ModelInfo) -> tuple[tuple[str, Any], ...]: class ModelInfo: - """Information about a model.""" def __init__(