From 2d468966f58ac398f64407a55caa05912faa82f5 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 27 Apr 2022 14:25:35 +0200 Subject: [PATCH] Add various missing generic arguments (#7702) Co-authored-by: Akuli --- stubs/Markdown/markdown/inlinepatterns.pyi | 4 ++-- stubs/Pillow/PIL/PdfParser.pyi | 4 ++-- .../SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi | 2 +- .../SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi | 2 +- .../SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi | 2 +- stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi | 2 +- stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi | 2 +- stubs/babel/babel/localedata.pyi | 4 ++-- stubs/humanfriendly/humanfriendly/case.pyi | 9 ++++++--- 9 files changed, 17 insertions(+), 14 deletions(-) diff --git a/stubs/Markdown/markdown/inlinepatterns.pyi b/stubs/Markdown/markdown/inlinepatterns.pyi index f534661dc..0fe488204 100644 --- a/stubs/Markdown/markdown/inlinepatterns.pyi +++ b/stubs/Markdown/markdown/inlinepatterns.pyi @@ -1,5 +1,5 @@ import typing -from typing import Any, Match +from typing import Any, ClassVar, Match from xml.etree.ElementTree import Element def build_inlinepatterns(md, **kwargs): ... @@ -94,7 +94,7 @@ class LinkInlineProcessor(InlineProcessor): class ImageInlineProcessor(LinkInlineProcessor): ... class ReferenceInlineProcessor(LinkInlineProcessor): - NEWLINE_CLEANUP_RE: typing.Pattern + NEWLINE_CLEANUP_RE: ClassVar[typing.Pattern[str]] def evalId(self, data, index, text): ... def makeTag(self, href, title, text): ... diff --git a/stubs/Pillow/PIL/PdfParser.pyi b/stubs/Pillow/PIL/PdfParser.pyi index 6cf70bc63..991e506d9 100644 --- a/stubs/Pillow/PIL/PdfParser.pyi +++ b/stubs/Pillow/PIL/PdfParser.pyi @@ -47,10 +47,10 @@ class PdfName: class PdfArray(list[Any]): def __bytes__(self): ... -class PdfDict(collections.UserDict): +class PdfDict(collections.UserDict[bytes, Any]): def __setattr__(self, key, value) -> None: ... def __getattr__(self, key): ... - def __bytes__(self): ... + def __bytes__(self) -> bytes: ... class PdfBinary: data: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi index ff186142a..5bcc21b1c 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/array.pyi @@ -20,7 +20,7 @@ CONTAINED_BY: _Any OVERLAP: _Any class ARRAY(sqltypes.ARRAY): - class Comparator(sqltypes.ARRAY.Comparator): + class Comparator(sqltypes.ARRAY.Comparator[_Any]): def contains(self, other, **kwargs): ... def contained_by(self, other): ... def overlap(self, other): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi index df92db455..4206ae880 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi @@ -10,7 +10,7 @@ class HSTORE(sqltypes.Indexable, sqltypes.Concatenable, sqltypes.TypeEngine): text_type: Any def __init__(self, text_type: Any | None = ...) -> None: ... - class Comparator(sqltypes.Indexable.Comparator, sqltypes.Concatenable.Comparator): + class Comparator(sqltypes.Indexable.Comparator[Any], sqltypes.Concatenable.Comparator[Any]): def has_key(self, other): ... def has_all(self, other): ... def has_any(self, other): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi index 351463089..c31ee1b82 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/ranges.pyi @@ -3,7 +3,7 @@ from typing import Any import sqlalchemy.types as sqltypes class RangeOperators: - class comparator_factory(sqltypes.Concatenable.Comparator): + class comparator_factory(sqltypes.Concatenable.Comparator[Any]): def __ne__(self, other): ... def contains(self, other, **kw): ... def contained_by(self, other): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi index 2e3d6479c..dbf481ab5 100644 --- a/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/orm/evaluator.pyi @@ -4,7 +4,7 @@ from ..sql import operators class UnevaluatableError(Exception): ... -class _NoObject(operators.ColumnOperators): +class _NoObject(operators.ColumnOperators[Any]): def operate(self, *arg, **kw) -> None: ... def reverse_operate(self, *arg, **kw) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi index 438891aaa..93d73afe9 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/type_api.pyi @@ -75,7 +75,7 @@ class TypeDecorator(ExternalType, SchemaEventTarget, TypeEngine): def __init__(self, *args, **kwargs) -> None: ... coerce_to_is_types: Any - class Comparator(TypeEngine.Comparator): + class Comparator(TypeEngine.Comparator[Any]): def operate(self, op, *other, **kwargs): ... def reverse_operate(self, op, other, **kwargs): ... diff --git a/stubs/babel/babel/localedata.pyi b/stubs/babel/babel/localedata.pyi index eaff52cf8..c3d1ce005 100644 --- a/stubs/babel/babel/localedata.pyi +++ b/stubs/babel/babel/localedata.pyi @@ -1,4 +1,4 @@ -import collections.abc as _abc +from collections.abc import MutableMapping from typing import Any def normalize_locale(name): ... @@ -13,7 +13,7 @@ class Alias: def __init__(self, keys) -> None: ... def resolve(self, data): ... -class LocaleDataDict(_abc.MutableMapping): +class LocaleDataDict(MutableMapping[Any, Any]): base: Any def __init__(self, data, base: Any | None = ...) -> None: ... def __len__(self): ... diff --git a/stubs/humanfriendly/humanfriendly/case.pyi b/stubs/humanfriendly/humanfriendly/case.pyi index 2dc151869..57aea27e9 100644 --- a/stubs/humanfriendly/humanfriendly/case.pyi +++ b/stubs/humanfriendly/humanfriendly/case.pyi @@ -1,9 +1,12 @@ -import collections -from typing import Any +from collections import OrderedDict +from typing import Any, Generic, TypeVar from humanfriendly.compat import unicode -class CaseInsensitiveDict(collections.OrderedDict): +_KT = TypeVar("_KT") +_VT = TypeVar("_VT") + +class CaseInsensitiveDict(OrderedDict[_KT, _VT], Generic[_KT, _VT]): def __init__(self, other: Any | None = ..., **kw) -> None: ... def coerce_key(self, key): ... @classmethod