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


Groups > comp.lang.python > #44747

How to avoid PEP8 'imported but unused'

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jiang.adam@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; "'',": 0.07; 'framework.': 0.09; 'imported': 0.09; 'indicates': 0.09; 'okay': 0.09; 'references.': 0.09; 'subject:How': 0.10; 'django': 0.11; 'def': 0.12; 'obviously,': 0.16; 'pep8': 0.16; 'urls.py': 0.16; 'module': 0.19; 'seems': 0.21; 'import': 0.22; 'header:User- Agent:1': 0.23; 'shown': 0.26; 'function': 0.29; 'code': 0.31; 'serve': 0.31; 'file:': 0.31; 'file': 0.32; 'checked': 0.32; 'totally': 0.33; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'application': 0.37; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'new': 0.61; 'content-disposition:inline': 0.62; 'show': 0.63; 'received:122': 0.63; 'within': 0.65; "'view'": 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=JyAPChai4MKOx20bh/2nHgTMsdbP0hhbXPzD3rYRwFM=; b=Y48I/IoQSUO/TFaEzZXnChhwQrQ2PxhMBf7lpXCrqlvmM4ux5+UPgz14vDaAX2BywC 4AVhdiE0fxtFECObuMjBXzKIt2l2os5/pk16DaZkQ77OpIcLMaV0dQOA4eLIHZFVkCw9 0D8/1CN2YphwJOtlv90smAUzjWQ3oKH3szjXyygw+LGFQ0uIpwGGQct3HG9GgCQyBYu6 lEMn+psUFK6fzakafPM0CQ54VD4m4BP6+0osY7C76kW4J+c/p8dtjfjb40E3s4mfoipC voM3VKPBnyaNYzZeaMuR0py0saR8HaVWphX7erckYx9JuJPWTO48+ySRZ1JW0pg/DEYZ /X5w==
X-Received by 10.66.27.99 with SMTP id s3mr23311170pag.73.1367769659893; Sun, 05 May 2013 09:00:59 -0700 (PDT)
Date Mon, 6 May 2013 01:00:54 +0900
From Adam Jiang <jiang.adam@gmail.com>
To python-list@python.org
Subject How to avoid PEP8 'imported but unused'
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1294.1367769670.3114.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367769670 news.xs4all.nl 15933 [2001:888:2000:d::a6]:56008
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44747

Show key headers only | View raw


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

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


Thread

How to avoid PEP8 'imported but unused' Adam Jiang <jiang.adam@gmail.com> - 2013-05-06 01:00 +0900

csiph-web