MCPcopy Create free account
hub / github.com/StackStorm/st2 / transform

Function transform

pylint_plugins/db_models.py:34–62  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

32
33
34def transform(cls):
35 if cls.name in CLASS_NAME_BLACKLIST:
36 return
37
38 if cls.name == "StormFoundationDB":
39 # _fields get added automagically by mongoengine
40 if "_fields" not in cls.locals:
41 cls.locals["_fields"] = [
42 nodes.Dict(
43 cls.lineno,
44 cls.col_offset,
45 parent=cls,
46 end_lineno=cls.end_lineno,
47 end_col_offset=cls.end_col_offset,
48 )
49 ]
50
51 if cls.name.endswith("DB"):
52 # mongoengine explicitly declared "id" field on each class so we teach pylint about that
53 property_name = "id"
54 node = astroid.ClassDef(
55 property_name,
56 cls.lineno,
57 cls.col_offset,
58 parent=cls,
59 end_lineno=cls.end_lineno,
60 end_col_offset=cls.end_col_offset,
61 )
62 cls.locals[property_name] = [node]
63
64
65MANAGER.register_transform(astroid.ClassDef, transform)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected