Skip to content

[pre-commit.ci] pre-commit autoupdate #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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.7"
hooks:
- id: ruff-format
- id: ruff
2 changes: 1 addition & 1 deletion colour_datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
4 changes: 1 addition & 3 deletions colour_datasets/loaders/__init__.py
Original file line number Diff line number Diff line change
@@ -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
"""
6 changes: 2 additions & 4 deletions colour_datasets/loaders/hung1995.py
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion colour_datasets/loaders/kuopio.py
Original file line number Diff line number Diff line change
@@ -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,),
4 changes: 2 additions & 2 deletions colour_datasets/loaders/luo1999.py
Original file line number Diff line number Diff line change
@@ -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,
3 changes: 1 addition & 2 deletions colour_datasets/loaders/solomotav2023.py
Original file line number Diff line number Diff line change
@@ -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(
23 changes: 10 additions & 13 deletions colour_datasets/records/zenodo.py
Original file line number Diff line number Diff line change
@@ -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",
"--------",
3 changes: 1 addition & 2 deletions colour_datasets/utilities/common.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion utilities/export_todo.py
Original file line number Diff line number Diff line change
@@ -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] = []