code style fixed and type hints in get_binaries.py fixed

This commit is contained in:
Nicolas Kruse 2025-11-03 22:49:31 +01:00
parent d0466cf769
commit b6c6d6bbf6
14 changed files with 43 additions and 43 deletions

View File

@ -1,4 +1,4 @@
from copapy import variable, NumLike
from copapy import NumLike
from copapy.backend import Write, compile_to_dag, add_read_command
import copapy as cp
import subprocess

View File

@ -1,4 +1,4 @@
from copapy import variable, NumLike
from copapy import NumLike
from copapy.backend import Write, compile_to_dag, add_read_command
import subprocess
from copapy import _binwrite
@ -26,7 +26,7 @@ def check_for_qemu() -> bool:
command = qemu_command + ['--version']
try:
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False)
except:
except Exception:
return False
return result.returncode == 0

View File

@ -1,3 +1,4 @@
from typing import Any
import os
import json
from urllib.request import urlopen, Request
@ -5,13 +6,13 @@ from urllib.request import urlopen, Request
OWNER = "Nonannet"
REPO = "copapy"
def fetch_json(url: str):
def fetch_json(url: str) -> Any:
req = Request(url, headers={"User-Agent": "Python"})
with urlopen(req, timeout=10) as resp:
assert resp.status == 200
return json.load(resp)
def download_file(url: str, dest_path: str):
def download_file(url: str, dest_path: str) -> None:
req = Request(url, headers={"User-Agent": "Python"})
with urlopen(req, timeout=30) as resp, open(dest_path, "wb") as f:
f.write(resp.read())

View File

@ -1,6 +1,5 @@
from copapy import variable
from copapy.backend import Write, compile_to_dag, stencil_db_from_package
import copapy as cp
from copapy._binwrite import Command