Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44750

Re: How to avoid PEP8 'imported but unused'

Date 2013-05-05 17:21 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: How to avoid PEP8 'imported but unused'
References <20130505160054.GA10521@capricorn>
Newsgroups comp.lang.python
Message-ID <mailman.1297.1367770896.3114.python-list@python.org> (permalink)

Show all headers | View raw


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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to avoid PEP8 'imported but unused' MRAB <python@mrabarnett.plus.com> - 2013-05-05 17:21 +0100

csiph-web