Skip to content

Commit 63bba87

Browse files
author
hao-xu5
committed
fix linting
Signed-off-by: hao-xu5 <hxu44@apple.com>
1 parent 4919fba commit 63bba87

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import logging
32
import traceback
43
import warnings

sdk/python/feast/table_format.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import json
1616
from abc import ABC, abstractmethod
1717
from enum import Enum
18-
from typing import Dict, Optional, TYPE_CHECKING
18+
from typing import TYPE_CHECKING, Dict, Optional
1919

2020
if TYPE_CHECKING:
2121
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
@@ -171,7 +171,9 @@ def from_dict(cls, data: Dict) -> "IcebergFormat":
171171

172172
def to_proto(self) -> "TableFormatProto":
173173
"""Convert to protobuf TableFormat message"""
174-
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
174+
from feast.protos.feast.core.DataFormat_pb2 import (
175+
TableFormat as TableFormatProto,
176+
)
175177

176178
iceberg_proto = TableFormatProto.IcebergFormat(
177179
catalog=self.catalog or "",
@@ -268,7 +270,9 @@ def from_dict(cls, data: Dict) -> "DeltaFormat":
268270

269271
def to_proto(self) -> "TableFormatProto":
270272
"""Convert to protobuf TableFormat message"""
271-
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
273+
from feast.protos.feast.core.DataFormat_pb2 import (
274+
TableFormat as TableFormatProto,
275+
)
272276

273277
delta_proto = TableFormatProto.DeltaFormat(
274278
checkpoint_location=self.checkpoint_location or "",
@@ -281,7 +285,9 @@ def from_proto(cls, proto: "TableFormatProto") -> "DeltaFormat":
281285
"""Create from protobuf TableFormat message"""
282286
delta_proto = proto.delta_format
283287
return cls(
284-
checkpoint_location=delta_proto.checkpoint_location if delta_proto.checkpoint_location else None,
288+
checkpoint_location=delta_proto.checkpoint_location
289+
if delta_proto.checkpoint_location
290+
else None,
285291
properties=dict(delta_proto.properties),
286292
)
287293

@@ -390,7 +396,9 @@ def from_dict(cls, data: Dict) -> "HudiFormat":
390396

391397
def to_proto(self) -> "TableFormatProto":
392398
"""Convert to protobuf TableFormat message"""
393-
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
399+
from feast.protos.feast.core.DataFormat_pb2 import (
400+
TableFormat as TableFormatProto,
401+
)
394402

395403
hudi_proto = TableFormatProto.HudiFormat(
396404
table_type=self.table_type or "",
@@ -407,7 +415,9 @@ def from_proto(cls, proto: "TableFormatProto") -> "HudiFormat":
407415
return cls(
408416
table_type=hudi_proto.table_type if hudi_proto.table_type else None,
409417
record_key=hudi_proto.record_key if hudi_proto.record_key else None,
410-
precombine_field=hudi_proto.precombine_field if hudi_proto.precombine_field else None,
418+
precombine_field=hudi_proto.precombine_field
419+
if hudi_proto.precombine_field
420+
else None,
411421
properties=dict(hudi_proto.properties),
412422
)
413423

@@ -541,7 +551,6 @@ def table_format_from_proto(proto: "TableFormatProto") -> TableFormat:
541551
Raises:
542552
ValueError: If the proto doesn't contain a recognized format.
543553
"""
544-
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
545554

546555
which_format = proto.WhichOneof("format")
547556

sdk/python/tests/unit/infra/offline_stores/contrib/spark_offline_store/test_spark_table_format_integration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
SparkOptions,
77
SparkSource,
88
)
9-
from feast.protos.feast.core.DataFormat_pb2 import TableFormat as TableFormatProto
109
from feast.table_format import (
1110
DeltaFormat,
1211
HudiFormat,
@@ -235,7 +234,9 @@ def test_spark_options_protobuf_serialization_with_table_format(self):
235234
assert proto.table_format.HasField("iceberg_format")
236235
assert proto.table_format.iceberg_format.catalog == "test_catalog"
237236
assert proto.table_format.iceberg_format.namespace == "test_namespace"
238-
assert proto.table_format.iceberg_format.properties["snapshot-id"] == "123456789"
237+
assert (
238+
proto.table_format.iceberg_format.properties["snapshot-id"] == "123456789"
239+
)
239240

240241
# Test deserialization from proto
241242
restored_options = SparkOptions.from_proto(proto)

0 commit comments

Comments
 (0)