Skip to content

Commit 7fd449e

Browse files
committed
Adapting to validations
1 parent 3103e34 commit 7fd449e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

awswrangler/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@
55
66
"""
77

8-
import importlib
98
import logging
9+
from importlib.util import find_spec
1010

1111
from awswrangler import athena, catalog, cloudwatch, db, emr, exceptions, s3 # noqa
1212
from awswrangler.__metadata__ import __description__, __license__, __title__, __version__ # noqa
1313
from awswrangler._utils import get_account_id # noqa
1414

15-
if (
16-
importlib.util.find_spec("torch")
17-
and importlib.util.find_spec("torchvision")
18-
and importlib.util.find_spec("torchaudio")
19-
and importlib.util.find_spec("PIL")
20-
): # type: ignore
15+
if find_spec("torch") and find_spec("torchvision") and find_spec("torchaudio") and find_spec("PIL"):
2116
from awswrangler import torch # noqa
2217

2318
logging.getLogger("awswrangler").addHandler(logging.NullHandler())

awswrangler/s3.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,14 @@ def list_objects(path: str, suffix: Optional[str] = None, boto3_session: Optiona
178178
['s3://bucket/prefix0', 's3://bucket/prefix1', 's3://bucket/prefix2']
179179
180180
"""
181-
return _list_objects(path=path, delimiter=None, boto3_session=boto3_session)
181+
return _list_objects(path=path, delimiter=None, suffix=suffix, boto3_session=boto3_session)
182182

183183

184184
def _list_objects(
185-
path: str, delimiter: Optional[str] = None, boto3_session: Optional[boto3.Session] = None
185+
path: str,
186+
delimiter: Optional[str] = None,
187+
suffix: Optional[str] = None,
188+
boto3_session: Optional[boto3.Session] = None,
186189
) -> List[str]:
187190
client_s3: boto3.client = _utils.client(service_name="s3", session=boto3_session)
188191
paginator = client_s3.get_paginator("list_objects_v2")
@@ -194,7 +197,7 @@ def _list_objects(
194197
args["Delimiter"] = delimiter
195198
response_iterator = paginator.paginate(**args)
196199
paths: List[str] = []
197-
for page in response_iterator:
200+
for page in response_iterator: # pylint: disable=too-many-nested-blocks
198201
if delimiter is None:
199202
contents: Optional[List] = page.get("Contents")
200203
if contents is not None:

0 commit comments

Comments
 (0)