cs-progress 20250325__tar.gz → 20250412__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cs-progress
3
- Version: 20250325
3
+ Version: 20250412
4
4
  Summary: A progress tracker with methods for throughput, ETA and update notification; also a compound progress meter composed from other progress meters.
5
5
  Keywords: python2,python3
6
6
  Author-email: Cameron Simpson <cs@cskk.id.au>
@@ -30,8 +30,8 @@ Project-URL: Source, https://github.com/cameron-simpson/css/blob/main/lib/python
30
30
  A progress tracker with methods for throughput, ETA and update notification;
31
31
  also a compound progress meter composed from other progress meters.
32
32
 
33
- *Latest release 20250325*:
34
- BaseProgress.iterbar: use @uses_runstate, accept a runstate parameter overridable by the cancelled param.
33
+ *Latest release 20250412*:
34
+ Bugfix progressbar: fix early return if no active Upd.
35
35
 
36
36
  Module contents:
37
37
  - <a name="auto_progressbar"></a>`auto_progressbar(*da, **dkw)`: Decorator for a function accepting an optional `progress`
@@ -78,7 +78,7 @@ if its position is less than `int(other)`.
78
78
  Construct a progress arrow representing completion
79
79
  to fit in the specified `width`.
80
80
 
81
- *`BaseProgress.bar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x108fe25c0>, **kw)`*:
81
+ *`BaseProgress.bar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x10c191da0>, **kw)`*:
82
82
  A context manager to create and withdraw a progress bar.
83
83
  It returns the `UpdProxy` which displays the progress bar.
84
84
 
@@ -125,7 +125,7 @@ If `remaining_time` is `None`, this is also `None`.
125
125
  Format `value` accoridng to `scale` and `max_parts`
126
126
  using `cs.units.transcribe`.
127
127
 
128
- *`BaseProgress.iterbar(self, it, label=None, *, itemlenfunc=None, incfirst=False, update_period=0.3, cancelled=None, runstate: Optional[cs.resources.RunState] = <function uses_runstate.<locals>.<lambda> at 0x108fe2a20>, **bar_kw)`*:
128
+ *`BaseProgress.iterbar(self, it, label=None, *, itemlenfunc=None, incfirst=False, update_period=0.3, cancelled=None, runstate: Optional[cs.resources.RunState] = <function uses_runstate.<locals>.<lambda> at 0x10c192200>, **bar_kw)`*:
129
129
  An iterable progress bar: a generator yielding values
130
130
  from the iterable `it` while updating a progress bar.
131
131
 
@@ -433,7 +433,7 @@ Record more progress.
433
433
  >>> P.update(12)
434
434
  >>> P.position
435
435
  12
436
- - <a name="progressbar"></a>`progressbar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x109134540>, **kw)`: Convenience function to construct and run a `Progress.iterbar`
436
+ - <a name="progressbar"></a>`progressbar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x10c193c40>, **kw)`: Convenience function to construct and run a `Progress.iterbar`
437
437
  wrapping the iterable `it`,
438
438
  issuing and withdrawing a progress bar during the iteration.
439
439
 
@@ -461,6 +461,9 @@ Record more progress.
461
461
 
462
462
 
463
463
 
464
+ *Release 20250412*:
465
+ Bugfix progressbar: fix early return if no active Upd.
466
+
464
467
  *Release 20250325*:
465
468
  BaseProgress.iterbar: use @uses_runstate, accept a runstate parameter overridable by the cancelled param.
466
469
 
@@ -29,7 +29,7 @@ classifiers = [
29
29
  "Topic :: Software Development :: Libraries :: Python Modules",
30
30
  "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
31
31
  ]
32
- version = "20250325"
32
+ version = "20250412"
33
33
 
34
34
  [project.license]
35
35
  text = "GNU General Public License v3 or later (GPLv3+)"
@@ -45,8 +45,8 @@ text = """
45
45
  A progress tracker with methods for throughput, ETA and update notification;
46
46
  also a compound progress meter composed from other progress meters.
47
47
 
48
- *Latest release 20250325*:
49
- BaseProgress.iterbar: use @uses_runstate, accept a runstate parameter overridable by the cancelled param.
48
+ *Latest release 20250412*:
49
+ Bugfix progressbar: fix early return if no active Upd.
50
50
 
51
51
  Module contents:
52
52
  - <a name=\"auto_progressbar\"></a>`auto_progressbar(*da, **dkw)`: Decorator for a function accepting an optional `progress`
@@ -93,7 +93,7 @@ if its position is less than `int(other)`.
93
93
  Construct a progress arrow representing completion
94
94
  to fit in the specified `width`.
95
95
 
96
- *`BaseProgress.bar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x108fe25c0>, **kw)`*:
96
+ *`BaseProgress.bar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x10c191da0>, **kw)`*:
97
97
  A context manager to create and withdraw a progress bar.
98
98
  It returns the `UpdProxy` which displays the progress bar.
99
99
 
@@ -140,7 +140,7 @@ If `remaining_time` is `None`, this is also `None`.
140
140
  Format `value` accoridng to `scale` and `max_parts`
141
141
  using `cs.units.transcribe`.
142
142
 
143
- *`BaseProgress.iterbar(self, it, label=None, *, itemlenfunc=None, incfirst=False, update_period=0.3, cancelled=None, runstate: Optional[cs.resources.RunState] = <function uses_runstate.<locals>.<lambda> at 0x108fe2a20>, **bar_kw)`*:
143
+ *`BaseProgress.iterbar(self, it, label=None, *, itemlenfunc=None, incfirst=False, update_period=0.3, cancelled=None, runstate: Optional[cs.resources.RunState] = <function uses_runstate.<locals>.<lambda> at 0x10c192200>, **bar_kw)`*:
144
144
  An iterable progress bar: a generator yielding values
145
145
  from the iterable `it` while updating a progress bar.
146
146
 
@@ -448,7 +448,7 @@ Record more progress.
448
448
  >>> P.update(12)
449
449
  >>> P.position
450
450
  12
451
- - <a name=\"progressbar\"></a>`progressbar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x109134540>, **kw)`: Convenience function to construct and run a `Progress.iterbar`
451
+ - <a name=\"progressbar\"></a>`progressbar(*a, upd: Optional[cs.upd.Upd] = <function uses_upd.<locals>.<lambda> at 0x10c193c40>, **kw)`: Convenience function to construct and run a `Progress.iterbar`
452
452
  wrapping the iterable `it`,
453
453
  issuing and withdrawing a progress bar during the iteration.
454
454
 
@@ -476,6 +476,9 @@ Record more progress.
476
476
 
477
477
 
478
478
 
479
+ *Release 20250412*:
480
+ Bugfix progressbar: fix early return if no active Upd.
481
+
479
482
  *Release 20250325*:
480
483
  BaseProgress.iterbar: use @uses_runstate, accept a runstate parameter overridable by the cancelled param.
481
484
 
@@ -38,7 +38,7 @@ from cs.units import (
38
38
  )
39
39
  from cs.upd import Upd, uses_upd, print # pylint: disable=redefined-builtin
40
40
 
41
- __version__ = '20250325'
41
+ __version__ = '20250412'
42
42
 
43
43
  DISTINFO = {
44
44
  'keywords': ["python2", "python3"],
@@ -1071,15 +1071,16 @@ def progressbar(
1071
1071
  ... do something with row ...
1072
1072
  '''
1073
1073
  if upd is None or upd.disabled:
1074
- return it
1075
- if total is None:
1076
- try:
1077
- total = len(it)
1078
- except TypeError:
1079
- total = None
1080
- yield from Progress(
1081
- name=label, position=position, total=total, units_scale=units_scale
1082
- ).iterbar(it, **iterbar_kw)
1074
+ yield from it
1075
+ else:
1076
+ if total is None:
1077
+ try:
1078
+ total = len(it)
1079
+ except TypeError:
1080
+ total = None
1081
+ yield from Progress(
1082
+ name=label, position=position, total=total, units_scale=units_scale
1083
+ ).iterbar(it, **iterbar_kw)
1083
1084
 
1084
1085
  @decorator
1085
1086
  def auto_progressbar(func, label=None, report_print=False):