[utils/statsd_logger] flake8 3.26
authorDavid Douard <david.douard@logilab.fr>
Mon, 16 Oct 2017 12:10:19 +0200
branch3.26
changeset 12291 b640ef6ad633
parent 12290 2b049c9fcec5
child 12292 f7067be5f69c
[utils/statsd_logger] flake8
cubicweb/statsd_logger.py
flake8-ok-files.txt
--- a/cubicweb/statsd_logger.py	Wed Dec 13 01:23:39 2017 +0100
+++ b/cubicweb/statsd_logger.py	Mon Oct 16 12:10:19 2017 +0200
@@ -47,7 +47,7 @@
 There is also a decorator (``statsd_timeit``) that may be used to
 measure and send to the statsd_ server the time passed in a function
 or a method and the number of calls. It will send a message like::
-   
+
     <bucket>.<funcname>:<ms>|ms\n<bucket>.<funcname>:1|c\n
 
 
@@ -56,7 +56,6 @@
 """
 
 
-
 import time
 import socket
 
@@ -112,10 +111,11 @@
     @property
     def __doc__(self):
         return self.callable.__doc__
+
     @property
     def __name__(self):
         return self.callable.__name__
-    
+
     def __call__(self, *args, **kw):
         if _address is None:
             return self.callable(*args, **kw)
@@ -123,13 +123,14 @@
         try:
             return self.callable(*args, **kw)
         finally:
-            dt = 1000*(time.time()-t0)
-            msg = '{0}.{1}:{2:.4f}|ms\n{0}.{1}:1|c\n'.format(_bucket, self.__name__, dt)
+            dt = 1000 * (time.time() - t0)
+            msg = '{0}.{1}:{2:.4f}|ms\n{0}.{1}:1|c\n'.format(
+                _bucket, self.__name__, dt)
             _socket.sendto(msg, _address)
-                
+
     def __get__(self, obj, objtype):
         """Support instance methods."""
-        if obj is None: # class method or some already wrapped method
+        if obj is None:  # class method or some already wrapped method
             return self
         import functools
         return functools.partial(self.__call__, obj)
--- a/flake8-ok-files.txt	Wed Dec 13 01:23:39 2017 +0100
+++ b/flake8-ok-files.txt	Mon Oct 16 12:10:19 2017 +0200
@@ -73,6 +73,7 @@
 cubicweb/sobjects/test/unittest_notification.py
 cubicweb/sobjects/test/unittest_register_user.py
 cubicweb/sobjects/textparsers.py
+cubicweb/statsd_logger.py
 cubicweb/test/data/libpython/cubicweb_comment/__init__.py
 cubicweb/test/data/libpython/cubicweb_comment/__pkginfo__.py
 cubicweb/test/data/libpython/cubicweb_email/entities.py