Я использовал следующий код.
Код: Выделить всё
from typing import NewType
MyDataType = NewType("MyDataType", dict[str, dict[str, dict[str, dict[str, float]]]])
class App:
def __init__(self, name: str, data: MyDataType):
self.name = name
self.data = data
app = App("app_1", data={}) # Pycharm warning: Expected type 'MyDataType', got 'dict' instead
Код: Выделить всё
Expected type 'MyDataType', got 'dict' instead
Подробнее здесь: https://stackoverflow.com/questions/756 ... n-python-3