MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / is_setup_call

Function is_setup_call

src/packagedcode/pypi_setup_py.py:50–69  ·  view source on GitHub ↗

Return if the AST ``element`` is a call to the setup() function. Note: this is derived from the code in packagedcode.pypi.py

(element)

Source from the content-addressed store, hash-verified

48
49
50def 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
72def parse_setup_py(location):

Callers 1

get_setup_callFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected