Skip to content

Commit

Permalink
Merge pull request #346 from tmaeno/master
Browse files Browse the repository at this point in the history
added remove_rule
  • Loading branch information
tmaeno authored Apr 15, 2024
2 parents b11073b + 1b931d8 commit 3c4297e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PandaPkgInfo.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release_version = "0.3.2"
release_version = "0.3.3"
27 changes: 27 additions & 0 deletions pandaserver/taskbuffer/task_split_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,30 @@ def replace_rule(split_rules, rule_name, rule_value, is_sub_rule=False):
tmp_str += rule_separator
tmp_str += split_rule_dict[rule_name] + key_value_separator + str(rule_value)
return tmp_str


# remove a rule
def remove_rule(split_rules, rule_token, is_sub_rule=False):
"""
Remove a rule from the split rule string
:param split_rules: comma separated string
:param rule_token: rule token
:param is_sub_rule: bool to indicate if the rule is a sub-rule
:return: string of split rules
"""
if split_rules is None:
split_rules = ""
if is_sub_rule:
rule_separator = "|"
key_value_separator = ":"
else:
rule_separator = ","
key_value_separator = "="
tmp_str = ""
for tmp_rule in split_rules.split(rule_separator):
if tmp_rule.startswith(rule_token + key_value_separator):
continue
if tmp_str != "":
tmp_str += rule_separator
tmp_str += tmp_rule
return tmp_str

0 comments on commit 3c4297e

Please sign in to comment.