Fixed old regex sequences to r'' format
This commit is contained in:
parent
33af368940
commit
d0a579cf4b
3 changed files with 11 additions and 10 deletions
|
@ -119,8 +119,8 @@ class Event(Message):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = EventMatchResult(is_match=False)
|
result = EventMatchResult(is_match=False)
|
||||||
event_tokens = re.split('\s+', self.args[argname].strip().lower())
|
event_tokens = re.split(r'\s+', self.args[argname].strip().lower())
|
||||||
condition_tokens = re.split('\s+', condition_value.strip().lower())
|
condition_tokens = re.split(r'\s+', condition_value.strip().lower())
|
||||||
|
|
||||||
while event_tokens and condition_tokens:
|
while event_tokens and condition_tokens:
|
||||||
event_token = event_tokens[0]
|
event_token = event_tokens[0]
|
||||||
|
@ -138,7 +138,7 @@ class Event(Message):
|
||||||
|
|
||||||
condition_tokens.pop(0)
|
condition_tokens.pop(0)
|
||||||
else:
|
else:
|
||||||
m = re.match('[^\\\]*\${(.+?)}', condition_token)
|
m = re.match(r'[^\\\]*\${(.+?)}', condition_token)
|
||||||
if m:
|
if m:
|
||||||
argname = m.group(1)
|
argname = m.group(1)
|
||||||
if argname not in result.parsed_args:
|
if argname not in result.parsed_args:
|
||||||
|
|
|
@ -129,7 +129,7 @@ class Request(Message):
|
||||||
except:
|
except:
|
||||||
if isinstance(v, str):
|
if isinstance(v, str):
|
||||||
try:
|
try:
|
||||||
exec('{}="{}"'.format(k, re.sub('(^|[^\\\])"', '\1\\"', v)))
|
exec('{}="{}"'.format(k, re.sub(r'(^|[^\\\])"', '\1\\"', v)))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class Request(Message):
|
||||||
parsed_value = _value
|
parsed_value = _value
|
||||||
|
|
||||||
while _value and isinstance(_value, str):
|
while _value and isinstance(_value, str):
|
||||||
m = re.match('([^$]*)(\${\s*(.+?)\s*})(.*)', _value)
|
m = re.match(r'([^$]*)(\${\s*(.+?)\s*})(.*)', _value)
|
||||||
if m and not m.group(1).endswith('\\'):
|
if m and not m.group(1).endswith('\\'):
|
||||||
prefix = m.group(1)
|
prefix = m.group(1)
|
||||||
expr = m.group(2)
|
expr = m.group(2)
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Procedure(object):
|
||||||
# Check if this request is an if-else
|
# Check if this request is an if-else
|
||||||
if len(request_config.keys()) >= 1:
|
if len(request_config.keys()) >= 1:
|
||||||
key = list(request_config.keys())[0]
|
key = list(request_config.keys())[0]
|
||||||
m = re.match('\s*(if)\s+\${(.*)}\s*', key)
|
m = re.match(r'\s*(if)\s+\${(.*)}\s*', key)
|
||||||
|
|
||||||
if m:
|
if m:
|
||||||
if_count += 1
|
if_count += 1
|
||||||
|
@ -94,7 +94,7 @@ class Procedure(object):
|
||||||
# Check if this request is a for loop
|
# Check if this request is a for loop
|
||||||
if len(request_config.keys()) == 1:
|
if len(request_config.keys()) == 1:
|
||||||
key = list(request_config.keys())[0]
|
key = list(request_config.keys())[0]
|
||||||
m = re.match('\s*(fork?)\s+([\w\d_]+)\s+in\s+(.*)\s*', key)
|
m = re.match(r'\s*(fork?)\s+([\w\d_]+)\s+in\s+(.*)\s*', key)
|
||||||
|
|
||||||
if m:
|
if m:
|
||||||
for_count += 1
|
for_count += 1
|
||||||
|
@ -118,7 +118,7 @@ class Procedure(object):
|
||||||
# Check if this request is a while loop
|
# Check if this request is a while loop
|
||||||
if len(request_config.keys()) == 1:
|
if len(request_config.keys()) == 1:
|
||||||
key = list(request_config.keys())[0]
|
key = list(request_config.keys())[0]
|
||||||
m = re.match('\s*while\s+\${(.*)}\s*', key)
|
m = re.match(r'\s*while\s+\${(.*)}\s*', key)
|
||||||
|
|
||||||
if m:
|
if m:
|
||||||
while_count += 1
|
while_count += 1
|
||||||
|
@ -145,6 +145,7 @@ class Procedure(object):
|
||||||
pending_if = if_config.get()
|
pending_if = if_config.get()
|
||||||
reqs.append(IfProcedure.build(**pending_if))
|
reqs.append(IfProcedure.build(**pending_if))
|
||||||
|
|
||||||
|
# noinspection PyArgumentList
|
||||||
return procedure_class(name=name, _async=_async, requests=reqs, args=args, backend=backend, **kwargs)
|
return procedure_class(name=name, _async=_async, requests=reqs, args=args, backend=backend, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -338,7 +339,7 @@ class WhileProcedure(LoopProcedure):
|
||||||
if isinstance(v, str):
|
if isinstance(v, str):
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
context[k] = eval('"{}"'.format(re.sub('(^|[^\\\])"', '\1\\"', v)))
|
context[k] = eval('"{}"'.format(re.sub(r'(^|[^\\\])"', '\1\\"', v)))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -451,7 +452,7 @@ class IfProcedure(Procedure):
|
||||||
except:
|
except:
|
||||||
if isinstance(v, str):
|
if isinstance(v, str):
|
||||||
try:
|
try:
|
||||||
exec('{}="{}"'.format(k, re.sub('(^|[^\\\])"', '\1\\"', v)))
|
exec('{}="{}"'.format(k, re.sub(r'(^|[^\\\])"', '\1\\"', v)))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue