pyflakes? (was: Re: [Framework-Team] Translation effort for Plone 3.1)

Andreas Zeidler az at zitc.de
Fri Feb 1 20:38:01 UTC 2008


On Feb 1, 2008, at 7:00 PM, Martijn Pieters wrote:
> On 1. feb.. 2008, at 12.28, Martin Aspeli wrote:
>>> Careful with weeding imports. I recently had to fix a migration  
>>> issue
>>> for a customer, where a persistent tool had been moved into another
>>> module with an import at the old location. Someone else then ran
>>> pyflakes and removed said import, breaking the migration.
>>
>> That's what zope.deferredimport is for. :)
>
> Perhaps. But moved persistent classes also need to be migrated,  
> really.

of course they would, _if_ we wanted to take the "cleaning up" of  
import to that level.  however, that wasn't my original intend at  
all.  like i said, i'd consider it perfectly fine to have convenience  
imports in say `interfaces/__init__.py` and i think they should be  
left alone[*], unless the imported symbols actually belong to some  
other package, of course.  i'll do some analysis when i find the time  
(or become too curious about it :)), but i'd suspect that this type of  
warnings will be the minority anyway.

my suggestion, however, was to clean up unused imports and other stuff  
in regular, i.e. code modules, and imho these shouldn't contains  
convenience imports used by other modules anyway, right?


andi

[*] if we really want to get rid of pyflakes warnings regarding those,  
too, you can always insert some no-op code like:

     from moduleX import ClassA, ClassB

     # convenience imports enumerated again to make pyflakes happy... :)
     ClassA, ClassB

that's what we (tomster and i) did in some bigger project a lot, and i  
worked quite nicely.  it's probably not exactly the cleanest way to  
solve this, but imho the benefits of normally having zero pyflakes  
warnings (and therefore being able to quickly spot other problems)  
outweighed the "hackyness" of these workarounds, especially as they  
were only "allowed" in interface modules anyway...

--
zeidler it consulting - http://zitc.de/ - info at zitc.de
friedelstraße 31 - 12047 berlin - telefon +49 30 25563779
pgp key at http://zitc.de/pgp - http://wwwkeys.de.pgp.net/
plone 3.0.5 released! -- http://plone.org/products/plone

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.plone.org/pipermail/plone-framework-team/attachments/20080201/44fd4f94/attachment.sig>


More information about the Framework-Team mailing list