Re: [Pydev-users] How to suppress 'unused import' warning
Brought to you by:
fabioz
|
From: Fabio Z. <fa...@gm...> - 2009-01-13 01:00:57
|
> in our code we sometimes use > > import apackage > from some.other.place import foo > > and our apackage/__init__.py sets up import mechanisms and is required > for proper functionality of following code. Now the problem is that > PyDev thinks that this is unused import. > > Is there any way how to suppress this for that specific package? Or > would it be reasonable to suppress this every time when __init__.py is > non-trivial (non-empty)? The only way to suppress it right now would be putting an #@UnusedImport on the place that's calling it. Suppressing it when it's non-empty seems strange for me... Maybe there could be a way to say that uses of that module should not be used, but in reality, I find that: - that construct is used when you want to config some subpackage, so, that import doesn't need to be explicit (it'll happen implicitly when some subpackage is used) - when you want it for some side-effects that will usually affect a factory or some other thing outside of the package (but then, having an explicit comment such as #@UnusedImport will make much more clear about your intentions, so, I think it's an advantage, not a disadvantage). Cheers, Fabio |