-
Benjamin Fischer authoredBenjamin Fischer authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
evil.py 1014 B
# -*- coding: utf-8 -*-
def ccall(func, pass_name=False):
"""
def arguments(): pass
res = func(False, None, 3, key="word", arguments=arguments)``
# becomes
class res(ccall(func), False, None, 3):
key = "word"
def arguments(): pass
"""
class metaclass(type):
def __new__(cls, name, a, d):
d.pop("__module__", 0)
if pass_name:
d["__name__"] = name
return func(*a[1:], **d)
def __call__(*a, **d):
return func(*a, **d)
return type.__new__(metaclass, func.__name__, (), {})
def pin(loc, *skip):
"""
def __init__(self, will, *have, **all):
def the(): pass
variables = 1
del but
pin(locals())
these = 2
"""
loc = dict(loc)
loc.pop("self").__dict__.update({k: v for k, v in loc.items() if not any(
s is k or
s is True and k.startswith("_") or
s is v and isinstance(s, object)
for s in skip
)})