Taragolis commented on code in PR #27775:
URL: https://github.com/apache/airflow/pull/27775#discussion_r1028567933
##########
airflow/providers/google/cloud/hooks/pubsub.py:
##########
@@ -537,12 +537,10 @@ def acknowledge(
individual attempt.
:param metadata: (Optional) Additional metadata that is provided to
the method.
"""
- if ack_ids is not None and messages is None:
- pass
- elif ack_ids is None and messages is not None:
- ack_ids = [message.ack_id for message in messages]
- else:
+ if not (ack_ids is None) ^ (messages is None):
raise ValueError("One and only one of 'ack_ids' and 'messages'
arguments have to be provided")
+ elif ack_ids is None:
+ ack_ids = [message.ack_id for message in messages] # type:
ignore[union-attr]
Review Comment:
Return to initial variant. Just add short comments and tests.
Unfortunetly `airflow.utils.helpers.exactly_one` cannot use in this case
because first argument (as well as second) for check would be Iterable
--
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]