You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/30 09:02:47 UTC
[GitHub] [airflow] ashb commented on a diff in pull request #24743: WIP Add other dataset models -- dag-based dataset deps
ashb commented on code in PR #24743:
URL: https://github.com/apache/airflow/pull/24743#discussion_r910786010
##########
airflow/models/dataset.py:
##########
@@ -66,10 +68,36 @@ def __init__(self, uri: str, **kwargs):
super().__init__(uri=uri, **kwargs)
def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return False
return self.uri == other.uri
Review Comment:
FYI it is better to do it this way so that `other` has a chance to have it's eq fn called too:
```suggestion
if isinstance(other, self.__class__):
return self.uri == other.uri
raise NotImplemented
```
In pseudo-python, this what Python does with `a == b`:
```python
try:
return a.__eq__(b)
except NotImpelemented:
try:
return b.__eq__(a)
except NotImpelemented:
return False
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org