def to_toml()

in experimental/piranha_playground/rule_inference/utils/rule_utils.py [0:0]


    def to_toml(self):
        str_reps = []
        if self.enclosing_node:
            str_reps.append(f'enclosing_node = """{self.enclosing_node}"""')
        if self.not_enclosing_node:
            str_reps.append(f'not_enclosing_node = """{self.not_enclosing_node}"""')
        if self.not_contains:
            str_reps.append(f"not_contains = {json.dumps(self.not_contains)}")
        if self.contains:
            str_reps.append(f'contains = """{self.contains}"""')
        if self.at_least != 1:
            str_reps.append(f"at_least = {self.at_least}")
        if self.at_most != 4294967295:
            str_reps.append(f"at_most = {self.at_most}")
        if self.child_count != 4294967295:
            str_reps.append(f"child_count = {self.child_count}")
        if self.sibling_count != 4294967295:
            str_reps.append(f"sibling_count = {self.sibling_count}")

        return "\n".join([f"[[rules.filters]]"] + str_reps)