in tools/generate_taint_models/decorator_parser.py [0:0]
def function_matches_target_decorators(self, node: FunctionDefinition) -> bool:
## TODO T58744796: In the future, change this to support
## filtering on multiple decorators.
target_decorator: Decorator = self.target_decorators[0]
for decorator in node.decorator_list:
node_decorator = self._parse_decorator(
cast(Union[ast.Name, ast.Call, ast.Attribute], decorator)
)
# if the target decorator has args / kwargs, the node decorator
# must also have them
if (
target_decorator.name == node_decorator.name
and (
not target_decorator.arguments
or (
node_decorator.arguments
and target_decorator.arguments.issubset(
node_decorator.arguments
)
)
)
and (
not target_decorator.keywords
or (
node_decorator.keywords
and target_decorator.keywords.issubset(node_decorator.keywords)
)
)
):
return True
return False