diff options
author | Zane Bitter <zbitter@redhat.com> | 2017-11-16 18:23:58 -0500 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2017-11-16 18:23:58 -0500 |
commit | 22da551c8c146922a00b3ed8435d5bbd1e9d41e5 (patch) | |
tree | 2b2f2a7ff0e920b5c8df0cf3b1c04006d0fa1237 /tools | |
parent | 38f1975cf71bf1f4c006c1009c308aaedd58a923 (diff) | |
download | heat-22da551c8c146922a00b3ed8435d5bbd1e9d41e5.tar.gz |
Use correct raw string format
You're not supposed to just randomly put backslashes in front of other
characters that don't need escaping unless it's a raw string. This is
deprecated in Python 3.6.
Change-Id: I7a69ba6dd10412bb065f2b6ba405840d0a98663a
Diffstat (limited to 'tools')
-rw-r--r-- | tools/custom_guidelines.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/custom_guidelines.py b/tools/custom_guidelines.py index 3d3627f1c..ce0defc80 100644 --- a/tools/custom_guidelines.py +++ b/tools/custom_guidelines.py @@ -167,12 +167,12 @@ class HeatCustomGuidelines(object): while idx < len(lines): if ('properties_schema' in lines[idx] or 'attributes_schema' in lines[idx]): - level = len(re.findall('(\{|\()', lines[idx])) - level -= len(re.findall('(\}|\))', lines[idx])) + level = len(re.findall(r'(\{|\()', lines[idx])) + level -= len(re.findall(r'(\}|\))', lines[idx])) idx += 1 while level != 0: - level += len(re.findall('(\{|\()', lines[idx])) - level -= len(re.findall('(\}|\))', lines[idx])) + level += len(re.findall(r'(\{|\()', lines[idx])) + level -= len(re.findall(r'(\}|\))', lines[idx])) if re.search("^((\'|\") )", lines[idx]): kwargs.update( {'details': 'line %s' % idx, @@ -180,8 +180,8 @@ class HeatCustomGuidelines(object): 'be on previous line'), 'snippet': lines[idx]}) self.print_guideline_error(**kwargs) - elif (re.search("(\S(\'|\"))$", lines[idx - 1]) and - re.search("^((\'|\")\S)", lines[idx])): + elif (re.search("(\\S(\'|\"))$", lines[idx - 1]) and + re.search("^((\'|\")\\S)", lines[idx])): kwargs.update( {'details': 'line %s' % (idx - 1), 'message': _('Omitted whitespace at the ' @@ -205,7 +205,7 @@ class HeatCustomGuidelines(object): 'terminator at the end') % error_key.title(), 'snippet': description}) self.print_guideline_error(**error_kwargs) - if re.search("\s{2,}", description): + if re.search(r"\s{2,}", description): error_kwargs.update( {'message': _('%s description contains double or more ' 'whitespaces') % error_key.title(), @@ -214,7 +214,7 @@ class HeatCustomGuidelines(object): def _check_description_details(self, doclines, error_kwargs, error_key): - if re.search("\S", doclines[1]): + if re.search(r"\S", doclines[1]): error_kwargs.update( {'message': _('%s description summary and ' 'main resource description should be ' @@ -240,7 +240,7 @@ class HeatCustomGuidelines(object): params = False for line in doclines[1:]: - if re.search("\s{2,}", line): + if re.search(r"\s{2,}", line): error_kwargs.update( {'message': _('%s description ' 'contains double or more ' |