mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: use black instead of flake8
Fixes #1546 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -14,5 +14,5 @@ def spy(method_to_decorate):
|
||||
|
||||
|
||||
def load_stage_file(path):
|
||||
with open(path, 'r') as fobj:
|
||||
with open(path, "r") as fobj:
|
||||
return yaml.safe_load(fobj)
|
||||
|
||||
@@ -10,9 +10,9 @@ class ETagHandler(SimpleHTTPRequestHandler):
|
||||
file = self.translate_path(self.path)
|
||||
|
||||
if not os.path.isdir(file) and os.path.exists(file):
|
||||
with open(file, 'r') as fd:
|
||||
etag = hashlib.md5(fd.read().encode('utf8')).hexdigest()
|
||||
self.send_header('ETag', etag)
|
||||
with open(file, "r") as fd:
|
||||
etag = hashlib.md5(fd.read().encode("utf8")).hexdigest()
|
||||
self.send_header("ETag", etag)
|
||||
|
||||
SimpleHTTPRequestHandler.end_headers(self)
|
||||
|
||||
@@ -22,9 +22,9 @@ class ContentMD5Handler(SimpleHTTPRequestHandler):
|
||||
file = self.translate_path(self.path)
|
||||
|
||||
if not os.path.isdir(file) and os.path.exists(file):
|
||||
with open(file, 'r') as fd:
|
||||
md5 = hashlib.md5(fd.read().encode('utf8')).hexdigest()
|
||||
self.send_header('Content-MD5', md5)
|
||||
with open(file, "r") as fd:
|
||||
md5 = hashlib.md5(fd.read().encode("utf8")).hexdigest()
|
||||
self.send_header("Content-MD5", md5)
|
||||
|
||||
SimpleHTTPRequestHandler.end_headers(self)
|
||||
|
||||
@@ -32,11 +32,11 @@ class ContentMD5Handler(SimpleHTTPRequestHandler):
|
||||
class StaticFileServer:
|
||||
__server_lock = threading.Lock()
|
||||
|
||||
def __init__(self, handler='etag'):
|
||||
handler_class = ETagHandler if handler == 'etag' else ContentMD5Handler
|
||||
def __init__(self, handler="etag"):
|
||||
handler_class = ETagHandler if handler == "etag" else ContentMD5Handler
|
||||
|
||||
self.__server_lock.acquire()
|
||||
self.httpd = HTTPServer(('localhost', 8000), handler_class)
|
||||
self.httpd = HTTPServer(("localhost", 8000), handler_class)
|
||||
|
||||
def __enter__(self):
|
||||
self.server_thread = threading.Thread(target=self.httpd.serve_forever)
|
||||
|
||||
Reference in New Issue
Block a user