mirror of https://gitlab.com/bashrc2/epicyon
Fix warnings
parent
2fe3da8f34
commit
9ef2a22b7a
25
pyjsonld.py
25
pyjsonld.py
|
@ -1616,7 +1616,7 @@ class JsonLdProcessor(object):
|
||||||
# object is IRI, bnode, or literal
|
# object is IRI, bnode, or literal
|
||||||
if o['type'] == 'IRI':
|
if o['type'] == 'IRI':
|
||||||
quad += '<' + o['value'] + '>'
|
quad += '<' + o['value'] + '>'
|
||||||
elif(o['type'] == 'blank node'):
|
elif (o['type'] == 'blank node'):
|
||||||
# normalization mode
|
# normalization mode
|
||||||
if bnode is not None:
|
if bnode is not None:
|
||||||
quad += '_:a' if o['value'] == bnode else '_:z'
|
quad += '_:a' if o['value'] == bnode else '_:z'
|
||||||
|
@ -1676,8 +1676,8 @@ class JsonLdProcessor(object):
|
||||||
:return: True if the triples are the same, False if not.
|
:return: True if the triples are the same, False if not.
|
||||||
"""
|
"""
|
||||||
for attr in ['subject', 'predicate', 'object']:
|
for attr in ['subject', 'predicate', 'object']:
|
||||||
if(t1[attr]['type'] != t2[attr]['type'] or
|
if t1[attr]['type'] != t2[attr]['type'] or \
|
||||||
t1[attr]['value'] != t2[attr]['value']):
|
t1[attr]['value'] != t2[attr]['value']:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if t1['object'].get('language') != t2['object'].get('language'):
|
if t1['object'].get('language') != t2['object'].get('language'):
|
||||||
|
@ -1718,8 +1718,8 @@ class JsonLdProcessor(object):
|
||||||
|
|
||||||
# recursively compact object
|
# recursively compact object
|
||||||
if _is_object(element):
|
if _is_object(element):
|
||||||
if(options['link'] and '@id' in element and
|
if options['link'] and '@id' in element and \
|
||||||
element['@id'] in options['link']):
|
element['@id'] in options['link']:
|
||||||
# check for a linked element to reuse
|
# check for a linked element to reuse
|
||||||
linked = options['link'][element['@id']]
|
linked = options['link'][element['@id']]
|
||||||
for link in linked:
|
for link in linked:
|
||||||
|
@ -1815,9 +1815,9 @@ class JsonLdProcessor(object):
|
||||||
|
|
||||||
# skip array processing for keywords that aren't
|
# skip array processing for keywords that aren't
|
||||||
# @graph or @list
|
# @graph or @list
|
||||||
if(expanded_property != '@graph' and
|
if expanded_property != '@graph' and \
|
||||||
expanded_property != '@list' and
|
expanded_property != '@list' and \
|
||||||
_is_keyword(expanded_property)):
|
_is_keyword(expanded_property):
|
||||||
# use keyword alias and add value as is
|
# use keyword alias and add value as is
|
||||||
alias = self._compact_iri(active_ctx, expanded_property)
|
alias = self._compact_iri(active_ctx, expanded_property)
|
||||||
JsonLdProcessor.add_value(rval, alias, expanded_value)
|
JsonLdProcessor.add_value(rval, alias, expanded_value)
|
||||||
|
@ -2530,13 +2530,14 @@ class JsonLdProcessor(object):
|
||||||
# 4. Have no keys other than: @id, rdf:first, rdf:rest
|
# 4. Have no keys other than: @id, rdf:first, rdf:rest
|
||||||
# and, optionally, @type where the value is rdf:List.
|
# and, optionally, @type where the value is rdf:List.
|
||||||
node_key_count = len(node.keys())
|
node_key_count = len(node.keys())
|
||||||
while(property == RDF_REST and
|
while (property == RDF_REST and
|
||||||
_is_object(referenced_once.get(node['@id'])) and
|
_is_object(referenced_once.get(node['@id'])) and
|
||||||
_is_array(node[RDF_FIRST]) and
|
_is_array(node[RDF_FIRST]) and
|
||||||
len(node[RDF_FIRST]) == 1 and
|
len(node[RDF_FIRST]) == 1 and
|
||||||
_is_array(node[RDF_REST]) and
|
_is_array(node[RDF_REST]) and
|
||||||
len(node[RDF_REST]) == 1 and
|
len(node[RDF_REST]) == 1 and
|
||||||
(node_key_count == 3 or (node_key_count == 4 and
|
(node_key_count == 3 or
|
||||||
|
(node_key_count == 4 and
|
||||||
_is_array(node.get('@type')) and
|
_is_array(node.get('@type')) and
|
||||||
len(node['@type']) == 1 and
|
len(node['@type']) == 1 and
|
||||||
node['@type'][0] == RDF_LIST))):
|
node['@type'][0] == RDF_LIST))):
|
||||||
|
@ -3175,7 +3176,7 @@ class JsonLdProcessor(object):
|
||||||
# reference; note that a circular reference won't occur when the
|
# reference; note that a circular reference won't occur when the
|
||||||
# embed flag is `@link` as the above check will short-circuit
|
# embed flag is `@link` as the above check will short-circuit
|
||||||
# before reaching this point
|
# before reaching this point
|
||||||
if(flags['embed'] == '@never' or self._creates_circular_reference(
|
if (flags['embed'] == '@never' or self._creates_circular_reference(
|
||||||
subject, state['subjectStack'])):
|
subject, state['subjectStack'])):
|
||||||
self._add_frame_output(parent, property, output)
|
self._add_frame_output(parent, property, output)
|
||||||
continue
|
continue
|
||||||
|
@ -4612,7 +4613,7 @@ def permutations(elements):
|
||||||
for i in range(length):
|
for i in range(length):
|
||||||
e = elements[i]
|
e = elements[i]
|
||||||
is_left = left[e]
|
is_left = left[e]
|
||||||
if((k is None or e > k) and
|
if ((k is None or e > k) and
|
||||||
((is_left and i > 0 and e > elements[i - 1]) or
|
((is_left and i > 0 and e > elements[i - 1]) or
|
||||||
(not is_left and i < last and e > elements[i + 1]))):
|
(not is_left and i < last and e > elements[i + 1]))):
|
||||||
k, pos = e, i
|
k, pos = e, i
|
||||||
|
|
|
@ -23,7 +23,8 @@ from threads import begin_thread
|
||||||
|
|
||||||
def _update_post_schedule(base_dir: str, handle: str, httpd,
|
def _update_post_schedule(base_dir: str, handle: str, httpd,
|
||||||
max_scheduled_posts: int) -> None:
|
max_scheduled_posts: int) -> None:
|
||||||
"""Checks if posts are due to be delivered and if so moves them to the outbox
|
"""Checks if posts are due to be delivered and if so moves them to
|
||||||
|
the outbox
|
||||||
"""
|
"""
|
||||||
schedule_index_filename = \
|
schedule_index_filename = \
|
||||||
base_dir + '/accounts/' + handle + '/schedule.index'
|
base_dir + '/accounts/' + handle + '/schedule.index'
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -3686,7 +3686,7 @@ def _test_web_links():
|
||||||
'<p>Test1 test2 #YetAnotherExcessivelyLongwindedAndBoringHashtag</p>'
|
'<p>Test1 test2 #YetAnotherExcessivelyLongwindedAndBoringHashtag</p>'
|
||||||
test_fn_str = add_web_links(example_text)
|
test_fn_str = add_web_links(example_text)
|
||||||
result_text = remove_long_words(test_fn_str, 40, [])
|
result_text = remove_long_words(test_fn_str, 40, [])
|
||||||
assert(result_text ==
|
assert (result_text ==
|
||||||
'<p>Test1 test2 '
|
'<p>Test1 test2 '
|
||||||
'#YetAnotherExcessivelyLongwindedAndBorin\ngHashtag</p>')
|
'#YetAnotherExcessivelyLongwindedAndBorin\ngHashtag</p>')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue