diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-02 12:53:04 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-08 15:11:57 +0200 |
commit | f6ee3793888768ebb90868cab0dc7bae8c49e9a3 (patch) | |
tree | 6e613db6ce5e3f6a41c7466ab9d79416584cee8e /wee_slack.py | |
parent | b459586d96ec1f765d7aed86538b8d8576977f6c (diff) | |
download | wee-slack-f6ee3793888768ebb90868cab0dc7bae8c49e9a3.tar.gz |
Use raw strings for regexes
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index 45f3fe0..ddb4686 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -739,8 +739,8 @@ def buffer_input_callback(signal, buffer_ptr, data): else: return int(message_id) - message_id_regex = "(\d*|\$[0-9a-fA-F]{3,})" - reaction = re.match("^{}(\+|-):(.*):\s*$".format(message_id_regex), data) + message_id_regex = r"(\d*|\$[0-9a-fA-F]{3,})" + reaction = re.match(r"^{}(\+|-):(.*):\s*$".format(message_id_regex), data) substitute = re.match("^{}s/".format(message_id_regex), data) if reaction: if reaction.group(2) == "+": @@ -3055,7 +3055,7 @@ def linkify_text(message, team): .replace('>', '>') .split(' ')) for item in enumerate(message): - targets = re.match('^\s*([@#])([\w\(\)\'.-]+)(\W*)', item[1], re.UNICODE) + targets = re.match(r'^\s*([@#])([\w\(\)\'.-]+)(\W*)', item[1], re.UNICODE) if targets and targets.groups()[0] == '@': named = targets.groups() if named[1] in ["group", "channel", "here"]: @@ -3950,7 +3950,7 @@ def command_upload(data, current_buffer, args): url = 'https://slack.com/api/files.upload' file_path = os.path.expanduser(args) if ' ' in file_path: - file_path = file_path.replace(' ', '\ ') + file_path = file_path.replace(' ', r'\ ') # only http proxy is currenlty supported proxy = ProxyWrapper() |