abstract-math 0.0.0.12__tar.gz → 0.0.0.47__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.
Files changed (35) hide show
  1. abstract_math-0.0.0.47/PKG-INFO +81 -0
  2. abstract_math-0.0.0.47/README.md +62 -0
  3. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/setup.py +1 -1
  4. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/src/abstract_math/__init__.py +1 -0
  5. abstract_math-0.0.0.47/src/abstract_math/createflask.py +4 -0
  6. abstract_math-0.0.0.47/src/abstract_math/derive_tokens.py +144 -0
  7. abstract_math-0.0.0.47/src/abstract_math/flask_scripts/__init__.py +0 -0
  8. abstract_math-0.0.0.47/src/abstract_math/flask_scripts/flask_utils.py +665 -0
  9. abstract_math-0.0.0.47/src/abstract_math/safe_math.py +207 -0
  10. abstract_math-0.0.0.47/src/abstract_math/solar_math/__init__.py +2 -0
  11. abstract_math-0.0.0.47/src/abstract_math/solar_math/flask_utils.py +11 -0
  12. abstract_math-0.0.0.47/src/abstract_math/solar_math/main.py +280 -0
  13. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/__init__.py +4 -0
  14. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/constants/__init__.py +30 -0
  15. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/constants/distance_constants.py +74 -0
  16. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/constants/planet_constants.py +164 -0
  17. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/constants/time_constants.py +60 -0
  18. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/imports.py +5 -0
  19. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/utils/__init__.py +3 -0
  20. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/utils/escape_velocity.py +145 -0
  21. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/utils/geometry_utils.py +104 -0
  22. abstract_math-0.0.0.47/src/abstract_math/solar_math/src/utils/velocity_utils.py +74 -0
  23. abstract_math-0.0.0.47/src/abstract_math.egg-info/PKG-INFO +81 -0
  24. abstract_math-0.0.0.47/src/abstract_math.egg-info/SOURCES.txt +27 -0
  25. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/src/abstract_math.egg-info/dependency_links.txt +0 -0
  26. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/src/abstract_math.egg-info/top_level.txt +0 -0
  27. abstract_math-0.0.0.47/tests/test.py +5 -0
  28. abstract_math-0.0.0.12/PKG-INFO +0 -20
  29. abstract_math-0.0.0.12/README.md +0 -1
  30. abstract_math-0.0.0.12/src/abstract_math/derive_tokens.py +0 -108
  31. abstract_math-0.0.0.12/src/abstract_math/safe_math.py +0 -101
  32. abstract_math-0.0.0.12/src/abstract_math.egg-info/PKG-INFO +0 -20
  33. abstract_math-0.0.0.12/src/abstract_math.egg-info/SOURCES.txt +0 -10
  34. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/pyproject.toml +0 -0
  35. {abstract_math-0.0.0.12 → abstract_math-0.0.0.47}/setup.cfg +0 -0
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: abstract_math
3
+ Version: 0.0.0.47
4
+ Author: putkoff
5
+ Author-email: partners@abstractendeavors.com
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: requires-python
19
+
20
+ # abstract_math
21
+
22
+ ## Description
23
+ The abstract_math Python module, currently in its Alpha development stage (version 0.0.0.14), is designed for performing complex mathematical operations and token manipulations. This module comprises primarily of two scripts: `safe_math` and `derive_tokens`.
24
+
25
+ ## Features
26
+ - Performing complex mathematical operations.
27
+ - Manipulation and derivation of mathematical tokens, referred to as 'lamports'.
28
+ - High precision for decimal calculations for better accuracy.
29
+ - Functions for deriving quantities like lamports, virtual reserves, sol reserves, sol amounts, token reserves, token amounts, derived token ratio, price, and token decimals.
30
+ - Module components for updating Sol and token variables.
31
+
32
+ ## Scripts Overview
33
+
34
+ - `derive_tokens.py`: This script is involved in the complex manipulation or derivation of mathematical tokens, referred to as 'lamports'. The functions defined in this script handle various aspects of token manipulations and calculations.
35
+
36
+
37
+ ## Installation
38
+ To install the abstract_math module, ensure that your Python version is 3.6 or later. This module currently does not have any external dependencies to be installed.
39
+
40
+ ## Usage
41
+ This module could potentially be used as a framework for handling complex mathematical operations or token manipulations. Developers interested in working with and enhancing this module can access the source code at the repository (provide repo link here).
42
+
43
+ ## Dependencies
44
+ Currently, the module does not require any external dependencies.
45
+
46
+ ## License
47
+ The module is provided under the MIT License.
48
+
49
+ ## Author & Contact
50
+ This Python module was authored by 'putkoff', who can be reached at partners@abstractendeavors.com for further queries or assistance.
51
+
52
+ ## Contributing
53
+ Contributions are welcome to help in the development of the abstract_math module, particularly with the 'safe_math' and 'derive_tokens' scripts that form the core of the module.
54
+ # Unknown Package (vUnknown Version)
55
+
56
+ No description available
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install Unknown Package
62
+ ```
63
+
64
+ ## Dependencies
65
+
66
+ None
67
+
68
+ ## Modules
69
+
70
+ ### src/abstract_math/safe_math.py
71
+
72
+ Description of script based on prompt: You are analyzing a Python script 'safe_math.py' l (mock response)
73
+
74
+ ### src/abstract_math/__init__.py
75
+
76
+ Description of script based on prompt: You are analyzing a Python script '__init__.py' lo (mock response)
77
+
78
+ ### src/abstract_math/derive_tokens.py
79
+
80
+ Description of script based on prompt: You are analyzing a Python script 'derive_tokens.p (mock response)
81
+
@@ -0,0 +1,62 @@
1
+ # abstract_math
2
+
3
+ ## Description
4
+ The abstract_math Python module, currently in its Alpha development stage (version 0.0.0.14), is designed for performing complex mathematical operations and token manipulations. This module comprises primarily of two scripts: `safe_math` and `derive_tokens`.
5
+
6
+ ## Features
7
+ - Performing complex mathematical operations.
8
+ - Manipulation and derivation of mathematical tokens, referred to as 'lamports'.
9
+ - High precision for decimal calculations for better accuracy.
10
+ - Functions for deriving quantities like lamports, virtual reserves, sol reserves, sol amounts, token reserves, token amounts, derived token ratio, price, and token decimals.
11
+ - Module components for updating Sol and token variables.
12
+
13
+ ## Scripts Overview
14
+
15
+ - `derive_tokens.py`: This script is involved in the complex manipulation or derivation of mathematical tokens, referred to as 'lamports'. The functions defined in this script handle various aspects of token manipulations and calculations.
16
+
17
+
18
+ ## Installation
19
+ To install the abstract_math module, ensure that your Python version is 3.6 or later. This module currently does not have any external dependencies to be installed.
20
+
21
+ ## Usage
22
+ This module could potentially be used as a framework for handling complex mathematical operations or token manipulations. Developers interested in working with and enhancing this module can access the source code at the repository (provide repo link here).
23
+
24
+ ## Dependencies
25
+ Currently, the module does not require any external dependencies.
26
+
27
+ ## License
28
+ The module is provided under the MIT License.
29
+
30
+ ## Author & Contact
31
+ This Python module was authored by 'putkoff', who can be reached at partners@abstractendeavors.com for further queries or assistance.
32
+
33
+ ## Contributing
34
+ Contributions are welcome to help in the development of the abstract_math module, particularly with the 'safe_math' and 'derive_tokens' scripts that form the core of the module.
35
+ # Unknown Package (vUnknown Version)
36
+
37
+ No description available
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install Unknown Package
43
+ ```
44
+
45
+ ## Dependencies
46
+
47
+ None
48
+
49
+ ## Modules
50
+
51
+ ### src/abstract_math/safe_math.py
52
+
53
+ Description of script based on prompt: You are analyzing a Python script 'safe_math.py' l (mock response)
54
+
55
+ ### src/abstract_math/__init__.py
56
+
57
+ Description of script based on prompt: You are analyzing a Python script '__init__.py' lo (mock response)
58
+
59
+ ### src/abstract_math/derive_tokens.py
60
+
61
+ Description of script based on prompt: You are analyzing a Python script 'derive_tokens.p (mock response)
62
+
@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
4
4
  long_description = fh.read()
5
5
  setuptools.setup(
6
6
  name='abstract_math',
7
- version='0.0.0.12',
7
+ version='0.0.0.47',
8
8
  author='putkoff',
9
9
  author_email='partners@abstractendeavors.com',
10
10
  description="",
@@ -1,2 +1,3 @@
1
1
  from .safe_math import *
2
2
  from .derive_tokens import *
3
+ from .solar_math import *
@@ -0,0 +1,4 @@
1
+ from abstract_flask.generator import *
2
+ directory = "/home/computron/Documents/pythonTools/modules/abstract_math/src/abstract_math/solar_math"
3
+ from_files = generate_from_files(directory=directory)
4
+ input(from_files)
@@ -0,0 +1,144 @@
1
+ from decimal import Decimal, getcontext
2
+ from .safe_math import *
3
+ def exponentials(value,exp=9,num=-1):
4
+ return multiply_it(value,exp_it(10,exp,num))
5
+
6
+ # High precision for decimal ops
7
+ getcontext().prec = 50
8
+
9
+ # SOL constants
10
+ SOL_DECIMAL_PLACE = 9
11
+ # lamports per SOL = 10**9
12
+ SOL_LAMPORTS = sol_lamports = int(exponentials(1, exp=SOL_DECIMAL_PLACE, num=1))
13
+
14
+
15
+ def get_proper_args(strings, *args, **kwargs):
16
+ """
17
+ Extract values for keys in `strings` from kwargs; if missing, pull from positional args in order.
18
+ """
19
+ properArgs = []
20
+ for key in strings:
21
+ kwarg = kwargs.get(key)
22
+ if kwarg is None and args:
23
+ kwarg = args[0]
24
+ args = [] if len(args) == 1 else args[1:]
25
+ properArgs.append(kwarg)
26
+ return properArgs
27
+
28
+
29
+ # ---------- Lamports helpers ----------
30
+ def get_lamports(integer: int):
31
+ """
32
+ Convert an integer N to 10^(len(str(N)) + 1).
33
+ NOTE: this is your original behavior, not 10**9 unless N is 1 with exp=9.
34
+ """
35
+ return exp_it(10, len(str(integer)) + 1, 1)
36
+
37
+
38
+ def get_lamport_difference(lamports: int, virtual_lamports: int):
39
+ """
40
+ Compare 'lamports' vs 'virtual_lamports' and return 10^(len(str(int(virtual/actual))))
41
+ """
42
+ integer = int(virtual_lamports / lamports)
43
+ exp = len(str(integer))
44
+ return int(exponential(1, exp, 1))
45
+
46
+
47
+ # ---------- Virtual reserves / ratios ----------
48
+ def get_vitual_reserves(*args, **kwargs):
49
+ return get_proper_args(["virtualSolReserves", "virtualTokenReserves"], *args, **kwargs)
50
+
51
+
52
+ def get_virtual_reserve_ratio(*args, **kwargs):
53
+ sol_res, token_res = get_vitual_reserves(*args, **kwargs)
54
+ return divide_it(sol_res, token_res)
55
+
56
+
57
+ # ---------- SOL-specific ----------
58
+ def get_virtual_sol_reservs(*args, **kwargs):
59
+ reserves = get_proper_args(["virtualSolReserves"], *args, **kwargs)
60
+ return reserves[0] if reserves else None
61
+
62
+
63
+ def get_virtual_sol_lamports(*args, **kwargs):
64
+ sol_res = get_virtual_sol_reservs(*args, **kwargs)
65
+ return get_lamports(sol_res)
66
+
67
+
68
+ def get_virtual_sol_lamp_difference(*args, **kwargs):
69
+ v_lam = get_virtual_sol_lamports(*args, **kwargs)
70
+ return get_lamport_difference(SOL_LAMPORTS, v_lam)
71
+
72
+
73
+ def get_sol_amount(*args, **kwargs):
74
+ amounts = get_proper_args(["solAmount"], *args, **kwargs)
75
+ return amounts[0] if amounts else None
76
+
77
+
78
+ def getSolAmountUi(*args, **kwargs):
79
+ sol_amt = get_sol_amount(*args, **kwargs)
80
+ return exponential(sol_amt, SOL_DECIMAL_PLACE)
81
+
82
+
83
+ # ---------- Token-specific ----------
84
+ def get_virtual_token_reserves(*args, **kwargs):
85
+ reserves = get_proper_args(["virtualTokenReserves"], *args, **kwargs)
86
+ return reserves[0] if reserves else None
87
+
88
+
89
+ def get_virtual_token_lamports(*args, **kwargs):
90
+ token_res = get_virtual_token_reserves(*args, **kwargs)
91
+ return get_lamports(token_res)
92
+
93
+
94
+ def get_token_amount(*args, **kwargs):
95
+ amounts = get_proper_args(["tokenAmount"], *args, **kwargs)
96
+ return amounts[0] if amounts else None
97
+
98
+
99
+ def get_price(*args, **kwargs):
100
+ reserve_ratio = get_virtual_reserve_ratio(*args, **kwargs)
101
+ sol_diff = get_virtual_sol_lamp_difference(*args, **kwargs)
102
+ return divide_it(reserve_ratio, sol_diff)
103
+
104
+
105
+ def derive_token_amount(*args, **kwargs):
106
+ token_res = get_virtual_token_reserves(*args, **kwargs)
107
+ price = get_price(*args, **kwargs)
108
+ return divide_it(token_res, price)
109
+
110
+
111
+ def get_derived_token_ratio(*args, **kwargs):
112
+ derived_amt = derive_token_amount(*args, **kwargs)
113
+ token_amt = get_token_amount(*args, **kwargs)
114
+ return divide_it(derived_amt, token_amt)
115
+
116
+
117
+ def derive_decimals_from_vars(*args, **kwargs):
118
+ ratio = get_derived_token_ratio(*args, **kwargs)
119
+ decimals = -1
120
+ # Count how many decimal places are needed to make ratio an integer (<= 1e-9 tolerance)
121
+ while abs(ratio - round(ratio)) > 1e-9:
122
+ ratio *= 10
123
+ decimals += 1
124
+ return decimals
125
+
126
+
127
+ def get_token_amount_ui(*args, **kwargs):
128
+ token_amt = get_token_amount(*args, **kwargs)
129
+ token_decimals = derive_decimals_from_vars(*args, **kwargs)
130
+ return exponential(token_amt, token_decimals)
131
+
132
+
133
+ def derive_token_decimals_from_token_variables(**variables):
134
+ variables["price"] = get_price(**variables)
135
+ variables["tokenDecimals"] = derive_decimals_from_vars(**variables)
136
+ return variables
137
+
138
+
139
+ def update_token_variables(variables: dict):
140
+ variables['solAmountUi'] = getSolAmountUi(**variables)
141
+ variables['solDecimals'] = SOL_DECIMAL_PLACE
142
+ variables = derive_token_decimals_from_token_variables(**variables)
143
+ variables['tokenAmountUi'] = get_token_amount_ui(**variables)
144
+ return variables