Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/v8_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def ensure_v8_src(revision: str) -> None:
"custom_vars": {},
},
]
""",
"""
)

run(
Expand Down
3 changes: 1 addition & 2 deletions mkdocs_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ def on_page_markdown(markdown: str, **kwargs: Any) -> str: # noqa: ANN401
# so the URLs look better. To make the cross-links between the pages work, do light
# surgery on them:
return markdown.replace("ARCHITECTURE.md", "architecture.md").replace(
"CONTRIBUTING.md",
"contributing.md",
"CONTRIBUTING.md", "contributing.md"
)
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ per-file-ignores = { "tests/*" = ["S101"] }

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
split-on-trailing-comma = false

[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
skip-magic-trailing-comma = true

[tool.coverage.run]
omit = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _generate_readme() -> str:
.read_text(encoding="utf-8")
.splitlines()[1:]
).replace("\n## ", "\n### "),
],
]
)


Expand Down
3 changes: 1 addition & 2 deletions src/py_mini_racer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from py_mini_racer._context import PyJsFunctionType
from py_mini_racer._dll import (
DEFAULT_V8_FLAGS,
LibAlreadyInitializedError,
Expand All @@ -23,6 +22,7 @@
JSSymbol,
JSUndefined,
JSUndefinedType,
PyJsFunctionType,
PythonJSConvertedTypes,
)
from py_mini_racer._value_handle import (
Expand All @@ -34,7 +34,6 @@

__all__ = [
"DEFAULT_V8_FLAGS",
"AsyncCleanupType",
"JSArray",
"JSArrayIndexError",
"JSEvalException",
Expand Down
35 changes: 9 additions & 26 deletions src/py_mini_racer/_abstract_context.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import (
TYPE_CHECKING,
)
from typing import TYPE_CHECKING

from py_mini_racer._types import JSUndefined

Expand Down Expand Up @@ -50,25 +48,19 @@ def get_identity_hash(self, obj: JSObject) -> int:

@abstractmethod
def get_own_property_names(
self,
obj: JSObject,
self, obj: JSObject
) -> tuple[PythonJSConvertedTypes, ...]:
pass

@abstractmethod
def get_object_item(
self,
obj: JSObject,
key: PythonJSConvertedTypes,
self, obj: JSObject, key: PythonJSConvertedTypes
) -> PythonJSConvertedTypes:
pass

@abstractmethod
def set_object_item(
self,
obj: JSObject,
key: PythonJSConvertedTypes,
val: PythonJSConvertedTypes,
self, obj: JSObject, key: PythonJSConvertedTypes, val: PythonJSConvertedTypes
) -> None:
pass

Expand All @@ -82,10 +74,7 @@ def del_from_array(self, arr: JSArray, index: int) -> None:

@abstractmethod
def array_insert(
self,
arr: JSArray,
index: int,
new_val: PythonJSConvertedTypes,
self, arr: JSArray, index: int, new_val: PythonJSConvertedTypes
) -> None:
pass

Expand All @@ -100,18 +89,14 @@ def call_function(
pass

@abstractmethod
def js_callback(
self,
func: Callable[[PythonJSConvertedTypes | JSEvalException], None],
def js_to_py_callback(
self, func: Callable[[PythonJSConvertedTypes | JSEvalException], None]
) -> AbstractContextManager[JSFunction]:
pass

@abstractmethod
def promise_then(
self,
promise: JSPromise,
on_resolved: JSFunction,
on_rejected: JSFunction,
self, promise: JSPromise, on_resolved: JSFunction, on_rejected: JSFunction
) -> None:
pass

Expand All @@ -133,8 +118,6 @@ def free(self, val_handle: AbstractValueHandle) -> None:

@abstractmethod
def evaluate(
self,
code: str,
timeout_sec: float | None = None,
self, code: str, timeout_sec: float | None = None
) -> PythonJSConvertedTypes:
pass
Loading
Loading