From 4f05c2e7125c5d13652e7168f21145f97ce5b1e6 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 26 Sep 2022 20:08:30 -0700 Subject: [PATCH] add plain_data.pyi to help type deduction for @plain_data() decorated classes --- src/nmutil/plain_data.pyi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/nmutil/plain_data.pyi diff --git a/src/nmutil/plain_data.pyi b/src/nmutil/plain_data.pyi new file mode 100644 index 0000000..1d42131 --- /dev/null +++ b/src/nmutil/plain_data.pyi @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: LGPL-3-or-later +# Copyright 2022 Jacob Lifshay programmerjake@gmail.com + +from typing import TypeVar, Type, Callable, Any + +_T = TypeVar("_T") + + +class FrozenPlainDataError(AttributeError): + pass + + +def plain_data(*, eq: bool = True, unsafe_hash: bool = False, + order: bool = False, repr: bool = True, + frozen: bool = False) -> Callable[[Type[_T]], Type[_T]]: + ... + + +def fields(pd: Any) -> tuple[str, ...]: + + +def replace(pd: _T, **changes: Any) -> _T: + ... -- 2.30.2