From: Jacob Lifshay Date: Tue, 27 Sep 2022 03:08:30 +0000 (-0700) Subject: add plain_data.pyi to help type deduction for @plain_data() decorated classes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f05c2e7125c5d13652e7168f21145f97ce5b1e6;p=nmutil.git add plain_data.pyi to help type deduction for @plain_data() decorated classes --- 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: + ...