Skip to content

Commit eb4aff1

Browse files
authored
Merge pull request #125 from ArcanaFramework/exc-msg-fix
Fix message in value error raised when no paths
2 parents ae86a7f + 5abcd34 commit eb4aff1

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Install Extras Package
4949
run: python3 -m pip install -e ./extras[test,application,image,vendor_openxmlformats_officedocument]
5050
- name: MyPy
51-
run: mypy --install-types --non-interactive --no-warn-unused-ignores .
51+
run: mypy --install-types --non-interactive --no-warn-unused-ignores --python-version "${{ matrix.python-version }}" .
5252
- name: Pytest
5353
run: pytest -vvs --cov fileformats --cov-config .coveragerc --cov-report xml .
5454
- name: Upload coverage to Codecov

extras/fileformats/extras/application/archive.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import os.path
2-
import sys
3-
import typing as ty
4-
import tempfile
52
import tarfile
3+
import tempfile
4+
import typing as ty
65
import zipfile
76
from pathlib import Path
7+
88
from pydra.compose import python
9-
from fileformats.generic import FsObject
10-
from fileformats.core.utils import set_cwd
11-
from fileformats.core.typing import PathType
12-
from fileformats.core import converter, FileSet
13-
from fileformats.application import Zip, Tar, TarGzip
149

10+
from fileformats.application import Tar, TarGzip, Zip
11+
from fileformats.core import FileSet, converter
12+
from fileformats.core.typing import PathType
13+
from fileformats.core.utils import set_cwd
14+
from fileformats.generic import FsObject
1515

1616
TAR_COMPRESSION_TYPES = ["", "gz", "bz2", "xz"]
1717

@@ -162,23 +162,13 @@ def create_zip(
162162

163163
out_file = out_file.absolute()
164164

165-
zip_kwargs = {}
166-
if not strict_timestamps: # Truthy is the default in earlier versions
167-
if sys.version_info.major <= 3 and sys.version_info.minor < 8:
168-
raise Exception(
169-
"Must be using Python >= 3.8 to pass "
170-
f"strict_timestamps={strict_timestamps!r}"
171-
)
172-
173-
zip_kwargs["strict_timestamps"] = strict_timestamps
174-
175165
with zipfile.ZipFile(
176166
out_file,
177167
mode="w",
178168
compression=compression,
179169
allowZip64=allowZip64,
180170
compresslevel=compresslevel,
181-
**zip_kwargs,
171+
strict_timestamps=strict_timestamps,
182172
) as zfile, set_cwd(base_dir):
183173
for fspath in in_file.fspaths:
184174
fspath = Path(fspath)

fileformats/core/fileset.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
else:
2424
from typing_extensions import TypeAlias
2525

26-
from fileformats.core.typing import Self
2726
from fileformats.core.converter_helpers import SubtypeVar
27+
from fileformats.core.typing import Self
2828
from fileformats.core.utils import _excluded_subpackages
2929

3030
from .classifier import Classifier
@@ -119,8 +119,6 @@ def __init__(
119119
metadata: ty.Optional[ty.Dict[str, ty.Any]] = None,
120120
**load_kwargs: ty.Any,
121121
):
122-
if not fspaths:
123-
raise ValueError("No file-system paths provided to FileSet")
124122
self._explicit_metadata = metadata
125123
self._load_kwargs = load_kwargs
126124
self._validate_class()
@@ -137,7 +135,7 @@ def __init__(
137135

138136
def _validate_fspaths(self) -> None:
139137
if not self.fspaths:
140-
raise ValueError(f"No file-system paths provided to {self}")
138+
raise ValueError(f"No file-system paths provided to {type(self)}")
141139
missing = [p for p in self.fspaths if not p or not p.exists()]
142140
if missing:
143141
missing_str = "\n".join(str(p) for p in missing)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ exclude = "fileformats/core/_version.py"
9292

9393

9494
[tool.mypy]
95-
python_version = "3.8"
95+
python_version = "3.9"
9696
ignore_missing_imports = true
9797
strict = true
9898
namespace_packages = true

0 commit comments

Comments
 (0)