From 5c915a549ad2d10a3eb36c56801574d81a601670 Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Aug 03 2023 00:21:04 +0000 Subject: 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 --- 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):