Skip to content

remove unnecessary map and rewrite it using list in providers #33763

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 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion airflow/providers/amazon/aws/sensors/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _check_key(self, key):
return False

# Reduce the set of metadata to size only
files = list(map(lambda f: {"Size": f["Size"]}, key_matches))
files = [{"Size": f["Size"]} for f in key_matches]
else:
obj = self.hook.head_object(key, bucket_name)
if obj is None:
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/elasticsearch/log/es_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __getitem__(self, k):
return _wrap(val)

def __iter__(self):
return map(lambda i: _wrap(i), self._l_)
return (_wrap(i) for i in self._l_)

def __bool__(self):
return bool(self._l_)
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/transfers/sql_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _write_local_data_files(self, cursor):
names in GCS, and values are file handles to local files that
contain the data for the GCS objects.
"""
org_schema = list(map(lambda schema_tuple: schema_tuple[0], cursor.description))
org_schema = [schema_tuple[0] for schema_tuple in cursor.description]
schema = [column for column in org_schema if column not in self.exclude_columns]

col_type_dict = self._get_col_type_dict()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _write_temp_file(self, cursor: Any, path_to_save: str | bytes | int) -> None
quotechar=self.quotechar,
quoting=self.quoting,
)
csv_writer.writerow(map(lambda field: field[0], cursor.description))
csv_writer.writerow(field[0] for field in cursor.description)
csv_writer.writerows(cursor)
csvfile.flush()

Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/oracle/transfers/oracle_to_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _execute(self, src_hook, dest_hook, context) -> None:
cursor = src_conn.cursor()
self.log.info("Querying data from source: %s", self.oracle_source_conn_id)
cursor.execute(self.source_sql, self.source_sql_params)
target_fields = list(map(lambda field: field[0], cursor.description))
target_fields = [field[0] for field in cursor.description]

rows_total = 0
for rows in iter(lambda: cursor.fetchmany(self.rows_chunk), []):
Expand Down