Skip to content

Conversation

@AlexWaygood
Copy link
Member

Fixes #10905

@AlexWaygood
Copy link
Member Author

@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, optional suggestions below.

Comment on lines 12 to 13
is_ssl: Any
ssl_certificate: Any
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get rid of the Anys (which should be Incompletes):

Suggested change
is_ssl: Any
ssl_certificate: Any
is_ssl: bool
ssl_certificate: bool | str | None

https://github.com/braintree/braintree_python/blob/a05909893e332879297dbf560431c8ae32aa657b/tests/unit/test_environment.py#L38C1-L42

ssl_certificate is passed to request's send() method, which takes bool | str | None as verify argument:

https://github.com/braintree/braintree_python/blob/a05909893e332879297dbf560431c8ae32aa657b/braintree/util/http.py#L111-L131

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, just because it's passed to send() doesn't mean that bool | str | None is the correct type, though -- maybe it's always a str, in which case bool | str | None will cause false positives. For now, I think I'll just use Incomplete for ssl_certificate

ssl_certificate: Any
def __init__(
self, name, server, port, auth_url, is_ssl, ssl_certificate, graphql_server: str = "", graphql_port: str = ""
self, name, server: str, port, auth_url: str, is_ssl, ssl_certificate, graphql_server: str = "", graphql_port: str = ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self, name, server: str, port, auth_url: str, is_ssl, ssl_certificate, graphql_server: str = "", graphql_port: str = ""
self, name, server: str, port, auth_url: str, is_ssl: bool, ssl_certificate: bool | str | None, graphql_server: str = "", graphql_port: str = ""

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 608eca5 into main Oct 18, 2023
@AlexWaygood AlexWaygood deleted the AlexWaygood-patch-1 branch October 18, 2023 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

braintree.Environment is missing attributes

3 participants