How to avoid PEP8 'imported but unused'

Discussion in 'Python' started by Adam Jiang, May 5, 2013.

  1. Adam Jiang

    Adam Jiang Guest

    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?

    Best regards,
    /Adam
     
    Adam Jiang, May 5, 2013
    #1
    1. Advertisements

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. F C
    Replies:
    0
    Views:
    2,488
  2. Alexander Malkis
    Replies:
    8
    Views:
    802
    Alexander Malkis
    Apr 14, 2004
  3. Roger23
    Replies:
    2
    Views:
    1,198
    Roger23
    Oct 12, 2006
  4. Ken Cecka
    Replies:
    10
    Views:
    1,544
    Andy Peters
    Mar 2, 2009
  5. Emmanuel Surleau

    The Python standard library and PEP8

    Emmanuel Surleau, Apr 19, 2009, in forum: Python
    Replies:
    2
    Views:
    329
    Colin J. Williams
    Apr 20, 2009
  6. Dun Peal
    Replies:
    10
    Views:
    700
    Chris Rebert
    May 3, 2011
  7. Volker Nicolai
    Replies:
    9
    Views:
    2,057
    Fabian Pilkowski
    Jul 4, 2005
  8. Qi
    Replies:
    22
    Views:
    1,108
Loading...