StructResult 0.1.0__tar.gz

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,15 @@
1
+ Metadata-Version: 2.2
2
+ Name: StructResult
3
+ Version: 0.1.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,2 @@
1
+ # Result_prj
2
+ python return struct
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools",
4
+ "setuptools-scm"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [tool.setuptools.packages.find]
8
+ where = ["src"]
9
+
10
+ [project]
11
+ name = "StructResult"
12
+ version = "0.1.0"
13
+ requires-python = ">= 3.12"
14
+ authors = [
15
+ {name="Serj Kotilevski", email="youserj@outlook.com"}
16
+ ]
17
+ dependencies = [
18
+ ]
19
+ description="structural result with exception"
20
+ readme = "README.md"
21
+ keywords=['result', 'exception']
22
+ classifiers = [
23
+ "Programming Language :: Python :: 3",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Operating System :: OS Independent",
26
+ ]
27
+ [project.urls]
28
+ Source = "https://github.com/youserj/Result_prj"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .main import Result
@@ -0,0 +1,21 @@
1
+ from dataclasses import dataclass
2
+ from typing import Any, Optional
3
+
4
+
5
+ @dataclass(slots=True)
6
+ class Result:
7
+ value: Any
8
+ err: Optional[list[Exception]] = None
9
+
10
+ def __getitem__(self, item):
11
+ if item == 0:
12
+ return self.value
13
+ elif item == 1:
14
+ return self.err
15
+ else:
16
+ raise StopIteration
17
+
18
+ def append_err(self, e: Exception):
19
+ if self.err is None:
20
+ self.err = list()
21
+ self.err.append(e)
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.2
2
+ Name: StructResult
3
+ Version: 0.1.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,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/StructResult/__init__.py
4
+ src/StructResult/main.py
5
+ src/StructResult.egg-info/PKG-INFO
6
+ src/StructResult.egg-info/SOURCES.txt
7
+ src/StructResult.egg-info/dependency_links.txt
8
+ src/StructResult.egg-info/top_level.txt
9
+ test/test_Result.py
@@ -0,0 +1 @@
1
+ StructResult
@@ -0,0 +1,10 @@
1
+ import unittest
2
+ from StructResult import Result
3
+
4
+
5
+ class TestType(unittest.TestCase):
6
+
7
+ def test_init(self):
8
+ res = Result(1)
9
+ self.assertEqual(res.value, 1)
10
+ self.assertEqual(list(res), [1, None])