miniopy-async 1.19__tar.gz → 1.20__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.
Files changed (36) hide show
  1. {miniopy-async-1.19 → miniopy_async-1.20}/PKG-INFO +1 -1
  2. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/__init__.py +1 -1
  3. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/api.py +26 -20
  4. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/datatypes.py +73 -3
  5. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async.egg-info/PKG-INFO +1 -1
  6. {miniopy-async-1.19 → miniopy_async-1.20}/LICENSE +0 -0
  7. {miniopy-async-1.19 → miniopy_async-1.20}/README.md +0 -0
  8. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/commonconfig.py +0 -0
  9. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/credentials/__init__.py +0 -0
  10. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/credentials/credentials.py +0 -0
  11. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/credentials/providers.py +0 -0
  12. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/deleteobjects.py +0 -0
  13. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/error.py +0 -0
  14. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/helpers.py +0 -0
  15. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/legalhold.py +0 -0
  16. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/lifecycleconfig.py +0 -0
  17. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/minioadmin.py +0 -0
  18. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/notificationconfig.py +0 -0
  19. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/objectlockconfig.py +0 -0
  20. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/progress.py +0 -0
  21. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/replicationconfig.py +0 -0
  22. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/retention.py +0 -0
  23. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/select.py +0 -0
  24. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/signer.py +0 -0
  25. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/sse.py +0 -0
  26. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/sseconfig.py +0 -0
  27. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/tagging.py +0 -0
  28. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/time.py +0 -0
  29. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/versioningconfig.py +0 -0
  30. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async/xml.py +0 -0
  31. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async.egg-info/SOURCES.txt +0 -0
  32. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async.egg-info/dependency_links.txt +0 -0
  33. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async.egg-info/requires.txt +0 -0
  34. {miniopy-async-1.19 → miniopy_async-1.20}/miniopy_async.egg-info/top_level.txt +0 -0
  35. {miniopy-async-1.19 → miniopy_async-1.20}/setup.cfg +0 -0
  36. {miniopy-async-1.19 → miniopy_async-1.20}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miniopy-async
3
- Version: 1.19
3
+ Version: 1.20
4
4
  Summary: Asynchronous MinIO Client SDK for Python
5
5
  Home-page: https://github.com/hlf20010508/miniopy-async
6
6
  Author: L-ING
@@ -45,7 +45,7 @@ miniopy-async - Asynchronous MinIO Client SDK for Python
45
45
 
46
46
  __title__ = "miniopy-async"
47
47
  __author__ = "L-ING."
48
- __version__ = "1.19"
48
+ __version__ = "1.20"
49
49
  __license__ = "Apache 2.0"
50
50
  __copyright__ = "(C) 2022 L-ING <hlf01@icloud.com>"
51
51
 
@@ -60,6 +60,7 @@ from .datatypes import (
60
60
  PostPolicy,
61
61
  parse_copy_object,
62
62
  parse_list_objects,
63
+ ListObjects,
63
64
  )
64
65
  from .deleteobjects import DeleteError, DeleteRequest, DeleteResult
65
66
  from .error import InvalidResponseError, S3Error, ServerError
@@ -264,11 +265,7 @@ class Minio: # pylint: disable=too-many-public-methods
264
265
  session = aiohttp.ClientSession()
265
266
 
266
267
  response = await session.request(
267
- method,
268
- urlunsplit(url),
269
- data=body,
270
- headers=headers,
271
- ssl=self._ssl
268
+ method, urlunsplit(url), data=body, headers=headers, ssl=self._ssl
272
269
  )
273
270
 
274
271
  if response.status in [200, 204, 206]:
@@ -317,18 +314,22 @@ class Minio: # pylint: disable=too-many-public-methods
317
314
  404: lambda: (
318
315
  ("NoSuchKey", "Object does not exist")
319
316
  if object_name
320
- else ("NoSuchBucket", "Bucket does not exist")
321
- if bucket_name
322
- else ("ResourceNotFound", "Request resource not found")
317
+ else (
318
+ ("NoSuchBucket", "Bucket does not exist")
319
+ if bucket_name
320
+ else ("ResourceNotFound", "Request resource not found")
321
+ )
323
322
  ),
324
323
  405: lambda: (
325
324
  "MethodNotAllowed",
326
325
  "The specified method is not allowed against this resource",
327
326
  ),
328
327
  409: lambda: (
329
- ("NoSuchBucket", "Bucket does not exist")
330
- if bucket_name
331
- else ("ResourceConflict", "Request resource conflicts"),
328
+ (
329
+ ("NoSuchBucket", "Bucket does not exist")
330
+ if bucket_name
331
+ else ("ResourceConflict", "Request resource conflicts")
332
+ ),
332
333
  ),
333
334
  501: lambda: (
334
335
  "MethodNotAllowed",
@@ -2414,7 +2415,7 @@ class Minio: # pylint: disable=too-many-public-methods
2414
2415
  )
2415
2416
  raise exc
2416
2417
 
2417
- async def list_objects(
2418
+ def list_objects(
2418
2419
  self,
2419
2420
  bucket_name,
2420
2421
  prefix=None,
@@ -2459,6 +2460,9 @@ class Minio: # pylint: disable=too-many-public-methods
2459
2460
  for obj in objects:
2460
2461
  print('obj:',obj)
2461
2462
 
2463
+ async for obj in client.list_objects("my-bucket"):
2464
+ print('obj:',obj)
2465
+
2462
2466
  # List objects information whose names starts with "my/prefix/".
2463
2467
  print('example two')
2464
2468
  objects = await client.list_objects("my-bucket",
@@ -2495,15 +2499,16 @@ class Minio: # pylint: disable=too-many-public-methods
2495
2499
  loop.run_until_complete(main())
2496
2500
  loop.close()
2497
2501
  """
2498
- return await self._list_objects(
2499
- bucket_name,
2500
- delimiter=None if recursive else "/",
2501
- include_user_meta=include_user_meta,
2502
+ return ListObjects(
2503
+ client=self,
2504
+ bucket_name=bucket_name,
2502
2505
  prefix=prefix,
2506
+ recursive=recursive,
2503
2507
  start_after=start_after,
2504
- use_api_v1=use_api_v1,
2508
+ include_user_meta=include_user_meta,
2505
2509
  include_version=include_version,
2506
- encoding_type="url" if use_url_encoding_type else None,
2510
+ use_api_v1=use_api_v1,
2511
+ use_url_encoding_type=use_url_encoding_type,
2507
2512
  )
2508
2513
 
2509
2514
  async def stat_object(
@@ -4173,6 +4178,7 @@ class Minio: # pylint: disable=too-many-public-methods
4173
4178
  include_version = True
4174
4179
 
4175
4180
  is_truncated = True
4181
+
4176
4182
  while is_truncated:
4177
4183
  query = {}
4178
4184
  if include_version:
@@ -4214,13 +4220,13 @@ class Minio: # pylint: disable=too-many-public-methods
4214
4220
  version_id_marker,
4215
4221
  ) = await parse_list_objects(response)
4216
4222
 
4223
+ yield objects
4224
+
4217
4225
  if not include_version:
4218
4226
  version_id_marker = None
4219
4227
  if not use_api_v1:
4220
4228
  continuation_token = start_after
4221
4229
 
4222
- return objects
4223
-
4224
4230
  async def _list_multipart_uploads(
4225
4231
  self,
4226
4232
  bucket_name,
@@ -276,9 +276,11 @@ async def parse_list_objects(response, bucket_name=None):
276
276
  objects += [
277
277
  Object(
278
278
  bucket_name,
279
- unquote_plus(findtext(tag, "Prefix", True))
280
- if encoding_type == "url"
281
- else findtext(tag, "Prefix", True),
279
+ (
280
+ unquote_plus(findtext(tag, "Prefix", True))
281
+ if encoding_type == "url"
282
+ else findtext(tag, "Prefix", True)
283
+ ),
282
284
  )
283
285
  for tag in elements
284
286
  ]
@@ -849,3 +851,71 @@ class AsyncEventIterable:
849
851
 
850
852
  async def __aexit__(self, exc_type, value, traceback):
851
853
  self._response.close()
854
+
855
+
856
+ class ListObjects:
857
+ def __init__(
858
+ self,
859
+ client,
860
+ bucket_name,
861
+ prefix=None,
862
+ recursive=False,
863
+ start_after=None,
864
+ include_user_meta=False,
865
+ include_version=False,
866
+ use_api_v1=False,
867
+ use_url_encoding_type=True,
868
+ ):
869
+ self.client = client
870
+ self.bucket_name = bucket_name
871
+ self.prefix = prefix
872
+ self.recursive = recursive
873
+ self.start_after = start_after
874
+ self.include_user_meta = include_user_meta
875
+ self.include_version = include_version
876
+ self.use_api_v1 = use_api_v1
877
+ self.use_url_encoding_type = use_url_encoding_type
878
+ self.objects = []
879
+ self.buffer = []
880
+ self.iterator = None
881
+ self.is_awaited = False
882
+
883
+ def gen_iterator(self):
884
+ return self.client._list_objects(
885
+ self.bucket_name,
886
+ delimiter=None if self.recursive else "/",
887
+ include_user_meta=self.include_user_meta,
888
+ prefix=self.prefix,
889
+ start_after=self.start_after,
890
+ use_api_v1=self.use_api_v1,
891
+ include_version=self.include_version,
892
+ encoding_type="url" if self.use_url_encoding_type else None,
893
+ )
894
+
895
+ def __aiter__(self):
896
+ self.iterator = self.gen_iterator()
897
+ return self
898
+
899
+ async def __anext__(self):
900
+ if self.iterator is None:
901
+ self.gen_iterator()
902
+
903
+ if not self.buffer:
904
+ try:
905
+ self.buffer = await self.iterator.__anext__()
906
+ self.objects.extend(self.buffer)
907
+ except StopAsyncIteration:
908
+ raise StopAsyncIteration
909
+
910
+ return self.buffer.pop(0)
911
+
912
+ def __await__(self):
913
+ return self._collect_objects().__await__()
914
+
915
+ async def _collect_objects(self):
916
+ if self.iterator is None:
917
+ self.gen_iterator()
918
+
919
+ async for partial_objects in self:
920
+ pass
921
+ return self.objects
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miniopy-async
3
- Version: 1.19
3
+ Version: 1.20
4
4
  Summary: Asynchronous MinIO Client SDK for Python
5
5
  Home-page: https://github.com/hlf20010508/miniopy-async
6
6
  Author: L-ING
File without changes
File without changes
File without changes
File without changes