HEX
Server: Apache
System: Linux beluga.o2switch.net 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: sc3naki1272 (1113)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: //opt/alt/python27/share/doc/alt-python27-pylint/examples/custom.py
import astroid

from pylint.interfaces import IAstroidChecker
from pylint.checkers import BaseChecker

class MyAstroidChecker(BaseChecker):
    """add member attributes defined using my own "properties" function
    to the class locals dictionary
    """
    
    __implements__ = IAstroidChecker

    name = 'custom'
    msgs = {}
    options = ()
    # this is important so that your checker is executed before others
    priority = -1 

    def visit_callfunc(self, node):
        """called when a CallFunc node is encountered.

        See astroid for the description of available nodes."""
        if not (isinstance(node.func, astroid.Getattr)
                and isinstance(node.func.expr, astroid.Name)
                and node.func.expr.name == 'properties'
                and node.func.attrname == 'create'):
            return
        in_class = node.frame()
        for param in node.args:
            in_class.locals[param.name] = node

    
def register(linter):
    """required method to auto register this checker"""
    linter.register_checker(MyAstroidChecker(linter))