Skip to content

Commit f03b28b

Browse files
PatStLouisdavidlehn
authored andcommitted
include both False and None values in condition checks
Signed-off-by: pstlouis <patrick.st-louis@opsecid.ca>
1 parent ed245c8 commit f03b28b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/pyld/context_resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def resolve(self, active_ctx, context, base, cycles=None):
6363
all_resolved.extend(resolved)
6464
else:
6565
all_resolved.append(resolved)
66-
elif ctx is None:
66+
elif ctx is None or ctx is False:
6767
all_resolved.append(ResolvedContext(False))
6868
elif not isinstance(ctx, dict) and not isinstance(ctx, frozendict):
6969
raise jsonld.JsonLdError(

lib/pyld/jsonld.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,7 @@ def _expand(
23202320
for type_ in sorted(types):
23212321
ctx = JsonLdProcessor.get_context_value(
23222322
type_scoped_ctx, type_, '@context')
2323-
if ctx:
2323+
if ctx is not None and ctx is not False:
23242324
active_ctx = self._process_context(
23252325
active_ctx, ctx, options, propagate=False)
23262326

@@ -3070,7 +3070,7 @@ def _process_context(self, active_ctx, local_ctx, options,
30703070
active_ctx['_uuid'] = str(uuid.uuid1())
30713071

30723072
# reset to initial context
3073-
if ctx is None:
3073+
if ctx is None or ctx is False:
30743074
if (not override_protected and
30753075
any(v.get('protected') for v in rval['mappings'].values())):
30763076
raise JsonLdError(

0 commit comments

Comments
 (0)