Skip to content

Commit

Permalink
unify callback signature with tqdm (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
clonker authored Sep 10, 2023
1 parent fe51e76 commit a6ac0b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions deeptime/clustering/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ def partial_fit(self, data, n_jobs=None):

class KMeansCallback(ProgressCallback):

def __init__(self, progress, description, total, parent_callback=None):
super().__init__(progress, description=description, total=total)
def __init__(self, progress, desc, total, parent_callback=None):
super().__init__(progress, desc=desc, total=total)
self._parent_callback = parent_callback

def __call__(self, *args, **kw):
Expand Down
2 changes: 1 addition & 1 deletion deeptime/markov/msm/tram/_tram.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class TRAMCallback(callbacks.IterationErrorProgressCallback):
"""

def __init__(self, progress, total, log_likelihoods_list=None, increments=None):
super().__init__(progress, total=total, description="Running TRAM estimate")
super().__init__(progress, total=total, desc="Running TRAM estimate")
self.log_likelihoods = log_likelihoods_list
self.increments = increments
self.last_increment = 0
Expand Down
14 changes: 7 additions & 7 deletions deeptime/util/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ class ProgressCallback:
also possess a `total` constructor keyword argument.
total : int
Number of iterations to completion.
description : string
desc : string
text to display in front of the progress bar.
See Also
--------
supports_progress_interface
"""

def __init__(self, progress, description=None, total=None):
def __init__(self, progress, desc=None, total=None):
self.progress_bar = handle_progress_bar(progress)(total=total)
self.total = total
self.set_description(description)
self.set_description(desc)

assert supports_progress_interface(self.progress_bar), \
f"Progress bar did not satisfy interface! It should at least have " \
Expand Down Expand Up @@ -82,7 +82,7 @@ class IterationErrorProgressCallback(ProgressCallback):
also possess a `total` constructor keyword argument.
total : int
Number of iterations to completion.
description : string
desc : string
text to display in front of the progress bar.
Notes
Expand All @@ -94,9 +94,9 @@ class IterationErrorProgressCallback(ProgressCallback):
supports_progress_interface, ProgressCallback
"""

def __init__(self, progress, description=None, total=None):
super().__init__(progress, description, total)
self.description = description
def __init__(self, progress, desc=None, total=None):
super().__init__(progress, desc, total)
self.description = desc

def __call__(self, inc=1, *args, **kw):
super().__call__(inc)
Expand Down

0 comments on commit a6ac0b9

Please sign in to comment.