pylint #69738 generated-members need dynamic member name [validation pending]

In django model instance, many member property are dynamically created base on some condition. such as many to many relationship:

If you don't specify a related_name attribute for a field in an abstract base class, the default reverse name will be the name of the child class followed by '_set', just as it normally would be if you'd declared the field directly on the child class. For example, in the above code, if the related_name attribute was omitted, the reverse name for the m2m field would be childa_set in the ChildA case and childb_set for the ChildB field.

This cause pylint to report invalid errors, a solution was proposed here is to add regular expression based generated-members:

[TYPECHECK]
generated-members=REQUEST,acl_users,aq_parent,objects,_meta,id,[a-zA-Z]+_set

with something like:


    # somewhere top of the file header in typecheck.py
    import re

    # and in visit_getattr()
    for pattern in self.config.generated_members:
        if re.match(pattern, node.attrname):
            return

prioritynormal
typeenhancement
done in0.24.0
load left0.000
closed by#d706dd303f1b add regular expression support for generated-members (closes #69738)