-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a42579f
commit 6eef0e6
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""The singleton metaclass for ensuring only one instance of a class.""" | ||
import abc | ||
|
||
|
||
class Singleton(abc.ABCMeta, type): | ||
""" | ||
Singleton metaclass for ensuring only one instance of a class. | ||
""" | ||
|
||
_instances = {} | ||
|
||
def __call__(cls, *args, **kwargs): | ||
"""Call method for the singleton metaclass.""" | ||
if cls not in cls._instances: | ||
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) | ||
return cls._instances[cls] | ||
|
||
|
||
class AbstractSingleton(abc.ABC, metaclass=Singleton): | ||
""" | ||
Abstract singleton class for ensuring only one instance of a class. | ||
""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
setuptools.setup( | ||
name="broadcast_service", | ||
version="1.3.0", | ||
version="1.3.1", | ||
author="Zeeland", | ||
author_email="[email protected]", | ||
description="A lightweight third-party broadcast/pubsub library", | ||
|