Fix F821 flake8 warning (x47).

Ignore warnings related to Python 2, because it's going away soon.
This commit is contained in:
Aymeric Augustin
2019-12-21 20:53:17 +01:00
parent 631be27078
commit 2ab78325f0
21 changed files with 78 additions and 38 deletions

View File

@@ -108,7 +108,7 @@ def read_swag_examples(input_file, is_training=True):
lines = []
for line in reader:
if sys.version_info[0] == 2:
line = list(unicode(cell, "utf-8") for cell in line)
line = list(unicode(cell, "utf-8") for cell in line) # noqa: F821
lines.append(line)
if is_training and lines[0][-1] != "label":

View File

@@ -225,7 +225,7 @@ def main():
# Batch size == 1. to add more examples please use num_return_sequences > 1
generated_sequence = output_sequences[0].tolist()
text = tokenizer.decode(generated_sequence, clean_up_tokenization_spaces=True)
text = text[: t.find(args.stop_token) if args.stop_token else None]
text = text[: text.find(args.stop_token) if args.stop_token else None]
print(text)

View File

@@ -184,7 +184,7 @@ class SwagProcessor(DataProcessor):
lines = []
for line in reader:
if sys.version_info[0] == 2:
line = list(unicode(cell, "utf-8") for cell in line)
line = list(unicode(cell, "utf-8") for cell in line) # noqa: F821
lines.append(line)
return lines