Skip to content

fix(s3.list): type hinting for chunked arg #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion awswrangler/s3/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import datetime
import fnmatch
import logging
from typing import Any, Dict, Iterator, List, Optional, Sequence, Union
from typing import Any, Dict, Iterator, List, Optional, Sequence, Union, overload

import boto3
import botocore.exceptions
from typing_extensions import Literal

from awswrangler import _utils, exceptions
from awswrangler.s3 import _fs
Expand Down Expand Up @@ -267,6 +268,36 @@ def list_directories(
return [path for paths in result_iterator for path in paths]


@overload
def list_objects(
path: str,
suffix: Union[str, List[str], None] = ...,
ignore_suffix: Union[str, List[str], None] = ...,
last_modified_begin: Optional[datetime.datetime] = ...,
last_modified_end: Optional[datetime.datetime] = ...,
ignore_empty: bool = ...,
chunked: Literal[False] = False,
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
boto3_session: Optional[boto3.Session] = ...,
) -> List[str]:
...


@overload
def list_objects(
path: str,
suffix: Union[str, List[str], None] = ...,
ignore_suffix: Union[str, List[str], None] = ...,
last_modified_begin: Optional[datetime.datetime] = ...,
last_modified_end: Optional[datetime.datetime] = ...,
ignore_empty: bool = ...,
chunked: Literal[True] = True,
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
boto3_session: Optional[boto3.Session] = ...,
) -> Union[List[str], Iterator[List[str]]]:
...


def list_objects(
path: str,
suffix: Union[str, List[str], None] = None,
Expand Down