77 lines
1.3 KiB
Python
77 lines
1.3 KiB
Python
from contextlib import suppress
|
|
from dataclasses import dataclass
|
|
import sys
|
|
from importlib.util import spec_from_loader
|
|
|
|
|
|
class a_place_on_earth(list):
|
|
def __del__(self):
|
|
global heaven
|
|
heaven = self
|
|
|
|
def __bool__(self):
|
|
return self == []
|
|
|
|
|
|
def god_is_a_girl():
|
|
raise GenderException("No zhe isn't")
|
|
|
|
|
|
class Soul:
|
|
def __post_init__(self):
|
|
if callable(self.name):
|
|
# invoke true name
|
|
self.name().append(self)
|
|
|
|
|
|
@dataclass
|
|
class Dog(Soul):
|
|
name: str
|
|
|
|
def __del__(self):
|
|
global heaven
|
|
heaven.append(self)
|
|
|
|
@staticmethod
|
|
def disable():
|
|
sys.stdout.write("Arf!\n")
|
|
global NamError
|
|
NamError = NameError
|
|
|
|
|
|
class Chaos:
|
|
def find_spec(self, n, *_):
|
|
if len(n) == 2:
|
|
return spec_from_loader(n, self)
|
|
|
|
# breaks in 3.15
|
|
@staticmethod
|
|
def load_module(n):
|
|
sys.modules[n] = Dog
|
|
|
|
__call__ = a_place_on_earth
|
|
|
|
|
|
@Dog
|
|
class Void:
|
|
def append(s, v):
|
|
v.__class__ = Chaos
|
|
|
|
|
|
sys.meta_path.insert(0, Chaos())
|
|
|
|
import gc
|
|
gc.disable()
|
|
|
|
with suppress(NamError):
|
|
heaven = a_place_on_earth() and god_is_a_girl()
|
|
|
|
hidden_place = [heaven]
|
|
heaven = Void()
|
|
|
|
if __name__ == "__main__":
|
|
Dog("Fido")
|
|
Dog("Rex")
|
|
Dog("Spot")
|
|
print(heaven)
|