Skip to content

Commit 5a6fe5b

Browse files
committed
I hope it fixes tests
1 parent b24fbc3 commit 5a6fe5b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

pyiceberg/types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _parse_fixed_type(fixed: Any) -> int:
100100
return fixed
101101

102102

103-
def _parse_geography_type(geography: Any) -> Tuple[str, GeographyType.EdgeAlgorithm]:
103+
def _parse_geography_type(geography: Any) -> Tuple[Optional[str], Optional[GeographyType.EdgeAlgorithm]]:
104104
if isinstance(geography, str):
105105
matches = GEOGRAPHY_REGEX.search(geography)
106106
if matches:
@@ -120,7 +120,7 @@ def _parse_geography_type(geography: Any) -> Tuple[str, GeographyType.EdgeAlgori
120120
return geography
121121

122122

123-
def _parse_geometry_type(geometry: Any) -> str:
123+
def _parse_geometry_type(geometry: Any) -> Optional[str]:
124124
if isinstance(geometry, str):
125125
matches = GEOMETRY_REGEX.search(geometry)
126126
if matches:
@@ -137,7 +137,7 @@ def _parse_geometry_type(geometry: Any) -> str:
137137
return geometry
138138

139139

140-
def _raise_if_any_missing_dictionary_key(d: Dict, expected_type: str, *keys: str):
140+
def _raise_if_any_missing_dictionary_key(d: Dict[str, str], expected_type: str, *keys: str) -> None:
141141
missing_keys = []
142142
for key in keys:
143143
if key not in d:
@@ -945,12 +945,12 @@ def ser_model(self) -> str:
945945
return f"geography({self.crs or GeographyType.default_crs}, {self.edge_algorithm.value})"
946946

947947
@property
948-
def crs(self) -> str:
948+
def crs(self) -> Optional[str]:
949949
"""Return the crs of the geography."""
950950
return self.root[0]
951951

952952
@property
953-
def edge_algorithm(self) -> EdgeAlgorithm:
953+
def edge_algorithm(self) -> Optional[EdgeAlgorithm]:
954954
"""Return the algorithm of the geography."""
955955
return self.root[1]
956956

@@ -971,7 +971,7 @@ def __hash__(self) -> int:
971971
"""Return the hash of the crs."""
972972
return hash(self.root)
973973

974-
def __getnewargs__(self) -> Tuple[str, EdgeAlgorithm]:
974+
def __getnewargs__(self) -> Tuple[Optional[str], Optional[EdgeAlgorithm]]:
975975
"""Pickle the GeographyType class."""
976976
return self.crs, self.edge_algorithm
977977

@@ -1006,7 +1006,7 @@ def ser_model(self) -> str:
10061006
return f"geometry({self.crs})"
10071007

10081008
@property
1009-
def crs(self) -> str:
1009+
def crs(self) -> Optional[str]:
10101010
"""Return the crs of the geometry."""
10111011
return self.root[0]
10121012

@@ -1024,7 +1024,7 @@ def __hash__(self) -> int:
10241024
"""Return the hash of the crs."""
10251025
return hash(self.root)
10261026

1027-
def __getnewargs__(self) -> str:
1027+
def __getnewargs__(self) -> Tuple[Optional[str]]:
10281028
"""Pickle the GeometryType class."""
10291029
return (self.crs, )
10301030

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,6 @@ def table_schema_with_all_types() -> Schema:
351351
NestedField(field_id=22, name="inner_int", field_type=IntegerType(), required=True),
352352
),
353353
),
354-
NestedField(field_id=23, name="geography", field_type=GeographyType(), required=True),
355-
NestedField(field_id=24, name="geometry", field_type=GeometryType(), required=True),
356354
schema_id=1,
357355
identifier_field_ids=[2],
358356
)

0 commit comments

Comments
 (0)