for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
# -*- coding: cp1250 -*-
try:
import logging
import sys
import datetime
import time
except ImportError as err:
logging.error('Error %s import module: %s', __name__, err)
logging.exception('Exception occurred')
sys.exit(128)
__author__ = 'kszalai'
class Timing:
def __init__(self):
self.start = time.time()
def end(self):
elapsed = time.time() - self.start
# return self.__seconds_to_str(elapsed)
return str(datetime.timedelta(seconds=elapsed))
def __seconds_to_str(self, t):
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example
class Foo: def some_method(self, x, y): return x + y;
could be written as
class Foo: @classmethod def some_method(cls, x, y): return x + y;
return "%d:%02d:%02d.%03d" % \
reduce(lambda ll, b: divmod(ll[0], b) + ll[1:],
reduce
[(t * 1000,), 1000, 60, 60])