Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stubs/SQLAlchemy/sqlalchemy/sql/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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): ...
Expand Down
8 changes: 5 additions & 3 deletions stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't pyright complain about column_set?

@AlexWaygood AlexWaygood Jul 19, 2022 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea :/

ordered_column_set = OrderedSet[_T] # noqa: Y026

def unique_list(seq: Iterable[_T], hashfunc: Callable[[_T], Any] | None = ...) -> list[_T]: ...

Expand Down
4 changes: 2 additions & 2 deletions stubs/SQLAlchemy/sqlalchemy/util/_concurrency_py3k.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
10 changes: 5 additions & 5 deletions stubs/boto/boto/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class LRUCache(dict[_KT, _VT]):
def __init__(self, capacity: int) -> None: ...

# This exists to work around Password.str's name shadowing the str type
_str: TypeAlias = str
_Str: TypeAlias = str

class Password:
hashfunc: Callable[[bytes], _Hash]
str: _str | None
def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _Hash] | None = ...) -> None: ...
def set(self, value: bytes | _str) -> None: ...
def __eq__(self, other: _str | bytes | None) -> bool: ... # type: ignore[override]
str: _Str | None
def __init__(self, str: _Str | None = ..., hashfunc: Callable[[bytes], _Hash] | None = ...) -> None: ...
def set(self, value: bytes | _Str) -> None: ...
def __eq__(self, other: _Str | bytes | None) -> bool: ... # type: ignore[override]
def __len__(self) -> int: ...

def notify(
Expand Down
4 changes: 2 additions & 2 deletions stubs/caldav/caldav/objects.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from .lib.url import URL

_CC = TypeVar("_CC", bound=CalendarObjectResource)

_vCalAddress: TypeAlias = Any # actually icalendar.vCalAddress
_VCalAddress: TypeAlias = Any # actually icalendar.vCalAddress

class DAVObject:
id: str | None
Expand Down Expand Up @@ -58,7 +58,7 @@ class Principal(DAVObject):
self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ...
) -> Calendar: ...
def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ...
def get_vcal_address(self) -> _vCalAddress: ...
def get_vcal_address(self) -> _VCalAddress: ...
calendar_home_set: CalendarSet # can also be set to anything URL.objectify() accepts
def freebusy_request(self, dtstart, dtend, attendees): ...
def calendar_user_address_set(self) -> list[str]: ...
Expand Down
3 changes: 1 addition & 2 deletions stubs/html5lib/html5lib/_tokenizer.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Any
from typing_extensions import TypeAlias

entitiesTrie: Any
attributeMap: TypeAlias = dict[Any, Any]
attributeMap = dict

class HTMLTokenizer:
stream: Any
Expand Down
5 changes: 2 additions & 3 deletions stubs/psutil/psutil/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from _typeshed import Self
from collections.abc import Callable, Iterable, Iterator
from contextlib import AbstractContextManager
from typing import Any
from typing_extensions import TypeAlias

from ._common import (
AIX as AIX,
Expand Down Expand Up @@ -109,8 +108,8 @@ elif sys.platform == "darwin":
elif sys.platform == "win32":
from ._pswindows import pfullmem, pmem
else:
Comment thread
AlexWaygood marked this conversation as resolved.
Resolved
pmem: TypeAlias = Any
pfullmem: TypeAlias = Any
class pmem(Any): ...
class pfullmem(Any): ...

if sys.platform == "linux":
PROCFS_PATH: str
Expand Down
10 changes: 5 additions & 5 deletions stubs/psycopg2/psycopg2/_psycopg.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class cursor:
def __iter__(self: Self) -> Self: ...
def __next__(self) -> tuple[Any, ...]: ...

_cursor: TypeAlias = cursor
_Cursor: TypeAlias = cursor

class AsIs:
adapted: Any
Expand Down Expand Up @@ -246,7 +246,7 @@ class Diagnostics:
def __init__(self, __err: Error) -> None: ...

class Error(Exception):
cursor: _cursor | None
cursor: _Cursor | None
diag: Diagnostics
pgcode: str | None
pgerror: str | None
Expand Down Expand Up @@ -357,7 +357,7 @@ class Xid:
def __getitem__(self, __index): ...
def __len__(self): ...

_T_cur = TypeVar("_T_cur", bound=_cursor)
_T_cur = TypeVar("_T_cur", bound=cursor)

class connection:
DataError: Any
Expand All @@ -377,7 +377,7 @@ class connection:
def binary_types(self) -> Any: ...
@property
def closed(self) -> int: ...
cursor_factory: Callable[..., _cursor]
cursor_factory: Callable[..., _Cursor]
@property
def dsn(self) -> str: ...
@property
Expand Down Expand Up @@ -415,7 +415,7 @@ class connection:
def close(self) -> None: ...
def commit(self) -> None: ...
@overload
def cursor(self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ...) -> _cursor: ...
def cursor(self, name: str | bytes | None = ..., *, withhold: bool = ..., scrollable: bool | None = ...) -> _Cursor: ...
@overload
def cursor(
self,
Expand Down
6 changes: 3 additions & 3 deletions stubs/python-dateutil/dateutil/relativedelta.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from ._common import weekday
_SelfT = TypeVar("_SelfT", bound=relativedelta)
_DateT = TypeVar("_DateT", date, datetime)
# Work around attribute and type having the same name.
_weekday: TypeAlias = weekday
_Weekday: TypeAlias = weekday

MO: weekday
TU: weekday
Expand All @@ -30,7 +30,7 @@ class relativedelta:
microseconds: int
year: int | None
month: int | None
weekday: _weekday | None
weekday: _Weekday | None
day: int | None
hour: int | None
minute: int | None
Expand All @@ -52,7 +52,7 @@ class relativedelta:
year: int | None = ...,
month: int | None = ...,
day: int | None = ...,
weekday: int | _weekday | None = ...,
weekday: int | _Weekday | None = ...,
yearday: int | None = ...,
nlyearday: int | None = ...,
hour: int | None = ...,
Expand Down
4 changes: 2 additions & 2 deletions stubs/python-dateutil/dateutil/rrule.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _iterinfo:
def mtimeset(self, hour, minute, second): ...
def stimeset(self, hour, minute, second): ...

_rrule: TypeAlias = rrule
_RRule: TypeAlias = rrule

class rruleset(rrulebase):
class _genitem:
Expand All @@ -100,7 +100,7 @@ class rruleset(rrulebase):
def __ne__(self, other): ...

def __init__(self, cache: bool = ...) -> None: ...
def rrule(self, rrule: _rrule): ...
def rrule(self, rrule: _RRule): ...
def rdate(self, rdate): ...
def exrule(self, exrule): ...
def exdate(self, exdate): ...
Expand Down
28 changes: 14 additions & 14 deletions stubs/typed-ast/typed_ast/ast27.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PyCF_ONLY_AST: int

# ast classes

_identifier: TypeAlias = str
_Identifier: TypeAlias = str

class AST:
_attributes: tuple[str, ...]
Expand Down Expand Up @@ -55,14 +55,14 @@ class stmt(AST):
col_offset: int

class FunctionDef(stmt):
name: _identifier
name: _Identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
type_comment: str | None

class ClassDef(stmt):
name: _identifier
name: _Identifier
bases: list[expr]
body: list[stmt]
decorator_list: list[expr]
Expand Down Expand Up @@ -133,7 +133,7 @@ class Import(stmt):
names: list[alias]

class ImportFrom(stmt):
module: _identifier | None
module: _Identifier | None
names: list[alias]
level: int | None

Expand All @@ -143,7 +143,7 @@ class Exec(stmt):
locals: expr | None

class Global(stmt):
names: list[_identifier]
names: list[_Identifier]

class Expr(stmt):
value: expr
Expand All @@ -153,7 +153,7 @@ class Break(stmt): ...
class Continue(stmt): ...
class slice(AST): ...

_slice: TypeAlias = slice # this lets us type the variable named 'slice' below
_Slice: TypeAlias = slice # this lets us type the variable named 'slice' below

class Slice(slice):
lower: expr | None
Expand Down Expand Up @@ -245,16 +245,16 @@ class Str(expr):

class Attribute(expr):
value: expr
attr: _identifier
attr: _Identifier
ctx: expr_context

class Subscript(expr):
value: expr
slice: _slice
slice: _Slice
ctx: expr_context

class Name(expr):
id: _identifier
id: _Identifier
ctx: expr_context

class List(expr):
Expand Down Expand Up @@ -319,18 +319,18 @@ class ExceptHandler(AST):

class arguments(AST):
args: list[expr]
vararg: _identifier | None
kwarg: _identifier | None
vararg: _Identifier | None
kwarg: _Identifier | None
defaults: list[expr]
type_comments: list[str | None]

class keyword(AST):
arg: _identifier
arg: _Identifier
value: expr

class alias(AST):
name: _identifier
asname: _identifier | None
name: _Identifier
asname: _Identifier | None

class TypeIgnore(AST):
lineno: int
Loading