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

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

Class Decorator Compatible For Mypy

Say I have the following simple example without any typehints: def wrapper(cls): class Subclass… Read more Class Decorator Compatible For Mypy

How To Use Reveal_type In Mypy

I have read that I can reveal the type of variables by using a function called reveal_type, but I c… Read more How To Use Reveal_type In Mypy

How Can I Keep Imports Lightweight And Still Properly Type Annotate?

Tensorflow is a super heavy import. I want to import it only when it's needed. However, I have … Read more How Can I Keep Imports Lightweight And Still Properly Type Annotate?

How To Add Hint To A Factory Method?

I'm looking for a way to annotate return type of a factory function. It returns random child of… Read more How To Add Hint To A Factory Method?

Python: All Type Hints Errors In Subclass Constructure Seems Ignored

I have the following code with python type hints It has a bunch of errors. All erros in code are fo… Read more Python: All Type Hints Errors In Subclass Constructure Seems Ignored

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

Mypy And Attrs: Errors Typechecking Lists Of Subclasses

I have a message container that can contain different kinds of messages. For now, there are only te… Read more Mypy And Attrs: Errors Typechecking Lists Of Subclasses