Skip to content

PYTHON-3865 add types to ssl_support.py #1326

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

Merged
merged 1 commit into from
Jul 25, 2023
Merged
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
18 changes: 10 additions & 8 deletions pymongo/ssl_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Support for SSL in PyMongo."""

from typing import Optional

from pymongo.errors import ConfigurationError

HAVE_SSL = True
Expand Down Expand Up @@ -41,14 +43,14 @@
BLOCKING_IO_ERRORS = _ssl.BLOCKING_IO_ERRORS

def get_ssl_context(
certfile,
passphrase,
ca_certs,
crlfile,
allow_invalid_certificates,
allow_invalid_hostnames,
disable_ocsp_endpoint_check,
):
certfile: Optional[str],
passphrase: Optional[str],
ca_certs: Optional[str],
crlfile: Optional[str],
allow_invalid_certificates: bool,
allow_invalid_hostnames: bool,
disable_ocsp_endpoint_check: bool,
) -> _ssl.SSLContext:
"""Create and return an SSLContext object."""
verify_mode = CERT_NONE if allow_invalid_certificates else CERT_REQUIRED
ctx = _ssl.SSLContext(_ssl.PROTOCOL_SSLv23)
Expand Down