tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit bfd038a11385ab8e0afe5e048aecf0e4b00ab3f4
parent 13cf285f677fb01e6b0d4c4b249a7988bf6cbe22
Author: Alex Hochheiden <ahochheiden@mozilla.com>
Date:   Wed, 10 Dec 2025 06:03:24 +0000

Bug 2003412 - Fix PLW0642 warnings: Avoid reassigning self/cls variable in method r=emilio

https://docs.astral.sh/ruff/rules/self-or-cls-assignment/

Differential Revision: https://phabricator.services.mozilla.com/D274696

Diffstat:
Mpython/mozrelease/mozrelease/versions.py | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/python/mozrelease/mozrelease/versions.py b/python/mozrelease/mozrelease/versions.py @@ -74,19 +74,23 @@ class MozillaVersionCompareMixin: # If our version ends with esr, coerce through MozillaVersion ending up with # a StrictVersion if possible has_esr.add("self") - self = MozillaVersion(str(self)[:-3]) # strip ESR from end of string + self_version = MozillaVersion( + str(self)[:-3] + ) # strip ESR from end of string + else: + self_version = self if isinstance(other, LooseModernMozillaVersion) or isinstance( - self, LooseModernMozillaVersion + self_version, LooseModernMozillaVersion ): # If we're still LooseVersion for self or other, run LooseVersion compare # Being sure to pass through Loose Version type first val = LooseVersion._cmp( - LooseModernMozillaVersion(str(self)), + LooseModernMozillaVersion(str(self_version)), LooseModernMozillaVersion(str(other)), ) else: # No versions are loose, therefore we can use StrictVersion - val = StrictVersion._cmp(self, other) + val = StrictVersion._cmp(self_version, other) if has_esr.isdisjoint(set(["other", "self"])) or has_esr.issuperset( set(["other", "self"]) ):