mirror of https://github.com/caronc/apprise
deprication warning cleanup
parent
419bcdb0b3
commit
804e27c5fd
|
@ -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<schema>[a-z0-9]{3,9})://.*$', re.I)
|
||||
GET_SCHEMA_RE = re.compile(r'\s*(?P<schema>[a-z0-9]{3,9})://.*$', re.I)
|
||||
|
||||
|
||||
# Load our Lookup Matrix
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,18 +19,18 @@ __all__ = [
|
|||
|
||||
#GNTP/<version> <messagetype> <encryptionAlgorithmID>[:<ivValue>][ <keyHashAlgorithmID>:<keyHash>.<salt>]
|
||||
GNTP_INFO_LINE = re.compile(
|
||||
'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' +
|
||||
' (?P<encryptionAlgorithmID>[A-Z0-9]+(:(?P<ivValue>[A-F0-9]+))?) ?' +
|
||||
'((?P<keyHashAlgorithmID>[A-Z0-9]+):(?P<keyHash>[A-F0-9]+).(?P<salt>[A-F0-9]+))?\r\n',
|
||||
r'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' +
|
||||
r' (?P<encryptionAlgorithmID>[A-Z0-9]+(:(?P<ivValue>[A-F0-9]+))?) ?' +
|
||||
r'((?P<keyHashAlgorithmID>[A-Z0-9]+):(?P<keyHash>[A-F0-9]+).(?P<salt>[A-F0-9]+))?\r\n',
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
GNTP_INFO_LINE_SHORT = re.compile(
|
||||
'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)',
|
||||
r'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|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(': ')
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from requests import RequestException
|
||||
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
import sys
|
||||
from decorator import decorator
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']):
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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<enc>\S*)', charset)
|
||||
enc_search = re.search(r'charset=(?P<enc>\S*)', charset)
|
||||
if enc_search is not None:
|
||||
encoding = enc_search.group('enc')
|
||||
else:
|
||||
|
|
|
@ -95,7 +95,7 @@ def is_hostname(hostname):
|
|||
if hostname[-1] == ".":
|
||||
hostname = hostname[:-1]
|
||||
|
||||
allowed = re.compile("(?!-)[A-Z\d_-]{1,63}(?<!-)$", re.IGNORECASE)
|
||||
allowed = re.compile(r'(?!-)[A-Z\d_-]{1,63}(?<!-)$', re.IGNORECASE)
|
||||
return all(allowed.match(x) for x in hostname.split("."))
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
|||
result['query'] = None
|
||||
try:
|
||||
(result['user'], result['host']) = \
|
||||
re.split('[\s@]+', result['host'])[:2]
|
||||
re.split(r'[\s@]+', result['host'])[:2]
|
||||
|
||||
except ValueError:
|
||||
# no problem then, host only exists
|
||||
|
@ -266,7 +266,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
|||
if result['user'] is not None:
|
||||
try:
|
||||
(result['user'], result['password']) = \
|
||||
re.split('[:\s]+', result['user'])[:2]
|
||||
re.split(r'[:\s]+', result['user'])[:2]
|
||||
|
||||
except ValueError:
|
||||
# no problem then, user only exists
|
||||
|
@ -275,7 +275,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
|||
|
||||
try:
|
||||
(result['host'], result['port']) = \
|
||||
re.split('[\s:]+', result['host'])[:2]
|
||||
re.split(r'[\s:]+', result['host'])[:2]
|
||||
|
||||
except ValueError:
|
||||
# no problem then, user only exists
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
# GNU Lesser General Public License for more details.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from os import chmod
|
||||
from os import getuid
|
||||
from os.path import dirname
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
# GNU Lesser General Public License for more details.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from apprise import cli
|
||||
from apprise import NotifyBase
|
||||
from click.testing import CliRunner
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
# GNU Lesser General Public License for more details.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
try:
|
||||
# Python 2.7
|
||||
from urllib import unquote
|
||||
|
|
Loading…
Reference in New Issue