StructResult 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ from .main import Result
StructResult/main.py ADDED
@@ -0,0 +1,26 @@
1
+ from typing import Optional, TypeVar, Generic
2
+
3
+ T = TypeVar("T")
4
+
5
+
6
+ class Result(Generic[T]):
7
+ value: T
8
+ err: Optional[list[Exception]]
9
+ __slots__ = ("value", "err")
10
+
11
+ def __init__(self, value: T):
12
+ self.value = value
13
+ self.err = None
14
+
15
+ def __getitem__(self, item):
16
+ if item == 0:
17
+ return self.value
18
+ elif item == 1:
19
+ return self.err
20
+ else:
21
+ raise StopIteration
22
+
23
+ def append_err(self, e: Exception):
24
+ if self.err is None:
25
+ self.err = list()
26
+ self.err.append(e)
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.2
2
+ Name: StructResult
3
+ Version: 0.2.0
4
+ Summary: structural result with exception
5
+ Author-email: Serj Kotilevski <youserj@outlook.com>
6
+ Project-URL: Source, https://github.com/youserj/Result_prj
7
+ Keywords: result,exception
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Result_prj
15
+ python return struct
@@ -0,0 +1,6 @@
1
+ StructResult/__init__.py,sha256=HmpVji5o5NBLgFYpjsuZuSTkOIZGpMN54s9iOYd2krg,26
2
+ StructResult/main.py,sha256=55Km-AjbdqxbHUX_zWbn5idycdZdK_61eY9QX9IKrAs,596
3
+ StructResult-0.2.0.dist-info/METADATA,sha256=6T0Ml8Sney55WM06owsstOnitWWLl8-KxaH56JVtKqc,496
4
+ StructResult-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
+ StructResult-0.2.0.dist-info/top_level.txt,sha256=Kpxya2oNyjOxogXuN_JnRenStl5IjQ4T9-ISm7DtqDk,13
6
+ StructResult-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ StructResult