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

Why Does Mypy Think Library Imports Are Missing?

When I run mypy it complains that modules cannot be found: sal@ahfang:~/workspace/ecs/cx-project-sk… Read more Why Does Mypy Think Library Imports Are Missing?

Type Hinting Sqlalchemy Query Result

I can't figure out what kind of object a sqlalchemy query returns. entries = session.query(Foo.… Read more Type Hinting Sqlalchemy Query Result

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

Why Does Mypy Infer The Common Base Type Instead Of The Union Of All Contained Types?

When iterating over a heterogeneous sequence (containing elements of type T1 and T2, say), mypy inf… Read more Why Does Mypy Infer The Common Base Type Instead Of The Union Of All Contained Types?

How Can I Add Python Type Annotations To The Flask Global Context G?

I have a decorator which adds a user onto the flask global context g: class User: def __init__(… Read more How Can I Add Python Type Annotations To The Flask Global Context G?

How To Make Mypy Complain About Assigning An Any To An Int

mypy --strict dutifully complains about the following code: from typing import Any, Dict def main(… Read more How To Make Mypy Complain About Assigning An Any To An Int

Type-hinting Parameters With A Sentinel Value As The Default

I currently use this strategy when I cannot assign default arguments in a function's signature … Read more Type-hinting Parameters With A Sentinel Value As The Default

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?