Skip to content

Commit 81d02cb

Browse files
committed
Lint transient module
1 parent f7c457a commit 81d02cb

5 files changed

Lines changed: 381 additions & 384 deletions

File tree

corems/__init__.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
__author__ = 'Yuri E. Corilo'
2-
__version__ = '2.2.1'
1+
__author__ = "Yuri E. Corilo"
2+
__version__ = "2.2.1"
33
import time
44
import os
55
import sys
66
import hashlib
77

88
# Get the path to the README file
9-
readme_path = os.path.join(os.path.dirname(__file__), '..', 'README.md')
9+
readme_path = os.path.join(os.path.dirname(__file__), "..", "README.md")
1010

1111
# Read the contents of the README file
12-
with open(readme_path, 'r', encoding='utf-8') as readme_file:
12+
with open(readme_path, "r", encoding="utf-8") as readme_file:
1313
__doc__ = readme_file.read()
1414

15+
1516
def timeit(method):
1617
def timed(*args, **kw):
1718
ts = time.time()
1819
result = method(*args, **kw)
1920
te = time.time()
20-
if 'log_time' in kw:
21-
name = kw.get('log_name', method.__name__.upper())
22-
kw['log_time'][name] = int((te - ts) * 1000)
21+
if "log_time" in kw:
22+
name = kw.get("log_name", method.__name__.upper())
23+
kw["log_time"][name] = int((te - ts) * 1000)
2324
else:
2425
print("%r %2.2f ms" % (method.__name__, (te - ts) * 1000))
2526
return result
27+
2628
return timed
2729

2830

2931
class SuppressPrints:
30-
3132
def __enter__(self):
3233
self._original_stdout = sys.stdout
33-
sys.stdout = open(os.devnull, 'w')
34+
sys.stdout = open(os.devnull, "w")
3435

3536
def __exit__(self, exc_type, exc_val, exc_tb):
3637
sys.stdout.close()
3738
sys.stdout = self._original_stdout
3839

40+
3941
def chunks(lst, n):
4042
"""Yield successive n-sized chunks from lst."""
4143
for i in range(0, len(lst), n):
42-
yield lst[i:i + n]
44+
yield lst[i : i + n]
4345

44-
def corems_md5(fname):
4546

46-
bytes_io = fname.open('rb').read()
47+
def corems_md5(fname):
48+
bytes_io = fname.open("rb").read()
4749

4850
md5_returned = hashlib.sha256(bytes_io).hexdigest()
4951

50-
return "{}:{}".format("sha256", md5_returned)
52+
return "{}:{}".format("sha256", md5_returned)

0 commit comments

Comments
 (0)