Skip to content

Fix linter warnings #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2021
Merged
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
13 changes: 8 additions & 5 deletions typing_extensions/src_py3/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,8 @@ def _typeddict_new(*args, total=True, **kwargs):

class _TypedDictMeta(type):
def __init__(cls, name, bases, ns, total=True):
# In Python 3.4 and 3.5 the __init__ method also needs to support the keyword arguments.
# In Python 3.4 and 3.5 the __init__ method also needs to support the
# keyword arguments.
# See https://www.python.org/dev/peps/pep-0487/#implementation-details
super(_TypedDictMeta, cls).__init__(name, bases, ns)

Expand Down Expand Up @@ -2072,7 +2073,6 @@ class Annotated(metaclass=AnnotatedMeta):
get_origin = typing.get_origin
get_args = typing.get_args
elif PEP_560:
from typing import _GenericAlias
try:
# 3.9+
from typing import _BaseGenericAlias
Expand Down Expand Up @@ -2386,6 +2386,7 @@ def _get_type_vars(self, tvars):
if self not in tvars:
tvars.append(self)


# Inherits from list as a workaround for Callable checks in Python < 3.9.2.
class _ConcatenateGenericAlias(list):

Expand Down Expand Up @@ -2433,6 +2434,7 @@ def _get_type_vars(self, tvars):
if self.__origin__ and self.__parameters__:
typing._get_type_vars(self.__parameters__, tvars)


@_tp_cache
def _concatenate_getitem(self, parameters):
if parameters == ():
Expand Down Expand Up @@ -2473,7 +2475,8 @@ def __repr__(self):
def __getitem__(self, parameters):
return _concatenate_getitem(self, parameters)

Concatenate = _ConcatenateForm('Concatenate',
Concatenate = _ConcatenateForm(
'Concatenate',
doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
higher order function which adds, removes or transforms parameters of a
callable.
Expand Down Expand Up @@ -2616,8 +2619,8 @@ def __getitem__(self, parameters):
return _GenericAlias(self, (item,))

TypeGuard = _TypeGuardForm(
'TypeGuard',
doc="""Special typing form used to annotate the return type of a user-defined
'TypeGuard',
doc="""Special typing form used to annotate the return type of a user-defined
type guard function. ``TypeGuard`` only accepts a single type argument.
At runtime, functions marked this way should return a boolean.

Expand Down