Use black with -l 120 param.

This commit is contained in:
grossmj committed 2021-04-13 18:46:50 +09:30
1 parent f928738bd5
commit c021e21309
194 files changed
+6034 -4564

No files matched your search

@@ -17,6 +17,7 @@
from ..qemu_error import QemuError
import logging
log = logging.getLogger(__name__)
+5 -3
View File
@@ -59,10 +59,12 @@ class Qcow2:
# } QCowHeader;
struct_format = ">IIQi"
with open(self._path, 'rb') as f:
with open(self._path, "rb") as f:
content = f.read(struct.calcsize(struct_format))
try:
self.magic, self.version, self.backing_file_offset, self.backing_file_size = struct.unpack_from(struct_format, content)
self.magic, self.version, self.backing_file_offset, self.backing_file_size = struct.unpack_from(
struct_format, content
)
except struct.error:
raise Qcow2Error(f"Invalid file header for {self._path}")
@@ -78,7 +80,7 @@ class Qcow2:
:returns: None if it's not a linked clone, the path otherwise
"""
with open(self._path, 'rb') as f:
with open(self._path, "rb") as f:
f.seek(self.backing_file_offset)
content = f.read(self.backing_file_size)
+4 -2
View File
@@ -20,12 +20,14 @@ import time
import shutil
import zipfile
def pack_zip(filename, root_dir=None, base_dir=None):
"""Create a zip archive"""
if filename[-4:].lower() == ".zip":
filename = filename[:-4]
shutil.make_archive(filename, 'zip', root_dir, base_dir)
shutil.make_archive(filename, "zip", root_dir, base_dir)
def unpack_zip(filename, extract_dir=None):
"""Unpack a zip archive"""
@@ -35,7 +37,7 @@ def unpack_zip(filename, extract_dir=None):
extract_dir = os.getcwd()
try:
with zipfile.ZipFile(filename, 'r') as zfile:
with zipfile.ZipFile(filename, "r") as zfile:
for zinfo in zfile.infolist():
fname = os.path.join(extract_dir, zinfo.filename)
date_time = time.mktime(zinfo.date_time + (0, 0, -1))