Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split world to different runtime #26

Open
wants to merge 2 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 0 additions & 144 deletions common/common/dataclass.py

This file was deleted.

13 changes: 13 additions & 0 deletions common/common/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ def __call__(cls, *args, **kwargs):
cls._instances[cls] = super().__call__(*args, **kwargs)
return cls._instances[cls]

def get_instance(cls):
return cls._instances[cls]


def CustomSingleton(*bases: type) -> type: # noqa
mcs: set[type] = {Singleton}

for base in bases:
if base.__class__ is not type:
mcs.add(base.__class__)

return type("Singleton", tuple(mcs), {"_instances": {}})


class _ClassProperty:
def __init__(self, fget, fset=None):
Expand Down