Skip to content

Commit

Permalink
Extract method for registration.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 1, 2024
1 parent a13a477 commit 1877402
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions keyring/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@

class KeyringBackendMeta(abc.ABCMeta):
"""
A metaclass that's both an ABCMeta and a type that keeps a registry of
all (non-abstract) types.
Specialized subclass behavior.
Keeps a registry of all (non-abstract) types.
"""

def __init__(cls, name, bases, dict):
super().__init__(name, bases, dict)
cls._register()

def _register(cls):
if not hasattr(cls, '_classes'):
cls._classes = set()
classes = cls._classes
Expand Down

0 comments on commit 1877402

Please sign in to comment.