thds.adls 4.1.20250709231508__py3-none-any.whl → 4.1.20250715190539__py3-none-any.whl

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.
thds/adls/source_tree.py CHANGED
@@ -6,25 +6,21 @@ from azure.storage.blob import BlobProperties, ContainerClient
6
6
  from thds.core import hashing
7
7
  from thds.core.source.tree import SourceTree
8
8
 
9
- from . import fqn, global_client, source, uri
9
+ from . import fqn, global_client, hashes, source, uri
10
10
 
11
11
 
12
12
  @dataclass
13
13
  class BlobMeta:
14
14
  path: str
15
15
  size: int
16
- md5: ty.Optional[hashing.Hash]
16
+ hash: ty.Optional[hashing.Hash]
17
17
 
18
18
 
19
19
  def to_blob_meta(blob_props: BlobProperties) -> BlobMeta:
20
20
  return BlobMeta(
21
21
  blob_props.name,
22
22
  blob_props.size,
23
- (
24
- hashing.Hash("md5", bytes(blob_props.content_settings.content_md5))
25
- if blob_props.content_settings.content_md5
26
- else None
27
- ),
23
+ next(iter(hashes.extract_hashes_from_props(blob_props).values()), None),
28
24
  )
29
25
 
30
26
 
@@ -34,10 +30,11 @@ def to_blob_meta(blob_props: BlobProperties) -> BlobMeta:
34
30
  def list_blob_meta(
35
31
  container_client: ContainerClient, root_dir: str, match_suffix: str = ""
36
32
  ) -> ty.List[BlobMeta]:
37
- """Gets the path (relative to the SA/container root), size, and MD5 hash of all blobs in a directory."""
33
+ """Gets the path (relative to the SA/container root), size, and _a_ hash (if available) of all blobs in a directory."""
38
34
  return [
39
35
  to_blob_meta(blob_props)
40
- for blob_props in container_client.list_blobs(name_starts_with=root_dir)
36
+ for blob_props in container_client.list_blobs(name_starts_with=root_dir, include=["metadata"])
37
+ # `list_blobs` does not include metadata by default, so we need to explicitly specify including it
41
38
  if blob_props.size > 0
42
39
  # container client lists directories as blobs with size 0
43
40
  and blob_props.name.endswith(match_suffix)
@@ -54,7 +51,7 @@ def from_path(adls_path: uri.UriIsh, match_suffix: str = "") -> SourceTree:
54
51
  container_root = root_fqn.root()
55
52
  return SourceTree(
56
53
  sources=[
57
- source.from_adls(container_root / blob_meta.path, hash=blob_meta.md5)
54
+ source.from_adls(container_root / blob_meta.path, hash=blob_meta.hash)
58
55
  for blob_meta in list_blob_meta(container_client, root_fqn.path, match_suffix=match_suffix)
59
56
  ],
60
57
  higher_logical_root=fqn.split(root_fqn)[-1],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thds.adls
3
- Version: 4.1.20250709231508
3
+ Version: 4.1.20250715190539
4
4
  Summary: ADLS tools
5
5
  Author-email: Trilliant Health <info@trillianthealth.com>
6
6
  License: MIT
@@ -23,7 +23,7 @@ thds/adls/ro_cache.py,sha256=P-UVFZhqnE5wojqYmRVWZcqjl-pM1xVMm9VAm3nXlnA,4769
23
23
  thds/adls/sas_tokens.py,sha256=mArbB_GYohevOmArw_1gKqVUWpv6kG8Hsbvdrhbtnbg,1957
24
24
  thds/adls/shared_credential.py,sha256=-x42aXoIM001KW59oS8PpuXQd4-F2vg-1gB6OMHlpk4,4602
25
25
  thds/adls/source.py,sha256=8HVMYuxDn1XYGwFFSBowMlvQ6r2Jm2CQlpu4h85JvsE,2559
26
- thds/adls/source_tree.py,sha256=yP_v2XrKxXqUOdZ-x8kqHhBFAuur3AlAq3zi4hHj4AE,2235
26
+ thds/adls/source_tree.py,sha256=exBi7jNrOyj9nH5rzxZmZOqhRW9WXnmZLdLt4weoXYc,2292
27
27
  thds/adls/upload.py,sha256=MRHK9Am-x5FKBPh1SXLTbPC1r0Xk0bGWNU8CcNuUMLo,6602
28
28
  thds/adls/uri.py,sha256=9MXuW_KfpPvzBc4ERxuTJ3vvi_6yr7e1kMAW9mx2zXM,1414
29
29
  thds/adls/azcopy/__init__.py,sha256=qn2dmT92EHcrtaQ8uwRoUgvtF6Fu3NQbhZItOBdIBmY,45
@@ -35,8 +35,8 @@ thds/adls/azcopy/upload.py,sha256=0l5FzV9IgZ2iQhm4eKZjTdw4SO17bHd8VnwcTev1lUs,27
35
35
  thds/adls/tools/download.py,sha256=CW2cWbCRdUqisVVVoqqvqk5Ved7pPGTkwnZj3uV0jy4,1587
36
36
  thds/adls/tools/ls.py,sha256=OgEaIfTK359twlZIj-A0AW_nv81Z6zi0b9Tw6OJJfWA,1083
37
37
  thds/adls/tools/upload.py,sha256=5WyWkpuVp2PETZ3O3ODlq8LXszSHU73ZMnIDZXPJdC8,442
38
- thds_adls-4.1.20250709231508.dist-info/METADATA,sha256=arD-CkKjjLZ9CmzD0gMWTYrB-DXJO0uyVFdDU5X3seg,587
39
- thds_adls-4.1.20250709231508.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- thds_adls-4.1.20250709231508.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
- thds_adls-4.1.20250709231508.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
- thds_adls-4.1.20250709231508.dist-info/RECORD,,
38
+ thds_adls-4.1.20250715190539.dist-info/METADATA,sha256=htqlyixo6qU6vvdT5DdQ8oqw8cuKyBYGYxR3tGzc7Hg,587
39
+ thds_adls-4.1.20250715190539.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ thds_adls-4.1.20250715190539.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
+ thds_adls-4.1.20250715190539.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
+ thds_adls-4.1.20250715190539.dist-info/RECORD,,