Skip to content
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 sdk/python/feast/aggregation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def from_proto(cls, agg_proto: AggregationProto):

def __eq__(self, other):
if not isinstance(other, Aggregation):
raise TypeError("Comparisons should only involve Aggregations.")
return False

if (
self.column != other.column
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/base_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool:

def __eq__(self, other):
if not isinstance(other, BaseFeatureView):
raise TypeError(
"Comparisons should only involve BaseFeatureView class objects."
)
return False

if (
self.name != other.name
Expand Down
4 changes: 4 additions & 0 deletions sdk/python/feast/data_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def to_proto(self):
pass

def __eq__(self, other):
if not isinstance(other, FileFormat):
return False
return self.to_proto() == other.to_proto()

@classmethod
Expand Down Expand Up @@ -95,6 +97,8 @@ def to_proto(self):
pass

def __eq__(self, other):
if not isinstance(other, StreamFormat):
return False
return self.to_proto() == other.to_proto()

@classmethod
Expand Down
14 changes: 4 additions & 10 deletions sdk/python/feast/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def __eq__(self, other):
return False

if not isinstance(other, DataSource):
raise TypeError("Comparisons should only involve DataSource class objects.")
return False

if (
self.name != other.name
Expand Down Expand Up @@ -499,9 +499,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, KafkaSource):
raise TypeError(
"Comparisons should only involve KafkaSource class objects."
)
return False

if not super().__eq__(other):
return False
Expand Down Expand Up @@ -639,9 +637,7 @@ def get_table_column_names_and_types(

def __eq__(self, other):
if not isinstance(other, RequestSource):
raise TypeError(
"Comparisons should only involve RequestSource class objects."
)
return False

if not super().__eq__(other):
return False
Expand Down Expand Up @@ -801,9 +797,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, KinesisSource):
raise TypeError(
"Comparisons should only involve KinesisSource class objects."
)
return False

if not super().__eq__(other):
return False
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __hash__(self) -> int:

def __eq__(self, other):
if not isinstance(other, Entity):
raise TypeError("Comparisons should only involve Entity class objects.")
return False

if (
self.name != other.name
Expand Down
2 changes: 2 additions & 0 deletions sdk/python/feast/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def __init__(
self._labels = labels

def __eq__(self, other):
if not isinstance(other, Feature):
return False
if self.name != other.name or self.dtype != other.dtype:
return False
return True
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/feature_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, FeatureService):
raise TypeError(
"Comparisons should only involve FeatureService class objects."
)
return False

if (
self.name != other.name
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool:

def __eq__(self, other):
if not isinstance(other, FeatureView):
raise TypeError(
"Comparisons should only involve FeatureView class objects."
)
return False

if not super().__eq__(other):
return False
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/infra/offline_stores/bigquery_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, BigQuerySource):
raise TypeError(
"Comparisons should only involve BigQuerySource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, AthenaSource):
raise TypeError(
"Comparisons should only involve AthenaSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, CouchbaseColumnarSource):
raise TypeError(
"Comparisons should only involve CouchbaseColumnarSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, MsSqlServerSource):
raise TypeError(
"Comparisons should only involve SqlServerSource class objects."
)
return False

return (
self.name == other.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, OracleSource):
raise TypeError(
"Comparisons should only involve OracleSource class objects."
)
return False

return (
self.name == other.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, PostgreSQLSource):
raise TypeError(
"Comparisons should only involve PostgreSQLSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def get_table_query_string(self) -> str:

def __eq__(self, other):
if not isinstance(other, RaySource):
raise TypeError("Comparisons should only involve RaySource class objects.")
return False
base_eq = super().__eq__(other)
if not base_eq:
return False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,13 @@ def _load_dataframe_from_path(self, spark_session):
return reader.load(self.path)

def __eq__(self, other):
base_eq = super().__eq__(other)
if not base_eq:
# Guard before the spark-specific attribute access below: the base
# DataSource.__eq__ accepts any DataSource subclass, so a cross-type
# comparison (e.g. against a FileSource with a matching name) would
# otherwise raise AttributeError on `other.table` (#6636).
if not isinstance(other, SparkSource):
return False
if not super().__eq__(other):
return False
return (
self.table == other.table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, TrinoSource):
raise TypeError(
"Comparisons should only involve TrinoSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/file_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, FileSource):
raise TypeError("Comparisons should only involve FileSource class objects.")
return False

return (
super().__eq__(other)
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/infra/offline_stores/redshift_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, RedshiftSource):
raise TypeError(
"Comparisons should only involve RedshiftSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/infra/offline_stores/snowflake_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, SnowflakeSource):
raise TypeError(
"Comparisons should only involve SnowflakeSource class objects."
)
return False

return (
super().__eq__(other)
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/labeling/label_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __copy__(self):

def __eq__(self, other):
if not isinstance(other, LabelView):
raise TypeError("Comparisons should only involve LabelView class objects.")
return False

if not super().__eq__(other):
return False
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/on_demand_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,7 @@ def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool:

def __eq__(self, other):
if not isinstance(other, OnDemandFeatureView):
raise TypeError(
"Comparisons should only involve OnDemandFeatureView class objects."
)
return False

# Note, no longer evaluating the base feature view layer as ODFVs can have
# multiple datasources and a base_feature_view only has one source
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/permissions/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, Permission):
raise TypeError("Comparisons should only involve Permission class objects.")
return False

if (
self.name != other.name
Expand Down
16 changes: 4 additions & 12 deletions sdk/python/feast/permissions/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, RoleBasedPolicy):
raise TypeError(
"Comparisons should only involve RoleBasedPolicy class objects."
)
return False

if sorted(self.roles) != sorted(other.roles):
return False
Expand Down Expand Up @@ -148,9 +146,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, GroupBasedPolicy):
raise TypeError(
"Comparisons should only involve GroupBasedPolicy class objects."
)
return False

if sorted(self.groups) != sorted(other.groups):
return False
Expand Down Expand Up @@ -206,9 +202,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, NamespaceBasedPolicy):
raise TypeError(
"Comparisons should only involve NamespaceBasedPolicy class objects."
)
return False

if sorted(self.namespaces) != sorted(other.namespaces):
return False
Expand Down Expand Up @@ -270,9 +264,7 @@ def __init__(

def __eq__(self, other):
if not isinstance(other, CombinedGroupNamespacePolicy):
raise TypeError(
"Comparisons should only involve CombinedGroupNamespacePolicy class objects."
)
return False

if sorted(self.groups) != sorted(other.groups) or sorted(
self.namespaces
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __hash__(self) -> int:

def __eq__(self, other):
if not isinstance(other, Project):
raise TypeError("Comparisons should only involve Project class objects.")
return False

if (
self.name != other.name
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/project_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def __hash__(self) -> int:

def __eq__(self, other):
if not isinstance(other, ProjectMetadata):
raise TypeError(
"Comparisons should only involve ProjectMetadata class objects."
)
return False

if (
self.project_name != other.project_name
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/saved_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ def __hash__(self):

def __eq__(self, other):
if not isinstance(other, SavedDataset):
raise TypeError(
"Comparisons should only involve SavedDataset class objects."
)
return False

if (
self.name != other.name
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/stream_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool:

def __eq__(self, other):
if not isinstance(other, StreamFeatureView):
raise TypeError("Comparisons should only involve StreamFeatureViews")
return False

if not super().__eq__(other):
return False
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/transformation/pandas_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ def infer_features(

def __eq__(self, other):
if not isinstance(other, PandasTransformation):
raise TypeError(
"Comparisons should only involve PandasTransformation class objects."
)
return False

if (
self.udf_string != other.udf_string
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/transformation/python_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ def infer_features(

def __eq__(self, other):
if not isinstance(other, PythonTransformation):
raise TypeError(
"Comparisons should only involve PythonTransformation class objects."
)
return False

if (
self.udf_string != other.udf_string
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/transformation/ray_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,7 @@ def infer_features(

def __eq__(self, other):
if not isinstance(other, RayTransformation):
raise TypeError(
"Comparisons should only involve RayTransformation class objects."
)
return False

if (
self.udf_string != other.udf_string
Expand Down
Loading
Loading