Skip to content

Commit

Permalink
chore: resurrect SupportsSchema type; clean up unused ignored impor…
Browse files Browse the repository at this point in the history
…ts (#8421)
  • Loading branch information
cpcloud authored Feb 22, 2024
1 parent 543a2ec commit 21384c3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions ibis/common/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@
import sys
from abc import abstractmethod
from itertools import zip_longest
from types import ModuleType # noqa: F401
from typing import (
TYPE_CHECKING,
Any,
Generic, # noqa: F401
Optional,
TypeVar,
Union,
get_args,
get_origin,
)
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union, get_args, get_origin
from typing import get_type_hints as _get_type_hints

from ibis.common.bases import Abstract
from ibis.common.caching import memoize

if TYPE_CHECKING:
from collections.abc import Iterable, Mapping

from typing_extensions import Self

import ibis.expr.datatypes as dt
import ibis.expr.schema as sch

SupportsSchema = TypeVar(
"SupportsSchema",
sch.Schema,
Mapping[str, str | dt.DataType],
Iterable[tuple[str, str | dt.DataType]],
)

if sys.version_info >= (3, 10):
from types import UnionType
from typing import TypeAlias
Expand Down Expand Up @@ -144,6 +146,7 @@ def get_bound_typevars(obj: Any) -> dict[TypeVar, tuple[str, type]]:
Examples
--------
>>> from typing import Generic
>>> class MyStruct(Generic[T, U]):
... a: T
... b: U
Expand Down

0 comments on commit 21384c3

Please sign in to comment.