From b5b30bd227088526bb0370f0806c84228c9dc1b4 Mon Sep 17 00:00:00 2001 From: Niels Buwen Date: Fri, 29 Mar 2024 08:45:06 +0100 Subject: [PATCH 1/3] Include arbitrary function call in Readme --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 8df440c..f429f76 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,16 @@ or type `cell_view.` in jupyter/ipython >>> print(cell_view.b_box) [[0, 10], [2, 8]] ``` + +##### Call any SKILL function + +```python +>>> ws['plus'](3, 4) +7 +``` + +*equivalent to:* + +```lisp +(plus 3 4) +``` From 0947e73c887a643717bec75b253388c39db926f2 Mon Sep 17 00:00:00 2001 From: Niels Buwen Date: Thu, 11 Apr 2024 10:13:38 +0200 Subject: [PATCH 2/3] Fix broken Q000 ruff rule --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ca32d6f..1eebe9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,7 +125,6 @@ ignore = [ "PLW1641", "PLW3201", "PT001", "PT013", "PTH123", - "Q000", "S101", "S108", "S310", "S311", "S404", "T201", "TCH001", "TCH002", "TCH003", @@ -152,6 +151,9 @@ ignore = [ "INP001", "A001", ] +"*" = [ + "Q000", +] [tool.ruff.lint.pylint] max-args = 7 From a4fd39093b9c1fd0d24c9b9052fa3a36e413ec78 Mon Sep 17 00:00:00 2001 From: Niels Buwen Date: Thu, 11 Apr 2024 10:13:47 +0200 Subject: [PATCH 3/3] Fix broken mypy self-check --- skillbridge/__init__.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/skillbridge/__init__.py b/skillbridge/__init__.py index 5c91a5a..3f1c341 100644 --- a/skillbridge/__init__.py +++ b/skillbridge/__init__.py @@ -1,9 +1,12 @@ +from __future__ import annotations + import contextlib from keyword import iskeyword from os import chdir from pathlib import Path from re import fullmatch, sub from sys import executable, version_info +from typing import Any from .client.functions import FunctionCollection, keys from .client.globals import Globals, GlobalVar @@ -42,9 +45,19 @@ loop_var_j = Var('j') -def generate_static_completion() -> None: - from mypy.stubgen import Options, generate_stubs # noqa: PLC0415 +def import_stub_gen() -> tuple[Any, Any]: + # the cpython parser wrongly parses a python3.8-valid syntax as invalid + # the newest mypy version uses that parser + # this syntax occurs in the mypy source code + # -> mypy detects a syntax error in its own code base + # this can only be ignored by hiding the import code behind an exec call + scope: dict[str, Any] = {} + exec("from mypy.stubgen import Options, generate_stubs", scope, scope) # noqa: S102 + return scope['Options'], scope['generate_stubs'] + +def generate_static_completion() -> None: + options, generate_stubs = import_stub_gen() base = Path(__file__).parent.absolute() / 'client' annotation = base / 'workspace.pyi' @@ -53,7 +66,7 @@ def generate_static_completion() -> None: chdir(base) - o = Options( + o = options( (version_info.major, version_info.minor), no_import=True, doc_dir='',