Skip to content

Commit cb0b2f0

Browse files
committed
Tweaked to not use horrible implements
1 parent 7d75408 commit cb0b2f0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

jsonschema.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
requests = None
3636

3737
try:
38-
from zope.interface import Interface, Attribute, implements
38+
from zope.interface import Interface, Attribute, classImplements
3939
HAS_ZOPE = True
4040
except ImportError:
4141
HAS_ZOPE = False
@@ -594,8 +594,6 @@ class Draft3Validator(ValidatorMixin, _Draft34CommonMixin, object):
594594
A validator for JSON Schema draft 3.
595595
596596
"""
597-
if HAS_ZOPE:
598-
implements(IValidator)
599597

600598
def validate_type(self, types, instance, schema):
601599
types = _list(types)
@@ -743,15 +741,16 @@ def validate_extends(self, extends, instance, schema):
743741
},
744742
}
745743

744+
if HAS_ZOPE:
745+
classImplements(Draft3Validator, IValidator)
746+
746747

747748
@validates("draft4")
748749
class Draft4Validator(ValidatorMixin, _Draft34CommonMixin, object):
749750
"""
750751
A validator for JSON Schema draft 4.
751752
752753
"""
753-
if HAS_ZOPE:
754-
implements(IValidator)
755754

756755
def validate_type(self, types, instance, schema):
757756
types = _list(types)
@@ -1000,6 +999,9 @@ def validate_not(self, not_schema, instance, schema):
1000999
"default": {}
10011000
}
10021001

1002+
if HAS_ZOPE:
1003+
classImplements(Draft4Validator, IValidator)
1004+
10031005

10041006
class FormatChecker(object):
10051007
"""

0 commit comments

Comments
 (0)