Buckets:

download
raw
499 Bytes
"""Common metaclasses for re-use."""
class SingletonMetaclass(type):
"""Singleton metaclass for instantation of a single instance of a class.
For example:
```python
class Foo(metaclass=SingletonMetaclass):
...
```
"""
_instance = None
def __call__(cls, *args, **kwargs):
"""Call the class constructor."""
if cls._instance is None:
cls._instance = super().__call__(*args, **kwargs)
return cls._instance

Xet Storage Details

Size:
499 Bytes
·
Xet hash:
4fb45e4ea4ba2aec2f549991ffa4c12a3f6340c84cf5557ce26a3c4de179d0b0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.