Skip to content

Commit f49eb08

Browse files
committed
Refactoring
1 parent b444b14 commit f49eb08

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

reportportal_client/_internal/static/abstract.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from abc import ABCMeta as _ABCMeta, abstractmethod
1717

18-
__all__ = ["AbstractBaseClass", "abstractmethod"]
18+
__all__ = ['AbstractBaseClass', 'abstractmethod']
1919

2020

2121
class AbstractBaseClass(_ABCMeta):
@@ -35,19 +35,19 @@ class Implementation(Interface):
3535
i = Implementation() -> success
3636
"""
3737

38-
_abc_registry = []
38+
_abc_registry = set()
3939

4040
def __call__(cls, *args, **kwargs):
4141
"""Disable instantiation for the interface classes."""
4242
if cls.__name__ in AbstractBaseClass._abc_registry:
43-
raise TypeError("No instantiation allowed for Interface-Class '{}'. Please inherit.".format(cls.__name__))
43+
raise TypeError(f'No instantiation allowed for Interface-Class "{cls.__name__}". Please inherit.')
4444

4545
result = super(AbstractBaseClass, cls).__call__(*args, **kwargs)
4646
return result
4747

4848
def __new__(mcs, name, bases, namespace):
4949
"""Register instance of the implementation class."""
5050
class_ = super(AbstractBaseClass, mcs).__new__(mcs, name, bases, namespace)
51-
if namespace.get("__metaclass__") is AbstractBaseClass:
52-
mcs._abc_registry.append(name)
51+
if namespace.get('__metaclass__') is AbstractBaseClass:
52+
mcs._abc_registry.add(name)
5353
return class_

0 commit comments

Comments
 (0)