Use raw strings in all pattern matching strings
This removes some of the deprecation warnings on unsupported escape sequence for python3.6 and up Change-Id: Ibb70a8d5be79af89faf625b939bb959661231aa3
This commit is contained in:
parent
fc4bcc7805
commit
f11565a317
@ -124,6 +124,7 @@ class VitrageGraphInit(object):
|
||||
def subscribe_presist_notifier(self):
|
||||
self.graph.subscribe(PersistNotifier().notify_when_applicable)
|
||||
|
||||
|
||||
PRIORITY_DELAY = 0.05
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ class ActionType(object):
|
||||
MARK_DOWN = 'mark_down'
|
||||
EXECUTE_MISTRAL = 'execute_mistral'
|
||||
|
||||
|
||||
action_types = [ActionType.SET_STATE,
|
||||
ActionType.RAISE_ALARM,
|
||||
ActionType.ADD_CAUSAL_RELATIONSHIP,
|
||||
|
@ -68,7 +68,7 @@ def is_function(str):
|
||||
A function has the format: func_name(params)
|
||||
Search for a regex with open and close parenthesis
|
||||
"""
|
||||
return re.match('.*\(.*\)', str)
|
||||
return re.match(r'.*\(.*\)', str)
|
||||
|
||||
|
||||
def _is_wanted_function(str, func_name):
|
||||
@ -77,4 +77,4 @@ def _is_wanted_function(str, func_name):
|
||||
A function has the format: func_name(params)
|
||||
Search for a regex with open and close parenthesis
|
||||
"""
|
||||
return re.match(func_name + '\(.*\)', str)
|
||||
return re.match(func_name + r'\(.*\)', str)
|
||||
|
@ -19,10 +19,10 @@ mutable_default_args = re.compile(r"^\s*def .+\((.+={\}|.+=\[\])")
|
||||
|
||||
asse_trueinst_re = re.compile(
|
||||
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
||||
"(\w|\.|\'|\"|\[|\])+\)\)")
|
||||
r"(\w|\.|\'|\"|\[|\])+\)\)")
|
||||
asse_equal_type_re = re.compile(
|
||||
r"(.)*assertEqual\(type\((\w|\.|\'|\"|\[|\])+\), "
|
||||
"(\w|\.|\'|\"|\[|\])+\)")
|
||||
r"(\w|\.|\'|\"|\[|\])+\)")
|
||||
asse_equal_end_with_none_re = re.compile(
|
||||
r"(.)*assertEqual\((\w|\.|\'|\"|\[|\])+, None\)")
|
||||
asse_equal_start_with_none_re = re.compile(
|
||||
|
@ -40,8 +40,8 @@ NEXT = 'next'
|
||||
WITH_VALS = 'with_values'
|
||||
SEVERITY = 'SEVERITY'
|
||||
ALARM_OID = 'ALARM_OID'
|
||||
IP_PAT = re.compile('\d+\.\d+\.\d+\.\d+')
|
||||
PORT_PAT = re.compile('\d+')
|
||||
IP_PAT = re.compile(r'\d+\.\d+\.\d+\.\d+')
|
||||
PORT_PAT = re.compile(r'\d+')
|
||||
|
||||
|
||||
class SnmpSender(SnmpSenderBase):
|
||||
|
@ -560,7 +560,7 @@ class TestFilter(base.BaseTest):
|
||||
|
||||
attr_filter = {
|
||||
"vitrage_category": "ALARM",
|
||||
"rawtext.regex": "Interface ([_a-zA-Z0-9'\-]+) down on {"
|
||||
"rawtext.regex": r"Interface ([_a-zA-Z0-9'\-]+) down on {"
|
||||
"HOST.NAME}",
|
||||
"host": "some_host_kukoo"
|
||||
}
|
||||
@ -578,7 +578,7 @@ class TestFilter(base.BaseTest):
|
||||
|
||||
attr_filter = {
|
||||
"vitrage_category": "ALARM",
|
||||
"rawtext.RegEx": "Interface ([_a-zA-Z0-9'\-]+) down on {"
|
||||
"rawtext.RegEx": r"Interface ([_a-zA-Z0-9'\-]+) down on {"
|
||||
"HOST.NAME}",
|
||||
"host": "some_host_kukoo"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user