Third-party stubs: enforce CamelCase for type alias names (#8256)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Alex Waygood
2022-07-19 08:23:24 +01:00
committed by GitHub
parent 4b34b345f1
commit e3d4bdc91a
13 changed files with 69 additions and 68 deletions

View File

@@ -5,6 +5,7 @@ from typing import Any, ClassVar
from .. import util
from ..util import HasMemoized, hybridmethod, memoized_property
from . import roles
from .elements import ColumnElement
from .traversals import (
HasCacheKey as HasCacheKey,
HasCopyInternals as HasCopyInternals,
@@ -151,7 +152,7 @@ class ImmutableColumnCollection(util.ImmutableContainer, ColumnCollection):
extend: Any
remove: Any
class ColumnSet(util.ordered_column_set):
class ColumnSet(util.ordered_column_set[ColumnElement[Any]]):
def contains_column(self, col): ...
def extend(self, cols) -> None: ...
def __add__(self, other): ...

View File

@@ -2,10 +2,8 @@ import collections.abc
from _typeshed import Self, SupportsKeysAndGetItem
from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import Any, Generic, NoReturn, TypeVar, overload
from typing_extensions import TypeAlias
from ..cimmutabledict import immutabledict as immutabledict
from ..sql.elements import ColumnElement
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
@@ -163,7 +161,11 @@ class WeakPopulateDict(dict[Any, Any]):
column_set = set
column_dict = dict
ordered_column_set: TypeAlias = OrderedSet[ColumnElement[Any]]
# Ignore Y026, this isn't a type alias.
# We have to do `ordered_column_set = OrderedSet[_T]
# instead of `ordered_column_set = OrderedSet`,
# or pyright complains
ordered_column_set = OrderedSet[_T] # noqa: Y026
def unique_list(seq: Iterable[_T], hashfunc: Callable[[_T], Any] | None = ...) -> list[_T]: ...

View File

@@ -5,11 +5,11 @@ from typing_extensions import TypeAlias
from .langhelpers import memoized_property
_greenlet: TypeAlias = Any # actually greenlet.greenlet
_Greenlet: TypeAlias = Any # actually greenlet.greenlet
def is_exit_exception(e): ...
class _AsyncIoGreenlet(_greenlet):
class _AsyncIoGreenlet(_Greenlet):
driver: Any
gr_context: Any
def __init__(self, fn, driver) -> None: ...