Skip to content Skip to sidebar Skip to footer
Showing posts with the label Mypy

Typehint Importing Module Dynamically Using Importlib

Give something as follows: import importlib module_path = 'mod' mod = importlib.import_mod… Read more Typehint Importing Module Dynamically Using Importlib

Python Type Hints And Context Managers

How should a context manager be annotated with Python type hints? import typing @contextlib.contex… Read more Python Type Hints And Context Managers

How Do I Annotate A Type Which Has An Extra Attribute With Mypy?

I have an ast.UnaryOp object, but I manually added a parent attribute (see answer). How do I annota… Read more How Do I Annotate A Type Which Has An Extra Attribute With Mypy?

How To Use Typeshed With Mypy?

I cloned typeshed but I can't figure out how to tell mypy to use the type hints it contains, I … Read more How To Use Typeshed With Mypy?

Why Is Mypy Complaining About List Comprehension When It Can't Be Annotated?

Why does Mypy complain that it requires a type annotation for a list comprehension variable, when i… Read more Why Is Mypy Complaining About List Comprehension When It Can't Be Annotated?

Using Mypy Local Stubs

I am trying the typing hint introduced by Python 3.5 and got a problem by using local stubs as the … Read more Using Mypy Local Stubs