Skip to content

Commit b7e13d6

Browse files
committed
Move _FakeSSLContext into socket.py
1 parent 5046882 commit b7e13d6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

circuitpython_typing/socket.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from types import ModuleType
1414
from typing import Any, Optional, Tuple, Union
1515

16-
from adafruit_connection_manager import _FakeSSLContext
17-
1816
# Protocol was introduced in Python 3.8, TypeAlias in 3.10
1917
from typing_extensions import Protocol, TypeAlias
2018

@@ -127,4 +125,18 @@ def TLS_MODE(self) -> int: # pylint: disable=invalid-name
127125
"""Constant representing that a socket's connection mode is TLS."""
128126

129127

128+
# pylint: disable=too-few-public-methods
129+
class _FakeSSLSocket:
130+
"""Describes the structure every fake SSL socket type must have."""
131+
132+
133+
class _FakeSSLContext:
134+
"""Describes the structure every fake SSL context type must have."""
135+
136+
def wrap_socket(
137+
self, socket: CircuitPythonSocketType, server_hostname: Optional[str] = None
138+
) -> _FakeSSLSocket:
139+
"""Wrap socket and return a new one that uses the methods from the original."""
140+
141+
130142
SSLContextType: TypeAlias = Union[SSLContext, _FakeSSLContext]

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55

66
Adafruit-Blinka
77
adafruit-circuitpython-busdevice
8-
Adafruit-Circuitpython-connectionmanager@git+https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager@connection-manager
98
adafruit-circuitpython-requests
109
typing_extensions~=4.0

0 commit comments

Comments
 (0)