Skip to content

Commit 80eb131

Browse files
committed
I hope it fixes tests
1 parent feffb11 commit 80eb131

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:
@@ -960,12 +960,12 @@ def ser_model(self) -> str:
960960
return f"geography({self.crs or GeographyType.default_crs}, {self.edge_algorithm.value})"
961961

962962
@property
963-
def crs(self) -> str:
963+
def crs(self) -> Optional[str]:
964964
"""Return the crs of the geography."""
965965
return self.root[0]
966966

967967
@property
968-
def edge_algorithm(self) -> EdgeAlgorithm:
968+
def edge_algorithm(self) -> Optional[EdgeAlgorithm]:
969969
"""Return the algorithm of the geography."""
970970
return self.root[1]
971971

@@ -986,7 +986,7 @@ def __hash__(self) -> int:
986986
"""Return the hash of the crs."""
987987
return hash(self.root)
988988

989-
def __getnewargs__(self) -> Tuple[str, EdgeAlgorithm]:
989+
def __getnewargs__(self) -> Tuple[Optional[str], Optional[EdgeAlgorithm]]:
990990
"""Pickle the GeographyType class."""
991991
return self.crs, self.edge_algorithm
992992

@@ -1021,7 +1021,7 @@ def ser_model(self) -> str:
10211021
return f"geometry({self.crs})"
10221022

10231023
@property
1024-
def crs(self) -> str:
1024+
def crs(self) -> Optional[str]:
10251025
"""Return the crs of the geometry."""
10261026
return self.root[0]
10271027

@@ -1039,7 +1039,7 @@ def __hash__(self) -> int:
10391039
"""Return the hash of the crs."""
10401040
return hash(self.root)
10411041

1042-
def __getnewargs__(self) -> str:
1042+
def __getnewargs__(self) -> Tuple[Optional[str]]:
10431043
"""Pickle the GeometryType class."""
10441044
return (self.crs, )
10451045

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ def table_schema_with_all_types() -> Schema:
354354
NestedField(field_id=22, name="inner_int", field_type=IntegerType(), required=True),
355355
),
356356
),
357-
NestedField(field_id=23, name="geography", field_type=GeographyType(), required=True),
358-
NestedField(field_id=24, name="geometry", field_type=GeometryType(), required=True),
359357
schema_id=1,
360358
identifier_field_ids=[2],
361359
)

0 commit comments

Comments
 (0)