From cee80fc11fc592a0119c1ed3128aa6c96ed29c70 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 10 Dec 2019 08:22:14 +0100 Subject: [PATCH] Use ==/!= to compare str, bytes, and int literals Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8 $ python ``` >>> pandas = "panda" >>> pandas += "s" >>> pandas == "pandas" True >>> pandas is "pandas" False ``` --- alpha_vantage/alphavantage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alpha_vantage/alphavantage.py b/alpha_vantage/alphavantage.py index 2815dbd..ce556fd 100644 --- a/alpha_vantage/alphavantage.py +++ b/alpha_vantage/alphavantage.py @@ -50,7 +50,7 @@ def __init__(self, key=None, output_format='json', 'https://www.alphavantage.co/support/#api-key') self.key = key self.output_format = output_format - if self.output_format is 'pandas' and not _PANDAS_FOUND: + if self.output_format == 'pandas' and not _PANDAS_FOUND: raise ValueError("The pandas library was not found, therefore can " "not be used as an output format, please install " "manually")