Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*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; 'adam': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'obviously,': 0.16; 'pep8': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'urls.py': 0.16; 'wrote:': 0.18; 'module': 0.19; 'seems': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'shown': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'code': 0.31; 'serve': 0.31; 'file:': 0.31; 'fixing': 0.31; 'file': 0.32; 'checked': 0.32; 'totally': 0.33; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'wrong': 0.37; 'application': 0.37; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'new': 0.61; 'show': 0.63; 'within': 0.65; 'header :Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; "'view'": 0.84; 'reply-to:addr:python.org': 0.84; 'not:': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JsTI8qIC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=7AxPfEIvyrUA:10 a=QIu2gGxNz0EA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=sMXCfOHx594A:10 a=CrecN2Lvt3icRSduX9sA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Sun, 05 May 2013 17:21:36 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How to avoid PEP8 'imported but unused' References: <20130505160054.GA10521@capricorn> In-Reply-To: <20130505160054.GA10521@capricorn> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367770896 news.xs4all.nl 15907 [2001:888:2000:d::a6]:36709 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44750 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?