Skip to content

Commit

Permalink
Merge pull request #18 from Jacksprojects/bugfix/suppress-syntax-warn…
Browse files Browse the repository at this point in the history
…ings

Bugfix: Fix SyntaxWarning when comparing a literal with 'is' instead of '=='
  • Loading branch information
shravan-g authored Nov 12, 2024
2 parents 7963f57 + e4ea5be commit 6436117
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions message_media_messages/api_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ def serialize_array(key, array, formatting="indexed"):
serializable_types = (str, int, float, bool, datetime.date, APIHelper.CustomDate)

if isinstance(array[0], serializable_types):
if formatting is "unindexed":
if formatting == "unindexed":
tuples += [("{0}[]".format(key), element) for element in array]
elif formatting is "indexed":
elif formatting == "indexed":
tuples += [("{0}[{1}]".format(key, index), element) for index, element in enumerate(array)]
elif formatting is "plain":
elif formatting == "plain":
tuples += [(key, element) for element in array]
else:
raise ValueError("Invalid format provided.")
Expand Down Expand Up @@ -199,13 +199,13 @@ def append_url_with_query_parameters(url,
if value is not None:
if isinstance(value, list):
value = [element for element in value if element]
if array_serialization is "csv":
if array_serialization == "csv":
url += "{0}{1}={2}".format(seperator, key,
",".join(quote(str(x), safe='') for x in value))
elif array_serialization is "psv":
elif array_serialization == "psv":
url += "{0}{1}={2}".format(seperator, key,
"|".join(quote(str(x), safe='') for x in value))
elif array_serialization is "tsv":
elif array_serialization == "tsv":
url += "{0}{1}={2}".format(seperator, key,
"\t".join(quote(str(x), safe='') for x in value))
else:
Expand Down

0 comments on commit 6436117

Please sign in to comment.