| 14 | |
| 15 | # Constructor |
| 16 | def __constructor(self, name, bases, kwargs): |
| 17 | # Register this type of auth_sources, based on the module name |
| 18 | # Avoid registering the BaseAuthentication itself |
| 19 | cls = self.__class__ |
| 20 | entry = self._decorate_cls_name(name, kwargs) |
| 21 | |
| 22 | if cls._registry is None: |
| 23 | cls._registry = dict() |
| 24 | else: |
| 25 | if entry in cls._registry: |
| 26 | raise RuntimeError(( |
| 27 | "{} class is already been registered with {} " |
| 28 | "(package: {})" |
| 29 | ).format(entry, cls._name_, cls._package_)) |
| 30 | |
| 31 | if cls._initialized is True: |
| 32 | cls._registry[entry] = self |
| 33 | cls._initialized = True |
| 34 | |
| 35 | ABCMeta.__init__(self, name, bases, kwargs) |
| 36 | |
| 37 | |
| 38 | @classmethod |