[elbe-devel] [PATCH 47/75] db: Fix Pylint

Olivier Dion dion at linutronix.de
Mon May 25 17:42:40 CEST 2020


104:0:  R0205: (useless-object-inheritance)
355:20: R1720: (no-else-raise)
540:15: R1714: (consider-using-in)
1061:0: R0205: (useless-object-inheritance)
1084:0: R0205: (useless-object-inheritance)
1107:0: R0205: (useless-object-inheritance)
1136:0: R0205: (useless-object-inheritance)

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/db.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index 01b7ac28..a9a00ba6 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -100,7 +100,8 @@ def _update_project_file(s, builddir, name, mime_type, description):
 
     return filename
 
-
+# TODO:py3 Remove object inheritance
+# pylint: disable=useless-object-inheritance
 class ElbeDB(object):
 
     # pylint: disable=too-many-public-methods
@@ -353,11 +354,9 @@ class ElbeDB(object):
                     directory_created = True
                 except OSError as e:
                     if e.errno == errno.EEXIST:
-                        raise ElbeDBError(
-                            "project directory %s already exists" %
-                            builddir)
-                    else:
-                        raise
+                        raise ElbeDBError("project directory %s already exists" %
+                                          builddir)
+                    raise
 
                 p = Project(builddir=builddir, status="empty_project",
                             owner_id=owner_id)
@@ -537,9 +536,7 @@ class ElbeDB(object):
             return p.status == "busy"
 
     def reset_busy(self, builddir, new_status):
-        assert new_status == "has_changes" or \
-            new_status == "build_done" or \
-            new_status == "build_failed"
+        assert new_status in ("has_changes", "build_done", "build_failed")
 
         with session_scope(self.session) as s:
             try:
@@ -1057,7 +1054,8 @@ class User(Base):
     admin = Column(Boolean)
     projects = relationship("Project", backref="owner")
 
-
+# TODO:py3 Remove object inheritance
+# pylint: disable=useless-object-inheritance
 class UserData (object):
     def __init__(self, user):
         self.id = int(user.id)
@@ -1080,7 +1078,8 @@ class Project (Base):
     versions = relationship("ProjectVersion", backref="project")
     files = relationship("ProjectFile", backref="project")
 
-
+# TODO:py3 Remove object inheritance
+# pylint: disable=useless-object-inheritance
 class ProjectData (object):
     def __init__(self, project):
         self.builddir = str(project.builddir)
@@ -1103,7 +1102,8 @@ class ProjectVersion (Base):
     description = Column(String)
     timestamp = Column(DateTime, default=datetime.utcnow)
 
-
+# TODO:py3 Remove object inheritance
+# pylint: disable=useless-object-inheritance
 class ProjectVersionData (object):
     def __init__(self, pv):
         self.builddir = str(pv.builddir)
@@ -1132,7 +1132,8 @@ class ProjectFile (Base):
     mime_type = Column(String, nullable=False)
     description = Column(String)
 
-
+# TODO:py3 Remove object inheritance
+# pylint: disable=useless-object-inheritance
 class ProjectFileData (object):
     def __init__(self, pf):
         self.name = str(pf.name)
-- 
2.26.2




More information about the elbe-devel mailing list