Skip to content

Commit

Permalink
explain locality
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Apr 8, 2024
1 parent 0724613 commit 14e2a55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/tqdm_publisher/_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def on_progress_update(progress_update: dict):
This is the injection called on every update of the progress bar.
It triggers the announcement event over all listeners on each update of the progress bar.
It must be defined inside this local scope to communicate the `additional_metadata` from the level above
without including it in the method signature.
"""
self._announce(message=dict(**progress_update, **additional_metadata))

Expand Down
5 changes: 4 additions & 1 deletion src/tqdm_publisher/_subscriber.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Iterable, Any, Dict
from typing import Any, Dict, Iterable

from ._publisher import TQDMProgressPublisher

Expand All @@ -13,6 +13,9 @@ def run_on_progress_update(format_dict: Dict[str, Any]):
It calls the `on_progress_update` function, which must take a dictionary
containing the progress bar ID and `format_dict`.
It must be defined inside this local scope to include the `.progress_bar_id` attribute from the level above
without including it in the method signature.
"""
on_progress_update(dict(progress_bar_id=self.progress_bar_id, format_dict=format_dict))

Expand Down

0 comments on commit 14e2a55

Please sign in to comment.