chaitanyamalaviya/lang-reps

Six undefined names

Closed this issue · 1 comments

flake8 testing of https://github.com/chaitanyamalaviya/lang-reps on Python 2.7.13

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./sequence2sequence.py:174:16: F821 undefined name 'args'
            if args.dropout: y = dynet.dropout(y, self.args.dropout)
               ^

./sequence2sequence.py:301:15: F821 undefined name 'BLEU'
        ans = BLEU.sentence_bleu(input_str, output_str)
              ^

./sequence2sequence.py:580:13: F821 undefined name 'last_encs'
            last_encs[idx] = src_encodings[-1]
            ^

./trainer.py:201:29: F821 undefined name 'train_data'
    train_order = range(len(train_data))
                            ^

./trainer.py:202:29: F821 undefined name 'valid_data'
    valid_order = range(len(valid_data))
                            ^

./util.py:318:23: F821 undefined name 'filename'
            with open(filename) as f:
                      ^

Flake8 testing on Python 3 just generates a bunch of TabErrors because Py3 is far less tolerant of mixed tabs and spaces indents than Py2. The tabnanny module is built into Python so that you can find and fix tab indentation errors.

flake8 testing of https://github.com/chaitanyamalaviya/lang-reps on Python 3.6.2

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./paired_bootstrap.py:37:19: E901 TabError: inconsistent use of tabs and spaces in indentation
	count_win_1 += 1
	                ^

./sequence2sequence.py:408:115: E901 TabError: inconsistent use of tabs and spaces in indentation
	decoder_all = [dynet.concatenate([fwd, bwd]) for fwd, bwd in zip(forward_cells, list(reversed(backward_cells)))]
	                                                                                                                ^

./trainer.py:176:24: E901 TabError: inconsistent use of tabs and spaces in indentation
	lines = f.readlines()
	                     ^

./util.py:89:20: E901 TabError: inconsistent use of tabs and spaces in indentation
	if i==2: continue
	                 ^

./preprocessing/preprocess_bible.py:28:17: E901 TabError: inconsistent use of tabs and spaces in indentation
	doc = f.read()
	              ^