Skip to content

Commit

Permalink
Use r-prefix when necessary
Browse files Browse the repository at this point in the history
Avoid pylint reports such as:

> W1401: Anomalous backslash in string: '\['. String constant might be missing an r prefix. (anomalous-backslash-in-string)
  • Loading branch information
mattst88 committed Mar 1, 2023
1 parent 97626f7 commit cc31bb6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DEFAULT_BRANCH = "2.x"
BASE_GITHUB_URL = "https://github.com/vit-project/vit/blob"

MARKUP_LINK_REGEX = "\[([^]]+)\]\(([\w]+\.md)\)"
MARKUP_LINK_REGEX = r"\[([^]]+)\]\(([\w]+\.md)\)"
FILE_DIR = path.dirname(path.abspath(path.realpath(__file__)))

with open(path.join(FILE_DIR, 'README.md')) as f:
Expand Down
2 changes: 1 addition & 1 deletion vit/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def register_managed_actions(self):
def default_keybinding_replacements(self):
import json
from datetime import datetime
task_replacement_match = re.compile("^TASK_(\w+)$")
task_replacement_match = re.compile(r"^TASK_(\w+)$")
def _task_attribute_match(variable):
matches = re.match(task_replacement_match, variable)
if matches:
Expand Down
2 changes: 1 addition & 1 deletion vit/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, config, task_config, theme, theme_alt_backgrounds):
# without pipes, the 'color' config setting in Taskwarrior is not used, and
# instead a custom setting is used.
self.color_enabled = self.config.get('color', 'enabled')
self.display_attrs_available, self.display_attrs = self.convert_color_config(self.task_config.filter_to_dict('^color\.'))
self.display_attrs_available, self.display_attrs = self.convert_color_config(self.task_config.filter_to_dict(r'^color\.'))
self.project_display_attrs = self.get_project_display_attrs()
if self.include_subprojects:
self.add_project_children()
Expand Down
8 changes: 4 additions & 4 deletions vit/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
SORT_ORDER_CHARACTERS = ['+', '-']
SORT_COLLATE_CHARACTERS = ['/']
VIT_CONFIG_FILE = 'config.ini'
FILTER_EXCLUSION_REGEX = re.compile('^limit:')
FILTER_PARENS_REGEX = re.compile('([\(\)])')
CONFIG_BOOLEAN_TRUE_REGEX = re.compile('1|yes|true', re.IGNORECASE)
FILTER_EXCLUSION_REGEX = re.compile(r'^limit:')
FILTER_PARENS_REGEX = re.compile(r'([\(\)])')
CONFIG_BOOLEAN_TRUE_REGEX = re.compile(r'1|yes|true', re.IGNORECASE)
# TaskParser expects clean hierarchies in the Taskwarrior dotted config names.
# However, this is occasionally violated, with a leaf ending in both a string
# value and another branch. The below list contains the config values that
Expand Down Expand Up @@ -294,7 +294,7 @@ def filter(self, matcher_regex):
def subtree(self, matcher, walk_subtree=True):
matcher_regex = matcher
if walk_subtree:
matcher_regex = r'%s' % (('^%s' % matcher).replace('.', '\.'))
matcher_regex = r'%s' % (('^%s' % matcher).replace(r'.', r'\.'))
full_tree = {}
lines = self.filter(matcher_regex)
for (hierarchy, value) in lines:
Expand Down

0 comments on commit cc31bb6

Please sign in to comment.