UniversalFunctions 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.
- universalfunctions-0.1.0/LICENSE +20 -0
- universalfunctions-0.1.0/PKG-INFO +127 -0
- universalfunctions-0.1.0/README.md +117 -0
- universalfunctions-0.1.0/UF/ClassToDict.py +24 -0
- universalfunctions-0.1.0/UF/DecoratorArchive.py +37 -0
- universalfunctions-0.1.0/UF/GetVariable.py +84 -0
- universalfunctions-0.1.0/UF/HelperFunctions.py +122 -0
- universalfunctions-0.1.0/UF/StringCheck.py +25 -0
- universalfunctions-0.1.0/UF/Validators/QuantumFuncValidators.py +59 -0
- universalfunctions-0.1.0/UF/Validators/QuantumValidators.py +56 -0
- universalfunctions-0.1.0/UF/Validators/ValidationClasses.py +128 -0
- universalfunctions-0.1.0/UF/Validators/__init__.py +16 -0
- universalfunctions-0.1.0/UF/__init__.py +19 -0
- universalfunctions-0.1.0/UniversalFunctions.egg-info/PKG-INFO +127 -0
- universalfunctions-0.1.0/UniversalFunctions.egg-info/SOURCES.txt +17 -0
- universalfunctions-0.1.0/UniversalFunctions.egg-info/dependency_links.txt +1 -0
- universalfunctions-0.1.0/UniversalFunctions.egg-info/top_level.txt +1 -0
- universalfunctions-0.1.0/pyproject.toml +19 -0
- universalfunctions-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Miah M. Sabiq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, merge, publish, distribute, sublicense, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: UniversalFunctions
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python utility library providing foundational functions, validators, and infrastructure.
|
|
5
|
+
Author-email: "Miah M. Sabiq" <miah.sabiq@gibs.at>
|
|
6
|
+
Requires-Python: >=3.14
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# UniversalFunctions
|
|
12
|
+
|
|
13
|
+
UniversalFunctions is a Python utility library providing foundational functions, validators, decorators, type utilities, and infrastructure for building structured Python applications and domain-specific APIs.
|
|
14
|
+
|
|
15
|
+
It is designed as an independent foundation layer that can be used on its own or as a dependency of larger projects such as GeometricalDomination.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install UniversalFunctions from PyPI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install UniversalFunctions
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package requires Python 3.14 or later.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
UniversalFunctions is imported through the UF Python package:
|
|
30
|
+
|
|
31
|
+
from UF.Validators import TypeValidate
|
|
32
|
+
from numbers import Real
|
|
33
|
+
|
|
34
|
+
TypeValidate(Real)(56)
|
|
35
|
+
|
|
36
|
+
The distribution name is UniversalFunctions, while the Python import package is UF.
|
|
37
|
+
|
|
38
|
+
## Package Structure
|
|
39
|
+
|
|
40
|
+
UniversalFunctions is organized into several foundational components:
|
|
41
|
+
|
|
42
|
+
### UF
|
|
43
|
+
|
|
44
|
+
The main package containing the core infrastructure and utilities.
|
|
45
|
+
|
|
46
|
+
### UF.Validators
|
|
47
|
+
|
|
48
|
+
Provides runtime validation utilities and validation classes for enforcing types, ranges, relationships, and other constraints.
|
|
49
|
+
|
|
50
|
+
#### Notable components include:
|
|
51
|
+
|
|
52
|
+
* ``TypeValidate``
|
|
53
|
+
* ``TupleValidate``
|
|
54
|
+
* ``LessThan``
|
|
55
|
+
* ``LessOrEqual``
|
|
56
|
+
* ``GreaterOrEqual``
|
|
57
|
+
* ``Positive``
|
|
58
|
+
* ``real_validate``
|
|
59
|
+
* ``str_validate``
|
|
60
|
+
* Callable validation utilities
|
|
61
|
+
|
|
62
|
+
The validation system also contains the Quantum Turtle Mechanics (QTM) validation infrastructure used for more structured runtime validation.
|
|
63
|
+
|
|
64
|
+
### Decorators
|
|
65
|
+
|
|
66
|
+
UniversalFunctions provides reusable decorator infrastructure, including decorator composition and class-level decorator utilities.
|
|
67
|
+
|
|
68
|
+
#### Notable components include:
|
|
69
|
+
|
|
70
|
+
* ``class_decorator``
|
|
71
|
+
* ``deco_superposition``
|
|
72
|
+
* ``cls_deco_superposition``
|
|
73
|
+
* Quantum Turtle Mechanics validation decorators
|
|
74
|
+
|
|
75
|
+
### Helper Functions
|
|
76
|
+
|
|
77
|
+
The library contains foundational helper functions intended to be reused by higher-level applications and APIs.
|
|
78
|
+
|
|
79
|
+
These utilities include mathematical and general-purpose functionality used throughout the surrounding ecosystem.
|
|
80
|
+
|
|
81
|
+
### Design Philosophy
|
|
82
|
+
|
|
83
|
+
UniversalFunctions exists as a foundational layer rather than as a standalone end-user application.
|
|
84
|
+
|
|
85
|
+
Its purpose is to provide reusable infrastructure that higher-level projects can build upon without duplicating common functionality.
|
|
86
|
+
|
|
87
|
+
The architecture separates foundational utilities from domain-specific functionality, allowing projects to depend on UniversalFunctions independently.
|
|
88
|
+
|
|
89
|
+
In the GeometricalDomination ecosystem, UniversalFunctions acts as the bridge between the underlying infrastructure and higher-level systems.
|
|
90
|
+
|
|
91
|
+
### Quantum Dimension
|
|
92
|
+
|
|
93
|
+
UniversalFunctions contains several architectural concepts inspired by the internal terminology of GeometricalDomination.
|
|
94
|
+
|
|
95
|
+
#### These include:
|
|
96
|
+
|
|
97
|
+
* Quantum Turtle Mechanics (QTM)
|
|
98
|
+
* Classical Turtle Mechanics (CTM)
|
|
99
|
+
* Quantum Turtle String Theory (QTST)
|
|
100
|
+
* The Quantum Dimension
|
|
101
|
+
|
|
102
|
+
These names describe architectural concepts within the project's validation and infrastructure systems.
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
Python 3.14 or later
|
|
106
|
+
|
|
107
|
+
UniversalFunctions is designed for modern Python and makes use of contemporary Python typing and language features.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
Clone the repository and install it in editable mode:
|
|
112
|
+
|
|
113
|
+
git clone https://github.com/Mangosaber2026/UniversalFunctions.git
|
|
114
|
+
cd UniversalFunctions
|
|
115
|
+
pip install -e .
|
|
116
|
+
|
|
117
|
+
Editable installation allows changes to the source code to be reflected immediately without reinstalling the package.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
UniversalFunctions is distributed under the terms of the license included in this repository.
|
|
122
|
+
|
|
123
|
+
## Author
|
|
124
|
+
|
|
125
|
+
Miah M. Sabiq
|
|
126
|
+
|
|
127
|
+
UniversalFunctions is developed as an independent Python package and serves as foundational infrastructure for larger projects within the author's software ecosystem.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# UniversalFunctions
|
|
2
|
+
|
|
3
|
+
UniversalFunctions is a Python utility library providing foundational functions, validators, decorators, type utilities, and infrastructure for building structured Python applications and domain-specific APIs.
|
|
4
|
+
|
|
5
|
+
It is designed as an independent foundation layer that can be used on its own or as a dependency of larger projects such as GeometricalDomination.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install UniversalFunctions from PyPI:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install UniversalFunctions
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The package requires Python 3.14 or later.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
UniversalFunctions is imported through the UF Python package:
|
|
20
|
+
|
|
21
|
+
from UF.Validators import TypeValidate
|
|
22
|
+
from numbers import Real
|
|
23
|
+
|
|
24
|
+
TypeValidate(Real)(56)
|
|
25
|
+
|
|
26
|
+
The distribution name is UniversalFunctions, while the Python import package is UF.
|
|
27
|
+
|
|
28
|
+
## Package Structure
|
|
29
|
+
|
|
30
|
+
UniversalFunctions is organized into several foundational components:
|
|
31
|
+
|
|
32
|
+
### UF
|
|
33
|
+
|
|
34
|
+
The main package containing the core infrastructure and utilities.
|
|
35
|
+
|
|
36
|
+
### UF.Validators
|
|
37
|
+
|
|
38
|
+
Provides runtime validation utilities and validation classes for enforcing types, ranges, relationships, and other constraints.
|
|
39
|
+
|
|
40
|
+
#### Notable components include:
|
|
41
|
+
|
|
42
|
+
* ``TypeValidate``
|
|
43
|
+
* ``TupleValidate``
|
|
44
|
+
* ``LessThan``
|
|
45
|
+
* ``LessOrEqual``
|
|
46
|
+
* ``GreaterOrEqual``
|
|
47
|
+
* ``Positive``
|
|
48
|
+
* ``real_validate``
|
|
49
|
+
* ``str_validate``
|
|
50
|
+
* Callable validation utilities
|
|
51
|
+
|
|
52
|
+
The validation system also contains the Quantum Turtle Mechanics (QTM) validation infrastructure used for more structured runtime validation.
|
|
53
|
+
|
|
54
|
+
### Decorators
|
|
55
|
+
|
|
56
|
+
UniversalFunctions provides reusable decorator infrastructure, including decorator composition and class-level decorator utilities.
|
|
57
|
+
|
|
58
|
+
#### Notable components include:
|
|
59
|
+
|
|
60
|
+
* ``class_decorator``
|
|
61
|
+
* ``deco_superposition``
|
|
62
|
+
* ``cls_deco_superposition``
|
|
63
|
+
* Quantum Turtle Mechanics validation decorators
|
|
64
|
+
|
|
65
|
+
### Helper Functions
|
|
66
|
+
|
|
67
|
+
The library contains foundational helper functions intended to be reused by higher-level applications and APIs.
|
|
68
|
+
|
|
69
|
+
These utilities include mathematical and general-purpose functionality used throughout the surrounding ecosystem.
|
|
70
|
+
|
|
71
|
+
### Design Philosophy
|
|
72
|
+
|
|
73
|
+
UniversalFunctions exists as a foundational layer rather than as a standalone end-user application.
|
|
74
|
+
|
|
75
|
+
Its purpose is to provide reusable infrastructure that higher-level projects can build upon without duplicating common functionality.
|
|
76
|
+
|
|
77
|
+
The architecture separates foundational utilities from domain-specific functionality, allowing projects to depend on UniversalFunctions independently.
|
|
78
|
+
|
|
79
|
+
In the GeometricalDomination ecosystem, UniversalFunctions acts as the bridge between the underlying infrastructure and higher-level systems.
|
|
80
|
+
|
|
81
|
+
### Quantum Dimension
|
|
82
|
+
|
|
83
|
+
UniversalFunctions contains several architectural concepts inspired by the internal terminology of GeometricalDomination.
|
|
84
|
+
|
|
85
|
+
#### These include:
|
|
86
|
+
|
|
87
|
+
* Quantum Turtle Mechanics (QTM)
|
|
88
|
+
* Classical Turtle Mechanics (CTM)
|
|
89
|
+
* Quantum Turtle String Theory (QTST)
|
|
90
|
+
* The Quantum Dimension
|
|
91
|
+
|
|
92
|
+
These names describe architectural concepts within the project's validation and infrastructure systems.
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
Python 3.14 or later
|
|
96
|
+
|
|
97
|
+
UniversalFunctions is designed for modern Python and makes use of contemporary Python typing and language features.
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
Clone the repository and install it in editable mode:
|
|
102
|
+
|
|
103
|
+
git clone https://github.com/Mangosaber2026/UniversalFunctions.git
|
|
104
|
+
cd UniversalFunctions
|
|
105
|
+
pip install -e .
|
|
106
|
+
|
|
107
|
+
Editable installation allows changes to the source code to be reflected immediately without reinstalling the package.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
UniversalFunctions is distributed under the terms of the license included in this repository.
|
|
112
|
+
|
|
113
|
+
## Author
|
|
114
|
+
|
|
115
|
+
Miah M. Sabiq
|
|
116
|
+
|
|
117
|
+
UniversalFunctions is developed as an independent Python package and serves as foundational infrastructure for larger projects within the author's software ecosystem.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains a function that takes all functions in a class and make a dictionary with them.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from .Validators.QuantumFuncValidators import qtm_validation_decorator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@qtm_validation_decorator
|
|
10
|
+
def classes_to_dict(*classes: tuple[type, ...]) -> dict[str, Callable]:
|
|
11
|
+
"""
|
|
12
|
+
Extracts callable objects from the given classes and returns them
|
|
13
|
+
as a dictionary mapping their names to the corresponding objects
|
|
14
|
+
:param classes: Classes from which the callables are extracted
|
|
15
|
+
:return: Dictionary of callable names and their objects
|
|
16
|
+
"""
|
|
17
|
+
dictionary = {}
|
|
18
|
+
for cls in classes:
|
|
19
|
+
dictionary.update({
|
|
20
|
+
name: obj
|
|
21
|
+
for name, obj in vars(cls).items()
|
|
22
|
+
if callable(obj)
|
|
23
|
+
})
|
|
24
|
+
return dictionary
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains decorators which take any number of decorators and apply them to the function they are assigned to.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from .Validators.QuantumFuncValidators import qtm_validation_decorator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@qtm_validation_decorator
|
|
10
|
+
def cls_deco_superposition(*decorators: tuple[Callable, ...]) -> Callable:
|
|
11
|
+
"""
|
|
12
|
+
DECORATOR!! Creates a class decorator that applies the given decorator to every user defined function
|
|
13
|
+
:param decorator: provided decorator function
|
|
14
|
+
:return: a class decorator that transforms the class (& it's functions) and returns it
|
|
15
|
+
"""
|
|
16
|
+
deco_composer = deco_superposition(*decorators)
|
|
17
|
+
|
|
18
|
+
def inner(cls):
|
|
19
|
+
for name, func in vars(cls).items():
|
|
20
|
+
if callable(func) and not name.startswith("_"):
|
|
21
|
+
setattr(cls, name, deco_composer(func))
|
|
22
|
+
return cls
|
|
23
|
+
return inner
|
|
24
|
+
|
|
25
|
+
@qtm_validation_decorator
|
|
26
|
+
def deco_superposition(*decorators: tuple[Callable, ...]) -> Callable:
|
|
27
|
+
"""
|
|
28
|
+
DECORATOR! this decorator takes multiple decorators and applies them to the given function the same way python would naturally
|
|
29
|
+
:param decorators: decorator functions
|
|
30
|
+
:return: supplied function
|
|
31
|
+
"""
|
|
32
|
+
def inner_deco(func):
|
|
33
|
+
for decorator in reversed(decorators):
|
|
34
|
+
func = decorator(func)
|
|
35
|
+
|
|
36
|
+
return func
|
|
37
|
+
return inner_deco
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains an extremely important function: get_num, which takes a numerical value from the user.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from time import sleep as rest
|
|
6
|
+
from typing import overload, Literal
|
|
7
|
+
from numbers import Real
|
|
8
|
+
from .Validators.ValidationClasses import LessThan, str_validate, real_validate, TypeValidate, GreaterOrEqual, LessOrEqual
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type int_type = type[int]
|
|
12
|
+
type float_type = type[float]
|
|
13
|
+
|
|
14
|
+
@overload
|
|
15
|
+
def get_num(TYPE: int_type, entry: str, **options) -> int: ...
|
|
16
|
+
|
|
17
|
+
@overload
|
|
18
|
+
def get_num(TYPE: float_type, entry: str, **options) -> float: ...
|
|
19
|
+
|
|
20
|
+
def get_num(TYPE: float_type|int_type, entry: str, **options) -> Real:
|
|
21
|
+
"""
|
|
22
|
+
Gets a real numerical value from the user
|
|
23
|
+
|
|
24
|
+
:param TYPE: float or int; which type of value to check for
|
|
25
|
+
:param entry: str; input string
|
|
26
|
+
:param options: MAX, MIN, store
|
|
27
|
+
:return: float or int
|
|
28
|
+
"""
|
|
29
|
+
if TYPE not in (int, float):
|
|
30
|
+
raise TypeError("TYPE must be type float or int")
|
|
31
|
+
|
|
32
|
+
str_validate()(entry, name="entry")
|
|
33
|
+
|
|
34
|
+
for item in ("MAX", "MIN"):
|
|
35
|
+
if item in options:
|
|
36
|
+
real_validate()(options[item], name=item)
|
|
37
|
+
|
|
38
|
+
if "MIN" in options and "MAX" in options:
|
|
39
|
+
LessThan(options["MAX"])(options["MIN"])
|
|
40
|
+
|
|
41
|
+
if "store" in options:
|
|
42
|
+
TypeValidate((Real, type(None)))(options["store"], name="store")
|
|
43
|
+
|
|
44
|
+
if (
|
|
45
|
+
"store" in options
|
|
46
|
+
and "MIN" in options
|
|
47
|
+
and "MAX" in options
|
|
48
|
+
and options["store"] is not None
|
|
49
|
+
and (options["MIN"] > options["store"] or options["MAX"] < options["store"])
|
|
50
|
+
):
|
|
51
|
+
raise ValueError("Stored value must be between MIN and MAX!")
|
|
52
|
+
|
|
53
|
+
while True:
|
|
54
|
+
try:
|
|
55
|
+
if "store" in options:
|
|
56
|
+
reserve: str = input(entry)
|
|
57
|
+
if reserve == "ans":
|
|
58
|
+
if isinstance(options["store"], Real):
|
|
59
|
+
value: Real = options["store"]
|
|
60
|
+
else:
|
|
61
|
+
print("\nThere is no value stored yet!")
|
|
62
|
+
continue
|
|
63
|
+
else:
|
|
64
|
+
value: Real = TYPE(reserve)
|
|
65
|
+
else:
|
|
66
|
+
value: Real = TYPE(input(entry))
|
|
67
|
+
value_name: Literal["value"] = "value"
|
|
68
|
+
|
|
69
|
+
if "MIN" in options and "MAX" in options:
|
|
70
|
+
GreaterOrEqual(options["MIN"])(value, name=value_name)
|
|
71
|
+
LessOrEqual(options["MAX"])(value, name=value_name)
|
|
72
|
+
|
|
73
|
+
elif "MIN" in options:
|
|
74
|
+
GreaterOrEqual(options["MIN"])(value, name=value_name)
|
|
75
|
+
|
|
76
|
+
elif "MAX" in options:
|
|
77
|
+
LessOrEqual(options["MAX"])(value, name=value_name)
|
|
78
|
+
|
|
79
|
+
elif "store" in options:
|
|
80
|
+
options["store"] = value
|
|
81
|
+
return value
|
|
82
|
+
except ValueError as error:
|
|
83
|
+
print(error)
|
|
84
|
+
rest(1.5)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains the HelperFunctions class which provides a collection of reusable helper functions
|
|
3
|
+
so that the user can easily use them without having to write the code for them again.
|
|
4
|
+
|
|
5
|
+
Some other functions:
|
|
6
|
+
|
|
7
|
+
sine -> calculates sine value
|
|
8
|
+
|
|
9
|
+
range_f -> acts like the conventional range function except for that this takes rational inputs
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from typing import Any, Annotated
|
|
13
|
+
from collections.abc import Generator
|
|
14
|
+
from math import sqrt, sin, radians, cos
|
|
15
|
+
from .GetVariable import get_num
|
|
16
|
+
from .DecoratorArchive import cls_deco_superposition
|
|
17
|
+
from .ClassToDict import classes_to_dict
|
|
18
|
+
from .Validators.QuantumFuncValidators import qtm_validation_decorator
|
|
19
|
+
from .Validators.ValidationClasses import LessThan, Positive
|
|
20
|
+
from numbers import Real
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@cls_deco_superposition(staticmethod)
|
|
24
|
+
class HelperFunctions:
|
|
25
|
+
|
|
26
|
+
def intervals_f() -> Real:
|
|
27
|
+
"""Asks the user for rational intervals"""
|
|
28
|
+
interval_num: float = get_num(float, "Enter intervals(ℚ>0): ", MIN=0)
|
|
29
|
+
return interval_num
|
|
30
|
+
|
|
31
|
+
def length_float() -> Real:
|
|
32
|
+
"""Asks the user for rational lengths"""
|
|
33
|
+
length: float = get_num(float, "Enter side length(ℚ>0): ", MIN=0)
|
|
34
|
+
return length
|
|
35
|
+
|
|
36
|
+
def radius_float() -> Real:
|
|
37
|
+
"""Asks the user for rational radius"""
|
|
38
|
+
radius: float = get_num(float, "Enter radius(ℚ>0): ", MIN=0)
|
|
39
|
+
return radius
|
|
40
|
+
|
|
41
|
+
def object_num() -> int:
|
|
42
|
+
"""Asks the user for the number of objects"""
|
|
43
|
+
object_count: int = get_num(int, "Enter object count(ℕ≥1): ", MIN=1)
|
|
44
|
+
return object_count
|
|
45
|
+
|
|
46
|
+
def sides_num() -> int:
|
|
47
|
+
"""Asks the user for the number of sides"""
|
|
48
|
+
sides: int = get_num(int, "Enter sides count(ℕ≥3): ", MIN=3)
|
|
49
|
+
return sides
|
|
50
|
+
|
|
51
|
+
def row_num() -> int:
|
|
52
|
+
"""Asks the user for the number of rows"""
|
|
53
|
+
row_count: int = get_num(int, "Enter row count(ℕ≥1): ", MIN=1)
|
|
54
|
+
return row_count
|
|
55
|
+
|
|
56
|
+
def row_pair() -> int:
|
|
57
|
+
"""Asks the user for the number of pairs of rows"""
|
|
58
|
+
row_count: int = get_num(int, "Enter row pairs count(ℕ≥1): ", MIN=1)
|
|
59
|
+
return row_count
|
|
60
|
+
|
|
61
|
+
@qtm_validation_decorator
|
|
62
|
+
def diameter_sq(length: Annotated[Real, Positive()]) -> tuple[Real,Real]:
|
|
63
|
+
"""
|
|
64
|
+
Calculates the diameter of a square with given length
|
|
65
|
+
:return: diameter, diameter/2
|
|
66
|
+
"""
|
|
67
|
+
if length <= 0:
|
|
68
|
+
raise ValueError("Length must be greater than 0")
|
|
69
|
+
|
|
70
|
+
diameter: float = length*sqrt(2); d_half: Real = diameter / 2
|
|
71
|
+
return diameter, d_half
|
|
72
|
+
|
|
73
|
+
def x_ft() -> Real:
|
|
74
|
+
"""Asks the user for the x value (on the coordinate system)"""
|
|
75
|
+
x_val: float = get_num(float, "Enter x value: ")
|
|
76
|
+
return x_val
|
|
77
|
+
|
|
78
|
+
def y_ft() -> Real:
|
|
79
|
+
"""Asks the user for the y value (on the coordinate system)"""
|
|
80
|
+
y_val: float = get_num(float, "Enter y value: ")
|
|
81
|
+
return y_val
|
|
82
|
+
|
|
83
|
+
def list_helperfunctions() -> dict:
|
|
84
|
+
"""
|
|
85
|
+
Creates a dictionary with all helper functions
|
|
86
|
+
:return: dictionary
|
|
87
|
+
"""
|
|
88
|
+
return classes_to_dict(HelperFunctions)
|
|
89
|
+
|
|
90
|
+
helper = HelperFunctions
|
|
91
|
+
|
|
92
|
+
@qtm_validation_decorator
|
|
93
|
+
def sine(angle: Real) -> Real:
|
|
94
|
+
"""
|
|
95
|
+
Calculates the sine of a given angle
|
|
96
|
+
:param angle: value required in degrees
|
|
97
|
+
:return: sine value
|
|
98
|
+
"""
|
|
99
|
+
return sin(radians(angle))
|
|
100
|
+
|
|
101
|
+
@qtm_validation_decorator
|
|
102
|
+
def cosine(angle: Real) -> Real:
|
|
103
|
+
"""
|
|
104
|
+
Calculates the cosine of a given angle
|
|
105
|
+
:param angle: value required in degrees
|
|
106
|
+
:return: cosine value
|
|
107
|
+
"""
|
|
108
|
+
return cos(radians(angle))
|
|
109
|
+
|
|
110
|
+
@qtm_validation_decorator
|
|
111
|
+
def range_f(start: Real, stop: Real, step: Annotated[Real, Positive()]) -> Generator[Real,Any,None]:
|
|
112
|
+
"""
|
|
113
|
+
Lets the user choose Real inputs for start, stop and step
|
|
114
|
+
:param start: start value; Real number
|
|
115
|
+
:param stop: stop value; Real number >= start
|
|
116
|
+
:param step: step value; Real number > 0
|
|
117
|
+
"""
|
|
118
|
+
LessThan(stop)(start)
|
|
119
|
+
|
|
120
|
+
while start < stop:
|
|
121
|
+
yield start
|
|
122
|
+
start += step
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains an extremely important function: get_str, which takes a string input from the user.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from time import sleep as rest
|
|
6
|
+
from .Validators.ValidationClasses import TypeValidate, str_validate
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_str(str_input: str, *check_values) -> str:
|
|
10
|
+
"""
|
|
11
|
+
Checks whether the input string matches the allowed values (*check_values)
|
|
12
|
+
:param str_input: input string
|
|
13
|
+
:param check_values: allowed string values (all lowercase), options: str, dict, list, tuple
|
|
14
|
+
"""
|
|
15
|
+
str_validate()(str_input, name="str_input")
|
|
16
|
+
while True:
|
|
17
|
+
value: str = input(str_input).lower()
|
|
18
|
+
for check in check_values:
|
|
19
|
+
TypeValidate((str, dict, list, tuple))(check, name="check")
|
|
20
|
+
if isinstance(check, str) and check == value:
|
|
21
|
+
return value
|
|
22
|
+
elif isinstance(check, (dict, list, tuple)) and value in check:
|
|
23
|
+
return value
|
|
24
|
+
print("Enter something VALID!")
|
|
25
|
+
rest(1.5)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains a validator and decorator from the QTM Dimension.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from inspect import signature
|
|
7
|
+
from typing import get_origin, Annotated
|
|
8
|
+
from .QuantumValidators import qtm_lt_validator, qtm_constr_validator
|
|
9
|
+
from functools import wraps
|
|
10
|
+
from .ValidationClasses import TypeValidate
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def qtm_func_validator(func: Callable, *args, **kwargs) -> bool:
|
|
14
|
+
"""
|
|
15
|
+
Takes a function and compares the entered value with the expected type
|
|
16
|
+
:param func: given function
|
|
17
|
+
:param args: arguments
|
|
18
|
+
:param kwargs: keyword arguments
|
|
19
|
+
:return: True if the provided argument matches the expected type, raises an error if not
|
|
20
|
+
"""
|
|
21
|
+
TypeValidate(Callable)(func, name=func.__name__)
|
|
22
|
+
sig = signature(func)
|
|
23
|
+
bound = sig.bind(*args, **kwargs)
|
|
24
|
+
|
|
25
|
+
for name, value in bound.arguments.items():
|
|
26
|
+
parameter = sig.parameters[name]
|
|
27
|
+
type_ = parameter.annotation
|
|
28
|
+
|
|
29
|
+
if type_ is parameter.empty:
|
|
30
|
+
continue
|
|
31
|
+
|
|
32
|
+
origin = get_origin(type_)
|
|
33
|
+
|
|
34
|
+
if origin in (list, tuple):
|
|
35
|
+
qtm_lt_validator(value, type_, name)
|
|
36
|
+
|
|
37
|
+
elif origin is Annotated:
|
|
38
|
+
qtm_constr_validator(value, type_, name)
|
|
39
|
+
|
|
40
|
+
else:
|
|
41
|
+
TypeValidate(type_)(value, name=name)
|
|
42
|
+
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
def qtm_validation_decorator(func: Callable) -> Callable:
|
|
46
|
+
"""
|
|
47
|
+
DECORATOR!
|
|
48
|
+
|
|
49
|
+
Decorates a function with the quantum function validator and returns the function
|
|
50
|
+
:param func: provided function
|
|
51
|
+
:return: validated function
|
|
52
|
+
"""
|
|
53
|
+
TypeValidate(Callable)(func, name=func.__name__)
|
|
54
|
+
|
|
55
|
+
@wraps(func)
|
|
56
|
+
def wrapper(*args, **kwargs):
|
|
57
|
+
qtm_func_validator(func, *args, **kwargs)
|
|
58
|
+
return func(*args, **kwargs)
|
|
59
|
+
return wrapper
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains type validators for list and tuple which belong to the QTM Dimension.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, get_args, get_origin, Annotated
|
|
6
|
+
from .ValidationClasses import TypeValidate
|
|
7
|
+
|
|
8
|
+
def qtm_lt_validator(value: list[Any] | tuple[Any, ...], TYPE: Any, name: str) -> bool:
|
|
9
|
+
"""
|
|
10
|
+
Takes a list of ONE specific element and validates its contents against the expected type
|
|
11
|
+
:param value: list of elements
|
|
12
|
+
:param TYPE: list[expected type]
|
|
13
|
+
:param name: name of value
|
|
14
|
+
:return: True if the contents of value satisfy the expected type
|
|
15
|
+
"""
|
|
16
|
+
origin = get_origin(TYPE)
|
|
17
|
+
if origin not in (list, tuple):
|
|
18
|
+
raise TypeError(f"{TYPE} must be a list or tuple for a specific type! e.g. list[int]")
|
|
19
|
+
|
|
20
|
+
TypeValidate(origin)(value)
|
|
21
|
+
|
|
22
|
+
element_type = get_args(TYPE)
|
|
23
|
+
if origin is list:
|
|
24
|
+
if len(element_type) != 1:
|
|
25
|
+
raise TypeError("TYPE must contain only ONE type!")
|
|
26
|
+
|
|
27
|
+
elif origin is tuple:
|
|
28
|
+
if len(element_type) != 2 or element_type[1] is not Ellipsis:
|
|
29
|
+
raise TypeError("tuple TYPE must contain only ONE type with the form tuple[T, ...]!")
|
|
30
|
+
|
|
31
|
+
for index, element in enumerate(value):
|
|
32
|
+
if not isinstance(element, element_type[0]):
|
|
33
|
+
raise TypeError(f"{name}[{index}] must be of type {element_type[0].__name__!r}!")
|
|
34
|
+
|
|
35
|
+
return True
|
|
36
|
+
|
|
37
|
+
def qtm_constr_validator(value, annotation, name) -> bool:
|
|
38
|
+
"""
|
|
39
|
+
Takes a value and its annotation and compares it against the expected type
|
|
40
|
+
:param value: given value
|
|
41
|
+
:param annotation: given annotation
|
|
42
|
+
:param name: name of value
|
|
43
|
+
:return: True, if validation succeeds
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
if get_origin(annotation) is not Annotated:
|
|
47
|
+
raise TypeError(f"{annotation} is not an Annotated type!")
|
|
48
|
+
|
|
49
|
+
type_obj, *constraints = get_args(annotation)
|
|
50
|
+
|
|
51
|
+
TypeValidate(type_obj)(value, name=name)
|
|
52
|
+
|
|
53
|
+
for constraint in constraints:
|
|
54
|
+
constraint(value)
|
|
55
|
+
|
|
56
|
+
return True
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from numbers import Real
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TypeValidate:
|
|
6
|
+
"""Makes sure the entered value is of correct type"""
|
|
7
|
+
def __init__(self, expected: type | tuple[type, ...]):
|
|
8
|
+
"""Makes sure the entered value is a type object"""
|
|
9
|
+
if isinstance(expected, tuple):
|
|
10
|
+
for item in expected:
|
|
11
|
+
if not isinstance(item, type):
|
|
12
|
+
raise TypeError(f"Entered value {item!r} is not a type object!")
|
|
13
|
+
self.expected = expected
|
|
14
|
+
|
|
15
|
+
elif isinstance(expected, type):
|
|
16
|
+
self.expected = expected
|
|
17
|
+
|
|
18
|
+
else:
|
|
19
|
+
raise TypeError(f"Parameter 'expected' MUST be a type object or a tuple of type objects!")
|
|
20
|
+
def __call__(self, value: Any, name: str | None = None) -> bool:
|
|
21
|
+
"""Validates the entered value, expected to be of expected type"""
|
|
22
|
+
if name is not None and not isinstance(name, str):
|
|
23
|
+
raise TypeError(f"Parameter 'name' MUST be a string object!")
|
|
24
|
+
|
|
25
|
+
if not isinstance(value, self.expected):
|
|
26
|
+
if type(self.expected) is type:
|
|
27
|
+
if name is not None:
|
|
28
|
+
raise TypeError(f"{name} is not of expected type {self.expected.__name__!r}!")
|
|
29
|
+
raise TypeError(f"{value!r} is not of expected type {self.expected.__name__!r}!")
|
|
30
|
+
elif type(self.expected) is tuple:
|
|
31
|
+
if name is not None:
|
|
32
|
+
raise TypeError(f"{name} is not of expected type {self.expected!r}!")
|
|
33
|
+
raise TypeError(f"{value!r} is not of expected type {self.expected!r}!")
|
|
34
|
+
return True
|
|
35
|
+
|
|
36
|
+
def int_validate() -> TypeValidate:
|
|
37
|
+
"""Makes sure the entered value is an integer with TypeValidate"""
|
|
38
|
+
return TypeValidate(int)
|
|
39
|
+
|
|
40
|
+
def str_validate() -> TypeValidate:
|
|
41
|
+
"""Makes sure the entered value is a string with TypeValidate"""
|
|
42
|
+
return TypeValidate(str)
|
|
43
|
+
|
|
44
|
+
def real_validate() -> TypeValidate:
|
|
45
|
+
"""Makes sure the entered value is a real number with TypeValidate"""
|
|
46
|
+
return TypeValidate(Real)
|
|
47
|
+
|
|
48
|
+
class RealValidationParent:
|
|
49
|
+
def __init__(self, expected: Real) -> None:
|
|
50
|
+
self._validator = real_validate()
|
|
51
|
+
self._validator(expected)
|
|
52
|
+
self.expected = expected
|
|
53
|
+
|
|
54
|
+
class Positive:
|
|
55
|
+
"""Makes sure the entered value is positive"""
|
|
56
|
+
def __call__(self, value: Real, name: str|None = None) -> bool:
|
|
57
|
+
"""Validates the entered value, expected to be positive (0 included)"""
|
|
58
|
+
if name is not None:
|
|
59
|
+
real_validate()(value, name)
|
|
60
|
+
else:
|
|
61
|
+
real_validate()(value)
|
|
62
|
+
if value <= 0:
|
|
63
|
+
raise ValueError(f"Entered value is expected to be greater than 0!")
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
class LessThan(RealValidationParent):
|
|
67
|
+
"""Makes sure the entered value is less than expected value"""
|
|
68
|
+
def __call__(self, value: Real, name: str|None = None) -> bool:
|
|
69
|
+
"""Validates the entered value, expected to be less than expected value"""
|
|
70
|
+
self._validator(value)
|
|
71
|
+
if name is not None:
|
|
72
|
+
str_validate()(name, "name")
|
|
73
|
+
if value >= self.expected:
|
|
74
|
+
raise ValueError(f"Entered value ({name}) is expected to be less than {self.expected!r}!")
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
class LessOrEqual(RealValidationParent):
|
|
78
|
+
"""Makes sure the entered value is less than or equal to expected value"""
|
|
79
|
+
def __call__(self, value: Real, name: str|None = None) -> bool:
|
|
80
|
+
"""Validates the entered value, expected to be less than or equal to expected value"""
|
|
81
|
+
self._validator(value)
|
|
82
|
+
if name is not None:
|
|
83
|
+
str_validate()(name, "name")
|
|
84
|
+
if value > self.expected:
|
|
85
|
+
raise ValueError(f"Entered value ({name}) is expected to be less than or equal to {self.expected!r}!")
|
|
86
|
+
return True
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class GreaterThan(RealValidationParent):
|
|
90
|
+
"""Makes sure the entered value is greater than expected value"""
|
|
91
|
+
def __call__(self, value: Real, name: str|None = None) -> bool:
|
|
92
|
+
"""Validates the entered value, expected to be greater than expected value"""
|
|
93
|
+
self._validator(value)
|
|
94
|
+
if name is not None:
|
|
95
|
+
str_validate()(name, "name")
|
|
96
|
+
if self.expected >= value:
|
|
97
|
+
raise ValueError(f"Entered value ({name}) is expected to be greater than {self.expected!r}!")
|
|
98
|
+
return True
|
|
99
|
+
|
|
100
|
+
class GreaterOrEqual(RealValidationParent):
|
|
101
|
+
"""Makes sure the entered value is greater than or equal to expected value"""
|
|
102
|
+
def __call__(self, value: Real, name: str|None = None) -> bool:
|
|
103
|
+
"""Validates the entered value, expected to be greater than or equal to expected value"""
|
|
104
|
+
self._validator(value)
|
|
105
|
+
if name is not None:
|
|
106
|
+
str_validate()(name, "name")
|
|
107
|
+
if self.expected > value:
|
|
108
|
+
raise ValueError(f"Entered value ({name}) is expected to be greater than or equal to {self.expected!r}!")
|
|
109
|
+
return True
|
|
110
|
+
|
|
111
|
+
class TupleValidate:
|
|
112
|
+
"""Makes sure the entered value is a tuple of any value"""
|
|
113
|
+
def __init__(self, *expected: type) -> None:
|
|
114
|
+
"""Validates and sets the tuple to a variable"""
|
|
115
|
+
for item in expected:
|
|
116
|
+
TypeValidate(type)(item)
|
|
117
|
+
self.expected = expected
|
|
118
|
+
|
|
119
|
+
def __call__(self, value: tuple, name: str|None = None) -> bool:
|
|
120
|
+
"""Validates the entered value, expected to be a tuple of expected value/s"""
|
|
121
|
+
TypeValidate(tuple)(value)
|
|
122
|
+
if name is not None:
|
|
123
|
+
str_validate()(name, "name")
|
|
124
|
+
if len(self.expected) != len(value):
|
|
125
|
+
raise ValueError(f"Entered value ({name}) must have the same number of elements as the provided expected tuple!")
|
|
126
|
+
for expected_type, actual_value in zip(self.expected, value):
|
|
127
|
+
TypeValidate(expected_type)(actual_value)
|
|
128
|
+
return True
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Welcome to the Quantum/Classical Dimension!
|
|
3
|
+
|
|
4
|
+
Here you will find some of the most sensitive pieces of code, however you may gladly use the validators,
|
|
5
|
+
no matter quantum or classic.
|
|
6
|
+
But whatever you do, DO NOT change the actual functions, otherwise, the entire
|
|
7
|
+
software will cease to function.
|
|
8
|
+
Almost every single other module in this software relies on the quantum validation centers, if anything is changed
|
|
9
|
+
inappropriately, the user shall face serious consequences.
|
|
10
|
+
|
|
11
|
+
Abbreviations:
|
|
12
|
+
qtm = Quantum Turtle Mechanics
|
|
13
|
+
ctm = Classical Turtle Mechanics
|
|
14
|
+
|
|
15
|
+
All functions with qtm belong to the Quantum Dimension whereas all functions with ctm belong to the Classical Dimension
|
|
16
|
+
"""
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Welcome to the bridge between the Quantum Dimension and Python
|
|
3
|
+
|
|
4
|
+
Here you will be able to explore the lower floors of the upper software!
|
|
5
|
+
|
|
6
|
+
Nevertheless, be aware, even though you may use the reusable functions as much as you want,
|
|
7
|
+
not only do you have to credit the author, but also make sure you DO NOT change anything unless you
|
|
8
|
+
have become an official contributor.
|
|
9
|
+
|
|
10
|
+
__________ Quantum Dimension __________
|
|
11
|
+
|
|
12
|
+
Quantum Turtle Mechanics: an extremely specialized sector where the author decided to implement
|
|
13
|
+
functions such as qtm_validation_decorator. This is a decorator which one can apply to a function to
|
|
14
|
+
make sure the Wave Function of each entered variable collapses into one.
|
|
15
|
+
|
|
16
|
+
Classical Turtle Mechanics: also a specialized sector, where the functions are closer to 'normal' Python
|
|
17
|
+
functions. These are still extremely important to the rest of the main package and must therefore
|
|
18
|
+
not be changed!
|
|
19
|
+
"""
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: UniversalFunctions
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python utility library providing foundational functions, validators, and infrastructure.
|
|
5
|
+
Author-email: "Miah M. Sabiq" <miah.sabiq@gibs.at>
|
|
6
|
+
Requires-Python: >=3.14
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# UniversalFunctions
|
|
12
|
+
|
|
13
|
+
UniversalFunctions is a Python utility library providing foundational functions, validators, decorators, type utilities, and infrastructure for building structured Python applications and domain-specific APIs.
|
|
14
|
+
|
|
15
|
+
It is designed as an independent foundation layer that can be used on its own or as a dependency of larger projects such as GeometricalDomination.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install UniversalFunctions from PyPI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install UniversalFunctions
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package requires Python 3.14 or later.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
UniversalFunctions is imported through the UF Python package:
|
|
30
|
+
|
|
31
|
+
from UF.Validators import TypeValidate
|
|
32
|
+
from numbers import Real
|
|
33
|
+
|
|
34
|
+
TypeValidate(Real)(56)
|
|
35
|
+
|
|
36
|
+
The distribution name is UniversalFunctions, while the Python import package is UF.
|
|
37
|
+
|
|
38
|
+
## Package Structure
|
|
39
|
+
|
|
40
|
+
UniversalFunctions is organized into several foundational components:
|
|
41
|
+
|
|
42
|
+
### UF
|
|
43
|
+
|
|
44
|
+
The main package containing the core infrastructure and utilities.
|
|
45
|
+
|
|
46
|
+
### UF.Validators
|
|
47
|
+
|
|
48
|
+
Provides runtime validation utilities and validation classes for enforcing types, ranges, relationships, and other constraints.
|
|
49
|
+
|
|
50
|
+
#### Notable components include:
|
|
51
|
+
|
|
52
|
+
* ``TypeValidate``
|
|
53
|
+
* ``TupleValidate``
|
|
54
|
+
* ``LessThan``
|
|
55
|
+
* ``LessOrEqual``
|
|
56
|
+
* ``GreaterOrEqual``
|
|
57
|
+
* ``Positive``
|
|
58
|
+
* ``real_validate``
|
|
59
|
+
* ``str_validate``
|
|
60
|
+
* Callable validation utilities
|
|
61
|
+
|
|
62
|
+
The validation system also contains the Quantum Turtle Mechanics (QTM) validation infrastructure used for more structured runtime validation.
|
|
63
|
+
|
|
64
|
+
### Decorators
|
|
65
|
+
|
|
66
|
+
UniversalFunctions provides reusable decorator infrastructure, including decorator composition and class-level decorator utilities.
|
|
67
|
+
|
|
68
|
+
#### Notable components include:
|
|
69
|
+
|
|
70
|
+
* ``class_decorator``
|
|
71
|
+
* ``deco_superposition``
|
|
72
|
+
* ``cls_deco_superposition``
|
|
73
|
+
* Quantum Turtle Mechanics validation decorators
|
|
74
|
+
|
|
75
|
+
### Helper Functions
|
|
76
|
+
|
|
77
|
+
The library contains foundational helper functions intended to be reused by higher-level applications and APIs.
|
|
78
|
+
|
|
79
|
+
These utilities include mathematical and general-purpose functionality used throughout the surrounding ecosystem.
|
|
80
|
+
|
|
81
|
+
### Design Philosophy
|
|
82
|
+
|
|
83
|
+
UniversalFunctions exists as a foundational layer rather than as a standalone end-user application.
|
|
84
|
+
|
|
85
|
+
Its purpose is to provide reusable infrastructure that higher-level projects can build upon without duplicating common functionality.
|
|
86
|
+
|
|
87
|
+
The architecture separates foundational utilities from domain-specific functionality, allowing projects to depend on UniversalFunctions independently.
|
|
88
|
+
|
|
89
|
+
In the GeometricalDomination ecosystem, UniversalFunctions acts as the bridge between the underlying infrastructure and higher-level systems.
|
|
90
|
+
|
|
91
|
+
### Quantum Dimension
|
|
92
|
+
|
|
93
|
+
UniversalFunctions contains several architectural concepts inspired by the internal terminology of GeometricalDomination.
|
|
94
|
+
|
|
95
|
+
#### These include:
|
|
96
|
+
|
|
97
|
+
* Quantum Turtle Mechanics (QTM)
|
|
98
|
+
* Classical Turtle Mechanics (CTM)
|
|
99
|
+
* Quantum Turtle String Theory (QTST)
|
|
100
|
+
* The Quantum Dimension
|
|
101
|
+
|
|
102
|
+
These names describe architectural concepts within the project's validation and infrastructure systems.
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
Python 3.14 or later
|
|
106
|
+
|
|
107
|
+
UniversalFunctions is designed for modern Python and makes use of contemporary Python typing and language features.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
Clone the repository and install it in editable mode:
|
|
112
|
+
|
|
113
|
+
git clone https://github.com/Mangosaber2026/UniversalFunctions.git
|
|
114
|
+
cd UniversalFunctions
|
|
115
|
+
pip install -e .
|
|
116
|
+
|
|
117
|
+
Editable installation allows changes to the source code to be reflected immediately without reinstalling the package.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
UniversalFunctions is distributed under the terms of the license included in this repository.
|
|
122
|
+
|
|
123
|
+
## Author
|
|
124
|
+
|
|
125
|
+
Miah M. Sabiq
|
|
126
|
+
|
|
127
|
+
UniversalFunctions is developed as an independent Python package and serves as foundational infrastructure for larger projects within the author's software ecosystem.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
UF/ClassToDict.py
|
|
5
|
+
UF/DecoratorArchive.py
|
|
6
|
+
UF/GetVariable.py
|
|
7
|
+
UF/HelperFunctions.py
|
|
8
|
+
UF/StringCheck.py
|
|
9
|
+
UF/__init__.py
|
|
10
|
+
UF/Validators/QuantumFuncValidators.py
|
|
11
|
+
UF/Validators/QuantumValidators.py
|
|
12
|
+
UF/Validators/ValidationClasses.py
|
|
13
|
+
UF/Validators/__init__.py
|
|
14
|
+
UniversalFunctions.egg-info/PKG-INFO
|
|
15
|
+
UniversalFunctions.egg-info/SOURCES.txt
|
|
16
|
+
UniversalFunctions.egg-info/dependency_links.txt
|
|
17
|
+
UniversalFunctions.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
UF
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "UniversalFunctions"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Python utility library providing foundational functions, validators, and infrastructure."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14"
|
|
11
|
+
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Miah M. Sabiq", email = "miah.sabiq@gibs.at"}
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[tool.setuptools.packages.find]
|
|
17
|
+
include = [
|
|
18
|
+
"UF*",
|
|
19
|
+
]
|