|
17 | 17 | from typing import Dict
|
18 | 18 | from typing import List
|
19 | 19 | from typing import NoReturn
|
| 20 | +from typing import Optional |
20 | 21 | from typing import Union
|
21 | 22 |
|
22 | 23 | from ansible.errors import AnsibleConnectionFailure
|
|
27 | 28 |
|
28 | 29 |
|
29 | 30 | class ConnectionPluginDisplay:
|
30 |
| - def __init__(self, host: str | None) -> None: |
| 31 | + def __init__(self, host: Optional[str]) -> None: |
31 | 32 | self._host_args = {}
|
32 | 33 | if host:
|
33 | 34 | self._host_args = {"host": host}
|
@@ -111,10 +112,10 @@ def __init__(
|
111 | 112 | instance_id: str,
|
112 | 113 | executable: str,
|
113 | 114 | ssm_timeout: int,
|
114 |
| - region_name: str | None, |
| 115 | + region_name: Optional[str], |
115 | 116 | profile_name: str,
|
116 |
| - document_name: str | None = None, |
117 |
| - parameters: Dict[str, List[str]] | None = None, |
| 117 | + document_name: Optional[str] = None, |
| 118 | + parameters: Optional[Dict[str, List[str]]] = None, |
118 | 119 | ) -> None:
|
119 | 120 | self._client = ssm_client
|
120 | 121 | self._session = None
|
@@ -178,15 +179,15 @@ class PortForwardingFileTransferManager:
|
178 | 179 |
|
179 | 180 | def __init__(
|
180 | 181 | self,
|
181 |
| - host: str | None, |
| 182 | + host: Optional[str], |
182 | 183 | ssm_client: Any,
|
183 | 184 | instance_id: str,
|
184 | 185 | executable: str,
|
185 | 186 | ssm_timeout: int,
|
186 |
| - region_name: str | None, |
| 187 | + region_name: Optional[str], |
187 | 188 | profile_name: str,
|
188 |
| - host_port: int | None = None, |
189 |
| - local_port: int | None = None, |
| 189 | + host_port: Optional[int], |
| 190 | + local_port: Optional[int], |
190 | 191 | ) -> None:
|
191 | 192 | self._client = ssm_client
|
192 | 193 | self._session = None
|
@@ -244,7 +245,7 @@ def _socket_connect(self, session: Any, port: int, host: str = "localhost", max_
|
244 | 245 | raise
|
245 | 246 | time.sleep(0.05)
|
246 | 247 |
|
247 |
| - def _socket_read(self, port: int, out_path: str | None = None) -> None: |
| 248 | + def _socket_read(self, port: int, out_path: Optional[str] = None) -> None: |
248 | 249 | self._display.vvvv(f"Read content from socket on port '{port}'...")
|
249 | 250 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as session:
|
250 | 251 | session.settimeout(1)
|
|
0 commit comments