Fix some mypy errors.

It looks like mypy 0.560 doesn't like when a local variable changes its
type inside a function.

Fixes introduce a new variable instead of reusing an existing one.
This commit is contained in:
Jakob Stoklund Olesen
2018-01-03 12:13:13 -08:00
parent 4f53cc1dad
commit 4afa19ddff
2 changed files with 18 additions and 15 deletions

View File

@@ -290,12 +290,12 @@ class Instruction(object):
# Allow a single Operand instance instead of the awkward singleton
# tuple syntax.
if isinstance(x, Operand):
x = (x,)
y = (x,) # type: Tuple[Operand, ...]
else:
x = tuple(x)
for op in x:
y = tuple(x)
for op in y:
assert isinstance(op, Operand)
return x
return y
@staticmethod
def _to_constraint_tuple(x):
@@ -307,12 +307,12 @@ class Instruction(object):
# import placed here to avoid circular dependency
from .ti import TypeConstraint # noqa
if isinstance(x, TypeConstraint):
x = (x,)
y = (x,) # type: Tuple[TypeConstraint, ...]
else:
x = tuple(x)
for op in x:
y = tuple(x)
for op in y:
assert isinstance(op, TypeConstraint)
return x
return y
def bind(self, *args):
# type: (*ValueType) -> BoundInstruction