shared/templates/file_owner/template.py
Similar blocks of code found in 2 locations. Consider refactoring.from ssg.utils import parse_template_boolean_valueSimilar blocks of code found in 2 locations. Consider refactoring.from ssg.utils import ensure_file_paths_and_file_regexes_are_correctly_definedSimilar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring.def preprocess(data, lang):Similar blocks of code found in 2 locations. Consider refactoring. ensure_file_paths_and_file_regexes_are_correctly_defined(data)Similar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring. data["recursive"] = parse_template_boolean_value(data,Similar blocks of code found in 2 locations. Consider refactoring. parameter="recursive",Similar blocks of code found in 2 locations. Consider refactoring. default_value=False)Similar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring. try:Similar blocks of code found in 2 locations. Consider refactoring. int(data["uid_or_name"])Similar blocks of code found in 2 locations. Consider refactoring. data["owner_represented_with_uid"] = TrueSimilar blocks of code found in 2 locations. Consider refactoring. except ValueError:Similar blocks of code found in 2 locations. Consider refactoring. data["owner_represented_with_uid"] = FalseSimilar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring. if data["owner_represented_with_uid"] == False:Similar blocks of code found in 2 locations. Consider refactoring. owners = data["uid_or_name"].split("|")Similar blocks of code found in 2 locations. Consider refactoring. if any(element.isnumeric() for element in owners):Similar blocks of code found in 2 locations. Consider refactoring. raise ValueError("uid_or_name list cannot contain uids when there are multiple owners")Similar blocks of code found in 2 locations. Consider refactoring. Similar blocks of code found in 2 locations. Consider refactoring. if lang == "oval":Similar blocks of code found in 2 locations. Consider refactoring. data["fileid"] = data["_rule_id"].replace("file_owner", "")Similar blocks of code found in 2 locations. Consider refactoring. return data