From 5c915a549ad2d10a3eb36c56801574d81a601670 Mon Sep 17 00:00:00 2001
From: Ondrej Nosek <onosek@redhat.com>
Date: Tue, 1 Aug 2023 23:26:43 +0200
Subject: [PATCH 1/4] Fix flake8 complaints
E721 do not compare types, for exact checks use `is` / `is not`, for
instance checks use `isinstance()`
Conditions in the method `_list_branches` were switched because:
`issubclass(git.RemoteReference, git.Head)`
Signed-off-by: Ondrej Nosek <onosek@redhat.com>
---
pyrpkg/__init__.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
index bc669b9..f69f2ce 100644
--- a/pyrpkg/__init__.py
+++ b/pyrpkg/__init__.py
@@ -1411,15 +1411,15 @@ class Commands(object):
remotes = []
locals = []
for ref in refs:
- if type(ref) == git.Head:
- self.log.debug('Found local branch %s', ref.name)
- locals.append(ref.name)
- elif type(ref) == git.RemoteReference:
+ if isinstance(ref, git.RemoteReference):
if ref.remote_head == 'HEAD':
self.log.debug('Skipping remote branch alias HEAD')
continue # Not useful in this context
self.log.debug('Found remote branch %s', ref.name)
remotes.append(ref.name)
+ elif isinstance(ref, git.Head):
+ self.log.debug('Found local branch %s', ref.name)
+ locals.append(ref.name)
return (locals, remotes)
def _srpmdetails(self, srpm):
--
2.41.0