mirror of https://github.com/Nonannet/copapy.git
code style fixed and type hints in get_binaries.py fixed
This commit is contained in:
parent
d0466cf769
commit
b6c6d6bbf6
|
|
@ -1,4 +1,4 @@
|
||||||
from copapy import variable, NumLike
|
from copapy import NumLike
|
||||||
from copapy.backend import Write, compile_to_dag, add_read_command
|
from copapy.backend import Write, compile_to_dag, add_read_command
|
||||||
import copapy as cp
|
import copapy as cp
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from copapy import variable, NumLike
|
from copapy import NumLike
|
||||||
from copapy.backend import Write, compile_to_dag, add_read_command
|
from copapy.backend import Write, compile_to_dag, add_read_command
|
||||||
import subprocess
|
import subprocess
|
||||||
from copapy import _binwrite
|
from copapy import _binwrite
|
||||||
|
|
@ -26,7 +26,7 @@ def check_for_qemu() -> bool:
|
||||||
command = qemu_command + ['--version']
|
command = qemu_command + ['--version']
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False)
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False)
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
return result.returncode == 0
|
return result.returncode == 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from typing import Any
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from urllib.request import urlopen, Request
|
from urllib.request import urlopen, Request
|
||||||
|
|
@ -5,13 +6,13 @@ from urllib.request import urlopen, Request
|
||||||
OWNER = "Nonannet"
|
OWNER = "Nonannet"
|
||||||
REPO = "copapy"
|
REPO = "copapy"
|
||||||
|
|
||||||
def fetch_json(url: str):
|
def fetch_json(url: str) -> Any:
|
||||||
req = Request(url, headers={"User-Agent": "Python"})
|
req = Request(url, headers={"User-Agent": "Python"})
|
||||||
with urlopen(req, timeout=10) as resp:
|
with urlopen(req, timeout=10) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
return json.load(resp)
|
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"})
|
req = Request(url, headers={"User-Agent": "Python"})
|
||||||
with urlopen(req, timeout=30) as resp, open(dest_path, "wb") as f:
|
with urlopen(req, timeout=30) as resp, open(dest_path, "wb") as f:
|
||||||
f.write(resp.read())
|
f.write(resp.read())
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from copapy import variable
|
from copapy import variable
|
||||||
from copapy.backend import Write, compile_to_dag, stencil_db_from_package
|
from copapy.backend import Write, compile_to_dag, stencil_db_from_package
|
||||||
import copapy as cp
|
|
||||||
from copapy._binwrite import Command
|
from copapy._binwrite import Command
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue