From 804e27c5fd326e3f80b62b0f5ec1878ad8d54bbd Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 8 Sep 2018 22:05:47 -0400 Subject: [PATCH] deprication warning cleanup --- apprise/Apprise.py | 2 +- apprise/plugins/NotifyEmail.py | 8 ++++---- apprise/plugins/NotifyGrowl/gntp/core.py | 10 +++++----- apprise/plugins/NotifyPushjet/pushjet/errors.py | 1 - apprise/plugins/NotifyPushjet/pushjet/pushjet.py | 6 ++---- apprise/plugins/NotifyPushjet/pushjet/utilities.py | 2 -- apprise/plugins/NotifyRocketChat.py | 2 +- apprise/plugins/NotifySlack.py | 8 ++++---- apprise/plugins/NotifyTelegram.py | 2 +- apprise/plugins/NotifyTwitter/tweepy/binder.py | 2 +- apprise/plugins/NotifyTwitter/tweepy/streaming.py | 2 +- apprise/utils.py | 8 ++++---- test/test_api.py | 1 - test/test_cli.py | 1 - test/test_utils.py | 1 - 15 files changed, 24 insertions(+), 32 deletions(-) diff --git a/apprise/Apprise.py b/apprise/Apprise.py index 42e5e624..332d55c3 100644 --- a/apprise/Apprise.py +++ b/apprise/Apprise.py @@ -39,7 +39,7 @@ logger = logging.getLogger(__name__) SCHEMA_MAP = {} # Used for attempting to acquire the schema if the URL can't be parsed. -GET_SCHEMA_RE = re.compile('\s*(?P[a-z0-9]{3,9})://.*$', re.I) +GET_SCHEMA_RE = re.compile(r'\s*(?P[a-z0-9]{3,9})://.*$', re.I) # Load our Lookup Matrix diff --git a/apprise/plugins/NotifyEmail.py b/apprise/plugins/NotifyEmail.py index f45822b8..e6d16c32 100644 --- a/apprise/plugins/NotifyEmail.py +++ b/apprise/plugins/NotifyEmail.py @@ -202,7 +202,7 @@ class NotifyEmail(NotifyBase): if self.smtp_host is None: # Detect Server if possible - self.smtp_host = re.split('[\s@]+', self.from_addr)[-1] + self.smtp_host = re.split(r'[\s@]+', self.from_addr)[-1] # Adjust email login based on the defined # usertype @@ -332,14 +332,14 @@ class NotifyEmail(NotifyBase): # get 'To' email address from_addr = '%s@%s' % ( re.split( - '[\s@]+', NotifyBase.unquote(results['user']))[0], + r'[\s@]+', NotifyBase.unquote(results['user']))[0], results.get('host', '') ) # Lets be clever and attempt to make the from # address an email based on the to address from_addr = '%s@%s' % ( - re.split('[\s@]+', from_addr)[0], - re.split('[\s@]+', from_addr)[-1], + re.split(r'[\s@]+', from_addr)[0], + re.split(r'[\s@]+', from_addr)[-1], ) # Attempt to detect 'to' email address diff --git a/apprise/plugins/NotifyGrowl/gntp/core.py b/apprise/plugins/NotifyGrowl/gntp/core.py index 60534f2d..99db7570 100644 --- a/apprise/plugins/NotifyGrowl/gntp/core.py +++ b/apprise/plugins/NotifyGrowl/gntp/core.py @@ -19,18 +19,18 @@ __all__ = [ #GNTP/ [:][ :.] GNTP_INFO_LINE = re.compile( - 'GNTP/(?P\d+\.\d+) (?PREGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' + - ' (?P[A-Z0-9]+(:(?P[A-F0-9]+))?) ?' + - '((?P[A-Z0-9]+):(?P[A-F0-9]+).(?P[A-F0-9]+))?\r\n', + r'GNTP/(?P\d+\.\d+) (?PREGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' + + r' (?P[A-Z0-9]+(:(?P[A-F0-9]+))?) ?' + + r'((?P[A-Z0-9]+):(?P[A-F0-9]+).(?P[A-F0-9]+))?\r\n', re.IGNORECASE ) GNTP_INFO_LINE_SHORT = re.compile( - 'GNTP/(?P\d+\.\d+) (?PREGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)', + r'GNTP/(?P\d+\.\d+) (?PREGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)', re.IGNORECASE ) -GNTP_HEADER = re.compile('([\w-]+):(.+)') +GNTP_HEADER = re.compile(r'([\w-]+):(.+)') GNTP_EOL = shim.b('\r\n') GNTP_SEP = shim.b(': ') diff --git a/apprise/plugins/NotifyPushjet/pushjet/errors.py b/apprise/plugins/NotifyPushjet/pushjet/errors.py index 3fd11109..bfa16b2a 100644 --- a/apprise/plugins/NotifyPushjet/pushjet/errors.py +++ b/apprise/plugins/NotifyPushjet/pushjet/errors.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals from requests import RequestException diff --git a/apprise/plugins/NotifyPushjet/pushjet/pushjet.py b/apprise/plugins/NotifyPushjet/pushjet/pushjet.py index 6a527137..070b7ea1 100644 --- a/apprise/plugins/NotifyPushjet/pushjet/pushjet.py +++ b/apprise/plugins/NotifyPushjet/pushjet/pushjet.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - import requests from functools import partial @@ -221,7 +219,7 @@ class Device(PushjetModel): def get_subscriptions(self): """Get all the subscriptions the device has. - :return: A list of :class:`~pushjet.Subscription`\ s. + :return: A list of :class:`~pushjet.Subscription`. """ _, response = self._request('subscription', 'GET') subscriptions = [] @@ -232,7 +230,7 @@ class Device(PushjetModel): def get_messages(self): """Get all new (that is, as of yet unretrieved) messages. - :return: A list of :class:`~pushjet.Message`\ s. + :return: A list of :class:`~pushjet.Message`. """ _, response = self._request('message', 'GET') messages = [] diff --git a/apprise/plugins/NotifyPushjet/pushjet/utilities.py b/apprise/plugins/NotifyPushjet/pushjet/utilities.py index 2def6f3b..3a2af502 100644 --- a/apprise/plugins/NotifyPushjet/pushjet/utilities.py +++ b/apprise/plugins/NotifyPushjet/pushjet/utilities.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - import re import sys from decorator import decorator diff --git a/apprise/plugins/NotifyRocketChat.py b/apprise/plugins/NotifyRocketChat.py index 4e9102aa..8b8432f9 100644 --- a/apprise/plugins/NotifyRocketChat.py +++ b/apprise/plugins/NotifyRocketChat.py @@ -128,7 +128,7 @@ class NotifyRocketChat(NotifyBase): return False # Prepare our message - text = '*%s*\r\n%s' % (title.replace('*', '\*'), body) + text = '*%s*\r\n%s' % (title.replace('*', '\\*'), body) # Initiaize our error tracking has_error = False diff --git a/apprise/plugins/NotifySlack.py b/apprise/plugins/NotifySlack.py index a44c7119..72693991 100644 --- a/apprise/plugins/NotifySlack.py +++ b/apprise/plugins/NotifySlack.py @@ -146,11 +146,11 @@ class NotifySlack(NotifyBase): # https://api.slack.com/docs/message-formatting self._re_formatting_map = { # New lines must become the string version - '\r\*\n': '\\n', + r'\r\*\n': '\\n', # Escape other special characters - '&': '&', - '<': '<', - '>': '>', + r'&': '&', + r'<': '<', + r'>': '>', } # Iterate over above list and store content accordingly diff --git a/apprise/plugins/NotifyTelegram.py b/apprise/plugins/NotifyTelegram.py index 210ea9a4..650ad48e 100644 --- a/apprise/plugins/NotifyTelegram.py +++ b/apprise/plugins/NotifyTelegram.py @@ -302,7 +302,7 @@ class NotifyTelegram(NotifyBase): # Load our response and attempt to fetch our userid response = loads(r.content) if 'ok' in response and response['ok'] is True: - start = re.compile('^\s*\/start', re.I) + start = re.compile(r'^\s*\/start', re.I) for _msg in iter(response['result']): # Find /start if not start.search(_msg['message']['text']): diff --git a/apprise/plugins/NotifyTwitter/tweepy/binder.py b/apprise/plugins/NotifyTwitter/tweepy/binder.py index e7dcf4b4..ff807313 100644 --- a/apprise/plugins/NotifyTwitter/tweepy/binder.py +++ b/apprise/plugins/NotifyTwitter/tweepy/binder.py @@ -19,7 +19,7 @@ import six import sys -re_path_template = re.compile('{\w+}') +re_path_template = re.compile(r'{\w+}') log = logging.getLogger('tweepy.binder') diff --git a/apprise/plugins/NotifyTwitter/tweepy/streaming.py b/apprise/plugins/NotifyTwitter/tweepy/streaming.py index 0a72a4ca..c0961467 100644 --- a/apprise/plugins/NotifyTwitter/tweepy/streaming.py +++ b/apprise/plugins/NotifyTwitter/tweepy/streaming.py @@ -306,7 +306,7 @@ class Stream(object): def _read_loop(self, resp): charset = resp.headers.get('content-type', default='') - enc_search = re.search('charset=(?P\S*)', charset) + enc_search = re.search(r'charset=(?P\S*)', charset) if enc_search is not None: encoding = enc_search.group('enc') else: diff --git a/apprise/utils.py b/apprise/utils.py index 26e7e8d7..ce0f4543 100644 --- a/apprise/utils.py +++ b/apprise/utils.py @@ -95,7 +95,7 @@ def is_hostname(hostname): if hostname[-1] == ".": hostname = hostname[:-1] - allowed = re.compile("(?!-)[A-Z\d_-]{1,63}(?