Skip to content

Commit 46d9a68

Browse files
committed
stuff
1 parent 9bdd5ca commit 46d9a68

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

asyncutils/channels.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ __all__ = 'EventBus', 'Observable', 'Rendezvous'
1414
class Observable[**P](LoopContextMixin):
1515
@type_check_only
1616
class _Observer(Protocol):
17+
'''Not exposed.'''
1718
async def __call__(self, *a: P.args, **k: P.kwargs) -> Any: ...
1819
@type_check_only
1920
class _SubscriptionReturnType(Protocol):
21+
'''Not exposed.'''
2022
def __call__(self, strict: bool=...) -> None: ...
2123
@property
2224
def idle(self) -> bool: ...
@@ -66,6 +68,7 @@ class EventBus(LoopContextMixin):
6668
Use instances as context managers only for proper setup and shutdown.'''
6769
@type_check_only
6870
class _WildcardType:
71+
'''Not exposed.'''
6972
def __bool__(self) -> Literal[False]: ...
7073
WILDCARD: _WildcardType
7174
'''Sentinel representing the event type of subscribers that accept any event name.'''

asyncutils/config.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class sentinel_base:
3939
@final
4040
@type_check_only
4141
class _sentinel(sentinel_base):
42-
'''Sentinels for this module, internal or public.'''
42+
'''Sentinels for this module, internal or public. Not exported.'''
4343
def __reduce__(self) -> str: '''These sentinels are accessible in the top level of the asyncutils.config namespace.'''
4444
def set_logger_level(level: int) -> None: '''Set the level of the module-global logger.'''
4545
def get_past_logs() -> str: '''Returns all stored logs as a string. Logs are only stored if asyncutils was started with -l MEMORY, otherwise an empty string is returned.'''

asyncutils/func.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ class benchmark(tuple[float, float, float, float, int]):
4343
@property
4444
def total(self) -> float: '''The total execution time.'''
4545
@property
46-
def avg(self) -> float: '''`total`/`iterations`.'''
46+
def avg(self) -> float: '''`total/iterations`.'''
4747
@property
4848
def iterations(self) -> int: '''The `times` constructor parameter.'''
4949
@type_check_only
5050
class _everymethodrvrv[T, R](Protocol):
51+
'''Not exported.'''
5152
async def __call__(_, self: T, /, *a: Any, **k: Any) -> R|None: ...
5253
@type_check_only
5354
class _everymethodft[T, R](Protocol):
55+
'''Not exported.'''
5456
def __call__(_, self: T, /, *a: Any, **k: Any) -> Awaitable[R]: ...
5557
@type_check_only
5658
class _frv(Protocol):
59+
'''Not exported.'''
5760
def __call__[T, **P](self, f: Callable[P, Awaitable[T]], /) -> Callable[P, Coroutine[Any, Any, T]]: ...

asyncutils/io.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ if sys.platform == 'win32': type _Seek = Literal[0, 1, 2]
7676
else: type _Seek = Literal[0, 1, 2, 3, 4]
7777
@type_check_only
7878
class _PipeFactory(Protocol):
79+
'''Not exported.'''
7980
def __call__(self) -> tuple[int, int]: ...
8081
@type_check_only
8182
class _file(LoopContextMixin):
82-
'''Not exposed at runtime. Calls itself asyncutils.io.file.'''
83+
'''Not exposed. Calls itself asyncutils.io.file.'''
8384
if sys.platform != 'win32':
8485
def madvise(self, option: int, start: int=..., length: int|None=...) -> None: ...
8586
async def reg(self, m: mmap, /) -> None: ...

asyncutils/queues.pyi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class _G[R, T](_Q[R, T], Protocol):
3737
async def get(self, pwd: R) -> T:
3838
'''Removes and returns an item from the password-protected queue, if the password provided was correct; raises WrongPassword otherwise.
3939
If the queue is empty, waits until an item is available.'''
40-
def get_nowait(self, pwd: R) -> T:
40+
def get_nowait(self, pwd: R) -> T:
4141
'''Removes and returns an item from the password-protected queue, if the password provided was correct; raises WrongPassword otherwise.
4242
If the queue is empty, raises asyncio.QueueEmpty.'''
4343
@type_check_only
@@ -53,11 +53,11 @@ class _P[R, T](_Q[R, T], Protocol):
5353
class _B[R, V, T](_G[R, T], _P[V, T], Protocol): '''Does not exist at runtime.'''
5454
@overload
5555
def password_queue[T, R](password_put: R, *, maxsize: int=..., protect_get: Literal[False]=..., protect_put: Literal[True]=..., can_change_put: bool=..., wait: bool=..., priority: bool=..., lifo: bool=..., raising: bool=..., put_from: str=..., puttyp: type[R]=..., init_items: SupportsIteration[T]=[], log: Callable[[str], None]=..., auditf: Callable[[Literal['asyncutils.queues.password_queue'], Literal[False], Literal[True], str, str], None]=...) -> _P[R, T]:
56-
'''Returns a password-protected queue, inheriting from asyncio.Queue, with maximum size maxsize. priority and lifo parameters determine if the queue is a priority queue and last-in-first-out.
57-
If protect_get is True, get and get_nowait will require a password, specified by password_get or retrieved from a variable in the caller's scope with name get_from (default 'password').
58-
If protect_put is True, put and put_nowait will require a password, specified by password_put or retrieved from a variable in the caller's scope with name put_from (default 'password').
59-
If init_items is specified, the items in that (async) iterable will be put into the queue immediately. If there are too many items in the (async) iterable, parameters wait and raising determine the behaviour; log is a function used to emit warnings in that case.
60-
auditf (default sys.audit) is an audit function that takes the event name ('asyncutils.queues.password_queue'), protect_get, protect_put, get_from, put_from and returns None; note that the passwords are not passed to the audit function.'''
56+
'''Returns a password-protected queue, the type of which inherits from asyncio.Queue, with maximum size `maxsize`. `priority` and `lifo` parameters determine if the queue is a priority queue and last-in-first-out.
57+
If `protect_get` is True, get and get_nowait will require a password, specified by password_get or retrieved from a variable in the caller's scope with name `get_from` (default `password`).
58+
If `protect_put` is True, put and put_nowait will require a password, specified by password_put or retrieved from a variable in the caller's scope with name `put_from` (default `password`).
59+
If `init_items` is specified, the items in that (async) iterable will be put into the queue immediately. If there are too many items in the (async) iterable, parameters wait and raising determine the behaviour; log is a function used to emit warnings in that case.
60+
`auditf` (default sys.audit) is an audit function that takes the event name ('asyncutils.queues.password_queue'), `protect_get`, `protect_put`, `get_from`, `put_from` and returns None; note that the passwords are not passed to the audit function.'''
6161
@overload
6262
def password_queue[T, R](*, maxsize: int=..., protect_get: Literal[False]=..., protect_put: Literal[True]=..., can_change_put: bool=..., wait: bool=..., priority: bool=..., lifo: bool=..., raising: bool=..., put_from: str=..., puttyp: type[R]=object, init_items: SupportsIteration[T]=[], log: Callable[[str], None]=..., auditf: Callable[[Literal['asyncutils.queues.password_queue'], Literal[False], Literal[True], str, str], None]=...) -> _P[R, T]: ...
6363
@overload
@@ -73,6 +73,7 @@ def password_queue[T, R, V](*, password_get: R, maxsize: int=..., protect_get: L
7373
@overload
7474
def password_queue[T, R, V](*, maxsize: int=..., protect_get: Literal[True], protect_put: Literal[True]=..., can_change_get: bool=..., can_change_put: bool=..., wait: bool=..., priority: bool=..., lifo: bool=..., raising: bool=..., get_from: str=..., put_from: str=..., gettyp: type[R]=object, puttyp: type[V]=object, init_items: SupportsIteration[T]=[], log: Callable[[str], None]=..., auditf: Callable[[Literal['asyncutils.queues.password_queue'], Literal[True], Literal[True], str, str], None]=...) -> _B[R, V, T]: ...
7575
class PotentQueueBase[T](Queue[T], EventualLoopMixin, metaclass=ABCMeta):
76+
'''A base class for queues with much more methods, async- and sync-compatible.'''
7677
@abstractmethod
7778
def _init(self, maxsize: int) -> None: ...
7879
@abstractmethod

0 commit comments

Comments
 (0)