oriebir-math 1.0.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.
- oriebir_math-1.0.0/LICENSE.txt +13 -0
- oriebir_math-1.0.0/NOTICE.txt +18 -0
- oriebir_math-1.0.0/PKG-INFO +25 -0
- oriebir_math-1.0.0/README.md +10 -0
- oriebir_math-1.0.0/oriebir_math.egg-info/PKG-INFO +25 -0
- oriebir_math-1.0.0/oriebir_math.egg-info/SOURCES.txt +12 -0
- oriebir_math-1.0.0/oriebir_math.egg-info/dependency_links.txt +1 -0
- oriebir_math-1.0.0/oriebir_math.egg-info/top_level.txt +1 -0
- oriebir_math-1.0.0/pyproject.toml +20 -0
- oriebir_math-1.0.0/sbu/__init__.py +3 -0
- oriebir_math-1.0.0/sbu/core.py +38 -0
- oriebir_math-1.0.0/sbu/operators.py +33 -0
- oriebir_math-1.0.0/setup.cfg +4 -0
- oriebir_math-1.0.0/tests/test_sbu_complete.py +52 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## **6️⃣ LICENSE (MIT)**
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 Your Name
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction...
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
NOTICE.txt SBU_MATH - Official Author Notice
|
|
2
|
+
---------------------------------
|
|
3
|
+
|
|
4
|
+
Project: SBU_MATH (Unified Block Syntax Library)
|
|
5
|
+
Author: Your Name
|
|
6
|
+
Date: 2026-03-09
|
|
7
|
+
Version: 1.0.0
|
|
8
|
+
|
|
9
|
+
This document certifies that the author listed above is the original creator
|
|
10
|
+
of the SBU_MATH library, including all concepts, operators, and design rules.
|
|
11
|
+
|
|
12
|
+
Description:
|
|
13
|
+
SBU_MATH condenses classical mathematical operations into a unified block syntax:
|
|
14
|
+
[IN] -> OP -> [OUT]. It is designed for accessibility, modularity, and expansion.
|
|
15
|
+
|
|
16
|
+
This notice serves as official recognition of the author's work
|
|
17
|
+
and can be presented as proof of authorship when submitting
|
|
18
|
+
to repositories, package managers, or online platforms.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oriebir-math
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Unified Block Syntax Library for mathematical operations
|
|
5
|
+
Author-email: Zaqueu Ribeiro da costa <Oriebirspeed@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
License-File: NOTICE.txt
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# SBU_MATH
|
|
17
|
+
|
|
18
|
+
Biblioteca de Sintaxe de Blocos Unificada para operações matemáticas.
|
|
19
|
+
|
|
20
|
+
O projeto SBU_MATH condensa operações matemáticas clássicas em uma sintaxe de blocos unificada seguindo a regra: `[INPUT] -> OPERATOR -> [ADJUSTMENT] = RESULT`. A ferramenta foi desenhada para acessibilidade, modularidade e rápida expansão de lógicas matemáticas.
|
|
21
|
+
|
|
22
|
+
## Instalação
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install sbu-math
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# SBU_MATH
|
|
2
|
+
|
|
3
|
+
Biblioteca de Sintaxe de Blocos Unificada para operações matemáticas.
|
|
4
|
+
|
|
5
|
+
O projeto SBU_MATH condensa operações matemáticas clássicas em uma sintaxe de blocos unificada seguindo a regra: `[INPUT] -> OPERATOR -> [ADJUSTMENT] = RESULT`. A ferramenta foi desenhada para acessibilidade, modularidade e rápida expansão de lógicas matemáticas.
|
|
6
|
+
|
|
7
|
+
## Instalação
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install sbu-math
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oriebir-math
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Unified Block Syntax Library for mathematical operations
|
|
5
|
+
Author-email: Zaqueu Ribeiro da costa <Oriebirspeed@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
License-File: NOTICE.txt
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# SBU_MATH
|
|
17
|
+
|
|
18
|
+
Biblioteca de Sintaxe de Blocos Unificada para operações matemáticas.
|
|
19
|
+
|
|
20
|
+
O projeto SBU_MATH condensa operações matemáticas clássicas em uma sintaxe de blocos unificada seguindo a regra: `[INPUT] -> OPERATOR -> [ADJUSTMENT] = RESULT`. A ferramenta foi desenhada para acessibilidade, modularidade e rápida expansão de lógicas matemáticas.
|
|
21
|
+
|
|
22
|
+
## Instalação
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install sbu-math
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
NOTICE.txt
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
oriebir_math.egg-info/PKG-INFO
|
|
6
|
+
oriebir_math.egg-info/SOURCES.txt
|
|
7
|
+
oriebir_math.egg-info/dependency_links.txt
|
|
8
|
+
oriebir_math.egg-info/top_level.txt
|
|
9
|
+
sbu/__init__.py
|
|
10
|
+
sbu/core.py
|
|
11
|
+
sbu/operators.py
|
|
12
|
+
tests/test_sbu_complete.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sbu
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42","wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "oriebir-math"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Unified Block Syntax Library for mathematical operations"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name="Zaqueu Ribeiro da costa", email="Oriebirspeed@gmail.com" }
|
|
11
|
+
]
|
|
12
|
+
license = { text="MIT" }
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from .operators import *
|
|
2
|
+
|
|
3
|
+
class SBU:
|
|
4
|
+
"""
|
|
5
|
+
Main class managing the SBU block operations.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self.operators = {
|
|
10
|
+
"sum": sum_op,
|
|
11
|
+
"mult": mult_op,
|
|
12
|
+
"avg": avg_op,
|
|
13
|
+
"sqrt": sqrt_op,
|
|
14
|
+
"diff": diff_op,
|
|
15
|
+
"approx": approx_op,
|
|
16
|
+
"wave": wave_op,
|
|
17
|
+
"limit": limit_op,
|
|
18
|
+
"const": const_op,
|
|
19
|
+
"integ": integ_op,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def eject(self, input_block, op, adjustment=None, **kwargs):
|
|
23
|
+
"""
|
|
24
|
+
Executes the SBU rule: [INPUT] -> OPERATOR -> [ADJUSTMENT] = RESULT
|
|
25
|
+
"""
|
|
26
|
+
if op not in self.operators:
|
|
27
|
+
raise ValueError(f"Operator '{op}' not recognized.")
|
|
28
|
+
|
|
29
|
+
result = self.operators[op](input_block, **kwargs)
|
|
30
|
+
|
|
31
|
+
if adjustment:
|
|
32
|
+
adj_sum = sum(adjustment)
|
|
33
|
+
if isinstance(result, (int, float)):
|
|
34
|
+
return result - adj_sum
|
|
35
|
+
elif isinstance(result, list):
|
|
36
|
+
return [n - adj_sum for n in result]
|
|
37
|
+
|
|
38
|
+
return result
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import math
|
|
2
|
+
from functools import reduce
|
|
3
|
+
from operator import mul
|
|
4
|
+
|
|
5
|
+
def sum_op(x):
|
|
6
|
+
return sum(x)
|
|
7
|
+
|
|
8
|
+
def mult_op(x):
|
|
9
|
+
return math.prod(x) if hasattr(math, 'prod') else reduce(mul, x, 1)
|
|
10
|
+
|
|
11
|
+
def avg_op(x):
|
|
12
|
+
return sum(x)/len(x) if x else 0
|
|
13
|
+
|
|
14
|
+
def sqrt_op(x):
|
|
15
|
+
return [math.sqrt(n) for n in x]
|
|
16
|
+
|
|
17
|
+
def diff_op(x):
|
|
18
|
+
return x[-1] - x[0] if len(x) >= 2 else 0
|
|
19
|
+
|
|
20
|
+
def approx_op(x, decimals=2):
|
|
21
|
+
return [round(n, decimals) for n in x]
|
|
22
|
+
|
|
23
|
+
def wave_op(x):
|
|
24
|
+
return [math.sin(n) * math.cos(n) for n in x]
|
|
25
|
+
|
|
26
|
+
def limit_op(x, tol=0.001):
|
|
27
|
+
return [n if n > tol else 0 for n in x]
|
|
28
|
+
|
|
29
|
+
def const_op(x, c=1):
|
|
30
|
+
return [n * c for n in x]
|
|
31
|
+
|
|
32
|
+
def integ_op(x, step=0.1):
|
|
33
|
+
return sum(x) * step
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
sys.path.append(os.path.abspath("..")) # garante que a raiz esteja no path
|
|
4
|
+
|
|
5
|
+
from sbu import SBU
|
|
6
|
+
|
|
7
|
+
bib = SBU()
|
|
8
|
+
|
|
9
|
+
def test_sum_basic():
|
|
10
|
+
assert bib.eject([1,2,3,4,5], 'sum') == 15
|
|
11
|
+
|
|
12
|
+
def test_sum_with_adjustment():
|
|
13
|
+
assert bib.eject([10,20,30], 'sum', [5,5]) == 50
|
|
14
|
+
|
|
15
|
+
def test_mult_basic():
|
|
16
|
+
assert bib.eject([2,3,4], 'mult') == 24
|
|
17
|
+
|
|
18
|
+
def test_avg_basic():
|
|
19
|
+
assert bib.eject([2,4,6], 'avg') == 4
|
|
20
|
+
|
|
21
|
+
def test_sqrt_basic():
|
|
22
|
+
assert bib.eject([4,9,16], 'sqrt') == [2.0,3.0,4.0]
|
|
23
|
+
|
|
24
|
+
def test_diff_basic():
|
|
25
|
+
assert bib.eject([10,50], 'diff') == 40
|
|
26
|
+
|
|
27
|
+
def test_approx_basic():
|
|
28
|
+
assert bib.eject([3.14159, 2.71828], 'approx') == [3.14, 2.72]
|
|
29
|
+
|
|
30
|
+
def test_wave_basic():
|
|
31
|
+
result = bib.eject([0.5,1.2], 'wave')
|
|
32
|
+
expected = [0.42073549240394825,0.3377315902755755]
|
|
33
|
+
for r,e in zip(result, expected):
|
|
34
|
+
assert abs(r - e) < 1e-6
|
|
35
|
+
|
|
36
|
+
def test_limit_basic():
|
|
37
|
+
assert bib.eject([0.0005,0.01,0.5], 'limit') == [0,0.01,0.5]
|
|
38
|
+
|
|
39
|
+
def test_const_basic():
|
|
40
|
+
assert bib.eject([1,2,3], 'const') == [1,2,3]
|
|
41
|
+
|
|
42
|
+
def test_integ_basic():
|
|
43
|
+
assert abs(bib.eject([1,2,3], 'integ') - 0.6) < 1e-6
|
|
44
|
+
|
|
45
|
+
def test_invalid_operator():
|
|
46
|
+
import pytest
|
|
47
|
+
with pytest.raises(ValueError):
|
|
48
|
+
bib.eject([1,2,3], 'nonexistent')
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
import pytest
|
|
52
|
+
pytest.main(["-v"])
|