summaryrefslogtreecommitdiff
path: root/src/zope/component/interface.py
diff options
context:
space:
mode:
authorMichael Howitz <mh@gocept.com>2023-04-14 08:03:36 +0200
committerGitHub <noreply@github.com>2023-04-14 08:03:36 +0200
commit1c6af940c08ca2fdb142916974a192ab6ff9ea7c (patch)
tree924adcafcaf497f1fa5f4c2f506ff6085caa3ae6 /src/zope/component/interface.py
parentba0550c4645c3e73f32f7cd77bbe3cc528f76ad6 (diff)
downloadzope-component-1c6af940c08ca2fdb142916974a192ab6ff9ea7c.tar.gz
Config with pure python template (#71)
* Lint the code, improve coverage. * Bumped version for breaking release. * Drop support for Python 2.7, 3.5, 3.6.
Diffstat (limited to 'src/zope/component/interface.py')
-rw-r--r--src/zope/component/interface.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/zope/component/interface.py b/src/zope/component/interface.py
index 2317149..f03770d 100644
--- a/src/zope/component/interface.py
+++ b/src/zope/component/interface.py
@@ -14,12 +14,11 @@
"""Interface utility functions
"""
from zope.interface import alsoProvides
+from zope.interface.interfaces import ComponentLookupError
from zope.interface.interfaces import IInterface
-from zope.interface.interfaces import ComponentLookupError
from zope.component._api import getSiteManager
from zope.component._api import queryUtility
-from zope.component._compat import CLASS_TYPES
def provideInterface(id, interface, iface_type=None, info=''):
@@ -31,10 +30,10 @@ def provideInterface(id, interface, iface_type=None, info=''):
Previously it was always registered in the global site manager.
"""
if not id:
- id = "%s.%s" % (interface.__module__, interface.__name__)
+ id = "{}.{}".format(interface.__module__, interface.__name__)
if not IInterface.providedBy(interface):
- if not isinstance(interface, CLASS_TYPES):
+ if not isinstance(interface, type):
raise TypeError(id, "is not an interface or class")
return
@@ -96,7 +95,7 @@ def searchInterfaceUtilities(context, search_string=None, base=None):
def getInterfaceAllDocs(interface):
- iface_id = '%s.%s' % (interface.__module__, interface.__name__)
+ iface_id = '{}.{}'.format(interface.__module__, interface.__name__)
docs = [str(iface_id).lower(),
str(interface.__doc__).lower()]
@@ -118,4 +117,4 @@ def nameToInterface(context, id):
def interfaceToName(context, interface):
if interface is None:
return 'None'
- return '%s.%s' % (interface.__module__, interface.__name__)
+ return '{}.{}'.format(interface.__module__, interface.__name__)