changeset 6866:c1ed9572b965

codingstyle: replace "not ... in ..." with "... not in ..." Reported by flake8.
author Lars Kruse <devel@sumpfralle.de>
date Fri, 25 Aug 2017 14:33:37 +0200
parents 94bbb7eb5b64
children 9988ec8c33e5
files kallithea/lib/auth_modules/auth_crowd.py kallithea/lib/indexers/daemon.py kallithea/lib/vcs/backends/git/changeset.py kallithea/lib/vcs/backends/git/repository.py kallithea/lib/vcs/backends/hg/changeset.py kallithea/lib/vcs/backends/hg/repository.py kallithea/lib/vcs/utils/__init__.py kallithea/lib/vcs/utils/helpers.py kallithea/tests/models/test_notifications.py kallithea/tests/models/test_repo_groups.py
diffstat 10 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/auth_modules/auth_crowd.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/auth_modules/auth_crowd.py	Fri Aug 25 14:33:37 2017 +0200
@@ -52,7 +52,7 @@
                                   passwd="some_passwd",
                                   version="1")
         """
-        if not "port" in kwargs:
+        if "port" not in kwargs:
             kwargs["port"] = "8095"
         self._logger = kwargs.get("logger", logging.getLogger(__name__))
         self._uri = "%s://%s:%s/crowd" % (kwargs.get("method", "http"),
--- a/kallithea/lib/indexers/daemon.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/indexers/daemon.py	Fri Aug 25 14:33:37 2017 +0200
@@ -353,7 +353,7 @@
                     indexed_repo_path = fields['repository']
                     indexed_paths.add(indexed_path)
 
-                    if not indexed_repo_path in self.filtered_repo_update_paths:
+                    if indexed_repo_path not in self.filtered_repo_update_paths:
                         continue
 
                     repo = self.repo_paths[indexed_repo_path]
--- a/kallithea/lib/vcs/backends/git/changeset.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/backends/git/changeset.py	Fri Aug 25 14:33:37 2017 +0200
@@ -110,7 +110,7 @@
     def _get_id_for_path(self, path):
         path = safe_str(path)
         # FIXME: Please, spare a couple of minutes and make those codes cleaner;
-        if not path in self._paths:
+        if path not in self._paths:
             path = path.strip('/')
             # set root tree
             tree = self.repository._repo[self._tree_id]
@@ -155,7 +155,7 @@
                         name = item
                     self._paths[name] = id
                     self._stat_modes[name] = stat
-            if not path in self._paths:
+            if path not in self._paths:
                 raise NodeDoesNotExistError("There is no file nor directory "
                     "at the given path '%s' at revision %s"
                     % (path, safe_str(self.short_id)))
@@ -423,7 +423,7 @@
                                      "or Blob, is %r" % type(obj))
         nodes = dirnodes + filenodes
         for node in nodes:
-            if not node.path in self.nodes:
+            if node.path not in self.nodes:
                 self.nodes[node.path] = node
         nodes.sort()
         return nodes
@@ -432,7 +432,7 @@
         if isinstance(path, unicode):
             path = path.encode('utf-8')
         path = self._fix_path(path)
-        if not path in self.nodes:
+        if path not in self.nodes:
             try:
                 id_ = self._get_id_for_path(path)
             except ChangesetError:
--- a/kallithea/lib/vcs/backends/git/repository.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/backends/git/repository.py	Fri Aug 25 14:33:37 2017 +0200
@@ -214,7 +214,7 @@
 
         # now detect if it's proper git repo
         gitdata = resp.read()
-        if not 'service=git-upload-pack' in gitdata:
+        if 'service=git-upload-pack' not in gitdata:
             raise urllib2.URLError(
                 "url [%s] does not look like an git" % (cleaned_uri))
 
@@ -329,7 +329,7 @@
         filesystem (``file:///``) schema.
         """
         url = safe_str(url)
-        if url != 'default' and not '://' in url:
+        if url != 'default' and '://' not in url:
             url = ':///'.join(('file', url))
         return url
 
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Fri Aug 25 14:33:37 2017 +0200
@@ -377,7 +377,7 @@
 
         path = self._fix_path(path)
 
-        if not path in self.nodes:
+        if path not in self.nodes:
             if path in self._file_paths:
                 node = FileNode(path, changeset=self)
             elif path in self._dir_paths or path in self._dir_paths:
--- a/kallithea/lib/vcs/backends/hg/repository.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/backends/hg/repository.py	Fri Aug 25 14:33:37 2017 +0200
@@ -482,7 +482,7 @@
         (``file:///``) schema.
         """
         url = safe_str(url)
-        if url != 'default' and not '://' in url:
+        if url != 'default' and '://' not in url:
             url = "file:" + urllib.pathname2url(url)
         return url
 
--- a/kallithea/lib/vcs/utils/__init__.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/utils/__init__.py	Fri Aug 25 14:33:37 2017 +0200
@@ -189,7 +189,7 @@
     """
     if not author:
         return ''
-    if not '@' in author:
+    if '@' not in author:
         return author
     return author.replace(author_email(author), '').replace('<', '') \
         .replace('>', '').strip()
--- a/kallithea/lib/vcs/utils/helpers.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/lib/vcs/utils/helpers.py	Fri Aug 25 14:33:37 2017 +0200
@@ -139,7 +139,7 @@
     """
     text = text.strip()
     CID_RE = r'[a-zA-Z0-9]+'
-    if not '..' in text:
+    if '..' not in text:
         m = re.match(r'^(?P<cid>%s)$' % CID_RE, text)
         if m:
             return {
--- a/kallithea/tests/models/test_notifications.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/tests/models/test_notifications.py	Fri Aug 25 14:33:37 2017 +0200
@@ -103,7 +103,7 @@
             Session().commit()
 
             notifications = Notification.query().all()
-            assert not notification in notifications
+            assert notification not in notifications
 
             un = UserNotification.query().filter(UserNotification.notification
                                                  == notification).all()
--- a/kallithea/tests/models/test_repo_groups.py	Fri Aug 25 14:33:18 2017 +0200
+++ b/kallithea/tests/models/test_repo_groups.py	Fri Aug 25 14:33:37 2017 +0200
@@ -24,11 +24,11 @@
 
 
 def _update_repo(name, **kwargs):
-    if not 'repo_name' in kwargs:
+    if 'repo_name' not in kwargs:
         kwargs['repo_name'] = name
-    if not 'perms_new' in kwargs:
+    if 'perms_new' not in kwargs:
         kwargs['perms_new'] = []
-    if not 'perms_updates' in kwargs:
+    if 'perms_updates' not in kwargs:
         kwargs['perms_updates'] = []
     r = RepoModel().update(name, **kwargs)
     return r