diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c52c83d..b3410b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v5.0.0" + rev: "v6.0.0" hooks: - id: check-added-large-files - id: check-case-conflict @@ -15,18 +15,18 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell args: ["--ignore-words-list=assertIn,exitance,seperately,socio-economic"] exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst" - repo: https://github.com/PyCQA/isort - rev: "5.13.2" + rev: "6.0.1" hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.2" + rev: "v0.12.8" hooks: - id: ruff-format - id: ruff diff --git a/colour_datasets/__init__.py b/colour_datasets/__init__.py index c06086b..569a66f 100644 --- a/colour_datasets/__init__.py +++ b/colour_datasets/__init__.py @@ -60,7 +60,7 @@ try: _version = ( - subprocess.check_output( # noqa: S603 + subprocess.check_output( ["git", "describe"], # noqa: S607 cwd=os.path.dirname(__file__), stderr=subprocess.STDOUT, diff --git a/colour_datasets/loaders/__init__.py b/colour_datasets/loaders/__init__.py index 76ecf2d..f662988 100644 --- a/colour_datasets/loaders/__init__.py +++ b/colour_datasets/loaders/__init__.py @@ -160,9 +160,7 @@ def load(dataset: int | str) -> Any: -------- >>> len(load("3245883").keys()) # doctest: +SKIP 28 - >>> len( - ... load("Camera Spectral Sensitivity Database - " "Jiang et al. (2013)").keys() - ... ) + >>> len(load("Camera Spectral Sensitivity Database - Jiang et al. (2013)").keys()) ... # doctest: +SKIP 28 """ diff --git a/colour_datasets/loaders/hung1995.py b/colour_datasets/loaders/hung1995.py index 6d89d73..2ee1a50 100644 --- a/colour_datasets/loaders/hung1995.py +++ b/colour_datasets/loaders/hung1995.py @@ -140,10 +140,8 @@ def load( "Table II.csv": "Intra- and interobserver variances for each " "reference hue expressed in circumferential " "hue-angle difference.", - "Table III.csv": "Weight-averaged constant hue loci for the CL " - "experiment.", - "Table IV.csv": "Weight-averaged constant hue loci for the VL " - "experiment.", + "Table III.csv": "Weight-averaged constant hue loci for the CL experiment.", + "Table IV.csv": "Weight-averaged constant hue loci for the VL experiment.", } for filename in filenames: diff --git a/colour_datasets/loaders/kuopio.py b/colour_datasets/loaders/kuopio.py index c85dc89..04027ff 100644 --- a/colour_datasets/loaders/kuopio.py +++ b/colour_datasets/loaders/kuopio.py @@ -256,7 +256,7 @@ class instances. prefix = re.sub("\\.|\\(|\\)|/|\\s", "", title) class_attribute = f"DatasetLoader_{prefix}" dataset_loader_class = cast( - DatasetLoader_KuopioUniversity, + "DatasetLoader_KuopioUniversity", type( str(class_attribute), (DatasetLoader_KuopioUniversity,), diff --git a/colour_datasets/loaders/luo1999.py b/colour_datasets/loaders/luo1999.py index 01815fa..5b88fae 100644 --- a/colour_datasets/loaders/luo1999.py +++ b/colour_datasets/loaders/luo1999.py @@ -471,8 +471,8 @@ def load(self) -> Dict[str, CorrespondingColourDataset_Luo1999]: as_float_array(XYZ_t) / 100, as_float_array(XYZ_cr) / 100, as_float_array(XYZ_ct) / 100, - cast(float, Y_r) * np.pi, - cast(float, Y_t) * np.pi, + cast("float", Y_r) * np.pi, + cast("float", Y_t) * np.pi, B_r, B_t, dataset_metadata, diff --git a/colour_datasets/loaders/solomotav2023.py b/colour_datasets/loaders/solomotav2023.py index bff8e21..9a2ad70 100644 --- a/colour_datasets/loaders/solomotav2023.py +++ b/colour_datasets/loaders/solomotav2023.py @@ -100,8 +100,7 @@ def load(self) -> Dict[str, Dict[str, RGB_CameraSensitivities]]: ("Ground Truth", "ground-truths"), ]: csv_files = glob.glob( - f'{os.path.join(self.record.repository, "dataset", path, path)}/' - f"*.csv" + f"{os.path.join(self.record.repository, 'dataset', path, path)}/*.csv" ) for csv_file in csv_files: camera_name = os.path.splitext(os.path.basename(csv_file))[0].replace( diff --git a/colour_datasets/records/zenodo.py b/colour_datasets/records/zenodo.py index 3c1621a..abf4c43 100644 --- a/colour_datasets/records/zenodo.py +++ b/colour_datasets/records/zenodo.py @@ -200,22 +200,22 @@ def strip_html(text: str) -> str: files = "\n".join( [ - f'- {file_data["key"]} : {file_data["links"]["self"]}' + f"- {file_data['key']} : {file_data['links']['self']}" for file_data in sorted(files, key=lambda x: x["key"]) ] ) return "\n".join( [ - f'{metadata["title"]} - {metadata["version"]}', - f'{"=" * (len(self.title) + 3 + len(metadata["version"]))}', + f"{metadata['title']} - {metadata['version']}", + f"{'=' * (len(self.title) + 3 + len(metadata['version']))}", "", f"Record ID : {self.id}", f"Authors : {authors}", - f'License : {metadata["license"]["id"]}', - f'DOI : {metadata["doi"]}', - f'Publication Date : {metadata["publication_date"]}', - f'URL : {self._data["links"]["self_html"]}\n', + f"License : {metadata['license']['id']}", + f"DOI : {metadata['doi']}", + f"Publication Date : {metadata['publication_date']}", + f"URL : {self._data['links']['self_html']}\n", "Description", "-----------", "", @@ -628,10 +628,7 @@ def __str__(self) -> str: datasets = "\n".join( [ - ( - f"[{'x' if dataset.synced() else ' '}] " - f"{dataset.id} : {dataset.title}" - ) + (f"[{'x' if dataset.synced() else ' '}] {dataset.id} : {dataset.title}") for dataset in sorted(self.values(), key=lambda x: x.title) ] ) @@ -641,11 +638,11 @@ def __str__(self) -> str: return "\n".join( [ f"{self._configuration.community}", - f'{"=" * len(self._configuration.community)}', + f"{'=' * len(self._configuration.community)}", "", f"Datasets : {len(self)}", f"Synced : {synced}", - f'URL : {self._data["community"]["links"]["self_html"]}', + f"URL : {self._data['community']['links']['self_html']}", "", "Datasets", "--------", diff --git a/colour_datasets/utilities/common.py b/colour_datasets/utilities/common.py index a87d40a..220a85f 100644 --- a/colour_datasets/utilities/common.py +++ b/colour_datasets/utilities/common.py @@ -179,8 +179,7 @@ def url_download( if md5 is not None and md5.lower() != hash_md5(filename): msg = ( - f'"MD5" hash of "{filename}" file does not match the ' - f"expected hash!" + f'"MD5" hash of "{filename}" file does not match the expected hash!' ) raise ValueError( # noqa: TRY301 msg diff --git a/utilities/export_todo.py b/utilities/export_todo.py index e24b4de..659b118 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -81,7 +81,7 @@ def extract_todo_items(root_directory: str) -> dict: if in_todo and line.startswith("#"): todo_item.append(line.replace("#", "").strip()) - elif len(todo_item): + elif todo_item: key = filename.replace("../", "") if not todo_items.get(key): todo_items[key] = []