Return if the AST ``element`` is a call to the setup() function. Note: this is derived from the code in packagedcode.pypi.py
(element)
| 48 | |
| 49 | |
| 50 | def is_setup_call(element): |
| 51 | """ |
| 52 | Return if the AST ``element`` is a call to the setup() function. |
| 53 | Note: this is derived from the code in packagedcode.pypi.py |
| 54 | """ |
| 55 | if ( |
| 56 | isinstance(element, ast.Call) |
| 57 | and ( |
| 58 | hasattr(element, 'func') |
| 59 | and isinstance(element.func, ast.Name) |
| 60 | and getattr(element.func, 'id', None) == 'setup' |
| 61 | ) or ( |
| 62 | hasattr(element, 'func') |
| 63 | and isinstance(element.func, ast.Attribute) |
| 64 | and getattr(element.func, 'attr', None) == 'setup' |
| 65 | and isinstance(element.func.value, ast.Name) |
| 66 | and getattr(element.func.value, 'id', None) == 'setuptools' |
| 67 | ) |
| 68 | ): |
| 69 | return True |
| 70 | |
| 71 | |
| 72 | def parse_setup_py(location): |