redzed 25.12.30__py3-none-any.whl → 26.1.28__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.
- redzed/__init__.py +4 -4
- redzed/base_block.py +2 -2
- redzed/block.py +13 -17
- redzed/blocklib/counter.py +4 -0
- redzed/blocklib/fsm.py +81 -52
- redzed/blocklib/inputs.py +38 -66
- redzed/blocklib/outputs.py +53 -38
- redzed/blocklib/timedate.py +3 -3
- redzed/blocklib/timeinterval.py +4 -0
- redzed/blocklib/timer.py +3 -4
- redzed/blocklib/validator.py +46 -0
- redzed/circuit.py +5 -5
- redzed/cron_service.py +137 -123
- redzed/debug.py +70 -53
- redzed/formula_trigger.py +4 -8
- redzed/initializers.py +6 -7
- redzed/py.typed +0 -0
- redzed/signal_shutdown.py +3 -3
- redzed/undef.py +2 -2
- redzed/utils/data_utils.py +20 -44
- {redzed-25.12.30.dist-info → redzed-26.1.28.dist-info}/METADATA +1 -1
- redzed-26.1.28.dist-info/RECORD +30 -0
- {redzed-25.12.30.dist-info → redzed-26.1.28.dist-info}/WHEEL +1 -1
- {redzed-25.12.30.dist-info → redzed-26.1.28.dist-info}/licenses/LICENSE.txt +1 -1
- redzed-25.12.30.dist-info/RECORD +0 -28
- {redzed-25.12.30.dist-info → redzed-26.1.28.dist-info}/top_level.txt +0 -0
redzed/utils/data_utils.py
CHANGED
|
@@ -4,12 +4,11 @@ Small utilities.
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
__all__ = [
|
|
7
|
-
'
|
|
7
|
+
'check_identifier', 'func_name', 'func_call_string',
|
|
8
8
|
'is_multiple', 'tasks_are_eager', 'to_tuple']
|
|
9
9
|
|
|
10
10
|
import asyncio
|
|
11
11
|
from collections.abc import Callable, Mapping, Sequence
|
|
12
|
-
import inspect
|
|
13
12
|
import itertools
|
|
14
13
|
import logging
|
|
15
14
|
import typing as t
|
|
@@ -24,7 +23,7 @@ def check_identifier(name: t.Any, msg_prefix: str) -> None:
|
|
|
24
23
|
if not name:
|
|
25
24
|
raise ValueError(f"{msg_prefix} cannot be an empty string")
|
|
26
25
|
if not name.isidentifier():
|
|
27
|
-
raise ValueError(f"{msg_prefix} must be a valid identifier, got '{name
|
|
26
|
+
raise ValueError(f"{msg_prefix} must be a valid identifier, got '{name}'")
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
def is_multiple(arg: t.Any) -> bool:
|
|
@@ -50,19 +49,29 @@ def to_tuple(args: _T_item|Sequence[_T_item]) -> tuple[_T_item, ...]:
|
|
|
50
49
|
return t.cast(tuple[_T_item], (args,))
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
def func_name(func: Callable[..., t.Any]) -> str:
|
|
53
|
+
"""Return the name of a callable."""
|
|
54
|
+
if not callable(func):
|
|
55
|
+
raise TypeError(f"{func!r} is not callable")
|
|
56
|
+
if (name := getattr(func, '__name__', None)) is not None:
|
|
57
|
+
return name
|
|
58
|
+
# callable objects with __call__ do not have a __name__
|
|
59
|
+
if not isinstance(func, type) and (hasattr(ftype := type(func), '__call__')):
|
|
60
|
+
return f'{ftype.__name__}.__call__'
|
|
61
|
+
# fail-safe default, though there is no such type of callable
|
|
62
|
+
return ftype.__name__
|
|
63
|
+
|
|
64
|
+
|
|
54
65
|
def func_call_string(
|
|
55
66
|
func: Callable[..., t.Any]|None,
|
|
56
67
|
args: Sequence[t.Any],
|
|
57
|
-
kwargs: Mapping[str, t.Any] =
|
|
68
|
+
kwargs: Mapping[str, t.Any]|None = None
|
|
58
69
|
) -> str:
|
|
59
70
|
"""Convert args and kwargs to a printable string."""
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if func is None
|
|
64
|
-
return arglist
|
|
65
|
-
return func.__name__ + arglist
|
|
71
|
+
agen = (repr(a) for a in args)
|
|
72
|
+
gen = itertools.chain(agen, (f"{k}={v!r}" for k, v in kwargs.items())) if kwargs else agen
|
|
73
|
+
arglist = f"({', '.join(gen)})"
|
|
74
|
+
return arglist if func is None else func_name(func) + arglist
|
|
66
75
|
|
|
67
76
|
|
|
68
77
|
def tasks_are_eager() -> bool:
|
|
@@ -81,36 +90,3 @@ def tasks_are_eager() -> bool:
|
|
|
81
90
|
flag = True
|
|
82
91
|
asyncio.create_task(test_task())
|
|
83
92
|
return flag
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def check_async_coro(arg: t.Any) -> None:
|
|
87
|
-
"""
|
|
88
|
-
Check if arg is a coroutine object.
|
|
89
|
-
|
|
90
|
-
Raise a TypeError with a descriptive message if it isn't.
|
|
91
|
-
"""
|
|
92
|
-
if inspect.iscoroutine(arg):
|
|
93
|
-
return
|
|
94
|
-
if inspect.iscoroutinefunction(arg):
|
|
95
|
-
received = f"an async function '{arg.__name__}'. Did you mean '{arg.__name__}()'?"
|
|
96
|
-
else:
|
|
97
|
-
received = repr(arg)
|
|
98
|
-
raise TypeError(f"Expected a coroutine, but got {received}")
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def check_async_func(arg: t.Any) -> None:
|
|
102
|
-
"""
|
|
103
|
-
Check if *arg* is an async function.
|
|
104
|
-
|
|
105
|
-
Raise a TypeError with a descriptive message if it isn't.
|
|
106
|
-
"""
|
|
107
|
-
if inspect.iscoroutinefunction(arg):
|
|
108
|
-
return
|
|
109
|
-
if inspect.iscoroutine(arg):
|
|
110
|
-
received = (f"a coroutine '{arg.__name__}()'. "
|
|
111
|
-
+ f"Did you mean '{arg.__name__}' without parentheses?")
|
|
112
|
-
elif callable(arg):
|
|
113
|
-
received = f"a non-async function/callable '{arg.__name__}'"
|
|
114
|
-
else:
|
|
115
|
-
received = repr(arg)
|
|
116
|
-
raise TypeError(f"Expected an async function, but got {received}")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
redzed/__init__.py,sha256=NxdFNxuOXDhqZRUpCZLhmSFH2W8-khvjkVq_4umGJ9E,1098
|
|
2
|
+
redzed/base_block.py,sha256=A1ZxEIH8jsNXj3z3HvzgAVshUsMoFtqIoR41-U2vMaw,5187
|
|
3
|
+
redzed/block.py,sha256=oviZ1Tonp-eQrgLX4CYnv9KrPSgBPeCHDyUM_yhghJU,11692
|
|
4
|
+
redzed/circuit.py,sha256=QO5XtX-zZhSFz_1ixKgnwrPzZ3vaBm98qWI8Y8-7r3I,31151
|
|
5
|
+
redzed/cron_service.py,sha256=0RSIte6zkbF4mSojrPoVFMHkVep1OZ2Mv2BtG3YiPTs,11372
|
|
6
|
+
redzed/debug.py,sha256=hsHbBxPOOUVL_utfiRnkRh49FszDvHsCZ9xAqxawUIU,2868
|
|
7
|
+
redzed/formula_trigger.py,sha256=lkBMeLVrcvqA71WGGapj9hitm52-dATMgT5QFhC1lOY,7360
|
|
8
|
+
redzed/initializers.py,sha256=1vqnxvQTRYJunAOmYMuZAOL9sr1GPP9Wz2FK92o4wVc,7740
|
|
9
|
+
redzed/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
redzed/signal_shutdown.py,sha256=BAolHuMw-P86R8cSIebjsvUDZOSt-PanKFA0iQS1GIc,2078
|
|
11
|
+
redzed/undef.py,sha256=0Q70QdtbmCHbAmFwJJ7L8CILi1-hxYOKU5nlR5EyH9I,892
|
|
12
|
+
redzed/blocklib/__init__.py,sha256=au7jbjO_RUFzK5U4STk-7pc1DTVA0OVh2W_aKsx1Y3s,557
|
|
13
|
+
redzed/blocklib/counter.py,sha256=pUT5Np31gk1rP2LqaTjJdzdyyS8NhpD9104Re_MtLpY,1251
|
|
14
|
+
redzed/blocklib/fsm.py,sha256=3UVQyKwZstL96jf3HYfuvN6R49uOMXVo20MFz9EpGkc,24746
|
|
15
|
+
redzed/blocklib/inputs.py,sha256=YtKtbDUtXyQyUTNadniwyxCA_-UPCgrrY17EipfXcaI,6223
|
|
16
|
+
redzed/blocklib/outputs.py,sha256=TnYjQV9DUfBX86WzXQP1xlSh-Oui-xvuN3uQEWvXIvc,13313
|
|
17
|
+
redzed/blocklib/repeat.py,sha256=hkIO7qgm4wS32dcKkkfL_DjnoKWf-l3k2DfRiRUk6iE,2500
|
|
18
|
+
redzed/blocklib/timedate.py,sha256=bmYZx6ToYsuD3UQzc1zxD2ddvovzF0A63-y4Pnkrm6Q,5225
|
|
19
|
+
redzed/blocklib/timeinterval.py,sha256=alK68glDdWPD9SWxZ97pEzhQIReC41RMdXrRIRZsyuE,6878
|
|
20
|
+
redzed/blocklib/timer.py,sha256=fCQTbmBOqo7pc6k32yj7JoyUM9XbdgHOXzu2tRiOiJE,1483
|
|
21
|
+
redzed/blocklib/validator.py,sha256=6r0qtPIJ2neCP32WhI7tGxEUus_ji6kx_jrzHd2_M9I,1312
|
|
22
|
+
redzed/utils/__init__.py,sha256=Yo8cj1f1HQj862UOdCsXOkMg4kfq1c5S3HJDhuiE5os,326
|
|
23
|
+
redzed/utils/async_utils.py,sha256=Vknijh9rABL8GcJbYv6a7I4qO2VLerMsGTr5wiGWbjo,4486
|
|
24
|
+
redzed/utils/data_utils.py,sha256=hesExhPcM2-IZPbDXAuGCUMpCI4YiNodp_ZJUj0_h9I,2952
|
|
25
|
+
redzed/utils/time_utils.py,sha256=eCqk4T4ipn4hgzL8-4Usn1W6kkTyRCuQ9-BMSvnELww,8524
|
|
26
|
+
redzed-26.1.28.dist-info/licenses/LICENSE.txt,sha256=brj9B7uNdzUvTJON_5Eibf7zeLRhcMuBYMInalu0KlI,1091
|
|
27
|
+
redzed-26.1.28.dist-info/METADATA,sha256=t_DTA4MdjNI4KoOY8ayUvtU_FNABfmLfUdqQVQddmaI,2057
|
|
28
|
+
redzed-26.1.28.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
29
|
+
redzed-26.1.28.dist-info/top_level.txt,sha256=7Rt0BRMqaJ0AGAmrd2JDqmqSY4cmQeW--7u6KDV1gZg,7
|
|
30
|
+
redzed-26.1.28.dist-info/RECORD,,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Vlado Potisk <redzed@poti.sk>
|
|
3
|
+
Copyright (c) 2025-2026 Vlado Potisk <redzed@poti.sk>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
redzed-25.12.30.dist-info/RECORD
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
redzed/__init__.py,sha256=eyvuX8qwxEFuiP6jOu4x1qv-AmHJAGKOziV1dKCNWWA,1098
|
|
2
|
-
redzed/base_block.py,sha256=NzJhY0POAJUyfp9EcQG2RvXM472vAV5iWG5LdsScpso,5191
|
|
3
|
-
redzed/block.py,sha256=0iwK8Pb5LJ0xzoOt5dkx-FeWplzUzAWHOWfah368u7s,12012
|
|
4
|
-
redzed/circuit.py,sha256=VkcAZZg5HfEdboUZ_vMnElI9E4MprwaoBveN8-hUvZw,31095
|
|
5
|
-
redzed/cron_service.py,sha256=f-YR0w2U0dpipX271cyUYXvsvJunpE3mywuV7SkFE_k,10581
|
|
6
|
-
redzed/debug.py,sha256=QeWHpfTZADPB6nY0zrj1Aqo91Wd9HB9bAJVgq_d3hCo,2767
|
|
7
|
-
redzed/formula_trigger.py,sha256=0_TVbR1wCQ0Wv7NlJtcfD-iDUbmTBlbVCSdbKDw_tX0,7516
|
|
8
|
-
redzed/initializers.py,sha256=oF5Wkdu2REFdfuCEdo8kS-9N2uW2dhdzYWoibILB3ks,7804
|
|
9
|
-
redzed/signal_shutdown.py,sha256=KjL6Kq9K0m_2nerjo7hryNFPhgdNTmSyTOfDi-SMsjA,2081
|
|
10
|
-
redzed/undef.py,sha256=iPxcUIKBDh5wqjdr8qvs9EQkx5s52ryNDY22at-PF0c,896
|
|
11
|
-
redzed/blocklib/__init__.py,sha256=au7jbjO_RUFzK5U4STk-7pc1DTVA0OVh2W_aKsx1Y3s,557
|
|
12
|
-
redzed/blocklib/counter.py,sha256=XvJPOarg6RZ9H-GrWFQrt3JJnGk9YGc1B7NOpF6ju4A,1125
|
|
13
|
-
redzed/blocklib/fsm.py,sha256=6Qv4pOsF-FOEBm9NQUSD6F2yLfb0chvbpvbrgg3sIk8,23492
|
|
14
|
-
redzed/blocklib/inputs.py,sha256=hhfU2Id7oJfmhZB-_PoowXBfYDuw9OQyceg_AprJVVs,7218
|
|
15
|
-
redzed/blocklib/outputs.py,sha256=hoBPr_978PyhR6OzD0rxou34PFukIRD1pIpK6JNgqQE,12894
|
|
16
|
-
redzed/blocklib/repeat.py,sha256=hkIO7qgm4wS32dcKkkfL_DjnoKWf-l3k2DfRiRUk6iE,2500
|
|
17
|
-
redzed/blocklib/timedate.py,sha256=78wqiH1mUz5zoz3ZgDOmsPaYYmQLypgt9IfmLUcH9Cw,5196
|
|
18
|
-
redzed/blocklib/timeinterval.py,sha256=hxPhao1Gm9q_NOp6WdjmsStkrfwkadH5uJh-Hli9D-4,6752
|
|
19
|
-
redzed/blocklib/timer.py,sha256=X3CoqwGJ46oLw0R5u0HK1a11VpcZdTWvPbWOkFjZrDI,1520
|
|
20
|
-
redzed/utils/__init__.py,sha256=Yo8cj1f1HQj862UOdCsXOkMg4kfq1c5S3HJDhuiE5os,326
|
|
21
|
-
redzed/utils/async_utils.py,sha256=Vknijh9rABL8GcJbYv6a7I4qO2VLerMsGTr5wiGWbjo,4486
|
|
22
|
-
redzed/utils/data_utils.py,sha256=xiaVnEJF7Q9oGFqqTOyiVyzI-sG0lYHxImfyFcXjwFI,3542
|
|
23
|
-
redzed/utils/time_utils.py,sha256=eCqk4T4ipn4hgzL8-4Usn1W6kkTyRCuQ9-BMSvnELww,8524
|
|
24
|
-
redzed-25.12.30.dist-info/licenses/LICENSE.txt,sha256=HwuPxdAOIKlSWHESVtk6Zov7d0BZaPu74eruoZc5UN8,1086
|
|
25
|
-
redzed-25.12.30.dist-info/METADATA,sha256=LiyTs38Xa48jh2ozWNw1uUICaNKrTg7xWSUd1vEHTK0,2058
|
|
26
|
-
redzed-25.12.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
-
redzed-25.12.30.dist-info/top_level.txt,sha256=7Rt0BRMqaJ0AGAmrd2JDqmqSY4cmQeW--7u6KDV1gZg,7
|
|
28
|
-
redzed-25.12.30.dist-info/RECORD,,
|
|
File without changes
|