Skip to content

Commit

Permalink
Merge branch 'main' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Jan 22, 2024
2 parents 80b1b8f + 31a6d2a commit 95b68b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

def main():

if (len(sys.argv) <= 1):
print("No command provided. Please specify a command (e.g. 'demo').")
return

command = sys.argv[1]

flags_list = sys.argv[2:]

client_flag = "--client" in flags_list
Expand Down
12 changes: 7 additions & 5 deletions src/tqdm_publisher/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from tqdm import tqdm as base_tqdm
from uuid import uuid4

from typing import Union

# This class is a subclass of tqdm that allows for an arbitary number of callbacks to be registered
class TQDMPublisher(base_tqdm):

Expand All @@ -11,12 +13,12 @@ def __init__(self, *args, **kwargs):


# Override the update method to call callbacks
def update(self, n=1):
def update(self, n: int=1) -> Union[bool, None]:
displayed = super().update(n)
for id in list(self.callbacks):
callback = self.callbacks.get(id)
if callback:
callback(self.format_dict)

for callback in self.callbacks.values():
callback(self.format_dict)

return displayed


Expand Down

0 comments on commit 95b68b0

Please sign in to comment.