Fixed for mypy 0.501.

The List and Dict types are no longer implicitly available. They must be
imported from typing.

Type annotations must appear before the doc comment in a function. Also
fix type errors in these functions that weren't detected before.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-03 09:04:29 -08:00
parent 6d3ee32f7b
commit 8c5a69eb47
11 changed files with 31 additions and 14 deletions

View File

@@ -143,22 +143,22 @@ class Var(Expr):
def is_input(self):
# type: () -> bool
"""Is this an input value to the src pattern?"""
return not self.src_def and not self.dst_def
return self.src_def is None and self.dst_def is None
def is_output(self):
"""Is this an output value, defined in both src and dst patterns?"""
# type: () -> bool
return self.src_def and self.dst_def
"""Is this an output value, defined in both src and dst patterns?"""
return self.src_def is not None and self.dst_def is not None
def is_intermediate(self):
"""Is this an intermediate value, defined only in the src pattern?"""
# type: () -> bool
return self.src_def and not self.dst_def
"""Is this an intermediate value, defined only in the src pattern?"""
return self.src_def is not None and self.dst_def is None
def is_temp(self):
"""Is this a temp value, defined only in the dst pattern?"""
# type: () -> bool
return not self.src_def and self.dst_def
"""Is this a temp value, defined only in the dst pattern?"""
return self.src_def is None and self.dst_def is not None
def get_typevar(self):
# type: () -> TypeVar