Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: How to avoid PEP8 'imported but unused'

Reply
Thread Tools

Re: How to avoid PEP8 'imported but unused'

 
 
MRAB
Guest
Posts: n/a
 
      05-05-2013
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to avoid PEP8 'imported but unused' Fábio Santos Python 0 05-05-2013 04:18 PM
How to avoid PEP8 'imported but unused' Adam Jiang Python 0 05-05-2013 04:00 PM
Re: How to subclass a family Devin Jeanpierre Python 0 04-08-2013 11:22 PM
Re: How to subclass a family Arnaud Delobelle Python 0 04-08-2013 09:17 PM
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM



Advertisments