abstract-math 0.0.0.17__tar.gz → 0.0.0.19__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.

Potentially problematic release.


This version of abstract-math might be problematic. Click here for more details.

Files changed (31) hide show
  1. abstract_math-0.0.0.19/PKG-INFO +81 -0
  2. abstract_math-0.0.0.19/README.md +62 -0
  3. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/setup.py +1 -1
  4. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/src/abstract_math/__init__.py +1 -0
  5. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/src/abstract_math/derive_tokens.py +37 -35
  6. abstract_math-0.0.0.19/src/abstract_math/flask_scripts/__init__.py +0 -0
  7. abstract_math-0.0.0.19/src/abstract_math/flask_scripts/flask_utils.py +664 -0
  8. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/src/abstract_math/safe_math.py +20 -3
  9. abstract_math-0.0.0.19/src/abstract_math/solar_math/__init__.py +2 -0
  10. abstract_math-0.0.0.19/src/abstract_math/solar_math/flask_utils.py +11 -0
  11. abstract_math-0.0.0.19/src/abstract_math/solar_math/main.py +263 -0
  12. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/__init__.py +4 -0
  13. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/constants/__init__.py +19 -0
  14. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/constants/distance_constants.py +45 -0
  15. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/constants/planet_constants.py +156 -0
  16. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/constants/time_constants.py +56 -0
  17. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/imports.py +5 -0
  18. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/utils/__init__.py +3 -0
  19. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/utils/escape_velocity.py +78 -0
  20. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/utils/geometry_utils.py +104 -0
  21. abstract_math-0.0.0.19/src/abstract_math/solar_math/src/utils/velocity_utils.py +26 -0
  22. abstract_math-0.0.0.19/src/abstract_math.egg-info/PKG-INFO +81 -0
  23. abstract_math-0.0.0.19/src/abstract_math.egg-info/SOURCES.txt +25 -0
  24. abstract_math-0.0.0.17/PKG-INFO +0 -47
  25. abstract_math-0.0.0.17/README.md +0 -28
  26. abstract_math-0.0.0.17/src/abstract_math.egg-info/PKG-INFO +0 -47
  27. abstract_math-0.0.0.17/src/abstract_math.egg-info/SOURCES.txt +0 -10
  28. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/pyproject.toml +0 -0
  29. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/setup.cfg +0 -0
  30. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/src/abstract_math.egg-info/dependency_links.txt +0 -0
  31. {abstract_math-0.0.0.17 → abstract_math-0.0.0.19}/src/abstract_math.egg-info/top_level.txt +0 -0
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: abstract_math
3
+ Version: 0.0.0.19
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.17',
7
+ version='0.0.0.19',
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 *
@@ -1,18 +1,19 @@
1
1
  from decimal import Decimal, getcontext
2
2
  from .safe_math import *
3
+ from .safe_math import exp_it, divide_it # if you need these
3
4
 
4
- # Set high precision for decimal operations
5
+ # High precision for decimal ops
5
6
  getcontext().prec = 50
6
7
 
7
- # Constants for SOL decimal places and lamports conversion
8
+ # SOL constants
8
9
  SOL_DECIMAL_PLACE = 9
9
- SOL_LAMPORTS = sol_lamports = int(exponential(1, SOL_DECIMAL_PLACE, 1))
10
+ # lamports per SOL = 10**9
11
+ SOL_LAMPORTS = sol_lamports = int(exponential(1, exp=SOL_DECIMAL_PLACE, num=1))
10
12
 
11
13
 
12
14
  def get_proper_args(strings, *args, **kwargs):
13
15
  """
14
- Extracts values from kwargs based on the provided keys (strings). If not present in kwargs,
15
- falls back to positional args in order.
16
+ Extract values for keys in `strings` from kwargs; if missing, pull from positional args in order.
16
17
  """
17
18
  properArgs = []
18
19
  for key in strings:
@@ -23,25 +24,26 @@ def get_proper_args(strings, *args, **kwargs):
23
24
  properArgs.append(kwarg)
24
25
  return properArgs
25
26
 
26
- # Lamports calculations
27
27
 
28
- def get_lamports(integer):
28
+ # ---------- Lamports helpers ----------
29
+ def get_lamports(integer: int):
29
30
  """
30
- Given an integer representing SOL, returns lamports (10^(digits_in_integer+1)).
31
+ Convert an integer N to 10^(len(str(N)) + 1).
32
+ NOTE: this is your original behavior, not 10**9 unless N is 1 with exp=9.
31
33
  """
32
34
  return exp_it(10, len(str(integer)) + 1, 1)
33
35
 
34
36
 
35
- def get_lamport_difference(lamports, virtual_lamports):
37
+ def get_lamport_difference(lamports: int, virtual_lamports: int):
36
38
  """
37
- Compares actual lamports to virtual lamports and returns the corresponding exponent-based difference.
39
+ Compare 'lamports' vs 'virtual_lamports' and return 10^(len(str(int(virtual/actual))))
38
40
  """
39
41
  integer = int(virtual_lamports / lamports)
40
42
  exp = len(str(integer))
41
43
  return int(exponential(1, exp, 1))
42
44
 
43
- # Virtual reserves and ratios
44
45
 
46
+ # ---------- Virtual reserves / ratios ----------
45
47
  def get_vitual_reserves(*args, **kwargs):
46
48
  return get_proper_args(["virtualSolReserves", "virtualTokenReserves"], *args, **kwargs)
47
49
 
@@ -50,8 +52,8 @@ def get_virtual_reserve_ratio(*args, **kwargs):
50
52
  sol_res, token_res = get_vitual_reserves(*args, **kwargs)
51
53
  return divide_it(sol_res, token_res)
52
54
 
53
- # SOL-specific calculations
54
55
 
56
+ # ---------- SOL-specific ----------
55
57
  def get_virtual_sol_reservs(*args, **kwargs):
56
58
  reserves = get_proper_args(["virtualSolReserves"], *args, **kwargs)
57
59
  return reserves[0] if reserves else None
@@ -66,7 +68,6 @@ def get_virtual_sol_lamp_difference(*args, **kwargs):
66
68
  v_lam = get_virtual_sol_lamports(*args, **kwargs)
67
69
  return get_lamport_difference(SOL_LAMPORTS, v_lam)
68
70
 
69
- # SOL amount conversions
70
71
 
71
72
  def get_sol_amount(*args, **kwargs):
72
73
  amounts = get_proper_args(["solAmount"], *args, **kwargs)
@@ -77,8 +78,8 @@ def getSolAmountUi(*args, **kwargs):
77
78
  sol_amt = get_sol_amount(*args, **kwargs)
78
79
  return exponential(sol_amt, SOL_DECIMAL_PLACE)
79
80
 
80
- # Token-specific calculations
81
81
 
82
+ # ---------- Token-specific ----------
82
83
  def get_virtual_token_reserves(*args, **kwargs):
83
84
  reserves = get_proper_args(["virtualTokenReserves"], *args, **kwargs)
84
85
  return reserves[0] if reserves else None
@@ -94,22 +95,10 @@ def get_token_amount(*args, **kwargs):
94
95
  return amounts[0] if amounts else None
95
96
 
96
97
 
97
- def get_token_amount_ui(*args, **kwargs):
98
- token_amt = get_token_amount(*args, **kwargs)
99
- token_decimals = derive_decimals_from_vars(*args, **kwargs)
100
- return exponential(token_amt, token_decimals)
101
-
102
-
103
- def derive_token_decimals_from_token_variables(**variables):
104
- variables["price"] = get_price(**variables)
105
- variables["tokenDecimals"] = derive_decimals_from_vars(**variables)
106
- return variables
107
-
108
-
109
- def get_derived_token_ratio(*args, **kwargs):
110
- derived_amt = derive_token_amount(*args, **kwargs)
111
- token_amt = get_token_amount(*args, **kwargs)
112
- return divide_it(derived_amt, token_amt)
98
+ def get_price(*args, **kwargs):
99
+ reserve_ratio = get_virtual_reserve_ratio(*args, **kwargs)
100
+ sol_diff = get_virtual_sol_lamp_difference(*args, **kwargs)
101
+ return divide_it(reserve_ratio, sol_diff)
113
102
 
114
103
 
115
104
  def derive_token_amount(*args, **kwargs):
@@ -118,22 +107,35 @@ def derive_token_amount(*args, **kwargs):
118
107
  return divide_it(token_res, price)
119
108
 
120
109
 
121
- def get_price(*args, **kwargs):
122
- reserve_ratio = get_virtual_reserve_ratio(*args, **kwargs)
123
- sol_diff = get_virtual_sol_lamp_difference(*args, **kwargs)
124
- return divide_it(reserve_ratio, sol_diff)
110
+ def get_derived_token_ratio(*args, **kwargs):
111
+ derived_amt = derive_token_amount(*args, **kwargs)
112
+ token_amt = get_token_amount(*args, **kwargs)
113
+ return divide_it(derived_amt, token_amt)
125
114
 
126
115
 
127
116
  def derive_decimals_from_vars(*args, **kwargs):
128
117
  ratio = get_derived_token_ratio(*args, **kwargs)
129
118
  decimals = -1
119
+ # Count how many decimal places are needed to make ratio an integer (<= 1e-9 tolerance)
130
120
  while abs(ratio - round(ratio)) > 1e-9:
131
121
  ratio *= 10
132
122
  decimals += 1
133
123
  return decimals
134
124
 
135
125
 
136
- def update_token_variables(variables):
126
+ def get_token_amount_ui(*args, **kwargs):
127
+ token_amt = get_token_amount(*args, **kwargs)
128
+ token_decimals = derive_decimals_from_vars(*args, **kwargs)
129
+ return exponential(token_amt, token_decimals)
130
+
131
+
132
+ def derive_token_decimals_from_token_variables(**variables):
133
+ variables["price"] = get_price(**variables)
134
+ variables["tokenDecimals"] = derive_decimals_from_vars(**variables)
135
+ return variables
136
+
137
+
138
+ def update_token_variables(variables: dict):
137
139
  variables['solAmountUi'] = getSolAmountUi(**variables)
138
140
  variables['solDecimals'] = SOL_DECIMAL_PLACE
139
141
  variables = derive_token_decimals_from_token_variables(**variables)