On 25 mai 13:17, JT Olds wrote:
> Hey all,

Hi,
 
> I have a rather large codebase in which I'm using PyLint. I am using a
> number of data-serialization classes (Google Protocol Buffers) that
> use metaclasses to fill out the fields. Of course, PyLint doesn't
> understand metaclasses, so I am unable to have PyLint's typechecker
> work on these classes.
> 
> However, the problem is that these class names are not unique in my
> code base. There's a number of classes that share the same name
> (though not the same import path), but I can't figure out how to get
> PyLint to disable a specific class as opposed to all classes with the
> same name.
> 
> How do I do this?
> 
> Things I've tried:
> 1) using a class more specific import name:
> (ignored-classes=module.module.Class). For some reason this doesn't
> work for me. I can only seem to get this to work if I use
> ignored-classes=Class. Should this work? What am I doing wrong?

Nothing wrong here, simply not implemented that way. Though I would 
welcome a patch that would make it (shouldn't be hard).

> 2) using the generated classes' base class (ignored-classes=Message,
> ignored-classes=message.Message,
> ignored-classes=google.protobuf.message.Message). Should this work?
> This would be a pretty swanky solution.

I agree that could be a nice way to fix your pb, but it shouldn't work
as is. And that would probably be worth a new option.

> 3) adding pylint disabling comments to the specific protocol buffer
> message definitions. This doesn't help callers of methods on a message
> in some other file though. :(

Indeed.
 
> Last resort: I could name all protocol buffer classes uniquely. This
> is a really gross solution for us as it would require a lot of code
> churn.
> 
> Is there something I am missing? What should I do for this case?

I don't think your missing anything. The easiest you can do seems to write
a patch so ignored-classes support qualified class names. If you've no clue
about how to do that, I'll try to find a few minutes to do so.
-- 
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (09.54.03.55.76)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to