Debian Codegraph @

saltpylint/smartup.py

raw symbols SCIP
1 """
2 Pylint Smartup Transformers
3 ===========================
4
5 This plugin will register some transform functions which will allow PyLint to better
6 understand some classed used in Salt which trigger, `no-member` and `maybe-no-member`
7 A bridge between the `pep8`_ library and PyLint
8
9 """
10
11 from astroid import MANAGER
12 from astroid import nodes
13
14
15 def rootlogger_transform(obj):
16 if obj.name != "RootLogger":
17 return
18
19 def _inject_method(cls, msg, *args, **kwargs):
20 pass
21
22 if not hasattr(obj, "trace"):
23 obj.trace = _inject_method
24
25 if not hasattr(obj, "garbage"):
26 obj.garbage = _inject_method
27
28
29 def register(linter):
30 """Register the transformation functions."""
31 try:
32 MANAGER.register_transform(nodes.Class, rootlogger_transform)
33 except AttributeError:
34 MANAGER.register_transform(nodes.ClassDef, rootlogger_transform)