Skip to content

Commit

Permalink
Python v2.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Aug 18, 2020
1 parent ebed0fa commit 40badd1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apprise/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,17 @@ def parse_bool(arg, default=False):
return bool(arg)


def parse_emails(*args, store_unparseable=True):
def parse_emails(*args, **kwargs):
"""
Takes a string containing URLs separated by comma's and/or spaces and
returns a list.
"""

# for Python 2.7 support, store_unparsable is not in the url above
# as just parse_emails(*args, store_unparseable=True) since it is
# an invalid syntax. This is the workaround to be backards compatible:
store_unparseable = kwargs.get('store_unparseable', True)

result = []
for arg in args:
if isinstance(arg, six.string_types) and arg:
Expand All @@ -603,12 +608,17 @@ def parse_emails(*args, store_unparseable=True):
return result


def parse_urls(*args, store_unparseable=True):
def parse_urls(*args, **kwargs):
"""
Takes a string containing URLs separated by comma's and/or spaces and
returns a list.
"""

# for Python 2.7 support, store_unparsable is not in the url above
# as just parse_urls(*args, store_unparseable=True) since it is
# an invalid syntax. This is the workaround to be backards compatible:
store_unparseable = kwargs.get('store_unparseable', True)

result = []
for arg in args:
if isinstance(arg, six.string_types) and arg:
Expand Down

0 comments on commit 40badd1

Please sign in to comment.