Skip to content

Commit

Permalink
Fix type hints and docs builds (#109)
Browse files Browse the repository at this point in the history
* Fix type hints and docs builds

* Try ignoring the DeprecationWarning from utcfromtimestamp
  • Loading branch information
sethmlarson authored Aug 21, 2023
1 parent 318af1c commit 3eee166
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx
sphinx>=7.2.2
furo
myst-parser
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ Documentation = "https://truststore.readthedocs.io"
asyncio_mode = "strict"
filterwarnings = [
"error",
"ignore:.*datetime.utcfromtimestamp().*:DeprecationWarning",
]
20 changes: 4 additions & 16 deletions src/truststore/_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import array
import ctypes
import mmap
import os
import pickle
import platform
import socket
import ssl
Expand All @@ -19,21 +15,13 @@
else:
from ._openssl import _configure_context, _verify_peercerts_impl

if typing.TYPE_CHECKING:
from typing_extensions import Buffer

# From typeshed/stdlib/ssl.pyi
_StrOrBytesPath: typing.TypeAlias = str | bytes | os.PathLike[str] | os.PathLike[bytes]
_PasswordType: typing.TypeAlias = str | bytes | typing.Callable[[], str | bytes]

# From typeshed/stdlib/_typeshed/__init__.py
_ReadableBuffer: typing.TypeAlias = typing.Union[
bytes,
memoryview,
bytearray,
"array.array[typing.Any]",
mmap.mmap,
"ctypes._CData",
pickle.PickleBuffer,
]


def inject_into_ssl() -> None:
"""Injects the :class:`truststore.SSLContext` into the ``ssl``
Expand Down Expand Up @@ -129,7 +117,7 @@ def load_verify_locations(
self,
cafile: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None = None,
capath: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None = None,
cadata: str | _ReadableBuffer | None = None,
cadata: typing.Union[str, "Buffer", None] = None,
) -> None:
return self._ctx.load_verify_locations(
cafile=cafile, capath=capath, cadata=cadata
Expand Down

0 comments on commit 3eee166

Please sign in to comment.