]> git.parisson.com Git - timeside.git/commitdiff
Fix PEP8 on timeside/tools/ with autopep8
authorThomas Fillon <thomas@parisson.com>
Tue, 22 Apr 2014 13:32:18 +0000 (15:32 +0200)
committerThomas Fillon <thomas@parisson.com>
Tue, 22 Apr 2014 13:32:18 +0000 (15:32 +0200)
timeside/tools/__init__.py
timeside/tools/cache.py
timeside/tools/gstutils.py
timeside/tools/logger.py

index 84c5294f6876eaa0fc462facdc94a9241ed7a010..3896805bf59323c689cb399cf433bf4b7ff7f50e 100644 (file)
@@ -1,4 +1,3 @@
 from cache import *
 from logger import *
 from gstutils import *
-
index 8decc97ce4b0fee0d7ad73526e7ec9cb8fdde7bd..6681e1cfdc1d457b1b01cc760984d334bed389e9 100644 (file)
@@ -41,23 +41,23 @@ import xml.dom.minidom
 
 
 class Cache(object):
-    
+
     def __init__(self, dir, params=None):
         self.dir = dir
         self.params = params
         self.files = self.get_files()
-        
+
     def get_files(self):
         list = []
         for root, dirs, files in os.walk(self.dir):
             for file in files:
                 list.append(file)
         return list
-    
+
     def exists(self, file):
         self.files = self.get_files()
         return file in self.files
-            
+
     def write_bin(self, data, file):
         path = self.dir + os.sep + file
         f = open(path, 'w')
@@ -70,7 +70,7 @@ class Cache(object):
         data = f.read()
         f.close()
         return data
-        
+
     def read_stream_bin(self, file):
         path = self.dir + os.sep + file
         chunk_size = 0x1000
@@ -89,14 +89,14 @@ class Cache(object):
         list = []
         path = self.dir + os.sep + file
         doc = xml.dom.minidom.parse(path)
-        for data in doc.documentElement.getElementsByTagName('data') :
+        for data in doc.documentElement.getElementsByTagName('data'):
             name = data.getAttribute('name')
             id = data.getAttribute('id')
             unit = data.getAttribute('unit')
             value = data.getAttribute('value')
             list.append({'name': name, 'id': id, 'unit': unit, 'value': value})
         return list
-        
+
     def write_analyzer_xml(self, data_list, file):
         path = self.dir + os.sep + file
         doc = xml.dom.minidom.Document()
index 960a8db818e5bacfca9b73a3529e4829d3ddcfbc..6d06a3ef1d844084c62bcda8256016cc6a6908f1 100644 (file)
@@ -13,7 +13,7 @@ def numpy_array_to_gst_buffer(frames, chunk_size, num_samples, sample_rate):
     from gst import Buffer
     """ gstreamer buffer to numpy array conversion """
     buf = Buffer(getbuffer(frames.astype("float32")))
-    #Set its timestamp and duration
+    # Set its timestamp and duration
     buf.timestamp = gst.util_uint64_scale(num_samples, gst.SECOND, sample_rate)
     buf.duration = gst.util_uint64_scale(chunk_size, gst.SECOND, sample_rate)
     return buf
@@ -26,6 +26,7 @@ def gst_buffer_to_numpy_array(buf, chan):
 
 
 class MainloopThread(threading.Thread):
+
     def __init__(self, mainloop):
         threading.Thread.__init__(self)
         self.mainloop = mainloop
index 2f68c4d0020dd136ed765c3fdf7dcd3309bcdb04..14056279ceae7d684f2e8188110301b679c900f8 100644 (file)
@@ -3,13 +3,16 @@
 
 import logging
 
+
 class Logger:
+
     """A logging object"""
 
     def __init__(self, file):
         self.logger = logging.getLogger('myapp')
         self.hdlr = logging.FileHandler(file)
-        self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+        self.formatter = logging.Formatter(
+            '%(asctime)s %(levelname)s %(message)s')
         self.hdlr.setFormatter(self.formatter)
         self.logger.addHandler(self.hdlr)
         self.logger.setLevel(logging.INFO)
@@ -19,4 +22,3 @@ class Logger:
 
     def write_error(self, message):
         self.logger.error(message)
-