panpath 0.4.8__tar.gz → 0.4.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: panpath
3
- Version: 0.4.8
3
+ Version: 0.4.9
4
4
  Summary: Universal sync/async local/cloud path library with pathlib-compatible interface
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -56,7 +56,7 @@ except ImportError:
56
56
  # Azure dependencies not installed
57
57
  pass
58
58
 
59
- __version__ = "0.4.8"
59
+ __version__ = "0.4.9"
60
60
 
61
61
  __all__ = [
62
62
  "PanPath",
@@ -192,7 +192,7 @@ class SyncClient(Client, ABC):
192
192
  raise ValueError(f"Invalid metadata format for: {path}")
193
193
  target: Any = meta_dict.get(self.__class__.symlink_target_metaname, None)
194
194
  if not target or not isinstance(target, str):
195
- raise ValueError(f"Not a symlink: {path}")
195
+ raise ValueError(f"Not a symlink: {path!r}")
196
196
 
197
197
  if any(target.startswith(f"{prefix}://") for prefix in self.__class__.prefix):
198
198
  return str(target)
@@ -424,10 +424,17 @@ class AsyncGSClient(AsyncClient):
424
424
  metadata = await self.get_metadata(path)
425
425
  target = metadata.get("metadata", {}).get( # type: ignore[union-attr, call-overload]
426
426
  self.__class__.symlink_target_metaname,
427
+ None,
427
428
  )
428
429
  if not target:
429
- raise ValueError(f"Not a symlink: {path}")
430
- return target # type: ignore[no-any-return]
430
+ raise ValueError(f"Not a symlink: {path!r}")
431
+
432
+ if any(target.startswith(f"{prefix}://") for prefix in self.__class__.prefix):
433
+ return target # type: ignore[no-any-return]
434
+
435
+ # relative path - construct full path
436
+ path = path.rstrip("/").rsplit("/", 1)[0]
437
+ return f"{path}/{target}"
431
438
 
432
439
  async def symlink_to(self, path: str, target: str) -> None:
433
440
  """Create symlink by storing target in metadata.
@@ -302,9 +302,9 @@ class GSClient(SyncClient):
302
302
  Symlink target path
303
303
  """
304
304
  metadata = self.get_metadata(path)
305
- target = metadata.get(self.__class__.symlink_target_metaname)
305
+ target = metadata.get(self.__class__.symlink_target_metaname, None)
306
306
  if not target:
307
- raise ValueError(f"Not a symlink: {path}")
307
+ raise ValueError(f"Not a symlink: {path!r}")
308
308
 
309
309
  if any(target.startswith(f"{prefix}://") for prefix in self.__class__.prefix):
310
310
  return target
@@ -427,8 +427,14 @@ class AsyncS3Client(AsyncClient):
427
427
  metadata = await self.get_metadata(path)
428
428
  target = metadata.get("Metadata", {}).get(self.__class__.symlink_target_metaname)
429
429
  if not target:
430
- raise ValueError(f"Not a symlink: {path}")
431
- return target # type: ignore[no-any-return]
430
+ raise ValueError(f"Not a symlink: {path!r}")
431
+
432
+ if any(target.startswith(f"{p}://") for p in self.prefix):
433
+ return target # type: ignore[no-any-return]
434
+
435
+ # relative path - construct full path
436
+ path = path.rstrip("/").rsplit("/", 1)[0]
437
+ return f"{path}/{target}"
432
438
 
433
439
  async def symlink_to(self, path: str, target: str) -> None:
434
440
  """Create symlink by storing target in metadata.
@@ -315,8 +315,14 @@ class S3Client(SyncClient):
315
315
  self.__class__.symlink_target_metaname
316
316
  )
317
317
  if not target:
318
- raise ValueError(f"Not a symlink: {path}")
319
- return target # type: ignore[no-any-return]
318
+ raise ValueError(f"Not a symlink: {path!r}")
319
+
320
+ if any(target.startswith(f"{p}://") for p in self.prefix):
321
+ return target # type: ignore[no-any-return]
322
+
323
+ # relative path - construct full path
324
+ path = path.rstrip("/").rsplit("/", 1)[0]
325
+ return f"{path}/{target}"
320
326
 
321
327
  def symlink_to(self, path: str, target: str) -> None:
322
328
  """Create symlink by storing target in metadata.
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "panpath"
7
- version = "0.4.8"
7
+ version = "0.4.9"
8
8
  description = "Universal sync/async local/cloud path library with pathlib-compatible interface"
9
9
  authors = ["panpath contributors"]
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes