Skip to content

Commit

Permalink
Merge branch 'py3' into 'master'
Browse files Browse the repository at this point in the history
Make gen-regexps and regextest2.py compatible with Python 3

See merge request mer-core/libcontentaction!12
  • Loading branch information
pvuorela committed Apr 4, 2019
2 parents 60a5404 + 548cc4f commit d826569
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/gen-regexps
Expand Up @@ -49,8 +49,8 @@ def rx_opt (rx):
return rx_repeat (rx, 0, 1)

def rx_output (rx, name):
print "s/@%s@/%s/g\n" % (name,
rx.replace('\\', '\\\\').replace('/', '\\/').replace('"', '\"').replace('&', '\&'))
print("s/@%s@/%s/g\n" % (name,
rx.replace('\\', '\\\\').replace('/', '\\/').replace('"', '\"').replace('&', '\&')))

## Phone numbers

Expand Down
4 changes: 2 additions & 2 deletions data/regextest2.py
Expand Up @@ -32,7 +32,7 @@ def regex_test (self):
parts = self.__spec.split (self.__delimiter)
text = "".join (parts)
expected = [ parts[i] for i in range (1, len (parts), 2) ]
result = map (lambda m: m.group(0), re.finditer (self.__regex, text))
result = list (map (lambda m: m.group(0), re.finditer (self.__regex, text)))
self.assertEquals (result, expected)


Expand Down Expand Up @@ -96,7 +96,7 @@ def static_counter_gen ():
while True:
k += 1
yield k
static_counter = static_counter_gen ().next
static_counter = lambda: next(static_counter_gen ())


rxt_regex = None
Expand Down

0 comments on commit d826569

Please sign in to comment.