Skip to content

Commit

Permalink
paramspecdef -> paramspectype
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jan 24, 2021
1 parent 7f10b71 commit 45ee506
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mypy/applytype.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_target_type(
context: Context,
skip_unsatisfied: bool
) -> Optional[Type]:
# TODO(shantanu): fix for ParamSpecDef
# TODO(shantanu): fix for ParamSpecType
assert isinstance(tvar, TypeVarType)
values = get_proper_types(tvar.values)
if values:
Expand Down
2 changes: 1 addition & 1 deletion mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4450,7 +4450,7 @@ def merge_typevars_in_callables_by_name(
for tvdef in target.variables:
name = tvdef.fullname
if name not in unique_typevars:
# TODO(shantanu): fix for ParamSpecDef
# TODO(shantanu): fix for ParamSpecType
assert isinstance(tvdef, TypeVarType)
unique_typevars[name] = tvdef
variables.append(tvdef)
Expand Down
2 changes: 1 addition & 1 deletion mypy/expandtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def freshen_function_type_vars(callee: F) -> F:
tvdefs = []
tvmap = {} # type: Dict[TypeVarId, Type]
for v in callee.variables:
# TODO(shantanu): fix for ParamSpecDef
# TODO(shantanu): fix for ParamSpecType
assert isinstance(v, TypeVarType)
tvdef = TypeVarType.new_unification_variable(v)
tvdefs.append(tvdef)
Expand Down
4 changes: 2 additions & 2 deletions mypy/tvar_scope.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Optional, Dict, Union
from mypy.types import TypeVarLikeType, TypeVarType, ParamSpecDef
from mypy.types import TypeVarLikeType, TypeVarType, ParamSpecType
from mypy.nodes import ParamSpecExpr, TypeVarExpr, TypeVarLikeExpr, SymbolTableNode


Expand Down Expand Up @@ -74,7 +74,7 @@ def bind_new(self, name: str, tvar_expr: TypeVarLikeExpr) -> TypeVarLikeType:
column=tvar_expr.column
) # type: TypeVarLikeType
elif isinstance(tvar_expr, ParamSpecExpr):
tvar_def = ParamSpecDef(
tvar_def = ParamSpecType(
name,
tvar_expr.fullname,
i,
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CallableType, NoneType, ErasedType, DeletedType, TypeList, SyntheticTypeVisitor,
StarType, PartialType, EllipsisType, UninhabitedType, TypeType,
CallableArgument, TypeQuery, union_items, TypeOfAny, LiteralType, RawExpressionType,
PlaceholderType, Overloaded, get_proper_type, TypeAliasType, TypeVarLikeType, ParamSpecDef
PlaceholderType, Overloaded, get_proper_type, TypeAliasType, TypeVarLikeType, ParamSpecType
)

from mypy.nodes import (
Expand Down Expand Up @@ -683,7 +683,7 @@ def analyze_callable_args_for_paramspec(
if sym is None:
return None
tvar_def = self.tvar_scope.get_binding(sym)
if not isinstance(tvar_def, ParamSpecDef):
if not isinstance(tvar_def, ParamSpecType):
return None

# TODO(shantanu): construct correct type for paramspec
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeops.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def true_or_false(t: Type) -> ProperType:


def erase_def_to_union_or_bound(tdef: TypeVarLikeType) -> Type:
# TODO(shantanu): fix for ParamSpecDef
# TODO(shantanu): fix for ParamSpecType
assert isinstance(tdef, TypeVarType)
if tdef.values:
return make_simplified_union(tdef.values)
Expand Down
10 changes: 5 additions & 5 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def deserialize(cls, data: JsonDict) -> 'TypeVarType':
)


class ParamSpecDef(TypeVarLikeType):
class ParamSpecType(TypeVarLikeType):
"""Definition of a single ParamSpec variable."""

def __repr__(self) -> str:
Expand All @@ -426,16 +426,16 @@ def __repr__(self) -> str:
def serialize(self) -> JsonDict:
assert not self.id.is_meta_var()
return {
'.class': 'ParamSpecDef',
'.class': 'ParamSpecType',
'name': self.name,
'fullname': self.fullname,
'id': self.id.raw_id,
}

@classmethod
def deserialize(cls, data: JsonDict) -> 'ParamSpecDef':
assert data['.class'] == 'ParamSpecDef'
return ParamSpecDef(
def deserialize(cls, data: JsonDict) -> 'ParamSpecType':
assert data['.class'] == 'ParamSpecType'
return ParamSpecType(
data['name'],
data['fullname'],
data['id'],
Expand Down

0 comments on commit 45ee506

Please sign in to comment.