abstract-math 0.0.0.14__py3-none-any.whl → 0.0.0.16__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.

Potentially problematic release.


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

@@ -1,43 +1,90 @@
1
- from abstract_utilities import *
2
- import math
3
- #math functions ------------------------------------------------------------------------------------------------------
4
- def exponential(value,exp=9,num=-1):
5
- return multiply_it(value,exp_it(10,exp,num))
1
+ from abstract_utilities import is_number
2
+ from functools import reduce
3
+ import operator
6
4
 
7
5
  def return_0(*args):
6
+ """Return True if *any* arg is “falsy” (None, non-number, or zero‐like)."""
8
7
  for arg in args:
9
- if arg == None or not is_number(arg) or arg in [0,'0','','null',' ']:
10
- return float(0)
11
-
12
- def exp_it(number,integer,mul):
13
- if return_0(number,integer,mul)==float(0):
14
- return float(0)
15
- return float(number)**float(float(integer)*int(mul))
8
+ if arg is None or not is_number(arg) or str(arg).strip().lower() in ('0', '', 'null'):
9
+ return True
10
+ return False
16
11
 
17
- def divide_it(number_1,number_2):
18
- if return_0(number_1,number_2)==float(0):
19
- return float(0)
20
- return float(number_1)/float(number_2)
12
+ def gather_0(*args):
13
+ """Convert any “falsy” arg into float(0), leave others alone."""
14
+ cleaned = []
15
+ for arg in args:
16
+ if arg is None or not is_number(arg) or str(arg).strip().lower() in ('0', '', 'null'):
17
+ cleaned.append(0.0)
18
+ else:
19
+ cleaned.append(float(arg))
20
+ return cleaned
21
+
22
+ def add_it(*args):
23
+ """Sum together any number of args, treating bad values as 0."""
24
+ nums = gather_0(*args)
25
+ return float(sum(nums))
26
+
27
+ def multiply_it(*args):
28
+ """Multiply any number of args, but return 0 if any input is ‘bad’ or zero-like."""
29
+ nums = gather_0(*args)
30
+ if any(n == 0.0 for n in nums):
31
+ return 0.0
32
+ return float(reduce(operator.mul, nums, 1.0))
33
+
34
+ def divide_it(*args):
35
+ """
36
+ Divide args[0] by args[1] by args[2]…
37
+ If any input is bad or you hit a zero‐division, return 0.
38
+ """
39
+ nums = gather_0(*args)
40
+ try:
41
+ return float(reduce(operator.truediv, nums))
42
+ except ZeroDivisionError:
43
+ return 0.0
21
44
 
22
- def multiply_it(number_1,number_2):
23
- if return_0(number_1,number_2)==float(0):
24
- return float(0)
25
- return float(number_1)*float(number_2)
45
+ def floor_divide_it(*args):
46
+ """
47
+ Floor‐divide args[0] by args[1] by args[2]…
48
+ If any input is bad or you hit a zero‐division, return 0.
49
+ """
50
+ nums = gather_0(*args)
51
+ try:
52
+ return float(reduce(operator.floordiv, nums))
53
+ except ZeroDivisionError:
54
+ return 0.0
26
55
 
27
- def add_it(number_1,number_2):
28
- if return_0(number_1,number_2)==float(0):
29
- return float(0)
30
- return float(number_1)+float(number_2)
56
+ def subtract_it(*args):
57
+ """
58
+ Subtract all subsequent args from the first:
59
+ args[0] - args[1] - args[2] - …
60
+ Bad values become 0.
61
+ """
62
+ nums = gather_0(*args)
63
+ if not nums:
64
+ return 0.0
65
+ return float(reduce(operator.sub, nums))
31
66
 
32
- def subtract_it(number_1,number_2):
33
- if return_0(number_1,number_2)==float(0):
34
- return float(0)
35
- return float(number_1)-float(number_2)
67
+ def exp_it(base, *factors):
68
+ """
69
+ Raise `base` to the power of (product of all `factors`).
70
+ e.g. exp_it(10, 2, 3) → 10**(2*3) == 10**6
71
+ Bad values become 0 (and so the result is 0).
72
+ """
73
+ nums = gather_0(base, *factors)
74
+ b, *f = nums
75
+ if return_0(*nums) or not f:
76
+ return 0.0
77
+ exponent = reduce(operator.mul, f, 1.0)
78
+ return float(b) ** exponent
36
79
 
37
- def get_percentage(owner_balance,address_balance):
38
- retained_div = divide_it(owner_balance,address_balance)
39
- retained_mul = multiply_it(retained_div,100)
40
- return round(retained_mul,2)
80
+ def exponential(value, *exp):
81
+ """
82
+ Multiply `value` by 10 to the power of (product of exp_factors).
83
+ e.g. exponential(5, 2, 3) → 5 * (10**(2*3)) == 5 * 1_000_000
84
+ If you give no exp_factors, it just returns value.
85
+ """
86
+ power = exp_it(10, *exp) or 1.0
87
+ return multiply_it(value, power)
41
88
 
42
89
  def get_proper_args(strings,*args,**kwargs):
43
90
  properArgs = []
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: abstract_math
3
+ Version: 0.0.0.16
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
+ # Unknown Package (vUnknown Version)
21
+
22
+ No description available
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install Unknown Package
28
+ ```
29
+
30
+ ## Dependencies
31
+
32
+ None
33
+
34
+ ## Modules
35
+
36
+ ### src/abstract_math/safe_math.py
37
+
38
+ Description of script based on prompt: You are analyzing a Python script 'safe_math.py' l (mock response)
39
+
40
+ ### src/abstract_math/__init__.py
41
+
42
+ Description of script based on prompt: You are analyzing a Python script '__init__.py' lo (mock response)
43
+
44
+ ### src/abstract_math/derive_tokens.py
45
+
46
+ Description of script based on prompt: You are analyzing a Python script 'derive_tokens.p (mock response)
47
+
@@ -0,0 +1,8 @@
1
+ abstract_math/__init__.py,sha256=3I0YJakDUyWD7qXpdRsaEsmcA7IxwcWhoyecvDfOE98,54
2
+ abstract_math/derive_tokens.py,sha256=Ba2hq3-W3NPmfko-Lf-58HfkBtl4kfN-GFuSZJMyiWM,4233
3
+ abstract_math/deriveit.py,sha256=Og8QtDGRrgGbmaHTh-jEusg35jUpb74DgzslsxZ_2iU,4271
4
+ abstract_math/safe_math.py,sha256=WIIiHELl3AqV2IdWlWd5Ca4TOD6qffeGNA33gJQqS6k,5378
5
+ abstract_math-0.0.0.16.dist-info/METADATA,sha256=C9JFxjf0rGKI9LaXkNbC1JvgGkie_TUsUkQO8fGaarc,1150
6
+ abstract_math-0.0.0.16.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
7
+ abstract_math-0.0.0.16.dist-info/top_level.txt,sha256=b7jOgD9c0U-CGH-l7yxhMPukzD40kMEQkQRV_sGyVfE,14
8
+ abstract_math-0.0.0.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,20 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: abstract_math
3
- Version: 0.0.0.14
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
- Safe math for delicate Processes, paralell in use case to SafeMath For SmartContracts in that it is designed to circumvent fatal errors for low level MDAS.
@@ -1,8 +0,0 @@
1
- abstract_math/__init__.py,sha256=3I0YJakDUyWD7qXpdRsaEsmcA7IxwcWhoyecvDfOE98,54
2
- abstract_math/derive_tokens.py,sha256=Ba2hq3-W3NPmfko-Lf-58HfkBtl4kfN-GFuSZJMyiWM,4233
3
- abstract_math/deriveit.py,sha256=Og8QtDGRrgGbmaHTh-jEusg35jUpb74DgzslsxZ_2iU,4271
4
- abstract_math/safe_math.py,sha256=wDWiZzgjymhZbpy3431fgQpetLn1WmiRo9_pP2YpRj8,4110
5
- abstract_math-0.0.0.14.dist-info/METADATA,sha256=uQbOoiMqkmfLHTuXSatBzpzaUKhTNMqs8YR0HltT07g,718
6
- abstract_math-0.0.0.14.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- abstract_math-0.0.0.14.dist-info/top_level.txt,sha256=b7jOgD9c0U-CGH-l7yxhMPukzD40kMEQkQRV_sGyVfE,14
8
- abstract_math-0.0.0.14.dist-info/RECORD,,