Skip to content

Commit b950458

Browse files
committed
fix(widgets): drop redundant self.* assignments (CodeQL overwritten-inherited-attribute)
FormatCustomText.__init__ and JobStatusBar.__init__ set instance attributes (format; name/left/right/fill) that their super().__init__ immediately re-sets from the same values, which CodeQL flags as overwriting the inherited attribute. Remove the duplicates; the base initializers (FormatWidgetMixin, Bar, VariableMixin) set them. Verified attrs identical after construction; no behavior change.
1 parent 151e151 commit b950458

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

progressbar/widgets.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,8 @@ def __init__(
12491249
mapping: dict[str, typing.Any] | None = None,
12501250
**kwargs,
12511251
):
1252-
self.format = format
1252+
# ``self.format`` is set by FormatWidgetMixin.__init__ (via super
1253+
# below); assigning it here too would just overwrite that.
12531254
# Always build a fresh per-instance dict so update_mapping() never
12541255
# mutates the shared class-level default (which every other
12551256
# default-constructed instance would otherwise alias). Fall back to
@@ -1672,17 +1673,13 @@ def __init__(
16721673
failure_marker='X',
16731674
**kwargs,
16741675
):
1675-
self.name = name
16761676
# Retained for backward compatibility only; render state now lives in
16771677
# ``progress.extra`` (see get_job_markers) so a single widget reused by
16781678
# multiple bars no longer interleaves their markers.
16791679
self.job_markers = []
16801680
# Unique per-widget key so multiple JobStatusBars on the same bar do
16811681
# not share storage either.
16821682
self._markers_key = f'{type(self).__name__}_{id(self)}_job_markers'
1683-
self.left = string_or_lambda(left)
1684-
self.right = string_or_lambda(right)
1685-
self.fill = string_or_lambda(fill)
16861683
self.success_fg_color = success_fg_color
16871684
self.success_bg_color = success_bg_color
16881685
self.success_marker = success_marker

0 commit comments

Comments
 (0)