Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quality issues reported by DeepSource #572

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stripe/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class HTTPClient(object):
def __init__(self, verify_ssl_certs=True, proxy=None):
self._verify_ssl_certs = verify_ssl_certs
if proxy:
if type(proxy) is str:
if isinstance(proxy, str):
proxy = {"http": proxy, "https": proxy}
if not (type(proxy) is dict):
if not isinstance(proxy, dict):
raise ValueError(
"Proxy(ies) must be specified as either a string "
"URL or a dict() with string URL under the"
Expand Down
6 changes: 2 additions & 4 deletions stripe/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ def authorize_url(**params):
@staticmethod
def token(**params):
requestor = api_requestor.APIRequestor(api_base=connect_api_base)
response, api_key = requestor.request(
"post", "/oauth/token", params, None
)
response, _ = requestor.request("post", "/oauth/token", params, None)
return response.data

@staticmethod
def deauthorize(**params):
requestor = api_requestor.APIRequestor(api_base=connect_api_base)
OAuth._set_client_id(params)
response, api_key = requestor.request(
response, _ = requestor.request(
"post", "/oauth/deauthorize", params, None
)
return response.data
2 changes: 1 addition & 1 deletion stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def convert_to_stripe_object(
):
global OBJECT_CLASSES

if len(OBJECT_CLASSES) == 0:
if not OBJECT_CLASSES:
load_object_classes()
types = OBJECT_CLASSES.copy()

Expand Down
2 changes: 1 addition & 1 deletion stripe/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def verify_header(cls, payload, header, secret, tolerance=None):
payload,
)

if len(signatures) == 0:
if not signatures:
raise error.SignatureVerificationError(
"No signatures found with expected scheme "
"%s" % cls.EXPECTED_SCHEME,
Expand Down