Skip to content

Commit 047582a

Browse files
committed
fixed type annotations
1 parent 7ea17cb commit 047582a

File tree

11 files changed

+11
-23
lines changed

11 files changed

+11
-23
lines changed

pyiceberg/avro/codecs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
from __future__ import annotations
2828

29-
from typing import Dict, Literal, Optional, Type
29+
from typing import Dict, Literal, Type
3030

3131
from typing_extensions import TypeAlias
3232

pyiceberg/catalog/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
Callable,
3131
Dict,
3232
List,
33-
Optional,
3433
Set,
3534
Tuple,
3635
Type,
37-
Union,
3836
cast,
3937
)
4038

pyiceberg/catalog/rest/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
Any,
2121
Dict,
2222
List,
23-
Optional,
2423
Set,
2524
Tuple,
2625
Union,

pyiceberg/expressions/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
Tuple,
3030
Type,
3131
TypeVar,
32-
Union,
3332
)
3433
from typing import Literal as TypingLiteral
3534

pyiceberg/io/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
from typing import (
3535
Dict,
3636
List,
37-
Optional,
3837
Protocol,
3938
Type,
40-
Union,
4139
runtime_checkable,
4240
)
4341
from urllib.parse import urlparse

pyiceberg/io/pyarrow.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@
4949
Iterable,
5050
Iterator,
5151
List,
52-
Optional,
5352
Set,
5453
Tuple,
5554
TypeVar,
56-
Union,
5755
cast,
5856
)
5957
from urllib.parse import urlparse
@@ -1291,7 +1289,7 @@ def primitive(self, primitive: pa.DataType) -> bool:
12911289
return True
12921290

12931291

1294-
class _ConvertToIceberg(PyArrowSchemaVisitor[Union[IcebergType, Schema]]):
1292+
class _ConvertToIceberg(PyArrowSchemaVisitor[IcebergType | Schema]):
12951293
"""Converts PyArrowSchema to Iceberg Schema. Applies the IDs from name_mapping if provided."""
12961294

12971295
_field_names: List[str]
@@ -1428,7 +1426,7 @@ def after_map_value(self, element: pa.Field) -> None:
14281426
self._field_names.pop()
14291427

14301428

1431-
class _ConvertToLargeTypes(PyArrowSchemaVisitor[Union[pa.DataType, pa.Schema]]):
1429+
class _ConvertToLargeTypes(PyArrowSchemaVisitor[IcebergType | pa.Schema]):
14321430
def schema(self, schema: pa.Schema, struct_result: pa.StructType) -> pa.Schema:
14331431
return pa.schema(struct_result)
14341432

@@ -1452,7 +1450,7 @@ def primitive(self, primitive: pa.DataType) -> pa.DataType:
14521450
return primitive
14531451

14541452

1455-
class _ConvertToSmallTypes(PyArrowSchemaVisitor[Union[pa.DataType, pa.Schema]]):
1453+
class _ConvertToSmallTypes(PyArrowSchemaVisitor[IcebergType | pa.Schema]):
14561454
def schema(self, schema: pa.Schema, struct_result: pa.StructType) -> pa.Schema:
14571455
return pa.schema(struct_result)
14581456

@@ -1807,7 +1805,7 @@ def _to_requested_schema(
18071805
return pa.RecordBatch.from_struct_array(struct_array)
18081806

18091807

1810-
class ArrowProjectionVisitor(SchemaWithPartnerVisitor[pa.Array, Optional[pa.Array]]):
1808+
class ArrowProjectionVisitor(SchemaWithPartnerVisitor[pa.Array, pa.Array | None]):
18111809
_file_schema: Schema
18121810
_include_field_ids: bool
18131811
_downcast_ns_timestamp_to_us: bool

pyiceberg/schema.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
Generic,
3030
List,
3131
Literal,
32-
Optional,
3332
Set,
3433
Tuple,
3534
TypeVar,
@@ -1433,7 +1432,7 @@ def sanitize_column_names(schema: Schema) -> Schema:
14331432
)
14341433

14351434

1436-
class _SanitizeColumnsVisitor(SchemaVisitor[Optional[IcebergType]]):
1435+
class _SanitizeColumnsVisitor(SchemaVisitor[IcebergType | None]):
14371436
def schema(self, schema: Schema, struct_result: IcebergType | None) -> IcebergType | None:
14381437
return struct_result
14391438

@@ -1484,7 +1483,7 @@ def prune_columns(schema: Schema, selected: Set[int], select_full_types: bool =
14841483
)
14851484

14861485

1487-
class _PruneColumnsVisitor(SchemaVisitor[Optional[IcebergType]]):
1486+
class _PruneColumnsVisitor(SchemaVisitor[IcebergType | None]):
14881487
selected: Set[int]
14891488
select_full_types: bool
14901489

pyiceberg/table/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@
3333
Iterable,
3434
Iterator,
3535
List,
36-
Optional,
3736
Set,
3837
Tuple,
3938
Type,
4039
TypeVar,
41-
Union,
4240
)
4341

4442
from pydantic import Field

pyiceberg/table/update/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from abc import ABC, abstractmethod
2222
from datetime import datetime
2323
from functools import singledispatch
24-
from typing import TYPE_CHECKING, Annotated, Any, Dict, Generic, List, Literal, Optional, Tuple, TypeVar, Union, cast
24+
from typing import TYPE_CHECKING, Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, cast
2525

2626
from pydantic import Field, field_validator, model_serializer, model_validator
2727

pyiceberg/table/update/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from copy import copy
2121
from dataclasses import dataclass
2222
from enum import Enum
23-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple
23+
from typing import TYPE_CHECKING, Any, Dict, List, Set, Tuple
2424

2525
from pyiceberg.exceptions import ResolveError, ValidationError
2626
from pyiceberg.expressions import literal # type: ignore
@@ -693,7 +693,7 @@ def assign_new_column_id(self) -> int:
693693
return next(self._last_column_id)
694694

695695

696-
class _ApplyChanges(SchemaVisitor[Optional[IcebergType]]):
696+
class _ApplyChanges(SchemaVisitor[IcebergType | None]):
697697
_adds: Dict[int, List[NestedField]]
698698
_updates: Dict[int, NestedField]
699699
_deletes: Set[int]

0 commit comments

Comments
 (0)