Modify find/split operations to work on Python 2 and 3
Python 3 only accepts certain syntaxes for find & split. Thankfully, it's possible to use them in Python 2, so rework it so we can use the same syntax for both. This is not detected or fixed by futurize, sadly (a problem true for many other situations). Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
This commit is contained in:
parent
8fee8a34bd
commit
05c238acc6
|
@ -1602,8 +1602,8 @@ def expand_ruleset(ruleset):
|
|||
# Note that this "for" loop modifies the ruleset while it's iterating,
|
||||
# so we *must* convert the keys into a list before iterating.
|
||||
for rule in list(ruleset.keys()):
|
||||
if string.find(rule, "|") != -1: # We found a rule to expand.
|
||||
for newrule in string.split(rule, "|"):
|
||||
if "|" in rule: # We found a rule to expand.
|
||||
for newrule in rule.split("|"):
|
||||
if newrule in ruleset:
|
||||
print("Error: Rule %s, when expanded, overlaps %s" % (
|
||||
rule, newrule))
|
||||
|
|
Loading…
Reference in New Issue