Remove sys.version_info[0] == 2 or 3.

This commit is contained in:
Aymeric Augustin
2019-12-22 18:12:11 +01:00
parent 8af25b1664
commit 798b3b3899
18 changed files with 41 additions and 170 deletions

View File

@@ -24,7 +24,6 @@ import glob
import logging
import os
import random
import sys
import numpy as np
import torch
@@ -104,12 +103,7 @@ class InputFeatures(object):
def read_swag_examples(input_file, is_training=True):
with open(input_file, "r", encoding="utf-8") as f:
reader = csv.reader(f)
lines = []
for line in reader:
if sys.version_info[0] == 2:
line = list(unicode(cell, "utf-8") for cell in line) # noqa: F821
lines.append(line)
lines = list(csv.reader(f))
if is_training and lines[0][-1] != "label":
raise ValueError("For training, the input file must contain a label column.")