Fixed missing types.

This commit is contained in:
Sleepy Monax 2023-03-25 15:26:34 +01:00 committed by Sleepy Monax
parent 35342c910a
commit c022c73ec1
6 changed files with 15 additions and 15 deletions

View file

@ -210,7 +210,7 @@ def instanciateDisabled(component: ComponentManifest, target: TargetManifest) -
return ComponentInstance(False, component.isEnabled(target)[1], component, [], [])
context: dict = {}
context: dict[str, Context] = {}
def contextFor(targetSpec: str, props: Props = {}) -> Context:

View file

@ -43,8 +43,8 @@ def makeMixinOptimize(level: str) -> Mixin:
def mixinDebug(target: TargetManifest, tools: Tools) -> Tools:
patchToolArgs(tools, "cc", ["-g"])
patchToolArgs(tools, "cxx", ["-g"])
patchToolArgs(tools, "cc", ["-g", "-gdwarf-4"])
patchToolArgs(tools, "cxx", ["-g", "-gdwarf-4"])
return tools
@ -66,5 +66,6 @@ mixins: dict[str, Mixin] = {
def append(mixinSpec: str, mixin: Mixin):
mixins[mixinSpec] = mixin
def byId(id: str) -> Mixin:
return mixins[id]

View file

@ -1,11 +1,9 @@
import os
from enum import Enum
from typing import Any
from json import JSONEncoder
from osdk.jexpr import Json
from osdk.logger import Logger
from osdk import const, utils
logger = Logger("model")
@ -26,7 +24,7 @@ class Manifest:
type: Type = Type.UNKNOWN
path: str = ""
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
if json is not None:
if not "id" in json:
raise ValueError("Missing id")
@ -59,7 +57,7 @@ class Extern:
git: str = ""
tag: str = ""
def __init__(self, json: Json = None, strict=True, **kwargs):
def __init__(self, json: Json = None, strict: bool = True, **kwargs: Any):
if json is not None:
if not "git" in json and strict:
raise ValueError("Missing git")
@ -87,7 +85,7 @@ class ProjectManifest(Manifest):
description: str = ""
extern: dict[str, Extern] = {}
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
if json is not None:
if not "description" in json and strict:
raise ValueError("Missing description")
@ -113,7 +111,7 @@ class Tool:
args: list[str] = []
files: list[str] = []
def __init__(self, json: Json = None, strict=True, **kwargs):
def __init__(self, json: Json = None, strict: bool = True, **kwargs: Any):
if json is not None:
if not "cmd" in json and strict:
raise ValueError("Missing cmd")
@ -147,7 +145,7 @@ class TargetManifest(Manifest):
tools: Tools
routing: dict[str, str]
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
if json is not None:
if not "props" in json and strict:
raise ValueError("Missing props")
@ -194,7 +192,7 @@ class ComponentManifest(Manifest):
provides: list[str] = []
subdirs: list[str] = []
def __init__(self, json: Json = None, path: str = "", strict=True, **kwargs):
def __init__(self, json: Json = None, path: str = "", strict: bool = True, **kwargs: Any):
if json is not None:
self.decription = json.get("description", self.decription)
self.props = json.get("props", self.props)

View file

@ -33,6 +33,8 @@ def uname() -> Uname:
result.machine = "arm64"
case "AMD64":
result.machine = "x86_64"
case _:
pass
return result
@ -102,7 +104,8 @@ def wget(url: str, path: str | None = None) -> str:
import requests
if path is None:
path = os.path.join(const.CACHE_DIR,
path = os.path.join(
const.CACHE_DIR,
hashlib.sha256(url.encode('utf-8')).hexdigest())
if os.path.exists(path):

View file

@ -2,8 +2,6 @@ from typing import Any, TypeVar, cast
import json
import hashlib
from osdk import shell, const
T = TypeVar('T')

View file

@ -28,7 +28,7 @@ def title(text: str):
print(f"{LIGHT_WHITE}{text}{RESET}:")
def wordwrap(text: str, width: int = 60, newline="\n") -> str:
def wordwrap(text: str, width: int = 60, newline: str = "\n") -> str:
result = ""
curr = 0