Skip to content

Commit 02a2d46

Browse files
jmahlikkukushking
andauthored
fix(s3.list): type hinting for chunked arg (#1113)
* fix(s3.list): type hinting for chunked arg * Fix isort * fix(s3.list): type hinting for chunked arg to ... Co-authored-by: Anton Kukushkin <[email protected]>
1 parent e1cd200 commit 02a2d46

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

awswrangler/s3/_list.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import datetime
44
import fnmatch
55
import logging
6-
from typing import Any, Dict, Iterator, List, Optional, Sequence, Union
6+
from typing import Any, Dict, Iterator, List, Optional, Sequence, Union, overload
77

88
import boto3
99
import botocore.exceptions
10+
from typing_extensions import Literal
1011

1112
from awswrangler import _utils, exceptions
1213
from awswrangler.s3 import _fs
@@ -267,6 +268,36 @@ def list_directories(
267268
return [path for paths in result_iterator for path in paths]
268269

269270

271+
@overload
272+
def list_objects(
273+
path: str,
274+
suffix: Union[str, List[str], None] = ...,
275+
ignore_suffix: Union[str, List[str], None] = ...,
276+
last_modified_begin: Optional[datetime.datetime] = ...,
277+
last_modified_end: Optional[datetime.datetime] = ...,
278+
ignore_empty: bool = ...,
279+
chunked: Literal[False] = False,
280+
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
281+
boto3_session: Optional[boto3.Session] = ...,
282+
) -> List[str]:
283+
...
284+
285+
286+
@overload
287+
def list_objects(
288+
path: str,
289+
suffix: Union[str, List[str], None] = ...,
290+
ignore_suffix: Union[str, List[str], None] = ...,
291+
last_modified_begin: Optional[datetime.datetime] = ...,
292+
last_modified_end: Optional[datetime.datetime] = ...,
293+
ignore_empty: bool = ...,
294+
chunked: Literal[True] = True,
295+
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
296+
boto3_session: Optional[boto3.Session] = ...,
297+
) -> Union[List[str], Iterator[List[str]]]:
298+
...
299+
300+
270301
def list_objects(
271302
path: str,
272303
suffix: Union[str, List[str], None] = None,

0 commit comments

Comments
 (0)