Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
MeggyCal committed Jun 18, 2024
1 parent c4d5eb5 commit 0c6fa36
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
32 changes: 18 additions & 14 deletions python_jsonschema_objects/classbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ def __init__(self, **props):
import sys

e = type(e)(
str(e)
+ " \nwhile setting '{0}' in {1}".format(
prop, self.__class__.__name__
)
str(e)
+ " \nwhile setting '{0}' in {1}".format(
prop, self.__class__.__name__
)
)
raise e.with_traceback(sys.exc_info()[2])

if getattr(self, "__strict__", None):
Expand Down Expand Up @@ -638,13 +638,15 @@ def _build_literal(self, nm, clsdata):
# This weird value on the next line is a sentinel value, because we can't use the standard `get(
# "key", None) is not None` motif because sometimes the value is None. If someone has an actual
# value like this (which I generated by having my cat walk on my keyboard), they're out of luck.
"__default__": clsdata["default"]
if clsdata.get(
"default",
"asldkfn24olkjalskdfn e;laishd;1loj;flkansd;iow;naosdinfe;lkamjsdfj",
)
is not "asldkfn24olkjalskdfn e;laishd;1loj;flkansd;iow;naosdinfe;lkamjsdfj"
else clsdata.get("const"),
"__default__": (
clsdata["default"]
if clsdata.get(
"default",
"asldkfn24olkjalskdfn e;laishd;1loj;flkansd;iow;naosdinfe;lkamjsdfj",
)
is not "asldkfn24olkjalskdfn e;laishd;1loj;flkansd;iow;naosdinfe;lkamjsdfj"
else clsdata.get("const")
),
}
},
)
Expand Down Expand Up @@ -820,9 +822,11 @@ def _build_object(self, nm, clsdata, parents, **kw):

def construct_objects(self, oneOfList, uri):
return [
self.construct(uri + "_%s" % i, item_detail)
if "$ref" not in item_detail
else self.resolve_type(item_detail["$ref"], uri + "_%s" % i)
(
self.construct(uri + "_%s" % i, item_detail)
if "$ref" not in item_detail
else self.resolve_type(item_detail["$ref"], uri + "_%s" % i)
)
for i, item_detail in enumerate(oneOfList)
]

Expand Down
2 changes: 0 additions & 2 deletions python_jsonschema_objects/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from collections.abc import Mapping, Sequence



class lazy_format(object):
__slots__ = ("fmt", "args", "kwargs")

Expand Down Expand Up @@ -35,7 +34,6 @@ def safe_issubclass(x, y):
return False



class ProtocolJSONEncoder(json.JSONEncoder):
def default(self, obj):
from python_jsonschema_objects import classbuilder, wrapper_types
Expand Down
4 changes: 1 addition & 3 deletions python_jsonschema_objects/wrapper_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ def validate_items(self):
elif util.safe_issubclass(typ, classbuilder.ProtocolBase):
if not isinstance(elem, typ):
try:
if isinstance(
elem, (str, int, float)
):
if isinstance(elem, (str, int, float)):
val = typ(elem)
else:
val = typ(**elem)
Expand Down

0 comments on commit 0c6fa36

Please sign in to comment.