mm-std 0.3.10__py3-none-any.whl → 0.3.11__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.
mm_std/__init__.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
from .async_concurrency import AsyncScheduler as AsyncScheduler
|
2
|
+
from .async_concurrency import async_synchronized as async_synchronized
|
2
3
|
from .command import CommandResult as CommandResult
|
3
4
|
from .command import run_command as run_command
|
4
5
|
from .command import run_ssh_command as run_ssh_command
|
mm_std/async_concurrency.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
import functools
|
1
2
|
import threading
|
2
3
|
from collections.abc import Awaitable, Callable
|
3
4
|
from dataclasses import dataclass, field
|
4
5
|
from datetime import UTC, datetime
|
5
6
|
from logging import Logger
|
7
|
+
from typing import ParamSpec, TypeVar
|
6
8
|
|
7
9
|
import anyio
|
8
10
|
|
@@ -105,3 +107,18 @@ class AsyncScheduler:
|
|
105
107
|
self._thread.join(timeout=5)
|
106
108
|
self._thread = None
|
107
109
|
self._logger.info("Scheduler stopped")
|
110
|
+
|
111
|
+
|
112
|
+
P = ParamSpec("P")
|
113
|
+
R = TypeVar("R")
|
114
|
+
|
115
|
+
|
116
|
+
def async_synchronized(func: Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[R]]:
|
117
|
+
lock = anyio.Lock()
|
118
|
+
|
119
|
+
@functools.wraps(func)
|
120
|
+
async def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
121
|
+
async with lock:
|
122
|
+
return await func(*args, **kwargs)
|
123
|
+
|
124
|
+
return wrapper
|
@@ -1,5 +1,5 @@
|
|
1
|
-
mm_std/__init__.py,sha256=
|
2
|
-
mm_std/async_concurrency.py,sha256=
|
1
|
+
mm_std/__init__.py,sha256=BJzVoqux6-YWxGMyXJS34v6CgKh3V7SrpV7eXIUVfbw,2718
|
2
|
+
mm_std/async_concurrency.py,sha256=w2cc35g2jJAew_1QUfoGRFjallFJH8jg6q0Jem92zzs,4313
|
3
3
|
mm_std/command.py,sha256=ze286wjUjg0QSTgIu-2WZks53_Vclg69UaYYgPpQvCU,1283
|
4
4
|
mm_std/concurrency.py,sha256=4kKLhde6YQYsjJJjH6K5eMQj6FtegEz55Mo5TmhQMM0,5242
|
5
5
|
mm_std/config.py,sha256=4ox4D2CgGR76bvZ2n2vGQOYUDagFnlKEDb87to5zpxE,1871
|
@@ -20,6 +20,6 @@ mm_std/str.py,sha256=BEjJ1p5O4-uSYK0h-enasSSDdwzkBbiwdQ4_dsrlEE8,3257
|
|
20
20
|
mm_std/toml.py,sha256=CNznWKR0bpOxS6e3VB5LGS-Oa9lW-wterkcPUFtPcls,610
|
21
21
|
mm_std/types_.py,sha256=hvZlnvBWyB8CL_MeEWWD0Y0nN677plibYn3yD-5g7xs,99
|
22
22
|
mm_std/zip.py,sha256=axzF1BwcIygtfNNTefZH7hXKaQqwe-ZH3ChuRWr9dnk,396
|
23
|
-
mm_std-0.3.
|
24
|
-
mm_std-0.3.
|
25
|
-
mm_std-0.3.
|
23
|
+
mm_std-0.3.11.dist-info/METADATA,sha256=JXQBD8DtKcAb1n44v5-JDuv9DM-1bgSHT-xgQUNK1j8,410
|
24
|
+
mm_std-0.3.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
25
|
+
mm_std-0.3.11.dist-info/RECORD,,
|
File without changes
|