voly 0.0.240__py3-none-any.whl → 0.0.242__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.
- voly/formulas.py +16 -20
- {voly-0.0.240.dist-info → voly-0.0.242.dist-info}/METADATA +1 -1
- {voly-0.0.240.dist-info → voly-0.0.242.dist-info}/RECORD +6 -6
- {voly-0.0.240.dist-info → voly-0.0.242.dist-info}/WHEEL +0 -0
- {voly-0.0.240.dist-info → voly-0.0.242.dist-info}/licenses/LICENSE +0 -0
- {voly-0.0.240.dist-info → voly-0.0.242.dist-info}/top_level.txt +0 -0
voly/formulas.py
CHANGED
@@ -16,37 +16,33 @@ from functools import wraps
|
|
16
16
|
def vectorize_inputs(func):
|
17
17
|
@wraps(func)
|
18
18
|
def wrapper(*args, **kwargs):
|
19
|
+
# Extract input argument names from the function
|
19
20
|
arg_names = func.__code__.co_varnames[:func.__code__.co_argcount]
|
20
21
|
input_dict = dict(zip(arg_names, args))
|
21
22
|
input_dict.update(kwargs)
|
22
23
|
|
23
|
-
|
24
|
-
k: len(v) for k, v in input_dict.items()
|
25
|
-
if isinstance(v, (list, np.ndarray, pd.Series))
|
26
|
-
}
|
24
|
+
values = list(input_dict.values())
|
27
25
|
|
28
|
-
|
26
|
+
n_vectors = sum(isinstance(v, (list, np.ndarray, pd.Series)) for v in values)
|
27
|
+
n_scalars = sum(not isinstance(v, (list, np.ndarray, pd.Series)) for v in values)
|
29
28
|
|
30
|
-
if
|
31
|
-
|
32
|
-
if len(lengths) != 1:
|
33
|
-
logger.error(f"Inconsistent input lengths in vectorized call: {vector_lengths}")
|
34
|
-
raise VolyError("All vectorized inputs must have the same length.")
|
29
|
+
if n_vectors > 0 and n_scalars > 0:
|
30
|
+
raise VolyError("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
):
|
40
|
-
|
41
|
-
raise VolyError("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
|
32
|
+
if n_vectors > 0:
|
33
|
+
# All inputs are vectors, make sure they're same length
|
34
|
+
lengths = [len(v) for v in values]
|
35
|
+
if len(set(lengths)) != 1:
|
36
|
+
raise VolyError("All vectorized inputs must have the same length.")
|
42
37
|
|
43
|
-
|
38
|
+
# Apply vectorized logic
|
44
39
|
return [
|
45
40
|
func(*[input_dict[name][i] for name in arg_names])
|
46
|
-
for i in range(
|
41
|
+
for i in range(lengths[0])
|
47
42
|
]
|
48
|
-
|
49
|
-
|
43
|
+
|
44
|
+
# All inputs are scalars
|
45
|
+
return func(*args, **kwargs)
|
50
46
|
|
51
47
|
return wrapper
|
52
48
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
|
2
2
|
voly/client.py,sha256=H4BY5n1isHOqMYX-Koe8-WKBKE6zxbdDYopDF58BPBI,14533
|
3
3
|
voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
|
4
|
-
voly/formulas.py,sha256=
|
4
|
+
voly/formulas.py,sha256=YGN8cy3Wt_LX_BKSYOMpBCrRA1g39RINTNRHTXRykWM,10007
|
5
5
|
voly/models.py,sha256=CGJQr13Uie7iwtx2hjViN9lMXeRN_uOqzp4u8NPaTlA,9282
|
6
6
|
voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
|
7
7
|
voly/core/charts.py,sha256=6MSU0z01fPOVSssodxdnFqchzDfupSmXq_e71WwDmVQ,12635
|
@@ -13,8 +13,8 @@ voly/core/rnd.py,sha256=wiZ5OIjPDf1Th5_sQ9CZG5JgAo3EL8f63T_Rj1_VP-0,13214
|
|
13
13
|
voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
|
14
14
|
voly/utils/density.py,sha256=ONpRli-IaJDgOZ2sb27HHFc9_tkkGSATKl94JODd86A,5879
|
15
15
|
voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
|
16
|
-
voly-0.0.
|
17
|
-
voly-0.0.
|
18
|
-
voly-0.0.
|
19
|
-
voly-0.0.
|
20
|
-
voly-0.0.
|
16
|
+
voly-0.0.242.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
17
|
+
voly-0.0.242.dist-info/METADATA,sha256=YXnwe-p-mZGYY8GMD-1XDGaEsFWyBxjlGRcc-2TCem4,4115
|
18
|
+
voly-0.0.242.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
19
|
+
voly-0.0.242.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
20
|
+
voly-0.0.242.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|