[Pkg-debile-commits] [debile-master] 01/03: first round of pep8 cleaning.

Vasudev Kamath vasudev-guest at moszumanska.debian.org
Sun Mar 2 13:56:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

vasudev-guest pushed a commit to branch master
in repository debile-master.

commit 6dba1ff0c5d4dfe5039795ad2926ab0027854619
Author: Vasudev Kamath <kamathvasudev at gmail.com>
Date:   Sun Mar 2 17:13:20 2014 +0530

    first round of pep8 cleaning.
---
 debilemaster/server.py | 73 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 45 insertions(+), 28 deletions(-)

diff --git a/debilemaster/server.py b/debilemaster/server.py
index 4a679c4..f0c95e2 100644
--- a/debilemaster/server.py
+++ b/debilemaster/server.py
@@ -123,7 +123,8 @@ class DebileMasterInterface(object):
         global PAUSED
         PAUSED = status
         if PAUSED:
-            logging.info("PAUSING ALL THE WORKERS UNTIL FURTHER INSTRUCTION RECEIVED")
+            logging.info("PAUSING ALL THE WORKERS UNTIL\
+            FURTHER INSTRUCTION RECEIVED")
         else:
             logging.info("RESUMING WORKERS")
         return PAUSED
@@ -138,14 +139,16 @@ class DebileMasterInterface(object):
             admin = "(admin)"
         else:
             admin = ""
-        success = "Connected successfully to debileserver, authenticated as %s %s" % (get_user().name, admin)
+        success = "Connected successfully to debileserver, authenticated\
+        as %s %s" % (get_user().name, admin)
         return success
 
     @admin_method
     def create_user(self, login, password, name, email, ascii_armored_key):
         """
         Only for administrators.
-        This method adds a new user in the DB and imports the GPG key in the keyring.
+        This method adds a new user in the DB and imports the GPG key
+        in the keyring.
         """
         session = Session()
         # Validate first by creating an entity that login/name/email are valid
@@ -177,7 +180,9 @@ class DebileMasterInterface(object):
 
         user_url = "%s/hacker/%s" % (config.get('paths', 'debile_url'), login)
 
-        return u.serialize(), "User %s with key %s added, see %s" % (name, u.gpg_fingerprint, user_url)
+        return u.serialize(), \
+            "User %s with key %s added, see %s"\
+            % (name, u.gpg_fingerprint, user_url)
 
     @user_method
     def list_user(self):
@@ -194,7 +199,8 @@ class DebileMasterInterface(object):
     def create_machine(self, name, password, ascii_armored_key):
         """
         Only for administrators.
-        Create a machine in debile system and import its GPG key in the local keyring.
+        Create a machine in debile system and import its GPG key in
+        the local keyring.
         """
         session = Session()
         # Validate first by creating an entity that login/name/email are valid
@@ -219,9 +225,11 @@ class DebileMasterInterface(object):
             session.rollback()
             return None, "Oops something screwed up"
 
-        machine_url = "%s/machine/%s" % (config.get('paths', 'debile_url'), name)
+        machine_url = "%s/machine/%s" % (config.get('paths', 'debile_url'),
+                                         name)
 
-        return m.serialize(), "Machine %s with key %s added, see %s" % (name, m.gpg_fingerprint, machine_url)
+        return m.serialize(), "Machine %s with key %s added, see %s" %\
+            (name, m.gpg_fingerprint, machine_url)
 
     @user_method
     def list_machine(self):
@@ -249,13 +257,15 @@ class DebileMasterInterface(object):
 
         # FIXME : OMG this looks bad
         dscpath = [os.path.join(dirpath, f)
-            for dirpath, dirnames, files in os.walk(pool_path)
-                for f in files if f == s.dsc]
+                   for dirpath, dirnames, files in os.walk(pool_path)
+                   for f in files if f == s.dsc]
         if len(dscpath) != 1:
             raise Exception("Bad code is bad")
 
         dscpath = dscpath[0]
-        return dscpath.replace(config.get('paths', 'pool_path'), config.get('paths', 'pool_url'))
+        return dscpath.replace(config.get('paths',
+                                          'pool_path'),
+                               config.get('paths', 'pool_url'))
 
     def get_write_location(self, job_id):
         """
@@ -282,13 +292,14 @@ class DebileMasterInterface(object):
 
         # FIXME : OMG this looks bad
         debpath = [os.path.join(dirpath, f)
-            for dirpath, dirnames, files in os.walk(pool_path)
-                for f in files if f == b.deb]
+                   for dirpath, dirnames, files in os.walk(pool_path)
+                   for f in files if f == b.deb]
         if len(debpath) != 1:
             raise Exception("Bad code is bad")
 
         debpath = debpath[0]
-        return debpath.replace(config.get('paths', 'pool_path'), config.get('paths', 'pool_url'))
+        return debpath.replace(config.get('paths', 'pool_path'),
+                               config.get('paths', 'pool_url'))
 
     @machine_method
     def get_dputcf(self):
@@ -303,10 +314,11 @@ class DebileMasterInterface(object):
                 # TODO : convertible to a template
                 l = "[%s-%s]\n" % (u.login, compiler)
                 l += "fqdn = %s\n" % config.get('paths', 'debile_fqdn')
-                l += "incoming = %s\n" % os.path.join(
-                                        config.get('paths', 'incoming_path'),
-                                        u.login,
-                                        compiler)
+                l += "incoming = %s\n" % \
+                     os.path.join(config.get
+                                  ('paths', 'incoming_path'),
+                                  u.login,
+                                  compiler)
                 l += "method = scp\n"
                 l += "login = debile\n"
                 dputcf += l
@@ -338,7 +350,8 @@ class DebileMasterInterface(object):
     @machine_method
     def get_next_job(self, suites, arches, types):
         """
-        Get an unassigned lint job given the following information from the builder :
+        Get an unassigned lint job given the following information
+        from the builder :
           * a list of suites supported
           * a list of arches supported
           * a list of job types supported
@@ -350,13 +363,13 @@ class DebileMasterInterface(object):
         session = Session()
 
         j = session.query(Job).\
-                filter(Job.assigned_at == None).\
-                filter(Job.machine == None).\
-                filter(Job.type.in_(types)).\
-                filter(Job.arch.in_(arches)).\
-                filter(Job.suite.in_(suites)).\
-                filter(Job.retries < 5).\
-                first()
+            filter(Job.assigned_at is None).\
+            filter(Job.machine is None).\
+            filter(Job.type.in_(types)).\
+            filter(Job.arch.in_(arches)).\
+            filter(Job.suite.in_(suites)).\
+            filter(Job.retries < 5).\
+            first()
 
         if j:
             j.assigned_at = dt.datetime.utcnow()
@@ -457,7 +470,8 @@ class DebileMasterAuthMixIn(SimpleXMLRPCRequestHandler):
     def authenticate_machine(self, machine_name, password):
         session = Session()
         try:
-            machine = session.query(Machine).filter(Machine.name == machine_name).one()
+            machine = session.query(Machine).filter(Machine.name ==
+                                                    machine_name).one()
             if machine.password == password:
                 NAMESPACE.machine = machine
                 # PING !
@@ -465,7 +479,8 @@ class DebileMasterAuthMixIn(SimpleXMLRPCRequestHandler):
                 session.commit()
                 return True
         except NoResultFound, e:
-            logging.error("Machine claiming name %s does not exist", machine_name)
+            logging.error("Machine claiming name %s does not exist",
+                          machine_name)
         return False
 
     def parse_request(self, *args):
@@ -492,7 +507,9 @@ def serve(server, port):
 
 
 def main():
-    logging.basicConfig(format='%(asctime)s - %(levelname)8s - [debile-master] %(message)s', level=logging.DEBUG)
+    logging.basicConfig(
+        format='%(asctime)s - %(levelname)8s - [debile-master] %(message)s',
+        level=logging.DEBUG)
     logging.info("Booting debile-masterd daemon")
     serve("0.0.0.0", 20017)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list