Skip to content

Commit

Permalink
Release 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jun 2, 2024
1 parent 51aa708 commit 181e0e0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r cutekit/requirements.txt
python -m pip install mypy pytest ruff
- name: Type Checking
Expand Down
2 changes: 1 addition & 1 deletion cutekit/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ProductScope(ComponentScope):
Compute = Callable[[TargetScope], list[str]]
_vars: dict[str, Compute] = {}

Hook = Callable[[ComponentScope], None]
Hook = Callable[[TargetScope], None]
_hooks: dict[str, Hook] = {}


Expand Down
6 changes: 4 additions & 2 deletions cutekit/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ def __bool__(self):
raise Exception("Uninitialized constant")


VERSION = (0, 7, 0, "dev")
VERSION_STR = f"{VERSION[0]}.{VERSION[1]}.{VERSION[2]}{'-' + VERSION[3] if len(VERSION) >= 4 else ''}"
VERSION = (0, 7, 0, "")
VERSION_STR = (
f"{VERSION[0]}.{VERSION[1]}.{VERSION[2]}{'-' + VERSION[3] if VERSION[3] else ''}"
)
MODULE_DIR = os.path.dirname(os.path.realpath(__file__))


Expand Down
1 change: 0 additions & 1 deletion cutekit/export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import json
import html
from typing import Any, Optional
from . import model, cli, vt100, jexpr, const

Expand Down
8 changes: 4 additions & 4 deletions cutekit/jexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _expand(expr: Jexpr) -> Jexpr:
result: dict[str, Jexpr] = {}
for k in expr:
key = _expand(k)
result[key] = _expand(expr[k])
result[str(key)] = _expand(expr[k])
return result

elif _isListExpr(expr):
Expand All @@ -80,7 +80,7 @@ def _expand(expr: Jexpr) -> Jexpr:
raise ValueError(f"Expected string, got {expr[0]}")

fName = _expand(expr[0][1:])
fVal = eval(fName, globals, locals)
fVal = eval(str(fName), globals, locals)
res = fVal(*_expand(expr[1:]))
return _expand(res)

Expand All @@ -90,8 +90,8 @@ def _expand(expr: Jexpr) -> Jexpr:
elif isinstance(expr, str):
return _extractStr(
expr,
lambda e: eval(e, globals, locals)
if not (e.startswith("{") and e.endswith("}"))
lambda e: eval(str(e), globals, locals)
if not (isinstance(e, str) and e.startswith("{") and e.endswith("}"))
else e,
)

Expand Down
5 changes: 1 addition & 4 deletions cutekit/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,10 @@ class Registry(DataClassJsonMixin):
project: Project
manifests: dict[str, Manifest] = dt.field(default_factory=dict)

def _append(self, m: Optional[Manifest]) -> Optional[Manifest]:
def _append(self, m: Manifest) -> Manifest:
"""
Append a manifest to the model
"""
if m is None:
return m

if m.id in self.manifests:
raise RuntimeError(
f"Duplicated manifest '{m.id}' at '{m.path}' already loaded from '{self.manifests[m.id].path}'"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_cli_extra_args():


class StrOperandArg:
value: str = cli.operand(None, "value")
value: str = cli.operand("value")


def test_cli_operand_args():
Expand All @@ -259,7 +259,7 @@ def test_cli_operand_args():


class ListOperandArg:
value: list[str] = cli.operand(None, "value")
value: list[str] = cli.operand("value")


def test_cli_operand_list_args():
Expand Down

0 comments on commit 181e0e0

Please sign in to comment.