Patch some mistakes (according to flake8)

This commit is contained in:
Valentin Niess
2025-05-20 23:27:20 +02:00
parent 331fc6ab7f
commit 60aec8ba25
13 changed files with 28 additions and 53 deletions

View File

@@ -5,4 +5,3 @@ from .extract import ImageExtractor, PythonExtractor
__all__ = ['Arch', 'Downloader', 'ImageExtractor', 'LinuxTag',
'PythonExtractor', 'PythonImpl', 'PythonVersion']

View File

@@ -1,4 +1,3 @@
import collections
from dataclasses import dataclass, field
import glob
import hashlib
@@ -7,7 +6,7 @@ from pathlib import Path
import requests
import shutil
import tempfile
from typing import List, Optional
from typing import Optional
from .config import Arch, LinuxTag
from ..utils.deps import CACHE_DIR
@@ -22,6 +21,7 @@ SUCCESS = 200
class DownloadError(Exception):
pass
class TarError(Exception):
pass
@@ -135,7 +135,7 @@ class Downloader:
hasher = hashlib.sha256()
tmp = workdir / 'layer.tgz'
with open(tmp, "wb") as f:
for chunk in r.iter_content(CHUNK_SIZE):
for chunk in r.iter_content(CHUNK_SIZE):
if chunk:
f.write(chunk)
hasher.update(chunk)
@@ -143,7 +143,7 @@ class Downloader:
h = hasher.hexdigest()
if h != hash_:
raise DownloadError(
f'bad hash (expected {name}, found {h})'
f'bad hash (expected {hash_}, found {h})'
)
layers_dir = destination / 'layers'
layers_dir.mkdir(exist_ok=True, parents=True)

View File

@@ -9,7 +9,7 @@ from pathlib import Path
import shutil
import stat
import subprocess
from typing import Dict, List, NamedTuple, Optional, Union
from typing import Dict, List, Optional
from .config import Arch, PythonImpl, PythonVersion
from ..appimage import Appifier
@@ -307,7 +307,7 @@ class PythonExtractor:
if (match not in dependencies) and (match not in self.excluded):
path = self.locate_library(match)
dependencies[match] = path
subs = recurse(path)
recurse(path)
recurse(target)
return dependencies
@@ -396,5 +396,5 @@ class ImageExtractor:
f'tar -xzf {filename} -C {destination} && ',
f'echo \'{layer}\' >> {extracted_file}'
))
process = subprocess.run(f'/bin/bash -c "{cmd}"', shell=True,
check=True, capture_output=True)
subprocess.run(f'/bin/bash -c "{cmd}"', shell=True,
check=True, capture_output=True)