Category "mypy"

can i tell mypy to warn me on type ignores without error codes, only *# type: ignore[code, ...]* should be accepted

I would like to have all type-ignores with errorcodes # type: ignore[code, ...] and disallow # type: ignore without them. I checked the docs but could not find

MyPy configuration - exclude multiple directories

We're currently using Mypy (v 0.910) in our project with pyproject.toml for configuration. I have the following file structure: src --app --generated

Mypy Function "lxml.etree.ElementTree" is not valid as a type but why?

I am using Mypy for this function import funcy as fu from lxml import etree from lxml.etree import Element, ElementTree def find_nodes(tree: ElementTree, paths

error: Incompatible return value type (got "Tuple[Tuple[float, float], ...]", expected "List[Any]")

Context While trying to implement static typing, I'm experiencing some difficulties in specifying the return type of the following function: def create_hexagon_

How to annotate that a function produces a dataclass?

Say you want to wrap the dataclass decorator like so: from dataclasses import dataclass def something_else(klass): return klass def my_dataclass(klass):

Mypy in Nox session not finding Nump type stubs

My nox session is defined like: @nox.session(python=["3.10", "3.9.10"]) def mypy(session: Session) -> None: args = session.posargs or locations insta

PyCharm raising Unresolved reference + expression expected for mypy ignore based on error code

I am trying to silence mypy errors based on error codes. This is done using something like this: from foolib import foo # type: ignore[attr-defined] I beli

mypy - Item "None" of "Optional[CustomAttrsModel]" has no attribute "country"

When I run mypy checkings I am getting an error. I am no able to ignore it or turn it off the strict optional checking. It there a way to solve this. Here is th

Problem while using mypy with my django project

I have implemented mypy in my django rest framework but I am getting errors ModuleNotFoundError: No module named 'config' while running mypy.Is there any wrong

mypy error for function returning TypeVar based on Type[T] argument

I have a function that validates variable based on TypedDict declaration at runtime. I want it to perform validation, raise exception on error and set return ty

mypy allow redefinition at a specific line

I'm trying to lint my python code with mypy. A utility that I depend on uses a callback to which arguments can take multiple types. Type is typically defined by