thds.adls 4.1.20250718170943__py3-none-any.whl → 4.1.20250721144539__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.

Potentially problematic release.


This version of thds.adls might be problematic. Click here for more details.

thds/adls/download.py CHANGED
@@ -158,6 +158,12 @@ IoRequest = ty.Union[_IoRequest, azcopy.download.DownloadRequest]
158
158
  IoResponse = ty.Union[FileProperties, None]
159
159
 
160
160
 
161
+ def _assert_fp(fp: ty.Optional[FileProperties], fqn: AdlsFqn) -> None:
162
+ assert fp, f"FileProperties for {fqn} should not be None."
163
+ assert fp.name, f"FileProperties for {fqn} should have a name."
164
+ assert fp.name == fqn.path, (fp, fqn)
165
+
166
+
161
167
  _dl_scope = scope.Scope("adls.download")
162
168
 
163
169
 
@@ -218,6 +224,7 @@ def _download_or_use_verified_cached_coroutine( # noqa: C901
218
224
  # expectations from ADLS itself.
219
225
  file_properties = yield _IoRequest.FILE_PROPERTIES
220
226
  if file_properties:
227
+ _assert_fp(file_properties, fqn)
221
228
  # critically, we expect the _first_ one in this list to be the fastest to verify.
222
229
  expected_hash = next(iter(hashes.extract_hashes_from_props(file_properties).values()), None)
223
230
 
@@ -247,6 +254,7 @@ def _download_or_use_verified_cached_coroutine( # noqa: C901
247
254
 
248
255
  logger.debug("Unable to find a cached version anywhere that we looked...")
249
256
  file_properties = yield _IoRequest.FILE_PROPERTIES
257
+ _assert_fp(file_properties, fqn)
250
258
 
251
259
  # if any of the remote hashes match the expected hash, verify that one.
252
260
  # otherwise, verify the first remote hash in the list, since that's the fastest one.
@@ -286,19 +294,14 @@ def _prep_download_coroutine(
286
294
  local_path: StrOrPath,
287
295
  expected_hash: ty.Optional[hashing.Hash] = None,
288
296
  cache: ty.Optional[Cache] = None,
289
- ) -> ty.Tuple[
290
- ty.Generator[IoRequest, IoResponse, _FileResult],
291
- IoRequest,
292
- ty.Optional[FileProperties],
293
- DataLakeFileClient,
294
- ]:
297
+ ) -> ty.Tuple[ty.Generator[IoRequest, IoResponse, _FileResult], IoRequest, DataLakeFileClient]:
295
298
  co = _download_or_use_verified_cached_coroutine(
296
299
  AdlsFqn(ty.cast(str, fs_client.account_name), fs_client.file_system_name, remote_key),
297
300
  local_path,
298
301
  expected_hash=expected_hash,
299
302
  cache=cache,
300
303
  )
301
- return co, co.send(None), None, fs_client.get_file_client(remote_key)
304
+ return co, co.send(None), fs_client.get_file_client(remote_key)
302
305
 
303
306
 
304
307
  def _excs_to_retry() -> ty.Callable[[Exception], bool]:
@@ -349,14 +352,16 @@ def download_or_use_verified(
349
352
  """
350
353
  file_properties = None
351
354
  try:
352
- co, co_request, file_properties, dl_file_client = _prep_download_coroutine(
355
+ co, co_request, dl_file_client = _prep_download_coroutine(
353
356
  fs_client, remote_key, local_path, expected_hash, cache
354
357
  )
358
+ assert dl_file_client.path_name == remote_key
355
359
  _dl_scope.enter(dl_file_client) # on __exit__, will release the connection to the pool
356
360
  while True:
357
361
  if co_request == _IoRequest.FILE_PROPERTIES:
358
362
  if not file_properties:
359
363
  # only fetch these if they haven't already been requested
364
+ assert dl_file_client.path_name == remote_key
360
365
  file_properties = dl_file_client.get_file_properties()
361
366
  co_request = co.send(file_properties)
362
367
  elif isinstance(co_request, azcopy.download.DownloadRequest):
@@ -399,7 +404,7 @@ async def async_download_or_use_verified(
399
404
  ) -> ty.Optional[Path]:
400
405
  file_properties = None
401
406
  try:
402
- co, co_request, file_properties, dl_file_client = _prep_download_coroutine(
407
+ co, co_request, dl_file_client = _prep_download_coroutine(
403
408
  fs_client, remote_key, local_path, expected_hash, cache
404
409
  )
405
410
  await _async_dl_scope.async_enter(dl_file_client) # type: ignore[arg-type]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thds.adls
3
- Version: 4.1.20250718170943
3
+ Version: 4.1.20250721144539
4
4
  Summary: ADLS tools
5
5
  Author-email: Trilliant Health <info@trillianthealth.com>
6
6
  License: MIT
@@ -7,7 +7,7 @@ thds/adls/conf.py,sha256=nTw3X1ilC3A_905jZH-rWXFsESeHAKQn5IghvfX2VIo,1991
7
7
  thds/adls/copy.py,sha256=jUWbGvTpb4B3yRGS0nhGSbDzqRPzUqYgH0z1lFRJB3k,6365
8
8
  thds/adls/dbfs.py,sha256=pPAjbIZRKJsaXKQljDMUgqS_zy1yKeEZHGMueXbuv3g,2219
9
9
  thds/adls/defaults.py,sha256=GGq5Pn4r-8cX4bZItp4nnwWAAz7S07pzPoOegw0y5Fw,676
10
- thds/adls/download.py,sha256=pL-i4Zq020Fb4oHgZ01EEFAEV27a7VqFBDqrF2UVgcg,18863
10
+ thds/adls/download.py,sha256=VmvkI3c0bAxVF2B7dBqHpSL18a701ddFNFCwpJSfdF4,19223
11
11
  thds/adls/download_lock.py,sha256=tgT48l4C5_qmArGeq05gl7VlxT22dZBH2Xwxx0itE9o,3176
12
12
  thds/adls/errors.py,sha256=6NMLHtVNsWBRDXaes9yzHj9cwKOD9t1dwL4BltdtjhU,1895
13
13
  thds/adls/etag.py,sha256=ct7jpHhNFcKzbekn5rZ3m6DhjK48A7qOZGwDiHkc-pc,242
@@ -35,8 +35,8 @@ thds/adls/azcopy/upload.py,sha256=RQLDJzS6qsMM12t5bykWJWBXs0UrmImrEFnPMxX2UlM,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.20250718170943.dist-info/METADATA,sha256=63BOl1GjMnjkbbJWw3RTODULnxG0pvZqEgAtRuYYapg,587
39
- thds_adls-4.1.20250718170943.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- thds_adls-4.1.20250718170943.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
- thds_adls-4.1.20250718170943.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
- thds_adls-4.1.20250718170943.dist-info/RECORD,,
38
+ thds_adls-4.1.20250721144539.dist-info/METADATA,sha256=ovHWIocl-mvVUUpe6czc-fcySpppzdGEv2JizzcDv_I,587
39
+ thds_adls-4.1.20250721144539.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ thds_adls-4.1.20250721144539.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
+ thds_adls-4.1.20250721144539.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
+ thds_adls-4.1.20250721144539.dist-info/RECORD,,