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

Function is_setup_call

src/packagedcode/pypi.py:2390–2412  ·  view source on GitHub ↗

Return if the AST ``statement`` is a call to the setup() function.

(statement)

Source from the content-addressed store, hash-verified

2388
2389
2390def is_setup_call(statement):
2391 """
2392 Return if the AST ``statement`` is a call to the setup() function.
2393 """
2394 return (
2395 isinstance(statement, (ast.Expr, ast.Call, ast.Assign))
2396 and isinstance(statement.value, ast.Call)
2397 and (
2398 # we look for setup and main as this is used sometimes instead of setup()
2399 (
2400 isinstance(statement.value.func, ast.Name)
2401 and statement.value.func.id in ('setup', 'main')
2402 )
2403 or
2404 # we also look for setuptools.setup when used instead of setup()
2405 (
2406 isinstance(statement.value.func, ast.Attribute)
2407 and statement.value.func.attr == 'setup'
2408 and isinstance(statement.value.func.value, ast.Name)
2409 and statement.value.func.value.id == 'setuptools'
2410 )
2411 )
2412 )
2413
2414
2415def get_setup_py_args_legacy(location, include_not_parsable=False):

Callers 1

get_setup_py_args_legacyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected