From 9b33f1a84320c3db1942815010e2e4f25edb26cc Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Thu, 9 Feb 2023 08:36:51 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- nowplaying/upgrade.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/nowplaying/upgrade.py b/nowplaying/upgrade.py index 049a2b94..e5ac7bd1 100644 --- a/nowplaying/upgrade.py +++ b/nowplaying/upgrade.py @@ -86,18 +86,24 @@ def __lt__(self, other): if self.chunk.get('rc') and not other.chunk.get('rc'): return True - if self.chunk.get('rc') and other.chunk.get('rc'): - if self.chunk.get('rc') != other.chunk.get('rc'): - return self.chunk.get('rc') < other.chunk.get('rc') + if ( + self.chunk.get('rc') + and other.chunk.get('rc') + and self.chunk.get('rc') != other.chunk.get('rc') + ): + return self.chunk.get('rc') < other.chunk.get('rc') # but commitnum > no commitnum at this point if self.chunk.get('commitnum') and not other.chunk.get('commitnum'): return False - if self.chunk.get('commitnum') and other.chunk.get('commitnum'): - if self.chunk.get('commitnum') != other.chunk.get('commitnum'): - return self.chunk.get('commitnum') < other.chunk.get( - 'commitnum') + if ( + self.chunk.get('commitnum') + and other.chunk.get('commitnum') + and self.chunk.get('commitnum') != other.chunk.get('commitnum') + ): + return self.chunk.get('commitnum') < other.chunk.get( + 'commitnum') return False @@ -133,10 +139,9 @@ def get_versions(self, testdata=None): if self.prerelease < tagname: self.prerelease = tagname self.predata = rel - else: - if self.stable < tagname: - self.stable = tagname - self.stabledata = rel + elif self.stable < tagname: + self.stable = tagname + self.stabledata = rel if self.stable > self.prerelease: self.prerelease = self.stable