Skip to content

Tighten types for parse.py and some more #2208

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 4 commits into from
Oct 2, 2016
Merged
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@
from os.path import dirname, basename

from typing import (AbstractSet, Dict, Iterable, Iterator, List,
NamedTuple, Optional, Set, Tuple, Union, Mapping)
NamedTuple, Optional, Set, Tuple, Union)

from mypy.types import Type
from mypy.nodes import (MypyFile, Node, Import, ImportFrom, ImportAll,
SymbolTableNode, MODULE_REF)
from mypy.nodes import (MypyFile, Import, ImportFrom, ImportAll)
from mypy.semanal import FirstPass, SemanticAnalyzer, ThirdPass
from mypy.checker import TypeChecker
from mypy.indirection import TypeIndirectionVisitor
from mypy.errors import Errors, CompileError, DecodeError, report_internal_error
from mypy import fixup
from mypy.report import Reports
from mypy import defaults
from mypy import moduleinfo
from mypy import util
from mypy.fixup import fixup_module_pass_one, fixup_module_pass_two
Expand Down
7 changes: 4 additions & 3 deletions mypy/exprtotype.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Translate an expression (Node) to a Type value."""
"""Translate an Expression to a Type value."""

from mypy.nodes import (
Node, NameExpr, MemberExpr, IndexExpr, TupleExpr, ListExpr, StrExpr, BytesExpr, EllipsisExpr
Expression, NameExpr, MemberExpr, IndexExpr, TupleExpr,
ListExpr, StrExpr, BytesExpr, EllipsisExpr
)
from mypy.parsetype import parse_str_as_type, TypeParseError
from mypy.types import Type, UnboundType, TypeList, EllipsisType
Expand All @@ -11,7 +12,7 @@ class TypeTranslationError(Exception):
"""Exception raised when an expression is not valid as a type."""


def expr_to_unanalyzed_type(expr: Node) -> Type:
def expr_to_unanalyzed_type(expr: Expression) -> Type:
"""Translate an expression to the corresponding type.

The result is not semantically analyzed. It can be UnboundType or TypeList.
Expand Down
6 changes: 3 additions & 3 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1762,12 +1762,12 @@ def accept(self, visitor: NodeVisitor[T]) -> T:
return visitor.visit_newtype_expr(self)


class AwaitExpr(Node):
class AwaitExpr(Expression):
"""Await expression (await ...)."""

expr = None # type: Node
expr = None # type: Expression

def __init__(self, expr: Node) -> None:
def __init__(self, expr: Expression) -> None:
self.expr = expr

def accept(self, visitor: NodeVisitor[T]) -> T:
Expand Down
Loading