pyroflow 0.2.0__tar.gz → 0.2.1__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.
- {pyroflow-0.2.0 → pyroflow-0.2.1}/PKG-INFO +1 -1
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/__init__.py +3 -0
- pyroflow-0.2.1/pyroflow/__meta__.py +1 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/enums.py +4 -2
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/async_tools.py +7 -6
- pyroflow-0.2.1/pyroflow/utils/iter_tools.py +37 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/validate_tools.py +6 -3
- pyroflow-0.2.0/pyroflow/__meta__.py +0 -1
- pyroflow-0.2.0/pyroflow/utils/iter_tools.py +0 -32
- {pyroflow-0.2.0 → pyroflow-0.2.1}/LICENSE +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/README.md +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyproject.toml +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/client.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/dispatcher.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/errors.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/listener_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/memory_listener_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/redis_listener_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/models.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/types.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/typings.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinated/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinated/callback_query_coordinated.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinated/message_coordinated.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinated/update_coordinated.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinator/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinator/memory_update_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinator/redis_update_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_coordinator/update_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history/callback_query_history.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history/message_history.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history/update_history.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history_store/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history_store/memory_update_history_store.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history_store/update_history_store.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_listener/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_listener/callback_query_listener.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_listener/message_listener.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_listener/update_listener.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/classes.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/enums.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/misc_tools.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/utils/typings.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/__init__.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/conftest.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_compat_static.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_coordinator.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_enums.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_history.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_imports.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_listener.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_models.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_patch_cls.py +0 -0
- {pyroflow-0.2.0 → pyroflow-0.2.1}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyroflow
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Conversation-oriented Pyrogram extension with per-update listeners and multi-session coordination
|
|
5
5
|
Project-URL: Homepage, https://github.com/eeeob/pyroflow
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/eeeob/pyroflow/issues
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -6,8 +6,10 @@ else:
|
|
|
6
6
|
from enum import Enum
|
|
7
7
|
|
|
8
8
|
class StrEnum(str, Enum):
|
|
9
|
-
def _generate_next_value_(
|
|
10
|
-
return
|
|
9
|
+
def _generate_next_value_(name, *args):
|
|
10
|
+
return name.lower()
|
|
11
|
+
def __str__(self):
|
|
12
|
+
return str(self.value)
|
|
11
13
|
|
|
12
14
|
from enum import IntEnum, auto
|
|
13
15
|
|
|
@@ -3,7 +3,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
3
3
|
|
|
4
4
|
from .typings import NestedContainer, MaybeAwaitable, _True, _False, _P, _T
|
|
5
5
|
from .validate_tools import is_exception, iscoroutinefunction_wrapped
|
|
6
|
-
from .iter_tools import
|
|
6
|
+
from .iter_tools import iter_flat_cont
|
|
7
7
|
|
|
8
8
|
import asyncio
|
|
9
9
|
import functools
|
|
@@ -103,9 +103,9 @@ async def gather_helper(
|
|
|
103
103
|
|
|
104
104
|
caller_stack = traceback.extract_stack()[:-1]
|
|
105
105
|
|
|
106
|
-
results = await asyncio.gather(*
|
|
106
|
+
results = await asyncio.gather(*iter_flat_cont(coros), return_exceptions=return_exc)
|
|
107
107
|
|
|
108
|
-
if log_exc:
|
|
108
|
+
if log_exc and return_exc:
|
|
109
109
|
for i, r in enumerate(results):
|
|
110
110
|
if is_exception(r):
|
|
111
111
|
_log_exc("error in gather_helper", caller_stack, r, index=i)
|
|
@@ -159,10 +159,11 @@ async def safe_await(
|
|
|
159
159
|
caller_stack = traceback.extract_stack()[:-1]
|
|
160
160
|
|
|
161
161
|
results = []
|
|
162
|
-
|
|
163
|
-
is_multi = len(flat_coros) > 1
|
|
162
|
+
is_multi = False
|
|
164
163
|
|
|
165
|
-
for i, coro in enumerate(
|
|
164
|
+
for i, coro in enumerate(iter_flat_cont(coros)):
|
|
165
|
+
if not is_multi and i > 0:
|
|
166
|
+
is_multi = True
|
|
166
167
|
try:
|
|
167
168
|
result = await coro
|
|
168
169
|
except Exception as e:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import List, Generator, Any, overload
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from .typings import NestedContainer, _T
|
|
5
|
+
from .validate_tools import is_container
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@overload
|
|
11
|
+
def iter_flat_cont(*containers: None) -> Generator[Any, None, None]: ...
|
|
12
|
+
@overload
|
|
13
|
+
def iter_flat_cont(*containers: NestedContainer[None]) -> Generator[Any, None, None]: ...
|
|
14
|
+
@overload
|
|
15
|
+
def iter_flat_cont(*containers: NestedContainer[_T]) -> Generator[_T, None, None]: ...
|
|
16
|
+
def iter_flat_cont(*containers):
|
|
17
|
+
for item in containers:
|
|
18
|
+
if is_container(item):
|
|
19
|
+
yield from iter_flat_cont(*item)
|
|
20
|
+
elif item is not None:
|
|
21
|
+
yield item
|
|
22
|
+
|
|
23
|
+
@overload
|
|
24
|
+
def flat_cont(*containers: None) -> List: ...
|
|
25
|
+
@overload
|
|
26
|
+
def flat_cont(*containers: NestedContainer[None]) -> List: ...
|
|
27
|
+
@overload
|
|
28
|
+
def flat_cont(*containers: NestedContainer[_T]) -> List[_T]: ...
|
|
29
|
+
def flat_cont(*containers):
|
|
30
|
+
return list(iter_flat_cont(*containers))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = (
|
|
34
|
+
"iter_flat_cont",
|
|
35
|
+
"flat_cont",
|
|
36
|
+
|
|
37
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Union
|
|
1
|
+
from typing import Any, Union, get_args
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import inspect
|
|
@@ -11,13 +11,16 @@ else:
|
|
|
11
11
|
|
|
12
12
|
from .typings import Container, NotContainer, _T
|
|
13
13
|
|
|
14
|
+
_CONTAINER_TYPES = get_args(Container)
|
|
15
|
+
_NOT_CONTAINER_TYPES = get_args(NotContainer)
|
|
16
|
+
|
|
14
17
|
def is_exception(obj: Any) -> TypeIs[BaseException]:
|
|
15
18
|
return isinstance(obj, BaseException)
|
|
16
19
|
|
|
17
20
|
def is_container(obj: Any) -> TypeIs[Union['Container[_T]', Any]]:
|
|
18
|
-
return isinstance(obj,
|
|
21
|
+
return isinstance(obj, _CONTAINER_TYPES) and not isinstance(obj, _NOT_CONTAINER_TYPES)
|
|
19
22
|
|
|
20
|
-
def iscoroutinefunction_wrapped(f):
|
|
23
|
+
def iscoroutinefunction_wrapped(f) -> bool:
|
|
21
24
|
is_coro = False
|
|
22
25
|
|
|
23
26
|
def _stop(func):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from typing import List, overload, Any, Generator
|
|
2
|
-
|
|
3
|
-
from .typings import NestedContainer, _T
|
|
4
|
-
from .validate_tools import is_container
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@overload
|
|
8
|
-
def flat_cont(*containers: None) -> List: ...
|
|
9
|
-
@overload
|
|
10
|
-
def flat_cont(*containers: NestedContainer[None]) -> List: ...
|
|
11
|
-
@overload
|
|
12
|
-
def flat_cont(*containers: NestedContainer[_T]) -> List[_T]: ...
|
|
13
|
-
def flat_cont(*containers):
|
|
14
|
-
|
|
15
|
-
def _flat_generator(item: Any) -> Generator[Any, None, None]:
|
|
16
|
-
if is_container(item):
|
|
17
|
-
for i in item:
|
|
18
|
-
yield from _flat_generator(i)
|
|
19
|
-
elif item is not None:
|
|
20
|
-
yield item
|
|
21
|
-
|
|
22
|
-
result = []
|
|
23
|
-
|
|
24
|
-
for item in containers:
|
|
25
|
-
result.extend(_flat_generator(item))
|
|
26
|
-
|
|
27
|
-
return result
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
__all__ = (
|
|
31
|
-
"flat_cont",
|
|
32
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/memory_listener_coordinator.py
RENAMED
|
File without changes
|
{pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/listener_coordinator/redis_listener_coordinator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyroflow-0.2.0 → pyroflow-0.2.1}/pyroflow/update_history_store/memory_update_history_store.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|