in plugins/spark_upgrade/execute_piranha.py [0:0]
def get_piranha_arguments(self) -> PiranhaArguments:
rg = self.get_rule_graph()
path_to_conf = self.path_to_configuration()
if rg.rules and path_to_conf:
raise Exception(
"You have provided a rule graph and path to configurations. Do not provide both.")
if not rg.rules and not path_to_conf:
raise Exception("You have neither provided a rule graph nor path to configurations.")
if rg.rules:
return PiranhaArguments(
language=self.language,
paths_to_codebase=self.paths_to_codebase,
substitutions=self.substitutions,
rule_graph=self.get_rule_graph(),
cleanup_comments=True,
dry_run=self.dry_run,
allow_dirty_ast=self.allow_dirty_ast
)
return PiranhaArguments(
language=self.language,
paths_to_codebase=self.paths_to_codebase,
substitutions=self.substitutions,
path_to_configurations=self.path_to_configuration(),
cleanup_comments=True,
dry_run=self.dry_run,
allow_dirty_ast=self.allow_dirty_ast
)