Skip to content

Commit 51a8a10

Browse files
committed
Minor changes to canonicalization
1 parent 02174ca commit 51a8a10

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

jsonsubschema/_canonicalization.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,19 @@ def canonicalize_not(d):
239239
allofs.append(canonicalize_not({"not": i}))
240240
return {"allOf": allofs}
241241

242+
# Should not reach here. Should be canonicalized and
243+
# simplified by now.
242244
elif c == "allOf":
243-
anyofs = []
244-
for i in negated_schema["allOf"]:
245-
anyofs.append(canonicalize_not({"not": i}))
246-
return {"anyOf": anyofs}
247-
248-
elif c == "oneOf":
249-
return canonicalize_not({"not": canonicalize_connectors(negated_schema)})
245+
# anyofs = []
246+
# for i in negated_schema["allOf"]:
247+
# anyofs.append(canonicalize_not({"not": i}))
248+
# return {"anyOf": anyofs}
249+
return canonicalize_not({'not': canonicalize_connectors(negated_schema)})
250+
251+
# anyofs.append(canonicalize_not({"not": i}))
252+
# Should not reach here. Should be canonicalized by now.
253+
# elif c == "oneOf":
254+
# return canonicalize_not({"not": canonicalize_connectors(negated_schema)})
250255
else:
251256
sys.exit(">>>>>> Ewwwww! Shouldn't be here during canonicalization. <<<<<<")
252257

@@ -296,7 +301,8 @@ def rewrite_enum(d):
296301

297302
# Unsupported cases of rewriting enums
298303
elif t == 'array' or t == 'object':
299-
raise UnexpectedCanonicalization(msg='Rewriting the following enum is not supported.', tau=t, schema=d)
304+
raise UnexpectedCanonicalization(
305+
msg='Rewriting the following enum is not supported.', tau=t, schema=d)
300306

301307

302308
def simplify_schema_and_embed_checkers(s):

0 commit comments

Comments
 (0)