aiomisc 17.7.7__py3-none-any.whl → 17.8.1__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.
aiomisc/entrypoint.py CHANGED
@@ -419,7 +419,7 @@ class Entrypoint:
419
419
  handle = loop.call_later(self.shutdown_timeout, task.cancel)
420
420
 
421
421
  def on_shutdown_finish(task: asyncio.Future) -> None:
422
- nonlocal handle, loop
422
+ nonlocal handle, loop # noqa
423
423
 
424
424
  if task.cancelled():
425
425
  log.warning(
@@ -9,7 +9,7 @@ from time import time
9
9
  from types import TracebackType
10
10
  from typing import (
11
11
  Any, AsyncIterator, Awaitable, Callable, Deque, Generator, NoReturn,
12
- Optional, Type, TypeVar, Union,
12
+ Optional, Type, TypeVar, Union, Generic, ParamSpec,
13
13
  )
14
14
  from weakref import finalize
15
15
 
@@ -19,8 +19,9 @@ from aiomisc.counters import Statistic
19
19
 
20
20
  T = TypeVar("T")
21
21
  R = TypeVar("R")
22
+ P = ParamSpec("P")
22
23
 
23
- GenType = Generator[T, R, None]
24
+ GenType = Generator[T, None, None]
24
25
  FuncType = Callable[[], GenType]
25
26
 
26
27
 
@@ -144,7 +145,7 @@ class IteratorWrapperStatistic(Statistic):
144
145
  enqueued: int
145
146
 
146
147
 
147
- class IteratorWrapper(AsyncIterator, EventLoopMixin):
148
+ class IteratorWrapper(Generic[P, T], AsyncIterator, EventLoopMixin):
148
149
  __slots__ = (
149
150
  "__channel",
150
151
  "__close_event",
@@ -155,9 +156,11 @@ class IteratorWrapper(AsyncIterator, EventLoopMixin):
155
156
  ) + EventLoopMixin.__slots__
156
157
 
157
158
  def __init__(
158
- self, gen_func: FuncType,
159
+ self,
160
+ gen_func: Callable[P, Generator[T, None, None]],
159
161
  loop: Optional[asyncio.AbstractEventLoop] = None,
160
- max_size: int = 0, executor: Optional[Executor] = None,
162
+ max_size: int = 0,
163
+ executor: Optional[Executor] = None,
161
164
  statistic_name: Optional[str] = None,
162
165
  ):
163
166
 
@@ -213,6 +216,12 @@ class IteratorWrapper(AsyncIterator, EventLoopMixin):
213
216
 
214
217
  def close(self) -> Awaitable[None]:
215
218
  self.__channel.close()
219
+ # if the iterator inside thread is blocked on `.put()`
220
+ # we need to wake it up to signal that it is closed.
221
+ try:
222
+ self.__channel.queue.get()
223
+ except QueueEmpty:
224
+ pass
216
225
  return asyncio.ensure_future(self.wait_closed())
217
226
 
218
227
  async def wait_closed(self) -> None:
@@ -221,11 +230,9 @@ class IteratorWrapper(AsyncIterator, EventLoopMixin):
221
230
  await asyncio.gather(self.__gen_task, return_exceptions=True)
222
231
 
223
232
  def _run(self) -> Any:
224
- return self.loop.run_in_executor(
225
- self.executor, self._in_thread,
226
- )
233
+ return self.loop.run_in_executor(self.executor, self._in_thread)
227
234
 
228
- def __aiter__(self) -> AsyncIterator[Any]:
235
+ def __aiter__(self) -> AsyncIterator[T]:
229
236
  if not self.loop.is_running():
230
237
  raise RuntimeError("Event loop is not running")
231
238
 
@@ -236,7 +243,7 @@ class IteratorWrapper(AsyncIterator, EventLoopMixin):
236
243
  self.__gen_task = gen_task
237
244
  return IteratorProxy(self, self.close)
238
245
 
239
- async def __anext__(self) -> Awaitable[T]:
246
+ async def __anext__(self) -> T:
240
247
  try:
241
248
  item, is_exc = await self.__channel.get()
242
249
  except ChannelClosed:
@@ -263,13 +270,13 @@ class IteratorWrapper(AsyncIterator, EventLoopMixin):
263
270
  await self.close()
264
271
 
265
272
 
266
- class IteratorProxy(AsyncIterator):
273
+ class IteratorProxy(Generic[T], AsyncIterator):
267
274
  def __init__(
268
- self, iterator: AsyncIterator,
275
+ self, iterator: AsyncIterator[T],
269
276
  finalizer: Callable[[], Any],
270
277
  ):
271
278
  self.__iterator = iterator
272
279
  finalize(self, finalizer)
273
280
 
274
- def __anext__(self) -> Awaitable[Any]:
281
+ def __anext__(self) -> Awaitable[T]:
275
282
  return self.__iterator.__anext__()
aiomisc/service/base.py CHANGED
@@ -1,15 +1,13 @@
1
1
  import asyncio
2
2
  from abc import ABC, ABCMeta, abstractmethod
3
- from typing import (
4
- Any, Coroutine, Dict, Generator, Optional, Set, Tuple, TypeVar, Union,
5
- )
3
+ from typing import Any, Coroutine, Dict, Optional, Set, Tuple, TypeVar, Union
6
4
 
7
5
  from ..context import Context, get_context
8
6
  from ..utils import cancel_tasks
9
7
 
10
8
 
11
9
  T = TypeVar("T")
12
- CoroutineType = Union[Coroutine[Any, Any, T], Generator[Any, None, T]]
10
+ CoroutineType = Union[Coroutine[Any, Any, T]]
13
11
 
14
12
 
15
13
  class ServiceMeta(ABCMeta):
aiomisc/thread_pool.py CHANGED
@@ -2,18 +2,19 @@ import asyncio
2
2
  import contextvars
3
3
  import inspect
4
4
  import logging
5
+ import os
5
6
  import threading
6
7
  import time
7
8
  import warnings
8
9
  from concurrent.futures import ThreadPoolExecutor as ThreadPoolExecutorBase
9
10
  from dataclasses import dataclass, field
10
- from functools import partial, wraps
11
+ from functools import partial
11
12
  from multiprocessing import cpu_count
12
13
  from queue import SimpleQueue
13
14
  from types import MappingProxyType
14
15
  from typing import (
15
- Any, Awaitable, Callable, Coroutine, Dict, FrozenSet, Optional, Set, Tuple,
16
- TypeVar,
16
+ Any, Awaitable, Callable, Coroutine, Dict, FrozenSet, Generic,
17
+ Optional, Set, Tuple, TypeVar, Generator, overload, Union
17
18
  )
18
19
 
19
20
  from ._context_vars import EVENT_LOOP
@@ -21,12 +22,15 @@ from .compat import ParamSpec
21
22
  from .counters import Statistic
22
23
  from .iterator_wrapper import IteratorWrapper
23
24
 
24
-
25
25
  P = ParamSpec("P")
26
26
  T = TypeVar("T")
27
27
  F = TypeVar("F", bound=Callable[..., Any])
28
28
  log = logging.getLogger(__name__)
29
29
 
30
+ THREADED_ITERABLE_DEFAULT_MAX_SIZE = int(
31
+ os.getenv("THREADED_ITERABLE_DEFAULT_MAX_SIZE", 1024)
32
+ )
33
+
30
34
 
31
35
  def context_partial(
32
36
  func: F, *args: Any,
@@ -327,6 +331,7 @@ def run_in_executor(
327
331
  return await loop.run_in_executor(
328
332
  executor, partial(func, *args, **kwargs),
329
333
  )
334
+
330
335
  return lazy_wrapper()
331
336
 
332
337
 
@@ -340,22 +345,56 @@ async def _awaiter(future: asyncio.Future) -> T:
340
345
  raise
341
346
 
342
347
 
348
+ class Threaded(Generic[P, T]):
349
+ __slots__ = ("func",)
350
+
351
+ def __init__(self, func: Callable[P, T]) -> None:
352
+ if asyncio.iscoroutinefunction(func):
353
+ raise TypeError("Can not wrap coroutine")
354
+ if inspect.isgeneratorfunction(func):
355
+ raise TypeError("Can not wrap generator function")
356
+ self.func = func
357
+
358
+ def sync_call(self, *args: P.args, **kwargs: P.kwargs) -> T:
359
+ return self.func(*args, **kwargs)
360
+
361
+ def async_call(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[T]:
362
+ return run_in_executor(func=self.func, args=args, kwargs=kwargs)
363
+
364
+ def __repr__(self) -> str:
365
+ return f"<Threaded {self.func.__name__} at {id(self):#x}>"
366
+
367
+ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[T]:
368
+ return self.async_call(*args, **kwargs)
369
+
370
+ def __get__(self, instance: Any, owner: Optional[type] = None) -> Any:
371
+ if instance is None:
372
+ return self
373
+ return partial(self.async_call, instance)
374
+
375
+
376
+ @overload
377
+ def threaded(func: Callable[P, T]) -> Threaded[P, T]:
378
+ ...
379
+
380
+
381
+ @overload
343
382
  def threaded(
344
- func: Callable[P, T],
345
- ) -> Callable[P, Awaitable[T]]:
346
- if asyncio.iscoroutinefunction(func):
347
- raise TypeError("Can not wrap coroutine")
383
+ func: Callable[P, Generator[T, None, None]]
384
+ ) -> Callable[P, IteratorWrapper[P, T]]:
385
+ ...
348
386
 
349
- if inspect.isgeneratorfunction(func):
350
- return threaded_iterable(func)
351
387
 
352
- @wraps(func)
353
- def wrap(
354
- *args: P.args, **kwargs: P.kwargs,
355
- ) -> Awaitable[T]:
356
- return run_in_executor(func=func, args=args, kwargs=kwargs)
388
+ def threaded(
389
+ func: Callable[P, T] | Callable[P, Generator[T, None, None]]
390
+ ) -> Threaded[P, T] | Callable[P, IteratorWrapper[P, T]]:
391
+ if inspect.isgeneratorfunction(func):
392
+ return threaded_iterable(
393
+ func,
394
+ max_size=THREADED_ITERABLE_DEFAULT_MAX_SIZE
395
+ )
357
396
 
358
- return wrap
397
+ return Threaded(func) # type: ignore
359
398
 
360
399
 
361
400
  def run_in_new_thread(
@@ -390,43 +429,112 @@ def run_in_new_thread(
390
429
  return future
391
430
 
392
431
 
432
+ class ThreadedSeparate(Threaded[P, T]):
433
+ """
434
+ A decorator to run a function in a separate thread.
435
+ It returns an `asyncio.Future` that can be awaited.
436
+ """
437
+
438
+ def __init__(self, func: Callable[P, T], detach: bool = True) -> None:
439
+ super().__init__(func)
440
+ self.detach = detach
441
+
442
+ def async_call(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[T]:
443
+ return run_in_new_thread(
444
+ self.func, args=args, kwargs=kwargs, detach=self.detach,
445
+ )
446
+
447
+
393
448
  def threaded_separate(
394
- func: F,
449
+ func: Callable[P, T],
395
450
  detach: bool = True,
396
- ) -> Callable[..., Awaitable[Any]]:
451
+ ) -> ThreadedSeparate[P, T]:
397
452
  if isinstance(func, bool):
398
453
  return partial(threaded_separate, detach=detach)
399
454
 
400
455
  if asyncio.iscoroutinefunction(func):
401
456
  raise TypeError("Can not wrap coroutine")
402
457
 
403
- @wraps(func)
404
- def wrap(*args: Any, **kwargs: Any) -> Any:
405
- future = run_in_new_thread(
406
- func, args=args, kwargs=kwargs, detach=detach,
458
+ return ThreadedSeparate(func, detach=detach)
459
+
460
+
461
+ class ThreadedIterable(Generic[P, T]):
462
+ def __init__(
463
+ self,
464
+ func: Callable[P, Generator[T, None, None]],
465
+ max_size: int = 0
466
+ ) -> None:
467
+ self.func = func
468
+ self.max_size = max_size
469
+
470
+ def sync_call(
471
+ self, *args: P.args, **kwargs: P.kwargs
472
+ ) -> Generator[T, None, None]:
473
+ return self.func(*args, **kwargs)
474
+
475
+ def async_call(
476
+ self, *args: P.args, **kwargs: P.kwargs
477
+ ) -> IteratorWrapper[P, T]:
478
+ return self.create_wrapper(*args, **kwargs)
479
+
480
+ def create_wrapper(
481
+ self, *args: P.args, **kwargs: P.kwargs
482
+ ) -> IteratorWrapper[P, T]:
483
+ return IteratorWrapper(
484
+ partial(self.func, *args, **kwargs),
485
+ max_size=self.max_size,
407
486
  )
408
- return future
409
487
 
410
- return wrap
488
+ def __call__(
489
+ self,
490
+ *args: P.args,
491
+ **kwargs: P.kwargs
492
+ ) -> IteratorWrapper[P, T]:
493
+ return self.async_call(*args, **kwargs)
494
+
495
+ def __get__(
496
+ self,
497
+ instance: Any,
498
+ owner: Optional[type] = None
499
+ ) -> Any:
500
+ if instance is None:
501
+ return self
502
+ return partial(self.async_call, instance)
411
503
 
412
504
 
505
+ @overload
413
506
  def threaded_iterable(
414
- func: Optional[F] = None,
507
+ func: Callable[P, Generator[T, None, None]],
508
+ *,
415
509
  max_size: int = 0,
416
- ) -> Any:
417
- if isinstance(func, int):
418
- return partial(threaded_iterable, max_size=func)
419
- if func is None:
420
- return partial(threaded_iterable, max_size=max_size)
510
+ ) -> "ThreadedIterable[P, T]":
511
+ ...
421
512
 
422
- @wraps(func)
423
- def wrap(*args: Any, **kwargs: Any) -> Any:
424
- return IteratorWrapper(
425
- partial(func, *args, **kwargs),
426
- max_size=max_size,
427
- )
428
513
 
429
- return wrap
514
+ @overload
515
+ def threaded_iterable(
516
+ *,
517
+ max_size: int = 0,
518
+ ) -> Callable[
519
+ [Callable[P, Generator[T, None, None]]], ThreadedIterable[P, T]
520
+ ]:
521
+ ...
522
+
523
+
524
+ def threaded_iterable(
525
+ func: Optional[Callable[P, Generator[T, None, None]]] = None,
526
+ *,
527
+ max_size: int = 0,
528
+ ) -> Union[
529
+ ThreadedIterable[P, T],
530
+ Callable[
531
+ [Callable[P, Generator[T, None, None]]], ThreadedIterable[P, T]
532
+ ]
533
+ ]:
534
+ if func is None:
535
+ return lambda f: ThreadedIterable(f, max_size=max_size)
536
+
537
+ return ThreadedIterable(func, max_size=max_size)
430
538
 
431
539
 
432
540
  class IteratorWrapperSeparate(IteratorWrapper):
@@ -434,23 +542,50 @@ class IteratorWrapperSeparate(IteratorWrapper):
434
542
  return run_in_new_thread(self._in_thread)
435
543
 
436
544
 
545
+ class ThreadedIterableSeparate(ThreadedIterable[P, T]):
546
+ def create_wrapper(
547
+ self, *args: P.args, **kwargs: P.kwargs
548
+ ) -> IteratorWrapperSeparate:
549
+ return IteratorWrapperSeparate(
550
+ partial(self.func, *args, **kwargs),
551
+ max_size=self.max_size,
552
+ )
553
+
554
+
555
+ @overload
437
556
  def threaded_iterable_separate(
438
- func: Optional[F] = None,
557
+ func: Callable[P, Generator[T, None, None]],
558
+ *,
439
559
  max_size: int = 0,
440
- ) -> Any:
441
- if isinstance(func, int):
442
- return partial(threaded_iterable_separate, max_size=func)
443
- if func is None:
444
- return partial(threaded_iterable_separate, max_size=max_size)
560
+ ) -> "ThreadedIterable[P, T]":
561
+ ...
445
562
 
446
- @wraps(func)
447
- def wrap(*args: Any, **kwargs: Any) -> Any:
448
- return IteratorWrapperSeparate(
449
- partial(func, *args, **kwargs),
450
- max_size=max_size,
451
- )
452
563
 
453
- return wrap
564
+ @overload
565
+ def threaded_iterable_separate(
566
+ *,
567
+ max_size: int = 0,
568
+ ) -> Callable[
569
+ [Callable[P, Generator[T, None, None]]],
570
+ ThreadedIterableSeparate[P, T]
571
+ ]:
572
+ ...
573
+
574
+
575
+ def threaded_iterable_separate(
576
+ func: Optional[Callable[P, Generator[T, None, None]]] = None,
577
+ *,
578
+ max_size: int = 0,
579
+ ) -> Union[
580
+ ThreadedIterable[P, T],
581
+ Callable[
582
+ [Callable[P, Generator[T, None, None]]], ThreadedIterableSeparate[P, T]
583
+ ]
584
+ ]:
585
+ if func is None:
586
+ return lambda f: ThreadedIterableSeparate(f, max_size=max_size)
587
+
588
+ return ThreadedIterableSeparate(func, max_size=max_size)
454
589
 
455
590
 
456
591
  class CoroutineWaiter:
@@ -509,4 +644,5 @@ def sync_await(
509
644
  ) -> T:
510
645
  async def awaiter() -> T:
511
646
  return await func(*args, **kwargs)
647
+
512
648
  return wait_coroutine(awaiter())
aiomisc/utils.py CHANGED
@@ -88,6 +88,10 @@ def bind_socket(
88
88
  if not args and ":" in address:
89
89
  sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
90
90
 
91
+ unix_address_family = getattr(socket, "AF_UNIX", None)
92
+ if sock.family == unix_address_family:
93
+ reuse_port = False
94
+
91
95
  if reuse_addr:
92
96
  sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
93
97
 
@@ -99,7 +103,6 @@ def bind_socket(
99
103
  for level, option, value in options:
100
104
  sock.setsockopt(level, option, value)
101
105
 
102
- unix_address_family = getattr(socket, "AF_UNIX", None)
103
106
  if sock.family == unix_address_family:
104
107
  proto_name = proto_name or "unix"
105
108
  sock.bind(address)
aiomisc/version.py CHANGED
@@ -2,5 +2,5 @@
2
2
  # BY: poem-plugins "git" plugin
3
3
  # NEVER EDIT THIS FILE MANUALLY
4
4
 
5
- version_info = (17, 7, 7)
6
- __version__ = "17.7.7"
5
+ version_info = (17, 8, 1)
6
+ __version__ = "17.8.1"
aiomisc/worker_pool.py CHANGED
@@ -60,6 +60,7 @@ class WorkerPool:
60
60
  socket.AF_UNIX,
61
61
  socket.SOCK_STREAM,
62
62
  address=path,
63
+ reuse_port=False,
63
64
  )
64
65
  self.address = path
65
66
  chmod(path, 0o600)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aiomisc
3
- Version: 17.7.7
3
+ Version: 17.8.1
4
4
  Summary: aiomisc - miscellaneous utils for asyncio
5
5
  License: MIT
6
6
  Author: Dmitry Orlov
@@ -7,9 +7,9 @@ aiomisc/compat.py,sha256=aYVe0J-2CvAzUHPAULNhrfMLFYNKN-z3Sg7nlBkzfxw,3291
7
7
  aiomisc/context.py,sha256=j2YRNGDAJbrg94OkFyIMyYKHKzHRRL8tSAWma1yxNKE,1549
8
8
  aiomisc/counters.py,sha256=ZU7K3FBY7V1jIKohWXXyXqby98FuOmq6H5Lv7Cf-c70,3686
9
9
  aiomisc/cron.py,sha256=zAxdrLn8r7ERhkVaoUOv8xrQVZn7Hmm8HBS-MmsIu2s,2165
10
- aiomisc/entrypoint.py,sha256=x85478I-nmza4niFc4Yb4QsnMdRrdyUQ1Ud5dACRduI,14256
10
+ aiomisc/entrypoint.py,sha256=CIMYhM2zQWHaIKgA6GDTdGuVlVG-Lkuia3pTAJPGlFY,14265
11
11
  aiomisc/io.py,sha256=PWBy_D6CVlfhHokQoVfzmHIvGb37VtUo1P-yedB9aL8,10004
12
- aiomisc/iterator_wrapper.py,sha256=d1aZ5jKTrK3kVCsfRPJPUq8X9ijVNi4o5Zs2pV4RS70,7243
12
+ aiomisc/iterator_wrapper.py,sha256=HNOwm1aj4_pxdqs8xGFYO-1EOsTOCiwgxzFf18v2NQk,7542
13
13
  aiomisc/log.py,sha256=UTu5fMwIK5OU9QrDoJqxyVwdQHVDkzPl1laav0SIb4o,6323
14
14
  aiomisc/periodic.py,sha256=OFYZbPkcGgeMjBk8zwsLr2TqPRTS6MNewaL3q9qK5js,2252
15
15
  aiomisc/plugins/__init__.py,sha256=eHKGec_217rBjXGf8u-Joyf7dzpO1O0QAuFan1IEyYE,1057
@@ -21,7 +21,7 @@ aiomisc/recurring.py,sha256=KjqirbRscmNUk53xn0zyGCq2hmQZkceLERJngRyrzNQ,4959
21
21
  aiomisc/service/__init__.py,sha256=_JSkI4Q78UljG4CvhK6He2UGLxJaQS6cVwZ9QT0cSWo,607
22
22
  aiomisc/service/aiohttp.py,sha256=Lfw1dm77zscBZP0H4sKYlVye7RfE0EPWeSSX5V-mvD0,4091
23
23
  aiomisc/service/asgi.py,sha256=S6ejgg7GpHfUzuj46g8QuLXTHn0YWwqI_pAGbXfoNjE,1583
24
- aiomisc/service/base.py,sha256=6xvD27Sh2jy-4JWer6n31FuSq798DZhLI730YYGQbYc,4322
24
+ aiomisc/service/base.py,sha256=znGfzAPS7IgIf4KzAj_9R24HXWr0matoDcCi_X9HMpU,4277
25
25
  aiomisc/service/carbon.py,sha256=V60dFfjZqYXdSVsFFy5hyelVUKchpzTj4uvOosCJNmA,1791
26
26
  aiomisc/service/cron.py,sha256=VM-FjdAhy_zFkU-YTdpBSxF79upvrsCo-3kdI9cZTOo,1975
27
27
  aiomisc/service/dns/__init__.py,sha256=RT8_0H8LrQe8sz2xvA2BvLi6CiJVZeVFltNRAx9MN7o,254
@@ -42,11 +42,11 @@ aiomisc/service/tracer.py,sha256=S8HXRsUEEuCHbP8zlx409rUZJ0fEC6enCP3a0LXyeHk,287
42
42
  aiomisc/service/udp.py,sha256=_uHzMAkpd7y-yt3tE9jN2llEETG7r47g2DF1SO7xyig,3616
43
43
  aiomisc/service/uvicorn.py,sha256=I2KYQL9ysFFqQHPYK00G4EoceA7J9p9Or6v1ATpLGw8,4324
44
44
  aiomisc/signal.py,sha256=_iiC2jukXg7-LLirIl1YATlKIIsKLbmTNFr1Ezheu7g,1728
45
- aiomisc/thread_pool.py,sha256=591u5HV1aBmBRcaVm4kAtMLPZOb6veqhT9wkts_knqE,14017
45
+ aiomisc/thread_pool.py,sha256=xf25KtceW4FC99SUvkbiyM-zB0xLz4SqgdqBlaPYlEQ,17575
46
46
  aiomisc/timeout.py,sha256=5jNDooLW4MAe6ZUIKhkiX29CoyI0zlXd-dZoZwQPxak,920
47
- aiomisc/utils.py,sha256=6yTfTpeRCVzfZp-MJCmB1oayOHUBVwQwzC3U5PBAjn8,11919
48
- aiomisc/version.py,sha256=s0OGgHOIMHrEON6vN-paBHIiLD43o32aTQ1MhgHvMUo,154
49
- aiomisc/worker_pool.py,sha256=GA91KdOrBlqHthbVSTxu_d6BsBIbl-uKqW2NxqSafG0,11107
47
+ aiomisc/utils.py,sha256=9VCtQEaU4QwdMUkWIprm9xvgCfp3y_D4E-Phj7L4S9A,11990
48
+ aiomisc/version.py,sha256=fcR5a6ThEdUG3p_bhPIVd82552CtELVQG_QdWHeqxiA,154
49
+ aiomisc/worker_pool.py,sha256=p1cNOduqHRur1a3SJ58yuEpgL08DgDea57Z2_wQ048U,11141
50
50
  aiomisc_log/__init__.py,sha256=N3g8Ea1YE2dWPDd-MwohuAn3Y0pBxSyL4l4Jsxqkv0Q,4854
51
51
  aiomisc_log/enum.py,sha256=_zfCZPYCGyI9KL6TqHiYVlOfA5U5MCbsuCuDKxDHdxg,1549
52
52
  aiomisc_log/formatter/__init__.py,sha256=1dBtF7yRvyvAhQRAofhBN682r7COoAB8blzibJxlvS8,235
@@ -57,14 +57,14 @@ aiomisc_log/formatter/rich.py,sha256=Zqia_UFpMKvW-C4ctF_7adoMpPHL9Yz8nNFvjkQYR4M
57
57
  aiomisc_log/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  aiomisc_worker/__init__.py,sha256=4b6FAPCXWRnxVq8RXJXOVVsP2o6x92jY7TeMayrR1vI,697
59
59
  aiomisc_worker/__main__.py,sha256=XisibeMsmXbNkkDrzGLQKXlbMz68CfT5xcgmZ-FfD5Y,182
60
- aiomisc_worker/forking.py,sha256=Gq8flvlDtA1dlSZY9Z4PW8AP3Zwn08Pa1fk5jW2qCpw,3057
61
- aiomisc_worker/process.py,sha256=YAkkubqpl2SBcBj8kpZEvzMCXR97vCRvpRwGkdqx3CM,3243
60
+ aiomisc_worker/forking.py,sha256=5nb3jatMiKXmO2h-3b-VLgJXC5WK9PihDgve-xyndnU,3078
61
+ aiomisc_worker/process.py,sha256=SF8qt7IGw4EotPSVqzGjMWBBlS8GnFFtSdhRXH1gCr4,3257
62
62
  aiomisc_worker/process_inner.py,sha256=8ZtjCSLrgySW57OIbuGrpEWxfysRLYKx1or1YaAqx_k,965
63
63
  aiomisc_worker/protocol.py,sha256=1smmlBbdreSmnrxuhHaUMUC10FO9xMIEcedhweQJX_A,2705
64
64
  aiomisc_worker/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  aiomisc_worker/worker.py,sha256=f8nCFhlKh84UUBUaEgCllwMRvVZiD8_UUXaeit6g3T8,3236
66
- aiomisc-17.7.7.dist-info/COPYING,sha256=Ky_8CQMaIixfyOreUBsl0hKN6A5fLnPF8KPQ9molMYA,1125
67
- aiomisc-17.7.7.dist-info/METADATA,sha256=jUwmbr5ctiWOcH-QZses2_BPjXgTwhCcAdf7H5QuWhQ,15685
68
- aiomisc-17.7.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
69
- aiomisc-17.7.7.dist-info/entry_points.txt,sha256=KRsSPCwKJyGTWrvzpwbS0yIDwzsgDA2X6f0CBWYmNao,55
70
- aiomisc-17.7.7.dist-info/RECORD,,
66
+ aiomisc-17.8.1.dist-info/COPYING,sha256=Ky_8CQMaIixfyOreUBsl0hKN6A5fLnPF8KPQ9molMYA,1125
67
+ aiomisc-17.8.1.dist-info/METADATA,sha256=gJ0QQVqRMgJ4o_Z55JcrcMw0KevQrQTOYosqUeesNQI,15685
68
+ aiomisc-17.8.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
69
+ aiomisc-17.8.1.dist-info/entry_points.txt,sha256=KRsSPCwKJyGTWrvzpwbS0yIDwzsgDA2X6f0CBWYmNao,55
70
+ aiomisc-17.8.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
aiomisc_worker/forking.py CHANGED
@@ -20,7 +20,7 @@ EXIT_LOCK = Lock()
20
20
 
21
21
 
22
22
  def at_exit() -> None:
23
- global PROCESSES
23
+ global PROCESSES # noqa
24
24
 
25
25
  with EXIT_LOCK:
26
26
  pids = tuple(PROCESSES.keys())
@@ -61,7 +61,7 @@ def fork(worker_id: bytes, cookie: bytes, address: AddressType) -> None:
61
61
 
62
62
 
63
63
  def main() -> int:
64
- global STOPPING
64
+ global STOPPING # noqa
65
65
 
66
66
  proto_stdin = FileIOProtocol(sys.stdin.buffer)
67
67
 
aiomisc_worker/process.py CHANGED
@@ -86,7 +86,7 @@ def main() -> int:
86
86
  env["AIOMISC_NO_PLUGINS"] = ""
87
87
 
88
88
  def create_worker() -> Worker:
89
- nonlocal env
89
+ nonlocal env # noqa
90
90
  return Worker(
91
91
  log_level, log_format, address, cookie, worker_id, env,
92
92
  initializer, initializer_args, initializer_kwargs,