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

Type Hint For Return Value In Subclass

I am writing a CustomEnum class in which I want to add some helper methods, that would then be avai… Read more Type Hint For Return Value In Subclass

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?

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

Python Async Decorator Preserve Typing

For the following file: from abc import ABC, abstractmethod from typing import Any, Awaitable, Call… Read more Python Async Decorator Preserve Typing

Typing Function When Decorator Change Return Type

how to correctly write types for the function whose return type is modified by decorator ? Simple … Read more Typing Function When Decorator Change Return Type

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

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?

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

Incompatible Types In Assignment (expression Has Type "List[]", Variable Has Type (...)

Consider the following self-contained example: from typing import List, Union T_BENCODED_LIST = Un… Read more Incompatible Types In Assignment (expression Has Type "List[]", Variable Has Type (...)