Skip to content
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

[fix] Zipping files older than 1980 #1914

Merged
merged 8 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
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: 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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes here are linting fmt.

# 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