panpath 0.4.8__tar.gz → 0.4.10__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.10
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.10"
60
60
 
61
61
  __all__ = [
62
62
  "PanPath",
@@ -1,10 +1,8 @@
1
1
  """Azure Blob Storage path implementation."""
2
-
2
+ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Optional
4
4
 
5
5
  from panpath.cloud import CloudPath
6
- from panpath.azure_client import AzureBlobClient
7
- from panpath.azure_async_client import AsyncAzureBlobClient
8
6
 
9
7
  if TYPE_CHECKING:
10
8
  from panpath.clients import Client, AsyncClient
@@ -13,15 +11,19 @@ if TYPE_CHECKING:
13
11
  class AzurePath(CloudPath):
14
12
  """Azure Blob Storage path implementation (sync and async methods)."""
15
13
 
16
- _client: Optional[AzureBlobClient] = None
17
- _default_client: Optional[AzureBlobClient] = None
14
+ _client: Optional[Client] = None
15
+ _default_client: Optional[Client] = None
18
16
 
19
17
  @classmethod
20
18
  def _create_default_client(cls) -> "Client": # type: ignore[override]
21
19
  """Create default Azure Blob client."""
20
+ from panpath.azure_client import AzureBlobClient
21
+
22
22
  return AzureBlobClient()
23
23
 
24
24
  @classmethod
25
25
  def _create_default_async_client(cls) -> "AsyncClient":
26
26
  """Create default async Azure Blob client."""
27
+ from panpath.azure_async_client import AsyncAzureBlobClient
28
+
27
29
  return AsyncAzureBlobClient()
@@ -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
@@ -1,9 +1,8 @@
1
1
  """Google Cloud Storage path implementation."""
2
-
2
+ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Optional
4
4
 
5
5
  from panpath.cloud import CloudPath
6
- from panpath.gs_client import GSClient
7
6
 
8
7
  if TYPE_CHECKING:
9
8
  from panpath.clients import Client, AsyncClient
@@ -12,12 +11,14 @@ if TYPE_CHECKING:
12
11
  class GSPath(CloudPath):
13
12
  """Google Cloud Storage path implementation (sync and async methods)."""
14
13
 
15
- _client: Optional[GSClient] = None
16
- _default_client: Optional[GSClient] = None
14
+ _client: Optional[Client] = None
15
+ _default_client: Optional[Client] = None
17
16
 
18
17
  @classmethod
19
18
  def _create_default_client(cls) -> "Client": # type: ignore[override]
20
19
  """Create default GCS client."""
20
+ from panpath.gs_client import GSClient
21
+
21
22
  return GSClient()
22
23
 
23
24
  @classmethod
@@ -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.
@@ -1,10 +1,8 @@
1
1
  """S3 path implementation."""
2
-
2
+ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Optional
4
4
 
5
5
  from panpath.cloud import CloudPath
6
- from panpath.s3_client import S3Client
7
- from panpath.s3_async_client import AsyncS3Client
8
6
 
9
7
  if TYPE_CHECKING:
10
8
  from panpath.clients import Client, AsyncClient
@@ -13,15 +11,19 @@ if TYPE_CHECKING:
13
11
  class S3Path(CloudPath):
14
12
  """S3 path implementation (sync and async methods)."""
15
13
 
16
- _client: Optional[S3Client] = None
17
- _default_client: Optional[S3Client] = None
14
+ _client: Optional[Client] = None
15
+ _default_client: Optional[Client] = None
18
16
 
19
17
  @classmethod
20
18
  def _create_default_client(cls) -> "Client": # type: ignore[override]
21
19
  """Create default S3 client."""
20
+ from panpath.s3_client import S3Client
21
+
22
22
  return S3Client()
23
23
 
24
24
  @classmethod
25
25
  def _create_default_async_client(cls) -> "AsyncClient":
26
26
  """Create default async S3 client."""
27
+ from panpath.s3_async_client import AsyncS3Client
28
+
27
29
  return AsyncS3Client()
@@ -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.10"
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