Ruff
This commit is contained in:
parent
1f3bef0772
commit
a99f2c134d
|
@ -59,7 +59,10 @@ def assert_good_value_repr(r):
|
|||
|
||||
|
||||
def to_quickstatements_v1_item(
|
||||
subject, lines, skip_impossible=True, skip_already_syncronized=True
|
||||
subject,
|
||||
lines,
|
||||
skip_impossible=True,
|
||||
skip_already_syncronized=True,
|
||||
):
|
||||
# assert '@id' not in subject, 'TODO: Linked subjects'
|
||||
subject_id = fmt_value(subject, True) if '@id' in subject else 'LAST'
|
||||
|
@ -103,12 +106,14 @@ def to_quickstatements_v1_item(
|
|||
|
||||
if skip_impossible and predicate_str.startswith('"'):
|
||||
logging.warning(
|
||||
'Bad line: %s (Lines must not start with ")', predicate_str
|
||||
'Bad line: %s (Lines must not start with ")',
|
||||
predicate_str,
|
||||
)
|
||||
continue
|
||||
if '' in line and skip_impossible:
|
||||
logging.warning(
|
||||
'Bad line: %s (Lines must not contain empty names)', line
|
||||
'Bad line: %s (Lines must not contain empty names)',
|
||||
line,
|
||||
)
|
||||
continue
|
||||
assert 'None' not in line, line
|
||||
|
|
|
@ -21,7 +21,7 @@ class Concept:
|
|||
for k, v in pairs.items():
|
||||
keys = canonical_keys(k, context)
|
||||
self.pairs.append(
|
||||
{'canonical_key': keys[0], 'keys': set(keys), 'values': v}
|
||||
{'canonical_key': keys[0], 'keys': set(keys), 'values': v},
|
||||
)
|
||||
self.regenerate_by_keys()
|
||||
|
||||
|
@ -36,7 +36,7 @@ class Concept:
|
|||
'canonical_key': p['canonical_key'],
|
||||
'keys': set(p['keys']),
|
||||
'values': p['values'],
|
||||
}
|
||||
},
|
||||
)
|
||||
new.regenerate_by_keys()
|
||||
return new
|
||||
|
|
|
@ -94,7 +94,8 @@ def get_triples_internal(subject, predicate, object):
|
|||
params['page'] = current_page
|
||||
url = (
|
||||
requests.Request(
|
||||
url='https://query.wikidata.org/bigdata/ldf', params=params
|
||||
url='https://query.wikidata.org/bigdata/ldf',
|
||||
params=params,
|
||||
)
|
||||
.prepare()
|
||||
.url
|
||||
|
@ -142,6 +143,9 @@ def get_triples(client, subject=None, predicate=None, object=None):
|
|||
|
||||
def get_backlinks(client, predicate, object):
|
||||
for subject, _, _ in get_triples(
|
||||
client, subject=None, predicate=predicate, object=object
|
||||
client,
|
||||
subject=None,
|
||||
predicate=predicate,
|
||||
object=object,
|
||||
):
|
||||
yield subject
|
||||
|
|
Loading…
Reference in New Issue
Block a user