Hi
I do have a module which at least until next year has to be awave of some users
who still use pyhton 2 eventhough not so far from now at end of life.
For this i have a central module which deals with all the differences and
ensures that base classes and basic classes exported by the module are
independent of pyhton verison.
All pyhton version specific stuff is handled by a single if
sys.verision_info[0] >= 3: else: clause.
The question i do have is how do i tell pylint or astroid respective that eiter
the if or the else branche is relevant and that i can ignore the other.
The cause of this question is that the module also contains a class which has
dynamic attricutes, as it represents the DOM of binary data files. For smoe
specific requirements this class in addition has a custom metaclass sepcified.
As metaclass specification differs in Pyhton 2 and Pyhton 3 i have defined an
empty parent class as follows
if sys.version_info[0] >= 3:
class ParentClass(object,metaclass=NodeMetaClass):
pass
else:
class ParentClass(object):
__metaclass__ = NodeMetaClass
pass
class Node(ParentClass):
pass
pylint will not report any no-member error on the Node class cause it thinks
that the PraentClass object is ambigously defined. The method safe_infer
retruns None.
Is it possible via transform plugin module to make pylint or astroid ignore one
of the two definitions or at least hide them from safe_infer method. So that
no-member check is performed properly.
Currently i have enabled all checks.
_______________________________________________
code-quality mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/code-quality.python.org/