add plain_data.pyi to help type deduction for @plain_data() decorated classes
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 27 Sep 2022 03:08:30 +0000 (20:08 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 27 Sep 2022 03:08:30 +0000 (20:08 -0700)
src/nmutil/plain_data.pyi [new file with mode: 0644]

diff --git a/src/nmutil/plain_data.pyi b/src/nmutil/plain_data.pyi
new file mode 100644 (file)
index 0000000..1d42131
--- /dev/null
@@ -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:
+    ...