Skip to content

Commit

Permalink
Merge branch 'release/v0.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Nov 13, 2023
2 parents 75d22ec + 974dd20 commit 01738ce
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 71 deletions.
29 changes: 29 additions & 0 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,36 @@ Colour - Datasets - TODO
TODO
----

- colour_datasets/__init__.py

- Line 78 : # TODO: Remove legacy printing support when deemed appropriate.


- colour_datasets/records/zenodo.py

- 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


- colour_datasets/utilities/common.py

- Line 42 : # TODO: Use *colour* definition.


- colour_datasets/loaders/kuopio.py

- Line 310 : # TODO: Implement support for *Natural Colors*: https://sandbox.zenodo.org/record/315640 http://www.uef.fi/web/spectral/natural-colors


- colour_datasets/loaders/xrite2016.py

- Line 109 : # TODO: Implement support for "CGATS" file format in "Colour": https://github.com/colour-science/colour/issues/354


- colour_datasets/loaders/dyer2017.py

- 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".
- Line 928 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.
- Line 1430 : # TODO: Re-instate "manufacturer", "model", "illuminant" and "type" attributes according to outcome of https://github.com/ampas/rawtoaces/issues/114.

About
-----
Expand Down
2 changes: 1 addition & 1 deletion colour_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

__major_version__ = "0"
__minor_version__ = "2"
__change_version__ = "3"
__change_version__ = "4"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
Expand Down
6 changes: 6 additions & 0 deletions colour_datasets/loaders/asano2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,9 @@ def build_Asano2015(load: bool = True) -> DatasetLoader_Asano2015:
_DATASET_LOADER_ASANO2015.load()

return _DATASET_LOADER_ASANO2015


if __name__ == "__main__":
import colour_datasets

colour_datasets.load("3252742")
6 changes: 3 additions & 3 deletions colour_datasets/records/tests/test_zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def test__str__(self):
-----
- camlist&equipment.txt : https://zenodo.org/api/records/3245883/files/\
camlist&equipment.txt
camlist&equipment.txt/content
- camspec_database.txt : https://zenodo.org/api/records/3245883/files/\
camspec_database.txt
- urls.txt : https://zenodo.org/api/records/3245883/files/urls.txt"""
camspec_database.txt/content
- urls.txt : https://zenodo.org/api/records/3245883/files/urls.txt/content"""
)[1:],
)

Expand Down
21 changes: 10 additions & 11 deletions colour_datasets/records/zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import json
import os
import re
import shutil
import stat
import tempfile
Expand Down Expand Up @@ -204,8 +205,8 @@ def strip_html(text: str) -> str:

files = "\n".join(
[
f"- {file_data['filename']} : {file_data['links']['self']}"
for file_data in sorted(files, key=lambda x: x["filename"])
f'- {file_data["key"]} : {file_data["links"]["self"]}'
for file_data in sorted(files, key=lambda x: x["key"])
]
)

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

def urls_download(urls: Dict, is_content_url=False):
def urls_download(urls: Dict) -> None:
"""Download given urls."""

for url, md5 in urls.items():
filename = re.sub("/content$", "", url)
filename = os.path.join(
downloads_directory,
urllib.parse.unquote( # pyright: ignore
url.split("/")[-1]
filename.split("/")[-1]
),
)
url = ( # noqa: PLW2901
f"{url}/content" if is_content_url else url
)
url_download(url, filename, md5.split(":")[-1], retries)

try:
if use_urls_txt_file and urls_txt:
urls = {}
urls_txt_file = tempfile.NamedTemporaryFile(delete=False).name
url_download(
urls_txt["links"]["download"],
urls_txt["links"]["self"],
urls_txt_file,
urls_txt["checksum"].split(":")[-1],
retries,
Expand Down Expand Up @@ -445,7 +444,7 @@ def urls_download(urls: Dict, is_content_url=False):

urls = {}
for file_data in self.data["files"]:
if file_data["filename"] == self._configuration.urls_txt_file:
if file_data["key"] == self._configuration.urls_txt_file:
continue

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

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

urls_download(urls, is_content_url=True)
urls_download(urls)

deflate_directory = os.path.join(
self.repository, self._configuration.deflate_directory
Expand Down
1 change: 1 addition & 0 deletions colour_datasets/utilities/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
]


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

Expand Down
16 changes: 8 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12"
alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12"
babel==2.13.0 ; python_version >= "3.9" and python_version < "3.12"
babel==2.13.1 ; python_version >= "3.9" and python_version < "3.12"
beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12"
biblib-simple==0.1.2 ; python_version >= "3.9" and python_version < "3.12"
cachetools==5.3.1 ; python_version >= "3.9" and python_version < "3.12"
cachetools==5.3.2 ; python_version >= "3.9" and python_version < "3.12"
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "3.12"
charset-normalizer==3.3.0 ; python_version >= "3.9" and python_version < "3.12"
charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "3.12"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and (platform_system == "Windows" or sys_platform == "win32")
colour-science==0.4.3 ; python_version >= "3.9" and python_version < "3.12"
docutils==0.20.1 ; python_version >= "3.9" and python_version < "3.12"
idna==3.4 ; python_version >= "3.9" and python_version < "3.12"
imageio==2.31.5 ; python_version >= "3.9" and python_version < "3.12"
imageio==2.32.0 ; python_version >= "3.9" and python_version < "3.12"
imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12"
importlib-metadata==6.8.0 ; python_version >= "3.9" and python_version < "3.10"
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12"
latexcodec==2.0.1 ; python_version >= "3.9" and python_version < "3.12"
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12"
numpy==1.26.1 ; python_version >= "3.9" and python_version < "3.12"
numpy==1.26.2 ; python_version >= "3.9" and python_version < "3.12"
opencv-python==4.8.1.78 ; python_version >= "3.9" and python_version < "3.12"
packaging==23.2 ; python_version >= "3.9" and python_version < "3.12"
pillow==10.1.0 ; python_version >= "3.9" and python_version < "3.12"
pillow==10.0.1 ; python_version >= "3.9" and python_version < "3.12"
pybtex-docutils==1.0.3 ; python_version >= "3.9" and python_version < "3.12"
pybtex==0.24.0 ; python_version >= "3.9" and python_version < "3.12"
pydata-sphinx-theme==0.14.1 ; python_version >= "3.9" and python_version < "3.12"
pydata-sphinx-theme==0.14.3 ; python_version >= "3.9" and python_version < "3.12"
pygments==2.16.1 ; python_version >= "3.9" and python_version < "3.12"
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.12"
requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12"
Expand All @@ -41,6 +41,6 @@ sphinxcontrib-qthelp==1.0.6 ; python_version >= "3.9" and python_version < "3.12
sphinxcontrib-serializinghtml==1.1.9 ; python_version >= "3.9" and python_version < "3.12"
tqdm==4.66.1 ; python_version >= "3.9" and python_version < "3.12"
typing-extensions==4.8.0 ; python_version >= "3.9" and python_version < "3.12"
urllib3==2.0.7 ; python_version >= "3.9" and python_version < "3.12"
urllib3==2.1.0 ; python_version >= "3.9" and python_version < "3.12"
xlrd==1.2.0 ; python_version >= "3.9" and python_version < "3.12"
zipp==3.17.0 ; python_version >= "3.9" and python_version < "3.10"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "colour-datasets"
version = "0.2.3"
version = "0.2.4"
description = "Colour science datasets for use with Colour"
license = "BSD-3-Clause"
authors = [ "Colour Developers <[email protected]>" ]
Expand Down Expand Up @@ -62,7 +62,7 @@ coveralls = "*"
flynt = "*"
invoke = "*"
jupyter = "*"
pre-commit = "*"
pre-commit = ">= 3.5"
pyright = "*"
pytest = "*"
pytest-cov = "*"
Expand Down
Loading

0 comments on commit 01738ce

Please sign in to comment.