From 487aba67a251f0d1c521d071bf41ae324ba477ad Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 11 Jul 2024 15:29:38 -0700 Subject: [PATCH 1/2] Fix E721 lint warning (type comparison) --- python/lsst/pipe/base/_task_metadata.py | 2 +- python/lsst/pipe/base/tests/no_dimensions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lsst/pipe/base/_task_metadata.py b/python/lsst/pipe/base/_task_metadata.py index 29620825..5accb158 100644 --- a/python/lsst/pipe/base/_task_metadata.py +++ b/python/lsst/pipe/base/_task_metadata.py @@ -616,7 +616,7 @@ def _validate_value(self, value: Any) -> tuple[str, Any]: type0 = type(value[0]) for i in value: - if type(i) != type0: + if type(i) is not type0: raise ValueError( "Type mismatch in supplied list. TaskMetadata requires all" f" elements have same type but see {type(i)} and {type0}." diff --git a/python/lsst/pipe/base/tests/no_dimensions.py b/python/lsst/pipe/base/tests/no_dimensions.py index 37c7f81d..48432740 100644 --- a/python/lsst/pipe/base/tests/no_dimensions.py +++ b/python/lsst/pipe/base/tests/no_dimensions.py @@ -117,7 +117,7 @@ def run(self, input: TaskMetadata | dict[str, int]) -> Struct: # Can change the return type via configuration. if "TaskMetadata" in cast(NoDimensionsTestConfig, self.config).outputSC: output = TaskMetadata.from_dict(output) # type: ignore - elif type(output) == TaskMetadata: + elif type(output) is TaskMetadata: # Want the output to be a dict output = output.to_dict() self.log.info("Run method returns data of type: %s", get_full_type_name(output)) From 1c2dc1e36aeb3502f4544d93e07640ab558a1fc5 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 11 Jul 2024 15:30:02 -0700 Subject: [PATCH 2/2] Refresh pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b0232317..795bf0d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: name: isort (python) - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.4.6 + rev: v0.5.1 hooks: - id: ruff - repo: https://github.com/numpy/numpydoc