pabloem commented on a change in pull request #16118:
URL: https://github.com/apache/beam/pull/16118#discussion_r762702697
##########
File path: playground/infrastructure/helper.py
##########
@@ -236,39 +237,52 @@ def _validate(tag: dict, supported_categories: List[str])
-> bool:
"""
valid = True
for field in fields(TagFields):
- if tag.get(field.default) is None:
+ if field.default not in tag:
logging.error(
- "tag doesn't contain %s field: %s \n"
- "Please, check that this field exists in the beam playground tag."
- "If you are sure that this field exists in the tag"
- " check the format of indenting.", field.default, tag.__str__())
+ "tag doesn't contain %s field: %s \n"
+ "Please, check that this field exists in the beam playground tag."
+ "If you are sure that this field exists in the tag"
+ " check the format of indenting.",
+ field.default,
+ tag.__str__())
+ valid = False
+
+ name = tag.get(TagFields.NAME)
+ if name == "":
Review comment:
AFAIK tihs is the preferred way to test for empty string / None / etc in
Python
[1] https://docs.python.org/3/library/stdtypes.html#truth-value-testing
[2]
https://stackoverflow.com/questions/9573244/how-to-check-if-the-string-is-empty
--
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]