Re: How to avoid PEP8 'imported but unused'

Discussion in 'Python' started by MRAB, May 5, 2013.

  1. MRAB

    MRAB Guest

    On 05/05/2013 17:00, Adam Jiang wrote:
    > I am new to python. Now, I am woring on an application within Django
    > framework. When I checked my code with pep8 and pyflakes, some warning
    > messages show up-'Foobar imported but unused'. Obviously, it indicates
    > that some modules are imprted to current module but never get
    > references. However, it seems the message is wrong in this case:
    >
    > # file: urls.py
    > urlpattens = patterns(
    > '',
    > url('^signup/$', 'signup')
    > }
    >
    > # file: register.py
    > def signup(request):
    > return ...
    >
    > # file: views.py
    > import signup from register
    >
    > The warning message is shown in file views.py. It seems to me that the
    > code is okay because Django requires all functions serve as 'view' is
    > typically go into views.py. 'import' is about get 'signup' function
    > into module 'views.py'. Or, I am totally wrong? Is there a proper way
    > to avoid this warnning?
    >

    It's not:

    import signup from register

    (that's an error) but:

    from register import signup

    After fixing that, does it still show the warning?
     
    MRAB, May 5, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam Jiang
    Replies:
    0
    Views:
    107
    Adam Jiang
    May 5, 2013
  2. Fábio Santos

    Re: How to avoid PEP8 'imported but unused'

    Fábio Santos, May 5, 2013, in forum: Python
    Replies:
    0
    Views:
    114
    Fábio Santos
    May 5, 2013
  3. Peter Otten
    Replies:
    0
    Views:
    109
    Peter Otten
    May 5, 2013
  4. Adam Jiang
    Replies:
    0
    Views:
    96
    Adam Jiang
    May 5, 2013
  5. Fábio Santos

    Re: How to avoid PEP8 'imported but unused'

    Fábio Santos, May 5, 2013, in forum: Python
    Replies:
    0
    Views:
    76
    Fábio Santos
    May 5, 2013
Loading...

Share This Page