Skip to content

Commit 01738ce

Browse files
committed
Merge branch 'release/v0.2.4'
2 parents 75d22ec + 974dd20 commit 01738ce

File tree

10 files changed

+103
-71
lines changed

10 files changed

+103
-71
lines changed

TODO.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,36 @@ Colour - Datasets - TODO
44
TODO
55
----
66

7+
- colour_datasets/__init__.py
78

9+
- Line 78 : # TODO: Remove legacy printing support when deemed appropriate.
10+
11+
12+
- colour_datasets/records/zenodo.py
13+
14+
- Line 450 : # TODO: Remove the following space escaping: The new Zenodo API is not quoting filenames properly thus we are temporarily escaping spaces for now. https://github.com/colour-science/colour-datasets/issues/ 36issuecomment-1773464695
15+
16+
17+
- colour_datasets/utilities/common.py
18+
19+
- Line 42 : # TODO: Use *colour* definition.
20+
21+
22+
- colour_datasets/loaders/kuopio.py
23+
24+
- Line 310 : # TODO: Implement support for *Natural Colors*: https://sandbox.zenodo.org/record/315640 http://www.uef.fi/web/spectral/natural-colors
25+
26+
27+
- colour_datasets/loaders/xrite2016.py
28+
29+
- Line 109 : # TODO: Implement support for "CGATS" file format in "Colour": https://github.com/colour-science/colour/issues/354
30+
31+
32+
- colour_datasets/loaders/dyer2017.py
33+
34+
- Line 141 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114. Those attributes are currently stored in "self._kwargs".
35+
- Line 928 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
36+
- Line 1430 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
837

938
About
1039
-----

colour_datasets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
__major_version__ = "0"
5353
__minor_version__ = "2"
54-
__change_version__ = "3"
54+
__change_version__ = "4"
5555
__version__ = ".".join(
5656
(__major_version__, __minor_version__, __change_version__)
5757
)

colour_datasets/loaders/asano2015.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,9 @@ def build_Asano2015(load: bool = True) -> DatasetLoader_Asano2015:
342342
_DATASET_LOADER_ASANO2015.load()
343343

344344
return _DATASET_LOADER_ASANO2015
345+
346+
347+
if __name__ == "__main__":
348+
import colour_datasets
349+
350+
colour_datasets.load("3252742")

colour_datasets/records/tests/test_zenodo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ def test__str__(self):
159159
-----
160160
161161
- camlist&equipment.txt : https://zenodo.org/api/records/3245883/files/\
162-
camlist&equipment.txt
162+
camlist&equipment.txt/content
163163
- camspec_database.txt : https://zenodo.org/api/records/3245883/files/\
164-
camspec_database.txt
165-
- urls.txt : https://zenodo.org/api/records/3245883/files/urls.txt"""
164+
camspec_database.txt/content
165+
- urls.txt : https://zenodo.org/api/records/3245883/files/urls.txt/content"""
166166
)[1:],
167167
)
168168

colour_datasets/records/zenodo.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import json
1515
import os
16+
import re
1617
import shutil
1718
import stat
1819
import tempfile
@@ -204,8 +205,8 @@ def strip_html(text: str) -> str:
204205

205206
files = "\n".join(
206207
[
207-
f"- {file_data['filename']} : {file_data['links']['self']}"
208-
for file_data in sorted(files, key=lambda x: x["filename"])
208+
f'- {file_data["key"]} : {file_data["links"]["self"]}'
209+
for file_data in sorted(files, key=lambda x: x["key"])
209210
]
210211
)
211212

@@ -388,31 +389,29 @@ def pull(self, use_urls_txt_file: bool = True, retries: int = 3):
388389
# given by the content of :attr:`URLS_TXT_FILE` attribute file.
389390
urls_txt = None
390391
for file_data in self.data["files"]:
391-
if file_data["filename"] == self._configuration.urls_txt_file:
392+
if file_data["key"] == self._configuration.urls_txt_file:
392393
urls_txt = file_data
393394
break
394395

395-
def urls_download(urls: Dict, is_content_url=False):
396+
def urls_download(urls: Dict) -> None:
396397
"""Download given urls."""
397398

398399
for url, md5 in urls.items():
400+
filename = re.sub("/content$", "", url)
399401
filename = os.path.join(
400402
downloads_directory,
401403
urllib.parse.unquote( # pyright: ignore
402-
url.split("/")[-1]
404+
filename.split("/")[-1]
403405
),
404406
)
405-
url = ( # noqa: PLW2901
406-
f"{url}/content" if is_content_url else url
407-
)
408407
url_download(url, filename, md5.split(":")[-1], retries)
409408

410409
try:
411410
if use_urls_txt_file and urls_txt:
412411
urls = {}
413412
urls_txt_file = tempfile.NamedTemporaryFile(delete=False).name
414413
url_download(
415-
urls_txt["links"]["download"],
414+
urls_txt["links"]["self"],
416415
urls_txt_file,
417416
urls_txt["checksum"].split(":")[-1],
418417
retries,
@@ -445,7 +444,7 @@ def urls_download(urls: Dict, is_content_url=False):
445444

446445
urls = {}
447446
for file_data in self.data["files"]:
448-
if file_data["filename"] == self._configuration.urls_txt_file:
447+
if file_data["key"] == self._configuration.urls_txt_file:
449448
continue
450449

451450
# TODO: Remove the following space escaping: The new Zenodo API
@@ -457,7 +456,7 @@ def urls_download(urls: Dict, is_content_url=False):
457456

458457
urls[url] = file_data["checksum"].split(":")[-1]
459458

460-
urls_download(urls, is_content_url=True)
459+
urls_download(urls)
461460

462461
deflate_directory = os.path.join(
463462
self.repository, self._configuration.deflate_directory

colour_datasets/utilities/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
]
4040

4141

42+
# TODO: Use *colour* definition.
4243
class suppress_stdout:
4344
"""A context manager and decorator temporarily suppressing standard output."""
4445

docs/requirements.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12"
22
alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12"
3-
babel==2.13.0 ; python_version >= "3.9" and python_version < "3.12"
3+
babel==2.13.1 ; python_version >= "3.9" and python_version < "3.12"
44
beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12"
55
biblib-simple==0.1.2 ; python_version >= "3.9" and python_version < "3.12"
6-
cachetools==5.3.1 ; python_version >= "3.9" and python_version < "3.12"
6+
cachetools==5.3.2 ; python_version >= "3.9" and python_version < "3.12"
77
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "3.12"
8-
charset-normalizer==3.3.0 ; python_version >= "3.9" and python_version < "3.12"
8+
charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "3.12"
99
colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and (platform_system == "Windows" or sys_platform == "win32")
1010
colour-science==0.4.3 ; python_version >= "3.9" and python_version < "3.12"
1111
docutils==0.20.1 ; python_version >= "3.9" and python_version < "3.12"
1212
idna==3.4 ; python_version >= "3.9" and python_version < "3.12"
13-
imageio==2.31.5 ; python_version >= "3.9" and python_version < "3.12"
13+
imageio==2.32.0 ; python_version >= "3.9" and python_version < "3.12"
1414
imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12"
1515
importlib-metadata==6.8.0 ; python_version >= "3.9" and python_version < "3.10"
1616
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12"
1717
latexcodec==2.0.1 ; python_version >= "3.9" and python_version < "3.12"
1818
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12"
19-
numpy==1.26.1 ; python_version >= "3.9" and python_version < "3.12"
19+
numpy==1.26.2 ; python_version >= "3.9" and python_version < "3.12"
2020
opencv-python==4.8.1.78 ; python_version >= "3.9" and python_version < "3.12"
2121
packaging==23.2 ; python_version >= "3.9" and python_version < "3.12"
22-
pillow==10.1.0 ; python_version >= "3.9" and python_version < "3.12"
22+
pillow==10.0.1 ; python_version >= "3.9" and python_version < "3.12"
2323
pybtex-docutils==1.0.3 ; python_version >= "3.9" and python_version < "3.12"
2424
pybtex==0.24.0 ; python_version >= "3.9" and python_version < "3.12"
25-
pydata-sphinx-theme==0.14.1 ; python_version >= "3.9" and python_version < "3.12"
25+
pydata-sphinx-theme==0.14.3 ; python_version >= "3.9" and python_version < "3.12"
2626
pygments==2.16.1 ; python_version >= "3.9" and python_version < "3.12"
2727
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.12"
2828
requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12"
@@ -41,6 +41,6 @@ sphinxcontrib-qthelp==1.0.6 ; python_version >= "3.9" and python_version < "3.12
4141
sphinxcontrib-serializinghtml==1.1.9 ; python_version >= "3.9" and python_version < "3.12"
4242
tqdm==4.66.1 ; python_version >= "3.9" and python_version < "3.12"
4343
typing-extensions==4.8.0 ; python_version >= "3.9" and python_version < "3.12"
44-
urllib3==2.0.7 ; python_version >= "3.9" and python_version < "3.12"
44+
urllib3==2.1.0 ; python_version >= "3.9" and python_version < "3.12"
4545
xlrd==1.2.0 ; python_version >= "3.9" and python_version < "3.12"
4646
zipp==3.17.0 ; python_version >= "3.9" and python_version < "3.10"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "colour-datasets"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
description = "Colour science datasets for use with Colour"
55
license = "BSD-3-Clause"
66
authors = [ "Colour Developers <colour-developers@colour-science.org>" ]
@@ -62,7 +62,7 @@ coveralls = "*"
6262
flynt = "*"
6363
invoke = "*"
6464
jupyter = "*"
65-
pre-commit = "*"
65+
pre-commit = ">= 3.5"
6666
pyright = "*"
6767
pytest = "*"
6868
pytest-cov = "*"

0 commit comments

Comments
 (0)