Skip to content

Commit 3f007c3

Browse files
committed
YAPF (formatting)
1 parent bbc6db1 commit 3f007c3

File tree

3 files changed

+47
-48
lines changed

3 files changed

+47
-48
lines changed

awswrangler/pandas.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,19 +1851,19 @@ def read_csv_prefix(
18511851
paths: List[str] = self._session.s3.list_objects(path=path_prefix)
18521852
paths = [p for p in paths if not p.endswith("/")]
18531853
return self.read_csv_list(paths=paths,
1854-
max_result_size=max_result_size,
1855-
header=header,
1856-
names=names,
1857-
usecols=usecols,
1858-
dtype=dtype,
1859-
sep=sep,
1860-
thousands=thousands,
1861-
decimal=decimal,
1862-
lineterminator=lineterminator,
1863-
quotechar=quotechar,
1864-
quoting=quoting,
1865-
escapechar=escapechar,
1866-
parse_dates=parse_dates,
1867-
infer_datetime_format=infer_datetime_format,
1868-
encoding=encoding,
1869-
converters=converters)
1854+
max_result_size=max_result_size,
1855+
header=header,
1856+
names=names,
1857+
usecols=usecols,
1858+
dtype=dtype,
1859+
sep=sep,
1860+
thousands=thousands,
1861+
decimal=decimal,
1862+
lineterminator=lineterminator,
1863+
quotechar=quotechar,
1864+
quoting=quoting,
1865+
escapechar=escapechar,
1866+
parse_dates=parse_dates,
1867+
infer_datetime_format=infer_datetime_format,
1868+
encoding=encoding,
1869+
converters=converters)

awswrangler/s3.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,16 @@ def list_objects(self, path: str) -> List[str]:
231231
bucket: str
232232
bucket, path = self.parse_path(path=path)
233233
args: Dict[str, Any] = {"Bucket": bucket, "MaxKeys": 1000, "Prefix": path}
234-
next_continuation_token: str = ""
234+
next_continuation_token: Optional[str] = ""
235235
keys: List[str] = []
236236
while next_continuation_token is not None:
237237
res: Dict[str, Any] = self._client_s3.list_objects_v2(**args)
238238
if res.get("Contents") is None:
239239
break
240-
keys += [f"s3://{bucket}/{x.get('Key')}" for x in res.get("Contents")]
240+
keys += [
241+
f"s3://{bucket}/{x['Key']}" for x in res.get("Contents") # type: ignore
242+
if (x is not None) and ("Key" in x)
243+
]
241244
next_continuation_token = res.get("NextContinuationToken")
242245
if next_continuation_token:
243246
args["ContinuationToken"] = next_continuation_token

testing/test_awswrangler/test_pandas.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,22 +1929,20 @@ def test_aurora_postgres_load_special(bucket, postgres_parameters):
19291929
})
19301930

19311931
path = f"s3://{bucket}/test_aurora_postgres_slash"
1932-
wr.pandas.to_aurora(
1933-
dataframe=df,
1934-
connection="aws-data-wrangler-postgres",
1935-
schema="public",
1936-
table="test_aurora_postgres_special",
1937-
mode="overwrite",
1938-
temp_s3_path=path,
1939-
engine="postgres",
1940-
procs_cpu_bound=4
1941-
)
1932+
wr.pandas.to_aurora(dataframe=df,
1933+
connection="aws-data-wrangler-postgres",
1934+
schema="public",
1935+
table="test_aurora_postgres_special",
1936+
mode="overwrite",
1937+
temp_s3_path=path,
1938+
engine="postgres",
1939+
procs_cpu_bound=4)
19421940
conn = Aurora.generate_connection(database="postgres",
1943-
host=postgres_parameters["PostgresAddress"],
1944-
port=3306,
1945-
user="test",
1946-
password=postgres_parameters["Password"],
1947-
engine="postgres")
1941+
host=postgres_parameters["PostgresAddress"],
1942+
port=3306,
1943+
user="test",
1944+
password=postgres_parameters["Password"],
1945+
engine="postgres")
19481946
with conn.cursor() as cursor:
19491947
cursor.execute("SELECT * FROM public.test_aurora_postgres_special")
19501948
rows = cursor.fetchall()
@@ -1971,22 +1969,20 @@ def test_aurora_mysql_load_special(bucket, mysql_parameters):
19711969
})
19721970

19731971
path = f"s3://{bucket}/test_aurora_mysql_special"
1974-
wr.pandas.to_aurora(
1975-
dataframe=df,
1976-
connection="aws-data-wrangler-mysql",
1977-
schema="test",
1978-
table="test_aurora_mysql_special",
1979-
mode="overwrite",
1980-
temp_s3_path=path,
1981-
engine="mysql",
1982-
procs_cpu_bound=1
1983-
)
1972+
wr.pandas.to_aurora(dataframe=df,
1973+
connection="aws-data-wrangler-mysql",
1974+
schema="test",
1975+
table="test_aurora_mysql_special",
1976+
mode="overwrite",
1977+
temp_s3_path=path,
1978+
engine="mysql",
1979+
procs_cpu_bound=1)
19841980
conn = Aurora.generate_connection(database="mysql",
1985-
host=mysql_parameters["MysqlAddress"],
1986-
port=3306,
1987-
user="test",
1988-
password=mysql_parameters["Password"],
1989-
engine="mysql")
1981+
host=mysql_parameters["MysqlAddress"],
1982+
port=3306,
1983+
user="test",
1984+
password=mysql_parameters["Password"],
1985+
engine="mysql")
19901986
with conn.cursor() as cursor:
19911987
cursor.execute("SELECT * FROM test.test_aurora_mysql_special")
19921988
rows = cursor.fetchall()

0 commit comments

Comments
 (0)