I'm running Python 3.9.6 on OSX. I have installed the managemeht-sdk-python module from cohesity github according to the instructions. When running any of the samples, Python complains with a warming for all uses of the syntax 'if variable is "something"' where "something" is a string literal or number.
One solution is to find all instances in api_helper.py and replace "is" with "==". Here's output from a git diff with the changes:
--- a/cohesity_management_sdk/api_helper.py
+++ b/cohesity_management_sdk/api_helper.py
@@ -119,11 +119,11 @@ class APIHelper(object):
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.")
@@ -193,13 +193,13 @@ class APIHelper(object):
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:
🐛 Bug Report
I'm running Python 3.9.6 on OSX. I have installed the managemeht-sdk-python module from cohesity github according to the instructions. When running any of the samples, Python complains with a warming for all uses of the syntax 'if variable is "something"' where "something" is a string literal or number.
One solution is to find all instances in api_helper.py and replace "is" with "==". Here's output from a git diff with the changes: