(cls)
| 32 | |
| 33 | |
| 34 | def 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 | |
| 65 | MANAGER.register_transform(astroid.ClassDef, transform) |
nothing calls this directly
no outgoing calls
no test coverage detected