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

Torben Hohn torben.hohn at linutronix.de
Fri May 29 13:14:13 CEST 2020


On Mon, May 25, 2020 at 11:42:40AM -0400, Olivier Dion wrote:
> 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>

Reviewed-by: Torben Hohn <torben.hohn 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list