after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def _load_json_file(
file: str, manager: BuildManager, log_sucess: str, log_error: str
) -> Optional[Dict[str, Any]]:
"""A simple helper to read a JSON file with logging."""
try:
data = manager.metastore.read(file)
except IOError:
manager.log(log_error + file)
return None
man... | def _load_json_file(
file: str, manager: BuildManager, log_sucess: str, log_error: str
) -> Optional[Dict[str, Any]]:
"""A simple helper to read a JSON file with logging."""
try:
data = manager.metastore.read(file)
except IOError:
manager.log(log_error + file)
return None
man... | https://github.com/python/mypy/issues/6156 | Traceback (most recent call last):
File "/usr/local/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/usr/local/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/usr/local/lib/python3.7/site-packages/mypy/main.py", line 92, in main
res = build.build(sources, option... | json.decoder.JSONDecodeError |
def __init__(self, items: List["OverloadPart"]) -> None:
super().__init__()
self.items = items
self.unanalyzed_items = items.copy()
self.impl = None
if len(items) > 0:
self.set_line(items[0].line)
self.is_final = False
| def __init__(self, items: List["OverloadPart"]) -> None:
super().__init__()
assert len(items) > 0
self.items = items
self.unanalyzed_items = items.copy()
self.impl = None
self.set_line(items[0].line)
self.is_final = False
| https://github.com/python/mypy/issues/6108 | Traceback (most recent call last):
File "/home/andrew/.virtualenvs/platform-api-clients/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/home/andrew/.virtualenvs/platfo... | AssertionError |
def deserialize(cls, data: JsonDict) -> "OverloadedFuncDef":
assert data[".class"] == "OverloadedFuncDef"
res = OverloadedFuncDef(
[cast(OverloadPart, SymbolNode.deserialize(d)) for d in data["items"]]
)
if data.get("impl") is not None:
res.impl = cast(OverloadPart, SymbolNode.deserializ... | def deserialize(cls, data: JsonDict) -> "OverloadedFuncDef":
assert data[".class"] == "OverloadedFuncDef"
res = OverloadedFuncDef(
[cast(OverloadPart, SymbolNode.deserialize(d)) for d in data["items"]]
)
if data.get("impl") is not None:
res.impl = cast(OverloadPart, SymbolNode.deserializ... | https://github.com/python/mypy/issues/6108 | Traceback (most recent call last):
File "/home/andrew/.virtualenvs/platform-api-clients/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/home/andrew/.virtualenvs/platform-api-clients/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/home/andrew/.virtualenvs/platfo... | AssertionError |
def array_value_callback(ctx: "mypy.plugin.AttributeContext") -> Type:
"""Callback to provide an accurate type for ctypes.Array.value."""
et = _get_array_element_type(ctx.type)
if et is not None:
types = [] # type: List[Type]
for tp in union_items(et):
if isinstance(tp, AnyType)... | def array_value_callback(ctx: "mypy.plugin.AttributeContext") -> Type:
"""Callback to provide an accurate type for ctypes.Array.value."""
et = _get_array_element_type(ctx.type)
if et is not None:
types = [] # type: List[Type]
for tp in union_items(et):
if isinstance(tp, AnyType)... | https://github.com/python/mypy/issues/5922 | Traceback (most recent call last):
File "C:\Python36\Scripts\mypy-script.py", line 11, in <module>
load_entry_point('mypy==0.650+dev.3ad628d797defcbd892dede48151c8e390f45258', 'console_scripts', 'mypy')()
File "c:\python36\lib\site-packages\mypy\__main__.py", line 7, in console_entry
main(None)
File "c:\python36\lib\si... | AssertionError |
def array_raw_callback(ctx: "mypy.plugin.AttributeContext") -> Type:
"""Callback to provide an accurate type for ctypes.Array.raw."""
et = _get_array_element_type(ctx.type)
if et is not None:
types = [] # type: List[Type]
for tp in union_items(et):
if (
isinstanc... | def array_raw_callback(ctx: "mypy.plugin.AttributeContext") -> Type:
"""Callback to provide an accurate type for ctypes.Array.raw."""
et = _get_array_element_type(ctx.type)
if et is not None:
types = [] # type: List[Type]
for tp in union_items(et):
if (
isinstanc... | https://github.com/python/mypy/issues/5922 | Traceback (most recent call last):
File "C:\Python36\Scripts\mypy-script.py", line 11, in <module>
load_entry_point('mypy==0.650+dev.3ad628d797defcbd892dede48151c8e390f45258', 'console_scripts', 'mypy')()
File "c:\python36\lib\site-packages\mypy\__main__.py", line 7, in console_entry
main(None)
File "c:\python36\lib\si... | AssertionError |
def visit_call_expr(self, expr: CallExpr) -> None:
"""Analyze a call expression.
Some call expressions are recognized as special forms, including
cast(...).
"""
if expr.analyzed:
return
expr.callee.accept(self)
if refers_to_fullname(expr.callee, "typing.cast"):
# Special for... | def visit_call_expr(self, expr: CallExpr) -> None:
"""Analyze a call expression.
Some call expressions are recognized as special forms, including
cast(...).
"""
if expr.analyzed:
return
expr.callee.accept(self)
if refers_to_fullname(expr.callee, "typing.cast"):
# Special for... | https://github.com/python/mypy/issues/5915 | Traceback (most recent call last):
File ".../bin/mypy", line 11, in <module>
sys.exit(console_entry())
File ".../lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File ".../lib/python3.6/site-packages/mypy/main.py", line 92, in main
res = build.build(sources, options, None, flush_errors... | AttributeError |
def visit_member_expr(self, expr: MemberExpr) -> None:
base = expr.expr
base.accept(self)
# Bind references to module attributes.
if isinstance(base, RefExpr) and base.kind == MODULE_REF:
# This branch handles the case foo.bar where foo is a module.
# In this case base.node is the module... | def visit_member_expr(self, expr: MemberExpr) -> None:
base = expr.expr
base.accept(self)
# Bind references to module attributes.
if isinstance(base, RefExpr) and base.kind == MODULE_REF:
# This branch handles the case foo.bar where foo is a module.
# In this case base.node is the module... | https://github.com/python/mypy/issues/5866 | sphinx/util/docutils.py:61: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.641
Traceback (most recent call last):
File "/Users/tkomiya/.pyenv/versions/3.7.1/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/tkomiya/.pyenv/versions/3.7.1/lib/python3.... | AssertionError |
def main() -> None:
# Make sure that the current directory is in sys.path so that
# stubgen can be run on packages in the current directory.
if "" not in sys.path:
sys.path.insert(0, "")
options = parse_options(sys.argv[1:])
if not os.path.isdir(options.output_dir):
raise SystemExit... | def main() -> None:
options = parse_options(sys.argv[1:])
if not os.path.isdir(options.output_dir):
raise SystemExit('Directory "{}" does not exist'.format(options.output_dir))
if options.recursive and options.no_import:
raise SystemExit(
"recursive stub generation without import... | https://github.com/python/mypy/issues/4571 | test>pip install git+https://github.com/python/mypy
test>tree /f
Folder PATH listing
C:.
└───pkg
test.py
__init__.py
test>stubgen pkg
Traceback (most recent call last):
File "c:\python36\lib\site-packages\mypy\stubgen.py", line 150, in find_module_path_and_all
mod = importlib.import_module(module)
File "c:\python36\lib... | ModuleNotFoundError |
def check_second_pass(
self, todo: Optional[Sequence[Union[DeferredNode, FineGrainedDeferredNode]]] = None
) -> bool:
"""Run second or following pass of type checking.
This goes through deferred nodes, returning True if there were any.
"""
self.recurse_into_functions = True
with experiments.str... | def check_second_pass(self, todo: Optional[List[DeferredNode]] = None) -> bool:
"""Run second or following pass of type checking.
This goes through deferred nodes, returning True if there were any.
"""
self.recurse_into_functions = True
with experiments.strict_optional_set(self.options.strict_optio... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def check_partial(
self, node: Union[DeferredNodeType, FineGrainedDeferredNodeType]
) -> None:
if isinstance(node, MypyFile):
self.check_top_level(node)
else:
self.recurse_into_functions = True
if isinstance(node, LambdaExpr):
self.expr_checker.accept(node)
else:
... | def check_partial(
self, node: Union[FuncDef, LambdaExpr, MypyFile, OverloadedFuncDef]
) -> None:
if isinstance(node, MypyFile):
self.check_top_level(node)
else:
self.recurse_into_functions = True
if isinstance(node, LambdaExpr):
self.expr_checker.accept(node)
els... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def handle_cannot_determine_type(self, name: str, context: Context) -> None:
node = self.scope.top_non_lambda_function()
if self.pass_num < self.last_pass and isinstance(node, FuncDef):
# Don't report an error yet. Just defer. Note that we don't defer
# lambdas because they are coupled to the su... | def handle_cannot_determine_type(self, name: str, context: Context) -> None:
node = self.scope.top_non_lambda_function()
if self.pass_num < self.last_pass and isinstance(node, FuncDef):
# Don't report an error yet. Just defer. Note that we don't defer
# lambdas because they are coupled to the su... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def check_method_override(
self, defn: Union[FuncDef, OverloadedFuncDef, Decorator]
) -> None:
"""Check if function definition is compatible with base classes.
This may defer the method if a signature is not available in at least one base class.
"""
# Check against definitions in base classes.
... | def check_method_override(self, defn: Union[FuncBase, Decorator]) -> None:
"""Check if function definition is compatible with base classes."""
# Check against definitions in base classes.
for base in defn.info.mro[1:]:
self.check_method_or_accessor_override_for_base(defn, base)
| https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def check_method_or_accessor_override_for_base(
self, defn: Union[FuncDef, OverloadedFuncDef, Decorator], base: TypeInfo
) -> bool:
"""Check if method definition is compatible with a base class.
Return True if the node was deferred because one of the corresponding
superclass nodes is not ready.
"""... | def check_method_or_accessor_override_for_base(
self, defn: Union[FuncBase, Decorator], base: TypeInfo
) -> None:
"""Check if method definition is compatible with a base class."""
if base:
name = defn.name()
base_attr = base.names.get(name)
if base_attr:
# First, check if... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def check_method_override_for_base_with_name(
self, defn: Union[FuncDef, OverloadedFuncDef, Decorator], name: str, base: TypeInfo
) -> bool:
"""Check if overriding an attribute `name` of `base` with `defn` is valid.
Return True if the supertype node was not analysed yet, and `defn` was deferred.
"""
... | def check_method_override_for_base_with_name(
self, defn: Union[FuncBase, Decorator], name: str, base: TypeInfo
) -> None:
base_attr = base.names.get(name)
if base_attr:
# The name of the method is defined in the base class.
# Point errors at the 'def' line (important for backward compatibi... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def refresh_partial(
self,
node: Union[MypyFile, FuncDef, OverloadedFuncDef],
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
"""Refresh a stale target in fine-grained incremental mode."""
self.patches = patches
if isinstance(node, MypyFile):
self.refresh_top_level(node)
el... | def refresh_partial(
self,
node: Union[MypyFile, FuncItem, OverloadedFuncDef],
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
"""Refresh a stale target in fine-grained incremental mode."""
self.patches = patches
if isinstance(node, MypyFile):
self.refresh_top_level(node)
e... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def refresh_partial(
self,
node: Union[MypyFile, FuncDef, OverloadedFuncDef],
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
"""Refresh a stale target in fine-grained incremental mode."""
self.options = self.sem.options
self.patches = patches
if isinstance(node, MypyFile):
... | def refresh_partial(
self,
node: Union[MypyFile, FuncItem, OverloadedFuncDef],
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
"""Refresh a stale target in fine-grained incremental mode."""
self.options = self.sem.options
self.patches = patches
if isinstance(node, MypyFile):
... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def strip_target(node: Union[MypyFile, FuncDef, OverloadedFuncDef]) -> None:
"""Reset a fine-grained incremental target to state after semantic analysis pass 1.
NOTE: Currently we opportunistically only reset changes that are known to otherwise
cause trouble.
"""
visitor = NodeStripVisitor()
... | def strip_target(node: Union[MypyFile, FuncItem, OverloadedFuncDef]) -> None:
"""Reset a fine-grained incremental target to state after semantic analysis pass 1.
NOTE: Currently we opportunistically only reset changes that are known to otherwise
cause trouble.
"""
visitor = NodeStripVisitor()
... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def find_targets_recursive(
manager: BuildManager,
graph: Graph,
triggers: Set[str],
deps: Dict[str, Set[str]],
up_to_date_modules: Set[str],
) -> Tuple[Dict[str, Set[FineGrainedDeferredNode]], Set[str], Set[TypeInfo]]:
"""Find names of all targets that need to reprocessed, given some triggers.
... | def find_targets_recursive(
manager: BuildManager,
graph: Graph,
triggers: Set[str],
deps: Dict[str, Set[str]],
up_to_date_modules: Set[str],
) -> Tuple[Dict[str, Set[DeferredNode]], Set[str], Set[TypeInfo]]:
"""Find names of all targets that need to reprocessed, given some triggers.
Return... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def reprocess_nodes(
manager: BuildManager,
graph: Dict[str, State],
module_id: str,
nodeset: Set[FineGrainedDeferredNode],
deps: Dict[str, Set[str]],
) -> Set[str]:
"""Reprocess a set of nodes within a single module.
Return fired triggers.
"""
if module_id not in graph:
man... | def reprocess_nodes(
manager: BuildManager,
graph: Dict[str, State],
module_id: str,
nodeset: Set[DeferredNode],
deps: Dict[str, Set[str]],
) -> Set[str]:
"""Reprocess a set of nodes within a single module.
Return fired triggers.
"""
if module_id not in graph:
manager.log_fi... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def key(node: FineGrainedDeferredNode) -> int:
# Unlike modules which are sorted by name within SCC,
# nodes within the same module are sorted by line number, because
# this is how they are processed in normal mode.
return node.node.line
| def key(node: DeferredNode) -> int:
# Unlike modules which are sorted by name within SCC,
# nodes within the same module are sorted by line number, because
# this is how they are processed in normal mode.
return node.node.line
| https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def update_deps(
module_id: str,
nodes: List[FineGrainedDeferredNode],
graph: Dict[str, State],
deps: Dict[str, Set[str]],
options: Options,
) -> None:
for deferred in nodes:
node = deferred.node
type_map = graph[module_id].type_map()
tree = graph[module_id].tree
... | def update_deps(
module_id: str,
nodes: List[DeferredNode],
graph: Dict[str, State],
deps: Dict[str, Set[str]],
options: Options,
) -> None:
for deferred in nodes:
node = deferred.node
type_map = graph[module_id].type_map()
tree = graph[module_id].tree
assert tree... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def lookup_target(
manager: BuildManager, target: str
) -> Tuple[List[FineGrainedDeferredNode], Optional[TypeInfo]]:
"""Look up a target by fully-qualified name.
The first item in the return tuple is a list of deferred nodes that
needs to be reprocessed. If the target represents a TypeInfo correspondin... | def lookup_target(
manager: BuildManager, target: str
) -> Tuple[List[DeferredNode], Optional[TypeInfo]]:
"""Look up a target by fully-qualified name.
The first item in the return tuple is a list of deferred nodes that
needs to be reprocessed. If the target represents a TypeInfo corresponding
to a ... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def target_from_node(
module: str, node: Union[FuncDef, MypyFile, OverloadedFuncDef]
) -> Optional[str]:
"""Return the target name corresponding to a deferred node.
Args:
module: Must be module id of the module that defines 'node'
Returns the target name, or None if the node is not a valid tar... | def target_from_node(
module: str, node: Union[FuncDef, MypyFile, OverloadedFuncDef, LambdaExpr]
) -> Optional[str]:
"""Return the target name corresponding to a deferred node.
Args:
module: Must be module id of the module that defines 'node'
Returns the target name, or None if the node is not... | https://github.com/python/mypy/issues/5560 | pymc3/model.py:672: error: Decorated property not supported
pymc3/variational/opvi.py:1556: error: Decorated property not supported
pymc3/variational/flows.py:193: error: Decorated property not supported
pymc3/__init__.py:25: error: Name 'utils' already defined (by an import)
pymc3/data.py:226: error: Need type annotat... | AssertionError |
def visit_class_def(self, tdef: ClassDef) -> None:
# NamedTuple base classes are validated in check_namedtuple_classdef; we don't have to
# check them again here.
self.scope.enter_class(tdef.info)
if not tdef.info.is_named_tuple:
types = list(tdef.info.bases) # type: List[Type]
for tvar... | def visit_class_def(self, tdef: ClassDef) -> None:
# NamedTuple base classes are validated in check_namedtuple_classdef; we don't have to
# check them again here.
self.scope.enter_class(tdef.info)
if not tdef.info.is_named_tuple:
types = list(tdef.info.bases) # type: List[Type]
for tvar... | https://github.com/python/mypy/issues/5195 | typetest.py:5: error: Recursive types not fully supported yet, nested types replaced with "Any"
typetest.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__mai... | TypeError |
def perform_transform(self, node: Node, transform: Callable[[Type], Type]) -> None:
"""Apply transform to all types associated with node."""
if isinstance(node, ForStmt):
if node.index_type:
node.index_type = transform(node.index_type)
self.transform_types_in_lvalue(node.index, trans... | def perform_transform(self, node: Node, transform: Callable[[Type], Type]) -> None:
"""Apply transform to all types associated with node."""
if isinstance(node, ForStmt):
if node.index_type:
node.index_type = transform(node.index_type)
self.transform_types_in_lvalue(node.index, trans... | https://github.com/python/mypy/issues/5195 | typetest.py:5: error: Recursive types not fully supported yet, nested types replaced with "Any"
typetest.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__mai... | TypeError |
def visit_instance(self, t: Instance, from_fallback: bool = False) -> Type:
"""This visitor method tracks situations like this:
x: A # When analyzing this type we will get an Instance from SemanticAnalyzerPass1.
# Now we need to update this to actual analyzed TupleType.
clas... | def visit_instance(self, t: Instance, from_fallback: bool = False) -> Type:
"""This visitor method tracks situations like this:
x: A # When analyzing this type we will get an Instance from SemanticAnalyzerPass1.
# Now we need to update this to actual analyzed TupleType.
clas... | https://github.com/python/mypy/issues/5195 | typetest.py:5: error: Recursive types not fully supported yet, nested types replaced with "Any"
typetest.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__mai... | TypeError |
def infer_lambda_type_using_context(
self, e: LambdaExpr
) -> Tuple[Optional[CallableType], Optional[CallableType]]:
"""Try to infer lambda expression type using context.
Return None if could not infer type.
The second item in the return type is the type_override parameter for check_func_item.
"""
... | def infer_lambda_type_using_context(
self, e: LambdaExpr
) -> Tuple[Optional[CallableType], Optional[CallableType]]:
"""Try to infer lambda expression type using context.
Return None if could not infer type.
The second item in the return type is the type_override parameter for check_func_item.
"""
... | https://github.com/python/mypy/issues/4599 | Traceback (most recent call last):
File "[somewhere]/mypy/main.py", line 80, in main
type_check_only(sources, bin_dir, options, flush_errors)
File "[somewhere]/mypy/main.py", line 129, in type_check_only
flush_errors=flush_errors)
File "[somewhere]/mypy/build.py", line 172, in build
result = _build(sources, options, al... | IndexError |
def replace_implicit_first_type(sig: FunctionLike, new: Type) -> FunctionLike:
if isinstance(sig, CallableType):
if len(sig.arg_types) == 0:
return sig
return sig.copy_modified(arg_types=[new] + sig.arg_types[1:])
elif isinstance(sig, Overloaded):
return Overloaded(
... | def replace_implicit_first_type(sig: FunctionLike, new: Type) -> FunctionLike:
if isinstance(sig, CallableType):
return sig.copy_modified(arg_types=[new] + sig.arg_types[1:])
elif isinstance(sig, Overloaded):
return Overloaded(
[
cast(CallableType, replace_implicit_fi... | https://github.com/python/mypy/issues/4599 | Traceback (most recent call last):
File "[somewhere]/mypy/main.py", line 80, in main
type_check_only(sources, bin_dir, options, flush_errors)
File "[somewhere]/mypy/main.py", line 129, in type_check_only
flush_errors=flush_errors)
File "[somewhere]/mypy/build.py", line 172, in build
result = _build(sources, options, al... | IndexError |
def __init__(
self,
arg_types: List[Type],
arg_kinds: List[int],
arg_names: Sequence[Optional[str]],
ret_type: Type,
fallback: Instance,
name: Optional[str] = None,
definition: Optional[SymbolNode] = None,
variables: Optional[List[TypeVarDef]] = None,
line: int = -1,
column: ... | def __init__(
self,
arg_types: List[Type],
arg_kinds: List[int],
arg_names: Sequence[Optional[str]],
ret_type: Type,
fallback: Instance,
name: Optional[str] = None,
definition: Optional[SymbolNode] = None,
variables: Optional[List[TypeVarDef]] = None,
line: int = -1,
column: ... | https://github.com/python/mypy/issues/4599 | Traceback (most recent call last):
File "[somewhere]/mypy/main.py", line 80, in main
type_check_only(sources, bin_dir, options, flush_errors)
File "[somewhere]/mypy/main.py", line 129, in type_check_only
flush_errors=flush_errors)
File "[somewhere]/mypy/build.py", line 172, in build
result = _build(sources, options, al... | IndexError |
def _visit_func_def(self, defn: FuncDef) -> None:
phase_info = self.postpone_nested_functions_stack[-1]
if phase_info != FUNCTION_SECOND_PHASE:
self.function_stack.append(defn)
# First phase of analysis for function.
if not defn._fullname:
defn._fullname = self.qualified_name... | def _visit_func_def(self, defn: FuncDef) -> None:
phase_info = self.postpone_nested_functions_stack[-1]
if phase_info != FUNCTION_SECOND_PHASE:
self.function_stack.append(defn)
# First phase of analysis for function.
if not defn._fullname:
defn._fullname = self.qualified_name... | https://github.com/python/mypy/issues/5534 | Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
ex... | AssertionError |
def add_symbol(self, name: str, node: SymbolTableNode, context: Context) -> None:
# NOTE: This logic mostly parallels SemanticAnalyzerPass1.add_symbol. If you change
# this, you may have to change the other method as well.
# TODO: Combine these methods in the first and second pass into a single one.
... | def add_symbol(self, name: str, node: SymbolTableNode, context: Context) -> None:
# NOTE: This logic mostly parallels SemanticAnalyzerPass1.add_symbol. If you change
# this, you may have to change the other method as well.
if self.is_func_scope():
assert self.locals[-1] is not None
if na... | https://github.com/python/mypy/issues/5534 | Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
ex... | AssertionError |
def add_local(self, node: Union[Var, FuncDef, OverloadedFuncDef], ctx: Context) -> None:
assert self.locals[-1] is not None, "Should not add locals outside a function"
name = node.name()
if name in self.locals[-1]:
self.name_already_defined(name, ctx, self.locals[-1][name])
return
node._... | def add_local(self, node: Union[Var, FuncDef, OverloadedFuncDef], ctx: Context) -> None:
assert self.locals[-1] is not None, "Should not add locals outside a function"
name = node.name()
if name in self.locals[-1]:
self.name_already_defined(name, ctx, self.locals[-1][name])
node._fullname = name... | https://github.com/python/mypy/issues/5534 | Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
ex... | AssertionError |
def add_symbol(self, name: str, node: SymbolTableNode, context: Context) -> None:
# NOTE: This is closely related to SemanticAnalyzerPass2.add_symbol. Since both methods
# will be called on top-level definitions, they need to co-operate. If you change
# this, you may have to change the other method ... | def add_symbol(self, name: str, node: SymbolTableNode, context: Context) -> None:
# NOTE: This is closely related to SemanticAnalyzerPass2.add_symbol. Since both methods
# will be called on top-level definitions, they need to co-operate. If you change
# this, you may have to change the other method ... | https://github.com/python/mypy/issues/5534 | Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
ex... | AssertionError |
def _build(
sources: List[BuildSource],
options: Options,
alt_lib_path: Optional[str],
bin_dir: Optional[str],
flush_errors: Callable[[List[str], bool], None],
fscache: Optional[FileSystemCache],
) -> BuildResult:
# This seems the most reasonable place to tune garbage collection.
gc.set_... | def _build(
sources: List[BuildSource],
options: Options,
alt_lib_path: Optional[str],
bin_dir: Optional[str],
flush_errors: Callable[[List[str], bool], None],
fscache: Optional[FileSystemCache],
) -> BuildResult:
# This seems the most reasonable place to tune garbage collection.
gc.set_... | https://github.com/python/mypy/issues/5319 | ./contrib/sacrebleu/sacrebleu.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/... | AssertionError |
def default_data_dir() -> str:
"""Returns directory containing typeshed directory."""
return os.path.dirname(__file__)
| def default_data_dir(bin_dir: Optional[str]) -> str:
"""Returns directory containing typeshed directory
Args:
bin_dir: directory containing the mypy script
"""
if not bin_dir:
if os.name == "nt":
prefixes = [os.path.join(sys.prefix, "Lib")]
try:
pre... | https://github.com/python/mypy/issues/5319 | ./contrib/sacrebleu/sacrebleu.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/... | AssertionError |
def __init__(self, strategy: Callable[[Iterable[T]], T]) -> None:
self.strategy = strategy
self.seen = [] # type: List[Type]
| def __init__(self, strategy: Callable[[Iterable[T]], T]) -> None:
self.strategy = strategy
| https://github.com/python/mypy/issues/4780 | Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/mypy", line 11, in <module>
load_entry_point('mypy===0.580-dev-51b4e0cb3726d03e2d17c8a0de4d56110e30c5e5', 'console_scripts', 'mypy')()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-package... | flush_error |
def query_types(self, types: Iterable[Type]) -> T:
"""Perform a query for a list of types.
Use the strategy to combine the results.
Skip types already visited types to avoid infinite recursion.
Note: types can be recursive until they are fully analyzed and "unentangled"
in patches after the semanti... | def query_types(self, types: Iterable[Type]) -> T:
"""Perform a query for a list of types.
Use the strategy to combine the results.
"""
return self.strategy(t.accept(self) for t in types)
| https://github.com/python/mypy/issues/4780 | Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/mypy", line 11, in <module>
load_entry_point('mypy===0.580-dev-51b4e0cb3726d03e2d17c8a0de4d56110e30c5e5', 'console_scripts', 'mypy')()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-package... | flush_error |
def visit_instance(self, t: Instance) -> Type:
info = t.type
for (i, arg), tvar in zip(enumerate(t.args), info.defn.type_vars):
if tvar.values:
if isinstance(arg, TypeVarType):
arg_values = arg.values
if not arg_values:
self.fail(
... | def visit_instance(self, t: Instance) -> Type:
info = t.type
for (i, arg), tvar in zip(enumerate(t.args), info.defn.type_vars):
if tvar.values:
if isinstance(arg, TypeVarType):
arg_values = arg.values
if not arg_values:
self.fail(
... | https://github.com/python/mypy/issues/4649 | .\break_mypy.py:22: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_glob... | IndexError |
def visit_instance(self, t: Instance) -> None:
info = t.type
if info.replaced or info.tuple_type:
self.indicator["synthetic"] = True
# Check type argument count.
if len(t.args) != len(info.type_vars):
fix_instance(t, self.fail)
elif info.defn.type_vars:
# Check type argument ... | def visit_instance(self, t: Instance) -> None:
info = t.type
if info.replaced or info.tuple_type:
self.indicator["synthetic"] = True
# Check type argument count.
if len(t.args) != len(info.type_vars):
if len(t.args) == 0:
any_type = AnyType(
TypeOfAny.from_omi... | https://github.com/python/mypy/issues/4649 | .\break_mypy.py:22: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_glob... | IndexError |
def visit_forwardref_type(self, t: ForwardRef) -> None:
self.indicator["forward"] = True
if t.resolved is None:
resolved = self.anal_type(t.unbound)
t.resolve(resolved)
assert t.resolved is not None
t.resolved.accept(self)
| def visit_forwardref_type(self, t: ForwardRef) -> None:
self.indicator["forward"] = True
if t.resolved is None:
resolved = self.anal_type(t.unbound)
t.resolve(resolved)
| https://github.com/python/mypy/issues/4649 | .\break_mypy.py:22: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_glob... | IndexError |
def check_namedtuple(
self, node: Expression, var_name: Optional[str], is_func_scope: bool
) -> Optional[TypeInfo]:
"""Check if a call defines a namedtuple.
The optional var_name argument is the name of the variable to
which this is assigned, if any.
If it does, return the corresponding TypeInfo. ... | def check_namedtuple(
self, node: Expression, var_name: Optional[str], is_func_scope: bool
) -> Optional[TypeInfo]:
"""Check if a call defines a namedtuple.
The optional var_name argument is the name of the variable to
which this is assigned, if any.
If it does, return the corresponding TypeInfo. ... | https://github.com/python/mypy/issues/4287 | Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user/src/server/.mypy/venv/lib/python3.5/site-packages/mypy/__main__.py", line 11, in <module>
main(... | AssertionError |
def __init__(self, items: List["OverloadPart"]) -> None:
super().__init__()
assert len(items) > 0
self.items = items
self.unanalyzed_items = items.copy()
self.impl = None
self.set_line(items[0].line)
| def __init__(self, items: List["OverloadPart"]) -> None:
super().__init__()
assert len(items) > 0
self.items = items
self.impl = None
self.set_line(items[0].line)
| https://github.com/python/mypy/issues/5181 | ..\probes\test.py:3: error: Name 'TypeVar' is not defined
..\probes\test.py:12: error: Name 'bar' already defined on line 8
..\probes\test.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610+dev-89c73ed2462e18d217bbd73be09d5085ff7f2632
Traceback (most recent call l... | IndexError |
def name(self) -> str:
if self.items:
return self.items[0].name()
else:
# This may happen for malformed overload
assert self.impl is not None
return self.impl.name()
| def name(self) -> str:
return self.items[0].name()
| https://github.com/python/mypy/issues/5181 | ..\probes\test.py:3: error: Name 'TypeVar' is not defined
..\probes\test.py:12: error: Name 'bar' already defined on line 8
..\probes\test.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610+dev-89c73ed2462e18d217bbd73be09d5085ff7f2632
Traceback (most recent call l... | IndexError |
def _visit_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
# Decid... | def _visit_overloaded_func_def(self, defn: OverloadedFuncDef) -> None:
# OverloadedFuncDef refers to any legitimate situation where you have
# more than one declaration for the same function in a row. This occurs
# with a @property with a setter or a deleter, and for a classic
# @overload.
# Decid... | https://github.com/python/mypy/issues/5181 | ..\probes\test.py:3: error: Name 'TypeVar' is not defined
..\probes\test.py:12: error: Name 'bar' already defined on line 8
..\probes\test.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610+dev-89c73ed2462e18d217bbd73be09d5085ff7f2632
Traceback (most recent call l... | IndexError |
def visit_overloaded_func_def(self, node: OverloadedFuncDef) -> None:
if not self.recurse_into_functions:
return
# Revert change made during semantic analysis pass 2.
node.items = node.unanalyzed_items.copy()
super().visit_overloaded_func_def(node)
| def visit_overloaded_func_def(self, node: OverloadedFuncDef) -> None:
if not self.recurse_into_functions:
return
if node.impl:
# Revert change made during semantic analysis pass 2.
assert node.items[-1] is not node.impl
node.items.append(node.impl)
super().visit_overloaded_fu... | https://github.com/python/mypy/issues/5181 | ..\probes\test.py:3: error: Name 'TypeVar' is not defined
..\probes\test.py:12: error: Name 'bar' already defined on line 8
..\probes\test.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610+dev-89c73ed2462e18d217bbd73be09d5085ff7f2632
Traceback (most recent call l... | IndexError |
def check_reverse_op_method(
self,
defn: FuncItem,
reverse_type: CallableType,
reverse_name: str,
context: Context,
) -> None:
"""Check a reverse operator method such as __radd__."""
# Decides whether it's worth calling check_overlapping_op_methods().
# This used to check for some very ... | def check_reverse_op_method(
self,
defn: FuncItem,
reverse_type: CallableType,
reverse_name: str,
context: Context,
) -> None:
"""Check a reverse operator method such as __radd__."""
# Decides whether it's worth calling check_overlapping_op_methods().
# This used to check for some very ... | https://github.com/python/mypy/issues/5337 | test_radd.py:2: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610
Traceback (most recent call last):
...
...
File "/Users/sidharthkapur/.local/share/virtualenvs/mypy-test-VQzn8vfh/lib/python3.7/site-packages/mypy/checker.py", line 957, in check_reverse_op_method
assert... | AssertionError |
def visit_unbound_type(self, t: UnboundType) -> Type:
# TODO: replace with an assert after UnboundType can't leak from semantic analysis.
return AnyType(TypeOfAny.from_error)
| def visit_unbound_type(self, t: UnboundType) -> Type:
assert False, "Not supported"
| https://github.com/python/mypy/issues/4543 | tmp.py:3: error: Invalid type "tmp.Bad"
tmp.py:13: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.570-dev-d2c04190b8d407476c535f30d07a9f6712e7b12a-dirty
Traceback (most recent call last):
File "/Users/ilevkivskyi/mypy/bin/mypy", line 11, in <module>
load_entry_point('my... | AssertionError |
def check_for_missing_annotations(self, fdef: FuncItem) -> None:
# Check for functions with unspecified/not fully specified types.
def is_unannotated_any(t: Type) -> bool:
return isinstance(t, AnyType) and t.type_of_any == TypeOfAny.unannotated
has_explicit_annotation = isinstance(fdef.type, Callab... | def check_for_missing_annotations(self, fdef: FuncItem) -> None:
# Check for functions with unspecified/not fully specified types.
def is_unannotated_any(t: Type) -> bool:
return isinstance(t, AnyType) and t.type_of_any == TypeOfAny.unannotated
has_explicit_annotation = isinstance(fdef.type, Callab... | https://github.com/python/mypy/issues/5122 | $ mypy --show-traceback --disallow-untyped-defs bin/asyncg.py
bin/asyncg.py:4: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.610+dev-c29210ea2f79f4017ec68435b5674d56e87c5105
Traceback (most recent call last):
File "/Users/jzijlstra-mpbt/py/venvs/venv36/bin/mypy", line ... | IndexError |
def visit_func_def(self, defn: FuncDef) -> None:
start_line = defn.get_line() - 1
start_indent = None
# When a function is decorated, sometimes the start line will point to
# whitespace or comments between the decorator and the function, so
# we have to look for the start.
while start_line < len... | def visit_func_def(self, defn: FuncDef) -> None:
start_line = defn.get_line() - 1
start_indent = self.indentation_level(start_line)
cur_line = start_line + 1
end_line = cur_line
# After this loop, function body will be lines [start_line, end_line)
while cur_line < len(self.source):
cur_i... | https://github.com/python/mypy/issues/4563 | zerver/templatetags/app_filters.py: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.560
Traceback (most recent call last):
File "/srv/zulip-py3-venv/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File ".../site-packages/mypy/__main__.py", line 7, in console_en... | AssertionError |
def attr_class_maker_callback(
ctx: "mypy.plugin.ClassDefContext", auto_attribs_default: bool = False
) -> None:
"""Add necessary dunder methods to classes decorated with attr.s.
attrs is a package that lets you define classes without writing dull boilerplate code.
At a quick glance, the decorator sea... | def attr_class_maker_callback(
ctx: "mypy.plugin.ClassDefContext", auto_attribs_default: bool = False
) -> None:
"""Add necessary dunder methods to classes decorated with attr.s.
attrs is a package that lets you define classes without writing dull boilerplate code.
At a quick glance, the decorator sea... | https://github.com/python/mypy/issues/4655 | thing = B(foo=1, bar='hi', baz='bye')
thing.foo = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jliu/Projects/lyft/coupons/venv/lib/python3.6/site-packages/attr/_make.py", line 351, in _frozen_setattrs
raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError | FrozenInstanceError |
def _analyze_class(
ctx: "mypy.plugin.ClassDefContext", auto_attribs: bool
) -> List[Attribute]:
"""Analyze the class body of an attr maker, its parents, and return the Attributes found."""
own_attrs = OrderedDict() # type: OrderedDict[str, Attribute]
# Walk the body looking for assignments and decorat... | def _analyze_class(
ctx: "mypy.plugin.ClassDefContext", auto_attribs: bool
) -> List[Attribute]:
"""Analyze the class body of an attr maker, its parents, and return the Attributes found."""
own_attrs = OrderedDict() # type: OrderedDict[str, Attribute]
# Walk the body looking for assignments and decorat... | https://github.com/python/mypy/issues/4655 | thing = B(foo=1, bar='hi', baz='bye')
thing.foo = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jliu/Projects/lyft/coupons/venv/lib/python3.6/site-packages/attr/_make.py", line 351, in _frozen_setattrs
raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError | FrozenInstanceError |
def _make_frozen(
ctx: "mypy.plugin.ClassDefContext", attributes: List[Attribute]
) -> None:
"""Turn all the attributes into properties to simulate frozen classes."""
for attribute in attributes:
if attribute.name in ctx.cls.info.names:
# This variable belongs to this class so we can mod... | def _make_frozen(
ctx: "mypy.plugin.ClassDefContext", attributes: List[Attribute]
) -> None:
"""Turn all the attributes into properties to simulate frozen classes."""
# TODO: Handle subclasses of frozen classes.
for attribute in attributes:
node = ctx.cls.info.names[attribute.name].node
... | https://github.com/python/mypy/issues/4655 | thing = B(foo=1, bar='hi', baz='bye')
thing.foo = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jliu/Projects/lyft/coupons/venv/lib/python3.6/site-packages/attr/_make.py", line 351, in _frozen_setattrs
raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError | FrozenInstanceError |
def check_reverse_op_method(
self,
defn: FuncItem,
reverse_type: CallableType,
reverse_name: str,
context: Context,
) -> None:
"""Check a reverse operator method such as __radd__."""
# Decides whether it's worth calling check_overlapping_op_methods().
# This used to check for some very ... | def check_reverse_op_method(
self, defn: FuncItem, typ: CallableType, method: str, context: Context
) -> None:
"""Check a reverse operator method such as __radd__."""
# This used to check for some very obscure scenario. It now
# just decides whether it's worth calling
# check_overlapping_op_method... | https://github.com/python/mypy/issues/3468 | third_party/3/pyspark/sql/column.pyi:24: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.511
Traceback (most recent call last):
File "/home/user/anaconda3/bin/mypy", line 6, in <module>
main(__file__)
File "/home/user/anaconda3/lib/python3.5/site-packages/mypy/main.py", ... | AttributeError |
def check_overlapping_op_methods(
self,
reverse_type: CallableType,
reverse_name: str,
reverse_class: TypeInfo,
forward_type: Type,
forward_name: str,
forward_base: Type,
context: Context,
) -> None:
"""Check for overlapping method and reverse method signatures.
Assume reverse m... | def check_overlapping_op_methods(
self,
reverse_type: CallableType,
reverse_name: str,
reverse_class: TypeInfo,
forward_type: Type,
forward_name: str,
forward_base: Instance,
context: Context,
) -> None:
"""Check for overlapping method and reverse method signatures.
Assume rever... | https://github.com/python/mypy/issues/3468 | third_party/3/pyspark/sql/column.pyi:24: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.511
Traceback (most recent call last):
File "/home/user/anaconda3/bin/mypy", line 6, in <module>
main(__file__)
File "/home/user/anaconda3/lib/python3.5/site-packages/mypy/main.py", ... | AttributeError |
def operator_method_signatures_overlap(
self,
reverse_class: TypeInfo,
reverse_method: str,
forward_class: Type,
forward_method: str,
context: Context,
) -> None:
self.fail(
'Signatures of "{}" of "{}" and "{}" of {} are unsafely overlapping'.format(
reverse_method,
... | def operator_method_signatures_overlap(
self,
reverse_class: str,
reverse_method: str,
forward_class: str,
forward_method: str,
context: Context,
) -> None:
self.fail(
'Signatures of "{}" of "{}" and "{}" of "{}" are unsafely overlapping'.format(
reverse_method, reverse_c... | https://github.com/python/mypy/issues/3468 | third_party/3/pyspark/sql/column.pyi:24: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.511
Traceback (most recent call last):
File "/home/user/anaconda3/bin/mypy", line 6, in <module>
main(__file__)
File "/home/user/anaconda3/lib/python3.5/site-packages/mypy/main.py", ... | AttributeError |
def process_type_info(self, info: Optional[TypeInfo]) -> None:
if info is None:
return
# TODO: Additional things:
# - declared_metaclass
# - metaclass_type
# - _promote
# - typeddict_type
# - replaced
replace_nodes_in_symbol_table(info.names, self.replacements)
for i, item in... | def process_type_info(self, info: TypeInfo) -> None:
# TODO: Additional things:
# - declared_metaclass
# - metaclass_type
# - _promote
# - typeddict_type
# - replaced
replace_nodes_in_symbol_table(info.names, self.replacements)
for i, item in enumerate(info.mro):
info.mro[i] = se... | https://github.com/python/mypy/issues/4596 | Traceback (most recent call last):
File "[somewhere]/mypy/dmypy_server.py", line 135, in serve
resp = self.run_command(command, data)
File "[somewhere]/mypy/dmypy_server.py", line 169, in run_command
return method(self, **data)
File "[somewhere]/mypy/dmypy_server.py", line 200, in cmd_check
return self.check(self.last_... | AttributeError |
def semantic_analysis(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
patches = [] # type: List[Tuple[int, Callable[[], None]]]
with self.wrap_context():
self.manager.semantic_analyzer.visit_file(
self.tree, self.x... | def semantic_analysis(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
patches = [] # type: List[Callable[[], None]]
with self.wrap_context():
self.manager.semantic_analyzer.visit_file(
self.tree, self.xpath, self.o... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def semantic_analysis_pass_three(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
patches = [] # type: List[Tuple[int, Callable[[], None]]]
with self.wrap_context():
self.manager.semantic_analyzer_pass3.visit_file(
... | def semantic_analysis_pass_three(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
patches = [] # type: List[Callable[[], None]]
with self.wrap_context():
self.manager.semantic_analyzer_pass3.visit_file(
self.tree, s... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def semantic_analysis_apply_patches(self) -> None:
patches_by_priority = sorted(self.patches, key=lambda x: x[0])
for priority, patch_func in patches_by_priority:
patch_func()
| def semantic_analysis_apply_patches(self) -> None:
for patch_func in self.patches:
patch_func()
| https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def visit_file(
self,
file_node: MypyFile,
fnam: str,
options: Options,
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
"""Run semantic analysis phase 2 over a file.
Add (priority, callback) pairs by mutating the 'patches' list argument. They
will be called after all semantic ... | def visit_file(
self,
file_node: MypyFile,
fnam: str,
options: Options,
patches: List[Callable[[], None]],
) -> None:
"""Run semantic analysis phase 2 over a file.
Add callbacks by mutating the patches list argument. They will be called
after all semantic analysis phases but before type... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def build_namedtuple_typeinfo(
self,
name: str,
items: List[str],
types: List[Type],
default_items: Dict[str, Expression],
) -> TypeInfo:
strtype = self.str_type()
implicit_any = AnyType(TypeOfAny.special_form)
basetuple_type = self.named_type("__builtins__.tuple", [implicit_any])
di... | def build_namedtuple_typeinfo(
self,
name: str,
items: List[str],
types: List[Type],
default_items: Dict[str, Expression],
) -> TypeInfo:
strtype = self.str_type()
implicit_any = AnyType(TypeOfAny.special_form)
basetuple_type = self.named_type("__builtins__.tuple", [implicit_any])
di... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def build_typeddict_typeinfo(
self, name: str, items: List[str], types: List[Type], required_keys: Set[str]
) -> TypeInfo:
fallback = (
self.named_type_or_none("typing.Mapping", [self.str_type(), self.object_type()])
or self.object_type()
)
info = self.basic_new_typeinfo(name, fallback)
... | def build_typeddict_typeinfo(
self, name: str, items: List[str], types: List[Type], required_keys: Set[str]
) -> TypeInfo:
fallback = (
self.named_type_or_none("typing.Mapping", [self.str_type(), self.object_type()])
or self.object_type()
)
info = self.basic_new_typeinfo(name, fallback)
... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def visit_file(
self,
file_node: MypyFile,
fnam: str,
options: Options,
patches: List[Tuple[int, Callable[[], None]]],
) -> None:
self.recurse_into_functions = True
self.errors.set_file(fnam, file_node.fullname())
self.options = options
self.sem.options = options
self.patches = p... | def visit_file(
self,
file_node: MypyFile,
fnam: str,
options: Options,
patches: List[Callable[[], None]],
) -> None:
self.recurse_into_functions = True
self.errors.set_file(fnam, file_node.fullname())
self.options = options
self.sem.options = options
self.patches = patches
s... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def analyze(
self, type: Optional[Type], node: Union[Node, SymbolTableNode], warn: bool = False
) -> None:
# Recursive type warnings are only emitted on type definition 'node's, marked by 'warn'
# Flags appeared during analysis of 'type' are collected in this dict.
indicator = {} # type: Dict[str, bool... | def analyze(
self, type: Optional[Type], node: Union[Node, SymbolTableNode], warn: bool = False
) -> None:
# Recursive type warnings are only emitted on type definition 'node's, marked by 'warn'
# Flags appeared during analysis of 'type' are collected in this dict.
indicator = {} # type: Dict[str, bool... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def analyze_types(self, types: List[Type], node: Node) -> None:
# Similar to above but for nodes with multiple types.
indicator = {} # type: Dict[str, bool]
for type in types:
analyzer = self.make_type_analyzer(indicator)
type.accept(analyzer)
self.check_for_omitted_generics(type)
... | def analyze_types(self, types: List[Type], node: Node) -> None:
# Similar to above but for nodes with multiple types.
indicator = {} # type: Dict[str, bool]
for type in types:
analyzer = self.make_type_analyzer(indicator)
type.accept(analyzer)
self.check_for_omitted_generics(type)
... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def make_type_analyzer(self, indicator: Dict[str, bool]) -> TypeAnalyserPass3:
return TypeAnalyserPass3(
self.sem.lookup_qualified,
self.sem.lookup_fully_qualified,
self.fail,
self.sem.note,
self.sem.plugin,
self.options,
self.is_typeshed_file,
indicat... | def make_type_analyzer(self, indicator: Dict[str, bool]) -> TypeAnalyserPass3:
return TypeAnalyserPass3(
self.sem.lookup_qualified,
self.sem.lookup_fully_qualified,
self.fail,
self.sem.note,
self.sem.plugin,
self.options,
self.is_typeshed_file,
indicat... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def patch() -> None:
self.perform_transform(node, lambda tp: tp.accept(TypeVariableChecker(self.fail)))
| def patch() -> None:
self.perform_transform(
node, lambda tp: tp.accept(ForwardReferenceResolver(self.fail, node, warn))
)
| https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def __init__(self, fail: Callable[[str, Context], None]) -> None:
self.fail = fail
| def __init__(
self,
fail: Callable[[str, Context], None],
start: Union[Node, SymbolTableNode],
warn: bool,
) -> None:
self.seen = [] # type: List[Type]
self.fail = fail
self.start = start
self.warn = warn
| https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def __init__(
self,
lookup_func: Callable[[str, Context], Optional[SymbolTableNode]],
lookup_fqn_func: Callable[[str], SymbolTableNode],
fail_func: Callable[[str, Context], None],
note_func: Callable[[str, Context], None],
plugin: Plugin,
options: Options,
is_typeshed_stub: bool,
ind... | def __init__(
self,
lookup_func: Callable[[str, Context], Optional[SymbolTableNode]],
lookup_fqn_func: Callable[[str], SymbolTableNode],
fail_func: Callable[[str, Context], None],
note_func: Callable[[str, Context], None],
plugin: Plugin,
options: Options,
is_typeshed_stub: bool,
ind... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def visit_instance(self, t: Instance) -> None:
info = t.type
if info.replaced or info.tuple_type:
self.indicator["synthetic"] = True
# Check type argument count.
if len(t.args) != len(info.type_vars):
if len(t.args) == 0:
from_builtins = (
t.type.fullname() in... | def visit_instance(self, t: Instance) -> None:
info = t.type
if info.replaced or info.tuple_type:
self.indicator["synthetic"] = True
# Check type argument count.
if len(t.args) != len(info.type_vars):
if len(t.args) == 0:
from_builtins = (
t.type.fullname() in... | https://github.com/python/mypy/issues/4200 | forward.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.540
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__.py... | RuntimeError |
def find_isinstance_check(self, node: Expression) -> Tuple[TypeMap, TypeMap]:
"""Find any isinstance checks (within a chain of ands). Includes
implicit and explicit checks for None and calls to callable.
Return value is a map of variables to their types if the condition
is true and a map of variables ... | def find_isinstance_check(self, n: Expression) -> "Tuple[TypeMap, TypeMap]":
return find_isinstance_check(n, self.type_map)
| https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def partition_by_callable(
self, typ: Type, unsound_partition: bool
) -> Tuple[List[Type], List[Type]]:
"""Takes in a type and partitions that type into callable subtypes and
uncallable subtypes.
Thus, given:
`callables, uncallables = partition_by_callable(type)`
If we assert `callable(type)` ... | def partition_by_callable(type: Type) -> Tuple[List[Type], List[Type]]:
"""Takes in a type and partitions that type into callable subtypes and
uncallable subtypes.
Thus, given:
`callables, uncallables = partition_by_callable(type)`
If we assert `callable(type)` then `type` has type Union[*callable... | https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def conditional_callable_type_map(
self,
expr: Expression,
current_type: Optional[Type],
) -> Tuple[TypeMap, TypeMap]:
"""Takes in an expression and the current type of the expression.
Returns a 2-tuple: The first element is a map from the expression to
the restricted type if it were callable. ... | def conditional_callable_type_map(
expr: Expression,
current_type: Optional[Type],
) -> Tuple[TypeMap, TypeMap]:
"""Takes in an expression and the current type of the expression.
Returns a 2-tuple: The first element is a map from the expression to
the restricted type if it were callable. The second... | https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def check_for_comp(self, e: Union[GeneratorExpr, DictionaryComprehension]) -> None:
"""Check the for_comp part of comprehensions. That is the part from 'for':
... for x in y if z
Note: This adds the type information derived from the condlists to the current binder.
"""
for index, sequence, conditio... | def check_for_comp(self, e: Union[GeneratorExpr, DictionaryComprehension]) -> None:
"""Check the for_comp part of comprehensions. That is the part from 'for':
... for x in y if z
Note: This adds the type information derived from the condlists to the current binder.
"""
for index, sequence, conditio... | https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def calculate_mro(self) -> None:
"""Calculate and set mro (method resolution order).
Raise MroError if cannot determine mro.
"""
mro = linearize_hierarchy(self)
assert mro, "Could not produce a MRO at all for %s" % (self,)
self.mro = mro
self.is_enum = self._calculate_is_enum()
# The pr... | def calculate_mro(self) -> None:
"""Calculate and set mro (method resolution order).
Raise MroError if cannot determine mro.
"""
mro = linearize_hierarchy(self)
assert mro, "Could not produce a MRO at all for %s" % (self,)
self.mro = mro
self.is_enum = self._calculate_is_enum()
| https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def calculate_class_mro(defn: ClassDef, fail: Callable[[str, Context], None]) -> None:
try:
defn.info.calculate_mro()
except MroError:
fail(
"Cannot determine consistent method resolution order "
'(MRO) for "%s"' % defn.name,
defn,
)
defn.info.... | def calculate_class_mro(defn: ClassDef, fail: Callable[[str, Context], None]) -> None:
try:
defn.info.calculate_mro()
except MroError:
fail(
"Cannot determine consistent method resolution order "
'(MRO) for "%s"' % defn.name,
defn,
)
defn.info.... | https://github.com/python/mypy/issues/3605 | $ mypy n.py
$ python3 n.py
hello
Traceback (most recent call last):
File "n.py", line 8, in <module>
f(lambda: print('hello'))
File "n.py", line 5, in f
1 + 'boom'
TypeError: unsupported operand type(s) for +: 'int' and 'str' | TypeError |
def visit_decorator(self, dec: Decorator) -> None:
"""Try to infer the type of the decorated function.
This lets us resolve references to decorated functions during
type checking when there are cyclic imports, as otherwise the
type might not be available when we need it.
This basically uses a simp... | def visit_decorator(self, dec: Decorator) -> None:
"""Try to infer the type of the decorated function.
This lets us resolve references to decorated functions during
type checking when there are cyclic imports, as otherwise the
type might not be available when we need it.
This basically uses a simp... | https://github.com/python/mypy/issues/4370 | $ mypy -p common --show-traceback
/home/USER/.virtualenvs/backoffice-py/lib64/python3.6/site-packages/aio_pika/patterns/rpc.py:186: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.550
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _... | RuntimeError |
def module_not_found(self, path: str, source: str, line: int, target: str) -> None:
self.errors.set_file(path, source)
stub_msg = "(Stub files are from https://github.com/python/typeshed)"
if target == "builtins":
self.errors.report(
line,
0,
"Cannot find 'builtin... | def module_not_found(self, path: str, id: str, line: int, target: str) -> None:
self.errors.set_file(path, id)
stub_msg = "(Stub files are from https://github.com/python/typeshed)"
if (
self.options.python_version[0] == 2 and moduleinfo.is_py2_std_lib_module(target)
) or (
self.options.p... | https://github.com/python/mypy/issues/4301 | file.py: error: Name '__builtins__' is not defined
file.py:1: error: Cannot find module named 'builtins'
file.py:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
file.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.550
Tra... | KeyError |
def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase:
assert n.level is not None
if len(n.names) == 1 and n.names[0].name == "*":
mod = n.module if n.module is not None else ""
i = ImportAll(mod, n.level) # type: ImportBase
else:
i = ImportFrom(
self.translate_mo... | def visit_ImportFrom(self, n: ast3.ImportFrom) -> ImportBase:
assert n.level is not None
if len(n.names) == 1 and n.names[0].name == "*":
assert n.module is not None
i = ImportAll(n.module, n.level) # type: ImportBase
else:
i = ImportFrom(
self.translate_module_id(n.modu... | https://github.com/python/mypy/issues/4111 | Traceback (most recent call last):
File "/path/py3env/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/path/py3env/lib/python3.5/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/path/py3env/lib/python3.5/site-packages/mypy/main.py", line 50, in main
res = type_check_only(sourc... | AssertionError |
def visit_ImportFrom(self, n: ast27.ImportFrom) -> ImportBase:
assert n.level is not None
if len(n.names) == 1 and n.names[0].name == "*":
mod = n.module if n.module is not None else ""
i = ImportAll(mod, n.level) # type: ImportBase
else:
i = ImportFrom(
self.translate_m... | def visit_ImportFrom(self, n: ast27.ImportFrom) -> ImportBase:
assert n.level is not None
if len(n.names) == 1 and n.names[0].name == "*":
assert n.module is not None
i = ImportAll(n.module, n.level) # type: ImportBase
else:
i = ImportFrom(
self.translate_module_id(n.mod... | https://github.com/python/mypy/issues/4111 | Traceback (most recent call last):
File "/path/py3env/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/path/py3env/lib/python3.5/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/path/py3env/lib/python3.5/site-packages/mypy/main.py", line 50, in main
res = type_check_only(sourc... | AssertionError |
def check_func_def(
self, defn: FuncItem, typ: CallableType, name: Optional[str]
) -> None:
"""Type check a function definition."""
# Expand type variables with value restrictions to ordinary types.
for item, typ in self.expand_typevars(defn, typ):
old_binder = self.binder
self.binder = ... | def check_func_def(
self, defn: FuncItem, typ: CallableType, name: Optional[str]
) -> None:
"""Type check a function definition."""
# Expand type variables with value restrictions to ordinary types.
for item, typ in self.expand_typevars(defn, typ):
old_binder = self.binder
self.binder = ... | https://github.com/python/mypy/issues/4241 | rmul_crash.py:4: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.550
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__... | IndexError |
def check_reverse_op_method(
self, defn: FuncItem, typ: CallableType, method: str, context: Context
) -> None:
"""Check a reverse operator method such as __radd__."""
# This used to check for some very obscure scenario. It now
# just decides whether it's worth calling
# check_overlapping_op_method... | def check_reverse_op_method(
self, defn: FuncItem, typ: CallableType, method: str
) -> None:
"""Check a reverse operator method such as __radd__."""
# This used to check for some very obscure scenario. It now
# just decides whether it's worth calling
# check_overlapping_op_methods().
if metho... | https://github.com/python/mypy/issues/4241 | rmul_crash.py:4: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.550
Traceback (most recent call last):
File "/Users/joshstaiger/anaconda/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/joshstaiger/anaconda/lib/python3.6/site-packages/mypy/__main__... | IndexError |
def handle_cannot_determine_type(self, name: str, context: Context) -> None:
node = self.scope.top_non_lambda_function()
if self.pass_num < LAST_PASS and isinstance(node, FuncDef):
# Don't report an error yet. Just defer. Note that we don't defer
# lambdas because they are coupled to the surroun... | def handle_cannot_determine_type(self, name: str, context: Context) -> None:
node = self.scope.top_function()
if self.pass_num < LAST_PASS and isinstance(node, (FuncDef, LambdaExpr)):
# Don't report an error yet. Just defer.
if self.errors.type_name:
type_name = self.errors.type_name... | https://github.com/python/mypy/issues/3672 | ~/s/px (python|●2✚1) $ mypy --show-traceback --check-untyped-defs --ignore-missing-imports *.py */*.py
px/px_terminal.py:23: error: Incompatible types in assignment (expression has type "int", variable has type "str")
px/px_terminal.py:24: error: Unsupported operand types for > ("int" and "str")
px/px_terminal.py:29: e... | AssertionError |
def __init__(self, name: str, old_type: "Optional[mypy.types.Type]", line: int) -> None:
self.name = name
self.old_type = old_type
self.line = line
| def __init__(self, name: str, old_type: "Optional[mypy.types.Type]", line: int) -> None:
self.name = name
self.old_type = old_type
| https://github.com/python/mypy/issues/4097 | Traceback (most recent call last):
File "/Users/daenyth/Curata/cmp/.tox/mypy/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site... | AssertionError |
def visit_class_def(self, tdef: ClassDef) -> None:
# NamedTuple base classes are validated in check_namedtuple_classdef; we don't have to
# check them again here.
if not tdef.info.is_named_tuple:
types = list(tdef.info.bases) # type: List[Type]
for tvar in tdef.type_vars:
if tva... | def visit_class_def(self, tdef: ClassDef) -> None:
# NamedTuple base classes are validated in check_namedtuple_classdef; we don't have to
# check them again here.
if not tdef.info.is_named_tuple:
types = list(tdef.info.bases) # type: List[Type]
for tvar in tdef.type_vars:
if tva... | https://github.com/python/mypy/issues/4097 | Traceback (most recent call last):
File "/Users/daenyth/Curata/cmp/.tox/mypy/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site... | AssertionError |
def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
"""Traverse the assignment statement.
This includes the actual assignment and synthetic types
resulted from this assignment (if any). Currently this includes
NewType, TypedDict, NamedTuple, and TypeVar.
"""
self.analyze(s.type, s)
... | def visit_assignment_stmt(self, s: AssignmentStmt) -> None:
"""Traverse the assignment statement.
This includes the actual assignment and synthetic types
resulted from this assignment (if any). Currently this includes
NewType, TypedDict, NamedTuple, and TypeVar.
"""
self.analyze(s.type, s)
... | https://github.com/python/mypy/issues/4097 | Traceback (most recent call last):
File "/Users/daenyth/Curata/cmp/.tox/mypy/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site... | AssertionError |
def perform_transform(
self, node: Union[Node, SymbolTableNode], transform: Callable[[Type], Type]
) -> None:
"""Apply transform to all types associated with node."""
if isinstance(node, ForStmt):
if node.index_type:
node.index_type = transform(node.index_type)
self.transform_typ... | def perform_transform(
self, node: Union[Node, SymbolTableNode], transform: Callable[[Type], Type]
) -> None:
"""Apply transform to all types associated with node."""
if isinstance(node, ForStmt):
if node.index_type:
node.index_type = transform(node.index_type)
self.transform_typ... | https://github.com/python/mypy/issues/4097 | Traceback (most recent call last):
File "/Users/daenyth/Curata/cmp/.tox/mypy/bin/mypy", line 11, in <module>
sys.exit(console_entry())
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/daenyth/Curata/cmp/.tox/mypy/lib/python3.6/site... | AssertionError |
def analyze_ref_expr(self, e: RefExpr, lvalue: bool = False) -> Type:
result = None # type: Optional[Type]
node = e.node
if isinstance(node, Var):
# Variable reference.
result = self.analyze_var_ref(node, e)
if isinstance(result, PartialType):
if result.type is None:
... | def analyze_ref_expr(self, e: RefExpr, lvalue: bool = False) -> Type:
result = None # type: Optional[Type]
node = e.node
if isinstance(node, Var):
# Variable reference.
result = self.analyze_var_ref(node, e)
if isinstance(result, PartialType):
if result.type is None:
... | https://github.com/python/mypy/issues/3574 | .\break_mypy.py:5: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.511
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\mypy", line 6, in <module>
main(__file__)
File "C:\Anaconda3\lib\site-packages\mypy\main.py", line 46, in main
res = type_check_only(sourc... | AssertionError |
def assign_type(
self,
expr: Expression,
type: Type,
declared_type: Optional[Type],
restrict_any: bool = False,
) -> None:
if self.type_assignments is not None:
# We are in a multiassign from union, defer the actual binding,
# just collect the types.
self.type_assignments... | def assign_type(
self,
expr: Expression,
type: Type,
declared_type: Optional[Type],
restrict_any: bool = False,
) -> None:
if not isinstance(expr, BindableTypes):
return None
if not literal(expr):
return
self.invalidate_dependencies(expr)
if declared_type is None:
... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def check_multi_assignment(
self,
lvalues: List[Lvalue],
rvalue: Expression,
context: Context,
infer_lvalue_type: bool = True,
rv_type: Optional[Type] = None,
undefined_rvalue: bool = False,
) -> None:
"""Check the assignment of one rvalue to a number of lvalues."""
# Infer the type... | def check_multi_assignment(
self,
lvalues: List[Lvalue],
rvalue: Expression,
context: Context,
infer_lvalue_type: bool = True,
msg: Optional[str] = None,
) -> None:
"""Check the assignment of one rvalue to a number of lvalues."""
# Infer the type of an ordinary rvalue expression.
rv... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def check_multi_assignment_from_tuple(
self,
lvalues: List[Lvalue],
rvalue: Expression,
rvalue_type: TupleType,
context: Context,
undefined_rvalue: bool,
infer_lvalue_type: bool = True,
) -> None:
if self.check_rvalue_count_in_assignment(lvalues, len(rvalue_type.items), context):
... | def check_multi_assignment_from_tuple(
self,
lvalues: List[Lvalue],
rvalue: Expression,
rvalue_type: TupleType,
context: Context,
undefined_rvalue: bool,
infer_lvalue_type: bool = True,
) -> None:
if self.check_rvalue_count_in_assignment(lvalues, len(rvalue_type.items), context):
... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def split_around_star(
self, items: List[T], star_index: int, length: int
) -> Tuple[List[T], List[T], List[T]]:
"""Splits a list of items in three to match another list of length 'length'
that contains a starred expression at 'star_index' in the following way:
star_index = 2, length = 5 (i.e., [a,b,*,... | def split_around_star(
self, items: List[T], star_index: int, length: int
) -> Tuple[List[T], List[T], List[T]]:
"""Splits a list of items in three to match another list of length 'length'
that contains a starred expression at 'star_index' in the following way:
star_index = 2, length = 5 (i.e., [a,b,*,... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def infer_variable_type(
self, name: Var, lvalue: Lvalue, init_type: Type, context: Context
) -> None:
"""Infer the type of initialized variables from initializer type."""
if isinstance(init_type, DeletedType):
self.msg.deleted_as_rvalue(init_type, context)
elif not is_valid_inferred_type(init_t... | def infer_variable_type(
self, name: Var, lvalue: Lvalue, init_type: Type, context: Context
) -> None:
"""Infer the type of initialized variables from initializer type."""
if isinstance(init_type, DeletedType):
self.msg.deleted_as_rvalue(init_type, context)
elif not is_valid_inferred_type(init_t... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def check_member_assignment(
self,
instance_type: Type,
attribute_type: Type,
rvalue: Expression,
context: Context,
) -> Tuple[Type, bool]:
"""Type member assigment.
This defers to check_simple_assignment, unless the member expression
is a descriptor, in which case this checks descripto... | def check_member_assignment(
self,
instance_type: Type,
attribute_type: Type,
rvalue: Expression,
context: Context,
) -> Tuple[Type, bool]:
"""Type member assigment.
This is defers to check_simple_assignment, unless the member expression
is a descriptor, in which case this checks descri... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def iterable_item_type(self, instance: Instance) -> Type:
iterable = map_instance_to_supertype(
instance, self.lookup_typeinfo("typing.Iterable")
)
item_type = iterable.args[0]
if not isinstance(item_type, AnyType):
# This relies on 'map_instance_to_supertype' returning 'Iterable[Any]'
... | def iterable_item_type(self, instance: Instance) -> Type:
iterable = map_instance_to_supertype(
instance, self.lookup_typeinfo("typing.Iterable")
)
return iterable.args[0]
| https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def map_instance_to_supertype(instance: Instance, superclass: TypeInfo) -> Instance:
"""Produce a supertype of `instance` that is an Instance
of `superclass`, mapping type arguments up the chain of bases.
If `superclass` is not a nominal superclass of `instance.type`,
then all type arguments are mapped... | def map_instance_to_supertype(instance: Instance, superclass: TypeInfo) -> Instance:
"""Produce a supertype of `instance` that is an Instance
of `superclass`, mapping type arguments up the chain of bases.
`superclass` is required to be a superclass of `instance.type`.
"""
if instance.type == superc... | https://github.com/python/mypy/issues/3859 | mypy --py2 --show-traceback test.py
test.py:6: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521-858f7512cf3b4e39c0f4e8de5a13eee0e1e138fb-dirty
Traceback (most recent call last):
File "/usr/local/Cellar/mypy/0.521/libexec/bin/mypy", line 11, in <module>
load_entry_poi... | AssertionError |
def write_cache(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
if not self.path or self.options.cache_dir == os.devnull:
return
if self.manager.options.quick_and_dirty:
is_errors = self.manager.errors.is_errors_for_fil... | def write_cache(self) -> None:
assert self.tree is not None, (
"Internal error: method must be called on parsed file only"
)
if not self.path or self.options.cache_dir == os.devnull:
return
if self.manager.options.quick_and_dirty:
is_errors = self.manager.errors.is_errors_for_fil... | https://github.com/python/mypy/issues/3852 | $ bin/mypy python/
Traceback (most recent call last):
File "bin/mypy", line 33, in <module>
sys.exit(console_entry())
File "dist/lib/python3.6/mypy/__main__.py", line 7, in console_entry
main(None)
File "dist/lib/python3.6/mypy/main.py", line 50, in main
res = type_check_only(sources, bin_dir, options)
File "dist/lib/p... | AssertionError |
def mark_interface_stale(self, *, on_errors: bool = False) -> None:
"""Marks this module as having a stale public interface, and discards the cache data."""
self.meta = None
self.externally_same = False
if not on_errors:
self.manager.stale_modules.add(self.id)
| def mark_interface_stale(self) -> None:
"""Marks this module as having a stale public interface, and discards the cache data."""
self.meta = None
self.externally_same = False
self.manager.stale_modules.add(self.id)
| https://github.com/python/mypy/issues/3852 | $ bin/mypy python/
Traceback (most recent call last):
File "bin/mypy", line 33, in <module>
sys.exit(console_entry())
File "dist/lib/python3.6/mypy/__main__.py", line 7, in console_entry
main(None)
File "dist/lib/python3.6/mypy/main.py", line 50, in main
res = type_check_only(sources, bin_dir, options)
File "dist/lib/p... | AssertionError |
def analyze_member_access(
name: str,
typ: Type,
node: Context,
is_lvalue: bool,
is_super: bool,
is_operator: bool,
builtin_type: Callable[[str], Instance],
not_ready_callback: Callable[[str, Context], None],
msg: MessageBuilder,
*,
original_type: Type,
chk: "mypy.checker... | def analyze_member_access(
name: str,
typ: Type,
node: Context,
is_lvalue: bool,
is_super: bool,
is_operator: bool,
builtin_type: Callable[[str], Instance],
not_ready_callback: Callable[[str, Context], None],
msg: MessageBuilder,
*,
original_type: Type,
chk: "mypy.checker... | https://github.com/python/mypy/issues/3852 | $ bin/mypy python/
Traceback (most recent call last):
File "bin/mypy", line 33, in <module>
sys.exit(console_entry())
File "dist/lib/python3.6/mypy/__main__.py", line 7, in console_entry
main(None)
File "dist/lib/python3.6/mypy/main.py", line 50, in main
res = type_check_only(sources, bin_dir, options)
File "dist/lib/p... | AssertionError |
def is_type_obj(self) -> bool:
return self.fallback.type.is_metaclass()
| def is_type_obj(self) -> bool:
t = self.fallback.type
return t is not None and t.is_metaclass()
| https://github.com/python/mypy/issues/3852 | $ bin/mypy python/
Traceback (most recent call last):
File "bin/mypy", line 33, in <module>
sys.exit(console_entry())
File "dist/lib/python3.6/mypy/__main__.py", line 7, in console_entry
main(None)
File "dist/lib/python3.6/mypy/main.py", line 50, in main
res = type_check_only(sources, bin_dir, options)
File "dist/lib/p... | AssertionError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.