Skip to content

Commit c431cb4

Browse files
author
Bruno Grande
committed
Fix bug with set operations
1 parent 27f5caf commit c431cb4

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/dcqc/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class File(SerializableMixin):
6161
url: str
6262
metadata: dict[str, Any]
6363
type: str
64-
_fs: Optional[FS]
6564

6665
LOCAL_REGEX = re.compile(r"((file|osfs)://)?/?[^:]+")
6766

@@ -82,6 +81,7 @@ def __init__(
8281
self.metadata = dict(metadata)
8382
self.type = self._pop_file_type()
8483
self.file_name = self._get_file_name()
84+
self._fs: Optional[FS]
8585
self._fs = None
8686

8787
@property

src/dcqc/filesystems/remote_file.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
import os
55
from array import array
66
from collections.abc import Callable, Iterable
7-
from ctypes import _CData
87
from mmap import mmap
98
from pickle import PickleBuffer
10-
from typing import IO, Any, BinaryIO, Optional, Union
9+
from typing import IO, TYPE_CHECKING, Any, BinaryIO, Optional, Union
1110

1211
from fs.mode import Mode
1312

14-
LinesType = Iterable[
15-
Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]]
16-
]
13+
if TYPE_CHECKING:
14+
from ctypes import _CData
15+
16+
LinesType = Iterable[
17+
Union[
18+
bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]
19+
]
20+
]
1721

1822

1923
class RemoteFile(io.IOBase, BinaryIO):

src/dcqc/suites/suite_abc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def list_test_classes(cls) -> tuple[Type[TestABC], ...]:
7070
for cls in reversed(superclasses): # Start from the base class
7171
if hasattr(cls, "add_tests"):
7272
add_tests = set(cls.add_tests) # type: ignore
73-
all_tests.union(add_tests)
73+
all_tests |= add_tests
7474
if hasattr(cls, "del_tests"):
7575
del_tests = set(cls.del_tests) # type: ignore
76-
all_tests.difference(del_tests)
76+
all_tests -= del_tests
7777

7878
return tuple(all_tests)
7979

0 commit comments

Comments
 (0)