parent
2566ef665f
commit
ef97c273db
@ -1,5 +1,14 @@
|
|||||||
python early hide:
|
python early hide:
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
try:
|
||||||
|
from renpy.lint import python_builtins, renpy_builtins
|
||||||
|
except ImportError:
|
||||||
|
import builtins
|
||||||
|
python_builtins = set(dir(builtins))
|
||||||
|
del builtins
|
||||||
|
renpy_builtins = set()
|
||||||
|
|
||||||
__register_params = frozenset(inspect.signature(renpy.register_statement).parameters).difference({"name", "parse"})
|
__register_params = frozenset(inspect.signature(renpy.register_statement).parameters).difference({"name", "parse"})
|
||||||
def register_decorator(cls):
|
def register_decorator(cls):
|
||||||
"""
|
"""
|
||||||
@ -54,6 +63,12 @@ python early hide:
|
|||||||
evaled = {n: eval(e) for n, e in self.items()}
|
evaled = {n: eval(e) for n, e in self.items()}
|
||||||
renpy.dynamic(**evaled)
|
renpy.dynamic(**evaled)
|
||||||
|
|
||||||
|
def lint(self):
|
||||||
|
for domain, st in (("Python", python_builtins), ("Ren'Py", renpy_builtins)):
|
||||||
|
inter = st.intersection(self)
|
||||||
|
if inter:
|
||||||
|
renpy.error(f"Dynamic statement redefines one or several {domain} builtins: {', '.join(map(repr, inter))}")
|
||||||
|
|
||||||
@register_decorator
|
@register_decorator
|
||||||
class chibi:
|
class chibi:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user