Skip to content

Commit f77dc0f

Browse files
committed
clean up diff
1 parent ef453d8 commit f77dc0f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

airbyte_cdk/models/airbyte_protocol.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,6 @@ def __eq__(self, other: object) -> bool:
4848
)
4949

5050

51-
def _custom_state_resolver(t: type) -> CustomType[AirbyteStateBlob, dict[str, Any]] | None:
52-
class AirbyteStateBlobType(CustomType[AirbyteStateBlob, Dict[str, Any]]):
53-
def serialize(self, value: AirbyteStateBlob) -> Dict[str, Any]:
54-
# cant use orjson.dumps() directly because private attributes are excluded, e.g. "__ab_full_refresh_sync_complete"
55-
return {k: v for k, v in value.__dict__.items()}
56-
57-
def deserialize(self, value: Dict[str, Any]) -> AirbyteStateBlob:
58-
return AirbyteStateBlob(value)
59-
60-
def get_json_schema(self) -> Dict[str, Any]:
61-
return {"type": "object"}
62-
63-
return AirbyteStateBlobType() if t is AirbyteStateBlob else None
64-
65-
6651
# The following dataclasses have been redeclared to include the new version of AirbyteStateBlob
6752
@dataclass
6853
class AirbyteStreamState:
@@ -101,6 +86,21 @@ class AirbyteMessage:
10186
control: Optional[AirbyteControlMessage] = None # type: ignore [name-defined]
10287

10388

89+
def _custom_state_resolver(t: type) -> CustomType[AirbyteStateBlob, dict[str, Any]] | None:
90+
class AirbyteStateBlobType(CustomType[AirbyteStateBlob, Dict[str, Any]]):
91+
def serialize(self, value: AirbyteStateBlob) -> Dict[str, Any]:
92+
# cant use orjson.dumps() directly because private attributes are excluded, e.g. "__ab_full_refresh_sync_complete"
93+
return {k: v for k, v in value.__dict__.items()}
94+
95+
def deserialize(self, value: Dict[str, Any]) -> AirbyteStateBlob:
96+
return AirbyteStateBlob(value)
97+
98+
def get_json_schema(self) -> Dict[str, Any]:
99+
return {"type": "object"}
100+
101+
return AirbyteStateBlobType() if t is AirbyteStateBlob else None
102+
103+
104104
def _with_serdes(
105105
cls,
106106
type_resolver: Callable[[type], CustomType[Any, Any] | None] | None = None,

0 commit comments

Comments
 (0)