filebridge 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {filebridge-0.2.2 → filebridge-0.2.4}/PKG-INFO +1 -1
- {filebridge-0.2.2 → filebridge-0.2.4}/pyproject.toml +2 -2
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/client.py +42 -18
- {filebridge-0.2.2 → filebridge-0.2.4}/README.md +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/__init__.py +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/core.py +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/exceptions.py +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/io.py +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/models.py +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/py.typed +0 -0
- {filebridge-0.2.2 → filebridge-0.2.4}/src/filebridge/stream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "filebridge"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "A Python library for interacting with the Filebridge daemon (filebridged)."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -38,5 +38,5 @@ per-file-ignores = { "__init__.py" = ["F401"] }
|
|
|
38
38
|
pythonpath = ["tests"]
|
|
39
39
|
|
|
40
40
|
[build-system]
|
|
41
|
-
requires = ["uv-build>=0.9.28,<0.
|
|
41
|
+
requires = ["uv-build>=0.9.28,<0.12.0"]
|
|
42
42
|
build-backend = "uv_build"
|
|
@@ -237,11 +237,13 @@ class LocationEntry:
|
|
|
237
237
|
self._stat = self._refresh(extensive=extensive)
|
|
238
238
|
return self._stat
|
|
239
239
|
|
|
240
|
-
def glob(
|
|
240
|
+
def glob(
|
|
241
|
+
self, pattern: str, *, extensive: bool = False
|
|
242
|
+
) -> Iterator[LocationEntry]:
|
|
241
243
|
"""Iterate over entries matching *pattern* relative to this entry."""
|
|
242
|
-
yield from self._location.glob(pattern, self)
|
|
244
|
+
yield from self._location.glob(pattern, self, extensive=extensive)
|
|
243
245
|
|
|
244
|
-
def iterdir(self) -> Iterator[LocationEntry]:
|
|
246
|
+
def iterdir(self, *, extensive: bool = False) -> Iterator[LocationEntry]:
|
|
245
247
|
"""Iterate over the entries in this directory.
|
|
246
248
|
|
|
247
249
|
Raises:
|
|
@@ -249,13 +251,13 @@ class LocationEntry:
|
|
|
249
251
|
"""
|
|
250
252
|
if not self.is_dir():
|
|
251
253
|
raise NotADirectoryError(f"{self._path} is not a directory")
|
|
252
|
-
yield from self._location.iterdir(self)
|
|
254
|
+
yield from self._location.iterdir(self, extensive=extensive)
|
|
253
255
|
|
|
254
256
|
def walk(
|
|
255
|
-
self,
|
|
257
|
+
self, *, extensive: bool = False
|
|
256
258
|
) -> Iterator[tuple[PurePosixPath, list[LocationEntry], list[LocationEntry]]]:
|
|
257
259
|
"""Walk the directory tree, yielding ``(dirpath, subdirs, files)`` tuples."""
|
|
258
|
-
yield from self._location.walk(self)
|
|
260
|
+
yield from self._location.walk(self, extensive=extensive)
|
|
259
261
|
|
|
260
262
|
def __truediv__(self, other: LocationPath) -> LocationEntry:
|
|
261
263
|
if isinstance(other, LocationEntry):
|
|
@@ -715,6 +717,8 @@ class Location:
|
|
|
715
717
|
def list(
|
|
716
718
|
self,
|
|
717
719
|
path: LocationPath | None = None,
|
|
720
|
+
*,
|
|
721
|
+
extensive: bool = False,
|
|
718
722
|
) -> Iterator[LocationEntry]:
|
|
719
723
|
"""List entries in a directory. Pass ``None`` for the root directory."""
|
|
720
724
|
pure_path = PurePosixPath(path or "")
|
|
@@ -728,11 +732,15 @@ class Location:
|
|
|
728
732
|
url,
|
|
729
733
|
self.token,
|
|
730
734
|
str_path,
|
|
735
|
+
extensive=extensive,
|
|
731
736
|
)
|
|
732
737
|
response = self._send_request("GET", url, kwargs, req_nonce)
|
|
733
738
|
else:
|
|
734
739
|
url = self._url(get_api_path(self.dir_id, str_path))
|
|
735
|
-
|
|
740
|
+
params = {"extensive": "true"} if extensive else {}
|
|
741
|
+
kwargs, req_nonce = prepare_request_kwargs(
|
|
742
|
+
"GET", url, self.token, {"params": params} if params else {}
|
|
743
|
+
)
|
|
736
744
|
response = self._send_request("GET", url, kwargs, req_nonce)
|
|
737
745
|
|
|
738
746
|
sig = response.request.headers.get("X-Signature", "") if self.token else None
|
|
@@ -816,9 +824,11 @@ class Location:
|
|
|
816
824
|
kwargs, req_nonce = prepare_request_kwargs("DELETE", url, self.token, {})
|
|
817
825
|
self._send_request("DELETE", url, kwargs, req_nonce)
|
|
818
826
|
|
|
819
|
-
def iterdir(
|
|
827
|
+
def iterdir(
|
|
828
|
+
self, path: LocationPath | None = None, *, extensive: bool = False
|
|
829
|
+
) -> Iterator[LocationEntry]:
|
|
820
830
|
"""Iterate over entries in a directory. Alias for ``list()``."""
|
|
821
|
-
yield from self.list(path)
|
|
831
|
+
yield from self.list(path, extensive=extensive)
|
|
822
832
|
|
|
823
833
|
def glob(
|
|
824
834
|
self,
|
|
@@ -826,6 +836,7 @@ class Location:
|
|
|
826
836
|
path: LocationPath | None = None,
|
|
827
837
|
*,
|
|
828
838
|
case_sensitive: bool | None = None,
|
|
839
|
+
extensive: bool = False,
|
|
829
840
|
) -> Iterator[LocationEntry]:
|
|
830
841
|
"""Iterate over entries matching a glob *pattern*.
|
|
831
842
|
|
|
@@ -838,6 +849,7 @@ class Location:
|
|
|
838
849
|
str(PurePosixPath(path or "")),
|
|
839
850
|
parts,
|
|
840
851
|
CaseSensitiveComparator if case_sense else CaseInsensitiveComparator,
|
|
852
|
+
extensive=extensive,
|
|
841
853
|
)
|
|
842
854
|
|
|
843
855
|
def _recursive_glob(
|
|
@@ -846,6 +858,8 @@ class Location:
|
|
|
846
858
|
pattern_parts: tuple[str, ...],
|
|
847
859
|
comparator: Type[FilenameComparator],
|
|
848
860
|
current_items: list[LocationEntry] | None = None,
|
|
861
|
+
*,
|
|
862
|
+
extensive: bool = False,
|
|
849
863
|
) -> Iterator[LocationEntry]:
|
|
850
864
|
if not pattern_parts:
|
|
851
865
|
return
|
|
@@ -856,7 +870,7 @@ class Location:
|
|
|
856
870
|
def get_items() -> list[LocationEntry]:
|
|
857
871
|
if current_items is not None:
|
|
858
872
|
return current_items
|
|
859
|
-
return list(self.list(current_path))
|
|
873
|
+
return list(self.list(current_path, extensive=extensive))
|
|
860
874
|
|
|
861
875
|
# Special case: recursive wildcard **
|
|
862
876
|
if pattern == "**":
|
|
@@ -864,16 +878,20 @@ class Location:
|
|
|
864
878
|
|
|
865
879
|
# 1. Apply remaining pattern at current directory (zero depth)
|
|
866
880
|
if remaining:
|
|
867
|
-
yield from self._recursive_glob(
|
|
881
|
+
yield from self._recursive_glob(
|
|
882
|
+
current_path, remaining, comparator, items, extensive=extensive
|
|
883
|
+
)
|
|
868
884
|
else:
|
|
869
885
|
# Bare ** without remainder: list everything recursively
|
|
870
|
-
yield from self._walk_all(current_path, items)
|
|
886
|
+
yield from self._walk_all(current_path, items, extensive=extensive)
|
|
871
887
|
return
|
|
872
888
|
|
|
873
889
|
# 2. Recurse into subdirectories and continue ** there
|
|
874
890
|
for item in items:
|
|
875
891
|
if item.is_dir():
|
|
876
|
-
yield from self._recursive_glob(
|
|
892
|
+
yield from self._recursive_glob(
|
|
893
|
+
str(item.path), pattern_parts, comparator, extensive=extensive
|
|
894
|
+
)
|
|
877
895
|
return
|
|
878
896
|
|
|
879
897
|
cmp = comparator(pattern)
|
|
@@ -885,35 +903,41 @@ class Location:
|
|
|
885
903
|
yield item
|
|
886
904
|
elif item.is_dir():
|
|
887
905
|
# Recurse with remaining pattern parts
|
|
888
|
-
yield from self._recursive_glob(
|
|
906
|
+
yield from self._recursive_glob(
|
|
907
|
+
str(item.path), remaining, comparator, extensive=extensive
|
|
908
|
+
)
|
|
889
909
|
|
|
890
910
|
def _walk_all(
|
|
891
911
|
self,
|
|
892
912
|
path: str,
|
|
893
913
|
current_items: list[LocationEntry] | None = None,
|
|
914
|
+
*,
|
|
915
|
+
extensive: bool = False,
|
|
894
916
|
) -> Iterator[LocationEntry]:
|
|
895
917
|
"""Helper for bare ** pattern: yield all entries recursively."""
|
|
896
|
-
items = current_items if current_items is not None else self.list(path)
|
|
918
|
+
items = current_items if current_items is not None else self.list(path, extensive=extensive)
|
|
897
919
|
for item in items:
|
|
898
920
|
yield item
|
|
899
921
|
if item.is_dir():
|
|
900
|
-
yield from self._walk_all(str(item.path))
|
|
922
|
+
yield from self._walk_all(str(item.path), extensive=extensive)
|
|
901
923
|
|
|
902
924
|
def walk(
|
|
903
925
|
self,
|
|
904
926
|
path: LocationPath | None = None,
|
|
927
|
+
*,
|
|
928
|
+
extensive: bool = False,
|
|
905
929
|
) -> Iterator[tuple[PurePosixPath, list[LocationEntry], list[LocationEntry]]]:
|
|
906
930
|
"""Walk the directory tree, yielding ``(dirpath, subdirs, files)`` tuples.
|
|
907
931
|
|
|
908
932
|
Similar to ``os.walk()``.
|
|
909
933
|
"""
|
|
910
934
|
p = PurePosixPath(path or "")
|
|
911
|
-
all_items = list(self.list(p))
|
|
935
|
+
all_items = list(self.list(p, extensive=extensive))
|
|
912
936
|
subdirs = [m for m in all_items if m.is_dir()]
|
|
913
937
|
files = [m for m in all_items if not m.is_dir()]
|
|
914
938
|
yield (p, subdirs, files)
|
|
915
939
|
for sub in subdirs:
|
|
916
|
-
yield from self.walk(p / sub.name)
|
|
940
|
+
yield from self.walk(p / sub.name, extensive=extensive)
|
|
917
941
|
|
|
918
942
|
@overload
|
|
919
943
|
def open(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|