d2l-ai / d2l-en

Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 500 universities from 70 countries including Stanford, MIT, Harvard, and Cambridge.
https://D2L.ai
Other
23.92k stars 4.36k forks source link

Undefined names: missing imports? #686

Closed cclauss closed 4 years ago

cclauss commented 4 years ago

flake8 testing of https://github.com/d2l-ai/d2l-en on Python 3.8.0

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./d2l/d2l.py:361:5: F821 undefined name 'DATA_URL'
    DATA_URL+'kaggle_house_pred_train.csv',
    ^
./d2l/d2l.py:515:13: F821 undefined name 'read_time_machine'
    lines = read_time_machine()
            ^
./d2l/d2l.py:761:27: F821 undefined name 'read_data_nmt'
    text = preprocess_nmt(read_data_nmt())
                          ^
./d2l/d2l.py:1481:17: F821 undefined name 'read_ptb'
    sentences = read_ptb()
                ^
./d2l/d2l.py:1590:34: F821 undefined name 'read_data_ml100k'
    data, num_users, num_items = read_data_ml100k()
                                 ^
5     F821 undefined name 'DATA_URL'
5

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead these tests are focus on runtime safety and correctness:

astonzhang commented 4 years ago

See https://github.com/d2l-ai/d2l-en/issues/685

cclauss commented 4 years ago

One down, four to go.

Binh0103 commented 4 years ago

.

astonzhang commented 4 years ago

We have fixed the missing imports. For the remaining flake8 style issues, we'll fix in the end

cclauss commented 4 years ago

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./d2l/d2l.py:1654:24: F821 undefined name 'vocab'
    premise = np.array(vocab[premise],
                       ^
./d2l/d2l.py:1656:27: F821 undefined name 'vocab'
    hypothesis = np.array(vocab[hypothesis],
                          ^
2     F821 undefined name 'vocab'
2
cclauss commented 4 years ago

Fixed in #953