You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy disregarded the exclude option in mypy.ini and reported errors on all three of these files. exclude = (pickler|profilerstats|solver/debugging)\.py
Traceback
This is the contents of the foo.txt written above...
outfile.py:29: error: Cannot assign to a method
outfile.py:32: error: Incompatible types in assignment (expression has type "str", variable has type "None")
outfile.py:37: error: Incompatible types in assignment (expression has type "TextIO", variable has type "None")
outfile.py:39: error: Incompatible types in assignment (expression has type "IO[Any]", variable has type "None")
profilerstats.py:309: error: Need type annotation for "newstats" (hint: "newstats: Dict[<type>, <type>] = ...")
profilerstats.py:429: error: Argument 1 to "print_title" of "Stats" has incompatible type "List[str]"; expected "Tuple[str, str, str, str, str]"
profilerstats.py:429: error: Argument 2 to "print_title" of "Stats" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, int, int, int, int]"
profilerstats.py:448: error: Argument 3 to "print_call_heading" of "Stats" has incompatible type "List[str]"; expected "Tuple[str, str, str]"
profilerstats.py:448: error: Argument 4 to "print_call_heading" of "Stats" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, int, int]"
profilerstats.py:451: error: Argument 4 to "print_call_line" of "Stats" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, int, int]"
profilerstats.py:469: error: Argument 3 to "print_call_heading" of "Stats" has incompatible type "List[str]"; expected "Tuple[str, str, str]"
profilerstats.py:469: error: Argument 4 to "print_call_heading" of "Stats" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, int, int]"
profilerstats.py:472: error: Argument 4 to "print_call_line" of "Stats" has incompatible type "Tuple[int, ...]"; expected "Tuple[int, int, int]"
profilerstats.py:509: error: Argument 1 to "call_items" of "Stats" has incompatible type "Tuple[Any, ...]"; expected "CallStats"
profilerstats.py:563: error: Invalid type comment or annotation
profilerstats.py:563: note: Suggestion: use Tuple[...] instead of Tuple(...)
profilerstats.py:576: error: Name "Mapping" is not defined
profilerstats.py:643: error: "CallStats" has no attribute "items"
profilerstats.py:645: error: "CallStats" has no attribute "items"
profilerstats.py:656: error: Incompatible return value type (got "Dict[Any, Any]", expected "CallStats")
profilerstats.py:842: error: Incompatible types in assignment (expression has type "None", variable has type "str")
solver\debugging.py:45: error: Name "InstrCtx" is not defined
solver\debugging.py:78: error: Need type annotation for "col_nums" (hint: "col_nums: List[<type>] = ...")
solver\debugging.py:89: error: Name "InstrCtx" is not defined
solver\debugging.py:94: error: Need type annotation for "debug_ignore_instr_nums" (hint: "debug_ignore_instr_nums: List[<type>] = ...")
solver\debugging.py:111: error: Missing positional argument "target" in call to "__call__" of "_Db"
solver\debugging.py:154: error: Name "debug_dump_codes_gen_thresh" already defined on line 153
solver\debugging.py:209: error: Cannot resolve name "_DebugBreakParams" (possible cyclic definition)
solver\debugging.py:241: error: Name "InstrTab" is not defined
solver\debugging.py:255: error: Name "OutFile" is not defined
solver\debugging.py:255: error: Name "InstrTab" is not defined
solver\debugging.py:270: error: Name "InstrTab" is not defined
solver\debugging.py:294: error: Name "CodeBits" is not defined
solver\debugging.py:302: error: Skipping analyzing "psutil": module is installed, but missing library stubs or py.typed marker
solver\debugging.py:302: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
solver\debugging.py:330: error: Skipping analyzing "psutil._common": module is installed, but missing library stubs or py.typed marker
solver\debugging.py:398: error: Need type annotation for "memo" (hint: "memo: Dict[<type>, <type>] = ...")
metaclasses.py:30: error: Incompatible return value type (got "Tuple[type, ...]", expected "Tuple[type]")
metaclasses.py:50: error: Need type annotation for "_memoized_metaclasses_map" (hint: "_memoized_metaclasses_map: Dict[<type>, <type>] = ...")
cache.py:43: error: Cannot assign to a method
cache.py:57: error: Name "WeakRef" is not defined
cache.py:57: error: Name "_CacheDir" is not defined
cache.py:100: error: Too many arguments for "_IterInKey"
cache.py:106: error: Too many arguments for "_IterInKey"
cache.py:112: error: All conditional function variants must have identical signatures
cache.py:125: error: Incompatible types in assignment (expression has type "Tuple[Tuple[Any, ...]]", variable has type "Tuple[Tuple[Any, ...], Tuple[Any, ...], Tuple[Any, ...]]")
cache.py:131: error: Name "__hash__" already defined on line 128
cache.py:134: error: Argument 1 of "__eq__" is incompatible with supertype "object"; supertype defines the argument type as "object"
cache.py:134: note: This violates the Liskov substitution principle
cache.py:134: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
cache.py:134: note: It is recommended for "__eq__" to work with arbitrary objects, for example:
cache.py:134: note: def __eq__(self, other: object) -> bool:
cache.py:134: note: if not isinstance(other, _Key):
cache.py:134: note: return NotImplemented
cache.py:134: note: return <logic to compare two _Key instances>
cache.py:145: error: "_Key" has no attribute "args"
cache.py:147: error: "_Key" has no attribute "kwds"; maybe "nokwds" or "kwords"?
cache.py:158: error: Invalid base class "Callable"
cache.py:195: error: Signature of "update" incompatible with supertype "dict"
cache.py:195: note: Superclass:
cache.py:195: note: @overload
cache.py:195: note: def update(self, Mapping[Any, Any], **kwargs: Any) -> None
cache.py:195: note: @overload
cache.py:195: note: def update(self, Iterable[Tuple[Any, Any]], **kwargs: Any) -> None
cache.py:195: note: @overload
cache.py:195: note: def update(self, **kwargs: Any) -> None
cache.py:195: note: Subclass:
cache.py:195: note: def update(self, key: Any, result: Any, bypass: bool = ...) -> Any
cache.py:195: error: Signature of "update" incompatible with supertype "MutableMapping"
cache.py:195: note: @overload
cache.py:195: note: def update(self, Mapping[Any, Any], **kwargs: Any) -> None
cache.py:195: note: @overload
cache.py:195: note: def update(self, Iterable[Tuple[Any, Any]], **kwargs: Any) -> None
cache.py:195: note: @overload
cache.py:195: note: def update(self, **kwargs: Any) -> None
cache.py:195: note: def update(self, key: Any, result: Any, bypass: bool = ...) -> Any
cache.py:222: error: Signature of "get" incompatible with supertype "Mapping"
cache.py:222: note: Superclass:
cache.py:222: note: @overload
cache.py:222: note: def get(self, key: Any) -> Optional[Any]
cache.py:222: note: @overload
cache.py:222: note: def [_T] get(self, Any, Union[Any, _T]) -> Union[Any, _T]
cache.py:222: note: Subclass:
cache.py:222: note: @classmethod
cache.py:222: note: def get(cls, target: Any, name: Any, enabled: bool) -> Any
cache.py:245: error: Name "self" is not defined
cache.py:330: error: Signature of "__call__" incompatible with supertype "_CacheMgr"
cache.py:330: note: Superclass:
cache.py:330: note: def __call__(self, args: Tuple[Any, ...], kwds: Dict[Any, Any] = ..., *, bypass: bool = ..., key_class: type = ...) -> Any
cache.py:330: note: Subclass:
cache.py:330: note: def __call__(self, bypass: bool = ..., _key: Any = ...) -> Any
cache.py:423: error: All conditional function variants must have identical signatures
cache.py:426: error: All conditional function variants must have identical signatures
cache.py:428: error: Too many arguments for "get_cache"
cache.py:428: error: Missing positional argument "args" in call to "__call__" of "_CacheMgr"
cache.py:444: error: All conditional function variants must have identical signatures
cache.py:447: error: All conditional function variants must have identical signatures
cache.py:449: error: Too many arguments for "get_cache"
cache.py:466: error: All conditional function variants must have identical signatures
cache.py:469: error: All conditional function variants must have identical signatures
cache.py:471: error: Too many arguments for "get_cache"
cache.py:552: error: Incompatible return value type (got "PropWrapper", expected "Callable[[Any], Any]")
cache.py:629: error: Variable "mcls" is not valid as a type
cache.py:629: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
cache.py:629: error: Invalid base class "mcls"
cache.py:652: error: Name "__class__" is not defined
cache.py:671: error: Cannot assign to a method
cache.py:683: error: Cannot assign to a method
cache.py:703: error: All conditional function variants must have identical signatures
cache.py:734: error: Cannot assign to a method
cache.py:734: error: Incompatible types in assignment (expression has type "object", variable has type "Callable[[type, VarArg(Any), KwArg(Any)], Any]")
cache.py:738: error: Cannot assign to a method
cache.py:843: error: Signature of "update" incompatible with supertype "_Missing"
cache.py:843: note: Superclass:
cache.py:843: note: def update(self, obj: Any, **kwds: Any) -> Any
cache.py:843: note: Subclass:
cache.py:843: note: def update(self, result: Any, **kwds: Any) -> Any
cache.py:854: error: Signature of "update" incompatible with supertype "_Missing"
cache.py:854: note: Superclass:
cache.py:854: note: def update(self, obj: Any, **kwds: Any) -> Any
cache.py:854: note: Subclass:
cache.py:854: note: def update(self, result: Any) -> Any
cache.py:912: error: Argument 2 to "CombineMeta" has incompatible type "Tuple[type, ...]"; expected "Tuple[type]"
cache.py:933: error: Incompatible return value type (got "type", expected "CacheBase")
cache.py:938: error: <nothing> has no attribute "__mro_entries__"
cache.py:939: error: Incompatible types in assignment (expression has type "None", variable has type "Type[type]")
cache.py:942: error: Invalid statement in NamedTuple definition; expected "field_name: field_type [= default]"
cache.py:948: error: Invalid statement in NamedTuple definition; expected "field_name: field_type [= default]"
cache.py:1010: error: "CachedTupleMeta" has no attribute "_nt_cls"
solver\common.py:12: error: Incompatible import of "Protocol" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm")
solver\common.py:12: error: Incompatible import of "get_type_hints" (imported name has type "Callable[[Callable[..., Any], Optional[Dict[str, Any]], Optional[Dict[str, Any]], bool], Dict[str, Any]]", local name has type "Callable[[Union[object, Callable[..., Any], FunctionType, BuiltinFunctionType, MethodType, Module, WrapperDescriptorType, MethodWrapperType, MethodDescriptorType], Optional[Dict[str, Any]], Optional[Dict[str, Any]]], Dict[str, Any]]")
solver\common.py:12: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
solver\common.py:225: error: Dynamic metaclass not supported for "Bits64Cached"
solver\common.py:230: error: Type cannot be declared in assignment to non-self attribute
solver\common.py:250: error: Name "__class__" is not defined
solver\common.py:308: error: Name "num_bits" already defined on line 265
solver\common.py:424: error: Variable "solver.common.SubCode" is not valid as a type
solver\common.py:424: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
solver\common.py:424: error: Invalid base class "SubCode"
solver\common.py:465: error: Variable "solver.common.SubCode" is not valid as a type
solver\common.py:465: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
solver\common.py:467: error: Name "InstrTab" is not defined
solver\common.py:467: error: Variable "solver.common.BinCode" is not valid as a type
solver\common.py:467: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
solver\common.py:485: error: Name "iterable" is not defined
solver\common.py:485: note: Did you forget to import it from "typing"? (Suggestion: "from typing import Iterable")
solver\common.py:538: error: Name "method" is not defined
Deferral trace:
About 18,000 lines...
pickler.py:233: error: Cannot find implementation or library stub for module named "org.python.core"
pickler.py:1842: error: Cannot find implementation or library stub for module named "_pickle"
Traceback (most recent call last):
File "D:\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "mypy\semanal.py", line 5142, in accept
File "mypy\nodes.py", line 1246, in accept
File "mypy\semanal.py", line 3604, in visit_assert_stmt
File "mypy\nodes.py", line 1713, in accept
File "mypy\semanal.py", line 3943, in visit_call_expr
File "mypy\nodes.py", line 1633, in accept
File "mypy\semanal.py", line 3996, in visit_member_expr
File "mypy\semanal.py", line 4448, in get_module_symbol
File "mypy\semanal.py", line 4843, in record_incomplete_ref
File "mypy\semanal.py", line 4826, in defer
AssertionError: Must not defer during final iteration
To Reproduce
Here is excerpt from opnd_types.py:
class FieldCategory(IntEnum):
""" Names used to prefix the capture group name for a field.
The enum's name is used to get a value of that category for a Body, or the substring of its name.
The enum's value is used to sort display of multiple FieldGroups in the same Col.
"""
bnk = auto()
num = auto()
off = auto()
def __init__(self, num):
self.cap_name = f'cap_{self.name}'
self.cap_str = attrgetter(f'type.cap_{self.name}')
self.val_method: Callable[[OpndBody], FieldCatVal] = methodcaller(f'{self.name}_val')
def get_val(self, body: Body):
""" The computed value of the body for this category.
It is a property of the body whose name depends on the body's type.
"""
# The following line crashes mypy!
assert isinstance(body, bodies.Body) # type:ignore [ line 986 with INTERNAL ERROR ]
return self.val_method(body)
from solver import bodies
Excerpt from solver/bodies.py:
from .opnd_types import *
class Body(BodyBase, InstrValCommon):
...
(Write what you did to reproduce the crash. Full source code is
appreciated. We also very much appreciate it if you try to narrow the
source down to a small stand-alone example.)
Your Environment
Mypy version used: 0.931
Mypy configuration options from mypy.ini (and other config files):```
For context, that module contains a lot of nested classes and is only really used in a few places, I haven't managed to narrow down the exact line that causes the error yet.
I worked around this by commenting out the offending line 986. I'll leave it in place when not running mypy.
By the way:
exclude = (pickler|profilerstats|solver/debugging)\.py
Crash Report
D:\Solutions\trunk\Python\Sass>mypy solver\opnd_types.py > foo.txt
mypy.ini: [mypy]: Unrecognized option: dummy = 3 [ I put this in to verify it was reading mypy.ini. ]
solver\opnd_types.py:986: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.931
solver\opnd_types.py:986: : note: use --pdb to drop into pdb
Traceback
This is the contents of the foo.txt written above...
To Reproduce
Here is excerpt from opnd_types.py:
Excerpt from solver/bodies.py:
(Write what you did to reproduce the crash. Full source code is
appreciated. We also very much appreciate it if you try to narrow the
source down to a small stand-alone example.)
Your Environment
mypy.ini
(and other config files):```The text was updated successfully, but these errors were encountered: