EMPTY COMMIT - fixing some pylint warnings
This commit is contained in:
parent
9117734b91
commit
6a9ee516a3
30
wani.py
30
wani.py
|
@ -249,7 +249,6 @@ class WordFormMsdCR(WordFormAnyCR):
|
|||
return False
|
||||
|
||||
return True
|
||||
pass
|
||||
|
||||
def add_word(self, word):
|
||||
if self.lemma is None:
|
||||
|
@ -366,9 +365,6 @@ class ComponentRendition:
|
|||
else:
|
||||
raise NotImplementedError("Representation selection: {}".format(feature))
|
||||
|
||||
else:
|
||||
return None
|
||||
|
||||
def cr_instance(self, word_renderer):
|
||||
return self.representation_factory(self.more, word_renderer)
|
||||
|
||||
|
@ -408,7 +404,7 @@ class ComponentRendition:
|
|||
|
||||
for cid, reps in representations.items():
|
||||
reps = [rep.rendition_text for rep in reps]
|
||||
if len(reps) == 0:
|
||||
if reps == []:
|
||||
pass
|
||||
elif all(r is None for r in reps):
|
||||
matches.representations[cid] = None
|
||||
|
@ -710,8 +706,8 @@ class SyntacticStructure:
|
|||
components, dependencies, definitions = list(system)
|
||||
|
||||
deps = [(dep.get('from'), dep.get('to'), dep.get('label'), dep.get('order'))
|
||||
for dep in dependencies]
|
||||
comps = { comp.get('cid'): dict(comp.items()) for comp in components }
|
||||
for dep in dependencies]
|
||||
comps = {comp.get('cid'): dict(comp.items()) for comp in components}
|
||||
|
||||
restrs, forms = {}, {}
|
||||
|
||||
|
@ -764,7 +760,7 @@ class SyntacticStructure:
|
|||
to_add.append(el)
|
||||
else:
|
||||
logging.warning("Strange representation feature in structure {}. Skipping"
|
||||
.format(self.id))
|
||||
.format(self.id))
|
||||
continue
|
||||
forms[n].append(to_add)
|
||||
|
||||
|
@ -850,7 +846,7 @@ class Word:
|
|||
assert None not in (self.id, self.lemma, self.msd)
|
||||
|
||||
@staticmethod
|
||||
def pcWord(pc, do_msd_translate):
|
||||
def pc_word(pc, do_msd_translate):
|
||||
pc.set('lemma', pc.text)
|
||||
pc.set('msd', "N" if do_msd_translate else "U")
|
||||
return Word(pc, do_msd_translate)
|
||||
|
@ -912,7 +908,7 @@ class WordMsdRenderer:
|
|||
self.frequent_words[lemma].append((msd, txt, n))
|
||||
|
||||
lf = self.lemma_features
|
||||
for lemma in self.lemma_msd.keys():
|
||||
for lemma in self.lemma_msd:
|
||||
cmsd = self.lemma_msd[lemma]
|
||||
if cmsd[0] in lf:
|
||||
self.lemma_msd[lemma] = "".join(
|
||||
|
@ -992,7 +988,7 @@ def load_tei_file(filename, skip_id_check, do_msd_translate, pc_tag, status):
|
|||
for w in et.iter("w"):
|
||||
words[w.get('id')] = Word(w, do_msd_translate)
|
||||
for pc in et.iter(pc_tag):
|
||||
words[pc.get('id')] = Word.pcWord(pc, do_msd_translate)
|
||||
words[pc.get('id')] = Word.pc_word(pc, do_msd_translate)
|
||||
|
||||
for l in et.iter("link"):
|
||||
if 'dep' in l.keys():
|
||||
|
@ -1083,9 +1079,11 @@ class Writer:
|
|||
|
||||
try:
|
||||
int(rows[0][self.sort_by])
|
||||
key=lambda row: int(row[self.sort_by])
|
||||
def key(row):
|
||||
return int(row[self.sort_by])
|
||||
except ValueError:
|
||||
key=lambda row: row[self.sort_by].lower()
|
||||
def key(row):
|
||||
return row[self.sort_by].lower()
|
||||
|
||||
return sorted(rows, key=key, reverse=self.sort_order)
|
||||
|
||||
|
@ -1118,7 +1116,7 @@ class Writer:
|
|||
|
||||
rows.append(to_write)
|
||||
|
||||
if len(rows) > 0:
|
||||
if rows != []:
|
||||
rows = self.sorted_rows(rows)
|
||||
file_handler.write("\n".join([", ".join(row) for row in rows]) + "\n")
|
||||
file_handler.flush()
|
||||
|
@ -1142,7 +1140,7 @@ class Writer:
|
|||
|
||||
for s in structures:
|
||||
if self.multiple_output:
|
||||
fp=fp_open(s.id)
|
||||
fp = fp_open(s.id)
|
||||
self.write_header(fp)
|
||||
|
||||
self.write_out_worker(fp, s.id, s.components, colocation_ids)
|
||||
|
@ -1227,7 +1225,7 @@ def match_file(words, structures):
|
|||
mhere = s.match(w)
|
||||
for match in mhere:
|
||||
colocation_id = [(idx, w.lemma) for idx, w in match.items()]
|
||||
colocation_id = [s.id] + list(sorted(colocation_id, key=lambda x:x[0]))
|
||||
colocation_id = [s.id] + list(sorted(colocation_id, key=lambda x: x[0]))
|
||||
colocation_id = tuple(colocation_id)
|
||||
|
||||
matches[s.id].append((match, colocation_id))
|
||||
|
|
Loading…
Reference in New Issue
Block a user