Skip to content

Commit

Permalink
fix: assorted fixes and improvements (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennedykori committed Jul 13, 2024
1 parent fa13030 commit 5928f9b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/sghi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@


# =============================================================================
# SETUP FUNTION
# SETUP FUNCTION
# =============================================================================


Expand Down
2 changes: 1 addition & 1 deletion src/sghi/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def of(
This factory will also include initializers marked using the
:func:`register` decorator by default, .i.e, those returned by the
:func:`get_registered_initializer_factories` function. This can be
disabled byvsetting the ``skip_registered_initializers`` parameter to
disabled by setting the ``skip_registered_initializers`` parameter to
``True``.
:param settings: The configurations/settings to use as a mapping.
Expand Down
6 changes: 3 additions & 3 deletions src/sghi/registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class Registry(metaclass=ABCMeta):
A ``Registry`` also comes bundled with a :class:`~sghi.dispatch.Dispatcher`
whose responsibility is to emit :class:`signals<Signal>` whenever changes
to the registry are made. It allows other components to subscribe to these
signals and react accordingly. This dispatcher is accessible using the
:attr:`~sghi.registry.Registry.dispatcher` property.
signals and react accordingly. The bundled dispatcher can be accessed using
the :attr:`~sghi.registry.Registry.dispatcher` property.
For a list of supported signals, see the
:attr:`~sghi.registry.Registry.dispatcher` property docs.
Expand Down Expand Up @@ -185,7 +185,7 @@ def dispatcher(self) -> Dispatcher:
following signals:
- :class:`RegistryItemSet` - This signal is emitted when either a new
item is added to the ``Registry``, or an existing item updated. It
item is added to the ``Registry``, or an existing item is updated. It
includes information about the item's key and value.
- :class:`RegistryItemRemoved` - This signal is emitted when an item is
removed from the registry. It includes information about the item's
Expand Down
14 changes: 7 additions & 7 deletions src/sghi/retry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ def cause(self) -> BaseException:
def if_exception_type_factory(
*exp_types: type[BaseException],
) -> _RetryPredicate:
"""Create a retry predicate for the given exception types.
"""Create a retry predicate for the given exception type(s).
:param exp_types: The exception types to check for.
:param exp_types: The exception type(s) to check for.
:return: A callable that takes an exception and returns ``True`` if the
provided exception is of the given types.
provided exception is of the given type(s).
"""
_exp: BaseException
return lambda _exp: isinstance(_exp, exp_types)
Expand Down Expand Up @@ -363,10 +363,10 @@ def do_retry(*args: _P.args, **kwargs: _P.kwargs) -> _RT:
def _calculate_deadline_time(self) -> datetime | None:
"""Determine and return the time when the last retry should be made.
This method is should only be called once per :class:`Retry <retry>`
instance. Return the calculated timeout time or ``None`` to indicate
that the callable should be retried indefinitely until a successful
call is made.
This method is only called once per :class:`Retry <retry>` operation.
Return the calculated timeout time or ``None`` to indicate that the
callable should be retried indefinitely until a successful call is
made.
:return: The calculated timeout time or ``None``.
"""
Expand Down
14 changes: 7 additions & 7 deletions src/sghi/task/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __call__(self, an_input: _IT) -> _OT:
"""
return self.execute(an_input)

def __lshift__(self, __before: Task[_IT1, _IT]) -> Task[_IT1, _OT]:
def __lshift__(self, __before: Task[_IT1, _IT], /) -> Task[_IT1, _OT]:
"""Compose two :class:`tasks<sghi.task.Task>` together.
This operator creates a new task that performs the computation of the
Expand Down Expand Up @@ -235,7 +235,7 @@ def compose(self, before: Task[_IT1, _IT]) -> Task[_IT1, _OT]:
Return a new ``Task`` that performs the computation of the given
task before the computation of this task. The returned task first
:meth:`applies<execute>` the ``after`` task to its input, and then
:meth:`applies<execute>` the ``before`` task to its input, and then
applies this task to the result. That is, the output of
``before.execute()`` becomes the input to ``self.execute()``.
Expand Down Expand Up @@ -363,7 +363,7 @@ def execute(self, an_input: Callable[[_IT], _OT]) -> Chain[_OT]:
@deprecated("To be removed in v2.x")
@final
class Consume(Task[_IT, _IT], Generic[_IT]):
"""A :class:`Task` that applies an action to it's inputs.
"""A :class:`Task` that applies an action to its inputs.
This ``Task`` wraps a callable and applies it to its input. It returns
its input value as is on execution and is better suited for
Expand All @@ -377,7 +377,7 @@ class Consume(Task[_IT, _IT], Generic[_IT]):

def __init__(self, accept: Callable[[_IT], Any]) -> None:
"""Initialize a new :class:`Consume` instance that applies the given
action to it's inputs.
action to its inputs.
:param accept: A callable to apply to this task's inputs. This MUST not
be None.
Expand Down Expand Up @@ -694,8 +694,8 @@ def dispose(self) -> None:
:return: None.
"""
self._executor.shutdown(wait=self._wait_for_completion)
self._is_disposed = True
self._executor.shutdown(wait=self._wait_for_completion)

@not_disposed
@override
Expand Down Expand Up @@ -744,9 +744,9 @@ def _do_execute_task(self, task: Task[_IT, _OT], an_input: _IT) -> _OT:
:param task: The ``Task`` to execute.
:param an_input: The input to pass to the ``Task``.
:return: The result of the tasks's execution.
:return: The result of the task's execution.
:raises Exception: If the tasks execution encounters an exception.
:raises Exception: If the execution failed.
"""
try:
result: _OT = task.execute(an_input)
Expand Down

0 comments on commit 5928f9b

Please sign in to comment.