Skip to content

Commit

Permalink
[fix] Zipping files older than 1980 (#1914)
Browse files Browse the repository at this point in the history
Co-authored-by: Håkon V. Treider <[email protected]>
  • Loading branch information
qTipTip and haakonvt authored Sep 12, 2024
1 parent f639cb2 commit 66879d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [7.59.1] - 2024-09-12

### Fixed
- Creating a function using files dated before 1980 no longer raises ValueError,
by overriding the timestamps to 1980-01-01.

## [7.59.0] - 2024-09-12
### Added
- Added `ignore_unknown_ids` to `client.files.delete`.
Expand Down
7 changes: 4 additions & 3 deletions cognite/client/_api/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@

MAX_RETRIES = 5
REQUIREMENTS_FILE_NAME = "requirements.txt"
REQUIREMENTS_REG = re.compile(r"(\[\/?requirements\]){1}$", flags=re.M) # Matches [requirements] and [/requirements]
# Match [requirements] and [/requirements]:
REQUIREMENTS_REG = re.compile(r"(\[\/?requirements\]){1}$", flags=re.M)
UNCOMMENTED_LINE_REG = re.compile(r"^[^\#]]*.*")
ALLOWED_HANDLE_ARGS = frozenset({"data", "client", "secrets", "function_call_info"})

Expand Down Expand Up @@ -597,7 +598,7 @@ def _zip_and_upload_folder(
try:
with TemporaryDirectory() as tmpdir:
zip_path = Path(tmpdir, "function.zip")
with ZipFile(zip_path, "w") as zf:
with ZipFile(zip_path, "w", strict_timestamps=False) as zf:
for root, dirs, files in os.walk("."):
zf.write(root)

Expand Down Expand Up @@ -638,7 +639,7 @@ def _zip_and_upload_handle(
f.write(f"{req}\n")

zip_path = Path(tmpdir, "function.zip")
with ZipFile(zip_path, "w") as zf:
with ZipFile(zip_path, "w", strict_timestamps=False) as zf:
zf.write(handle_path, arcname=HANDLER_FILE_NAME)
if docstr_requirements:
zf.write(requirements_path, arcname=REQUIREMENTS_FILE_NAME)
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "7.59.0"
__version__ = "7.59.1"
__api_subversion__ = "20230101"
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tool.poetry]
name = "cognite-sdk"

version = "7.59.0"

version = "7.59.1"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down

0 comments on commit 66879d4

Please sign in to comment.