moving to scripts

This commit is contained in:
eneller
2021-11-16 23:55:48 +01:00
parent f591ca2077
commit 14bfb7f96f
2575 changed files with 465862 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
class AlreadyUsedError(RuntimeError):
"""An Outcome can only be unwrapped once."""
pass
def fixup_module_metadata(module_name, namespace):
def fix_one(obj):
mod = getattr(obj, "__module__", None)
if mod is not None and mod.startswith("outcome."):
obj.__module__ = module_name
if isinstance(obj, type):
for attr_value in obj.__dict__.values():
fix_one(attr_value)
for objname in namespace["__all__"]:
obj = namespace[objname]
fix_one(obj)
def remove_tb_frames(exc, n):
tb = exc.__traceback__
for _ in range(n):
tb = tb.tb_next
return exc.with_traceback(tb)