jroachgolf84 commented on code in PR #55070:
URL: https://github.com/apache/airflow/pull/55070#discussion_r2310262288
##########
providers/amazon/src/airflow/providers/amazon/aws/sensors/s3.py:
##########
@@ -132,21 +144,23 @@ def _check_key(self, key, context: Context):
for f in key_matches:
metadata = {}
if "*" in self.metadata_keys:
- metadata = self.hook.head_object(f["Key"], bucket_name)
+ metadata = self.hook.head_object(f["Key"], bucket_name) #
type: ignore[index]
else:
- for key in self.metadata_keys:
+ for mk in self.metadata_keys:
try:
- metadata[key] = f[key]
+ metadata[mk] = f[mk] # type: ignore[index]
except KeyError:
# supplied key might be from head_object response
- self.log.info("Key %s not found in response,
performing head_object", key)
- metadata[key] = self.hook.head_object(f["Key"],
bucket_name).get(key, None)
+ self.log.info("Key %s not found in response,
performing head_object", mk)
+ metadata[mk] = self.hook.head_object(f["Key"],
bucket_name).get(mk, None) # type: ignore[index]
files.append(metadata)
+
elif self.use_regex:
- keys = self.hook.get_file_metadata("", bucket_name)
- key_matches = [k for k in keys if re.match(pattern=key,
string=k["Key"])]
- if not key_matches:
- return False
+ for k in self.hook.get_file_metadata("", bucket_name):
Review Comment:
This change felt out-of-scope, but happy to play around a bit with that?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]