montior: remove "unit" from Progress (YAGNI)
Removing "unit" from progress as it is currently unused and we can always add it back when we have a real use-case.
This commit is contained in:
parent
f6125048c6
commit
de9ead53a2
2 changed files with 2 additions and 4 deletions
|
|
@ -113,10 +113,9 @@ class Context:
|
|||
|
||||
|
||||
class Progress:
|
||||
def __init__(self, name: str, total: int, unit: Optional[str] = None):
|
||||
def __init__(self, name: str, total: int):
|
||||
self.name = name
|
||||
self.total = total
|
||||
self.unit = unit
|
||||
self.done = None
|
||||
self._sub_progress: Optional[Progress] = None
|
||||
|
||||
|
|
@ -144,7 +143,6 @@ class Progress:
|
|||
"name": self.name,
|
||||
"total": self.total,
|
||||
"done": self.done,
|
||||
"unit": self.unit,
|
||||
}
|
||||
if self._sub_progress:
|
||||
d["progress"] = self._sub_progress.as_dict()
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ def test_context():
|
|||
|
||||
|
||||
def test_progress():
|
||||
prog = Progress("test", total=12, unit="tests")
|
||||
prog = Progress("test", total=12)
|
||||
subprog = Progress("test-sub1", total=3)
|
||||
prog.sub_progress(subprog)
|
||||
assert prog.done is None # starts with None until the first incr()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue