gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: janitor: flake8ism


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: janitor: flake8ism
Date: Tue, 22 May 2018 14:28:05 +0200

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

ng0 pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 922a08fc6 janitor: flake8ism
922a08fc6 is described below

commit 922a08fc69525cca89463d2ed524e68b1a3abc3a
Author: Nils Gillmann <address@hidden>
AuthorDate: Tue May 22 12:28:33 2018 +0000

    janitor: flake8ism
    
    Signed-off-by: Nils Gillmann <address@hidden>
---
 contrib/scripts/gnunet_janitor.py.in | 83 +++++++++++++++++++-----------------
 1 file changed, 43 insertions(+), 40 deletions(-)

diff --git a/contrib/scripts/gnunet_janitor.py.in 
b/contrib/scripts/gnunet_janitor.py.in
index 74fc70886..c4bd00687 100644
--- a/contrib/scripts/gnunet_janitor.py.in
+++ b/contrib/scripts/gnunet_janitor.py.in
@@ -1,6 +1,6 @@
 address@hidden@
 #    This file is part of GNUnet.
-#    (C) 2011 Christian Grothoff (and other contributing authors)
+#    (C) 2011, 2018 Christian Grothoff (and other contributing authors)
 #
 #    GNUnet is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published
@@ -33,46 +33,49 @@ import signal
 import terminate
 
 if os.name == 'nt':
-  from win32com.client import GetObject
-  WMI = GetObject('winmgmts:')
+    from win32com.client import GetObject
+    WMI = GetObject('winmgmts:')
 
-def get_process_list ():
-  result = []
-  if os.name == 'nt':
-    processes = WMI.InstancesOf('Win32_Process')
-    for p in processes:
-      result.append ((p.Properties_('ProcessId').Value, re.sub (r'(.+)\.exe', 
r'\1', p.Properties_('Name').Value)))
-  else:
-    pids = [pid for pid in os.listdir('/proc') if pid.isdigit ()]
-    for pid in pids:
-      with open (os.path.join ('/proc', pid, 'cmdline'), 'rb') as p:
-        cmdline = p.read ().split ('\x00')
-        if len (cmdline) > 0:
-          result.append ((pid, cmdline[0]))
-  return result
 
-def main ():
-  procs = get_process_list ()
-  gnunet_procs = []
-  for p in procs:
-    if re.match (r'gnunet-.+', p[1]):
-      gnunet_procs.append (p)
-  for p in gnunet_procs:
-    if re.match (r'gnunet-service-arm', p[1]):
-      print ("killing arm process {0:5} {1}".format (p[0], p[1]))
-      try:
-        terminate.safe_terminate_process_by_pid (int (p[0]), 1)
-      except OSError as e:
-        print ("failed: {0}".format (e))
-        pass
-  for p in gnunet_procs:
-    if not re.match (r'gnunet-service-arm', p[1]):
-      print ("killing non-arm process {0:5} {1}".format (p[0], p[1]))
-      try:
-        terminate.safe_terminate_process_by_pid (int (p[0]), 1)
-      except OSError as e:
-        print ("failed: {0}".format (e))
-        pass
+def get_process_list():
+    result = []
+    if os.name == 'nt':
+        processes = WMI.InstancesOf('Win32_Process')
+        for p in processes:
+            result.append((p.Properties_('ProcessId').Value, 
re.sub(r'(.+)\.exe', r'\1', p.Properties_('Name').Value)))
+    else:
+        pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
+        for pid in pids:
+            with open(os.path.join('/proc', pid, 'cmdline'), 'rb') as p:
+                cmdline = p.read().split('\x00')
+                if len(cmdline) > 0:
+                    result.append((pid, cmdline[0]))
+    return result
+
+
+def main():
+    procs = get_process_list()
+    gnunet_procs = []
+    for p in procs:
+        if re.match(r'gnunet-.+', p[1]):
+            gnunet_procs.append(p)
+    for p in gnunet_procs:
+        if re.match(r'gnunet-service-arm', p[1]):
+            print("killing arm process {0:5} {1}".format(p[0], p[1]))
+            try:
+                terminate.safe_terminate_process_by_pid(int(p[0]), 1)
+            except OSError as e:
+                print("failed: {0}".format(e))
+                pass
+    for p in gnunet_procs:
+        if not re.match(r'gnunet-service-arm', p[1]):
+            print("killing non-arm process {0:5} {1}".format(p[0], p[1]))
+            try:
+                terminate.safe_terminate_process_by_pid(int(p[0]), 1)
+            except OSError as e:
+                print("failed: {0}".format(e))
+                pass
+
 
 if __name__ == '__main__':
-  sys.exit (main ())
+    sys.exit(main())

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]