Skip to content

Commit

Permalink
Fix linter warnings (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
srittau authored Aug 30, 2021
1 parent 3ed2adb commit ec052c3
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit ec052c3

Please sign in to comment.