执行 Ruff 安全自动修复
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import json
|
||||
import math
|
||||
@@ -355,7 +356,7 @@ def js_set(obj, key, val):
|
||||
if isinstance(obj, str):
|
||||
raise TypeError("Cannot assign to read only property")
|
||||
cur = getattr(
|
||||
getattr(__import__("pyvm.algorithm", fromlist=["x"]), "VM"), "_last_u", None
|
||||
__import__("pyvm.algorithm", fromlist=["x"]).VM, "_last_u", None
|
||||
)
|
||||
raise TypeError(
|
||||
f"invalid set target obj={type(obj).__name__} key={key!r} val={type(val).__name__} u={cur}"
|
||||
@@ -418,7 +419,7 @@ class Window:
|
||||
class JSFunction:
|
||||
"""VM 函数(解释器实例工厂返回的 h)。"""
|
||||
|
||||
__slots__ = ("entry", "args", "s", "n", "t", "vm", "name")
|
||||
__slots__ = ("args", "entry", "n", "name", "s", "t", "vm")
|
||||
|
||||
def __init__(self, vm, entry, args, s, n, t):
|
||||
self.vm = vm
|
||||
@@ -455,7 +456,7 @@ def js_call(fn, this, args):
|
||||
return fn.fn(this, *args)
|
||||
if callable(fn):
|
||||
return fn(this, *args)
|
||||
raise TypeError(f"{str(fn)} is not a function u={getattr(VM, '_last_u', None)}")
|
||||
raise TypeError(f"{fn!s} is not a function u={getattr(VM, '_last_u', None)}")
|
||||
|
||||
|
||||
def js_apply(fn, this, args):
|
||||
|
||||
Reference in New Issue
Block a user