@@ -151,7 +151,7 @@ def find_host_network(self) -> Optional[str]:
151
151
except ipaddress .AddressValueError :
152
152
continue
153
153
if docker_host in subnet :
154
- return cast (str , network .name )
154
+ return cast (" str" , network .name )
155
155
except (ipaddress .AddressValueError , OSError ):
156
156
pass
157
157
return None
@@ -163,7 +163,7 @@ def port(self, container_id: str, port: int) -> str:
163
163
port_mappings = self .client .api .port (container_id , port )
164
164
if not port_mappings :
165
165
raise ConnectionError (f"Port mapping for container { container_id } and port { port } is not available" )
166
- return cast (str , port_mappings [0 ]["HostPort" ])
166
+ return cast (" str" , port_mappings [0 ]["HostPort" ])
167
167
168
168
def get_container (self , container_id : str ) -> dict [str , Any ]:
169
169
"""
@@ -172,7 +172,7 @@ def get_container(self, container_id: str) -> dict[str, Any]:
172
172
containers = self .client .api .containers (filters = {"id" : container_id })
173
173
if not containers :
174
174
raise RuntimeError (f"Could not get container with id { container_id } " )
175
- return cast (dict [str , Any ], containers [0 ])
175
+ return cast (" dict[str, Any]" , containers [0 ])
176
176
177
177
def bridge_ip (self , container_id : str ) -> str :
178
178
"""
@@ -241,7 +241,7 @@ def host(self) -> str:
241
241
hostname = url .hostname
242
242
if not hostname or (hostname == "localnpipe" and utils .is_windows ()):
243
243
return "localhost"
244
- return cast (str , url .hostname )
244
+ return cast (" str" , url .hostname )
245
245
if utils .inside_container () and ("unix" in url .scheme or "npipe" in url .scheme ):
246
246
ip_address = utils .default_gateway_ip ()
247
247
if ip_address :
@@ -257,7 +257,7 @@ def login(self, auth_config: DockerAuthInfo) -> None:
257
257
258
258
def client_networks_create (self , name : str , param : dict [str , Any ]) -> dict [str , Any ]:
259
259
labels = create_labels ("" , param .get ("labels" ))
260
- return cast (dict [str , Any ], self .client .networks .create (name , ** {** param , "labels" : labels }))
260
+ return cast (" dict[str, Any]" , self .client .networks .create (name , ** {** param , "labels" : labels }))
261
261
262
262
263
263
def get_docker_host () -> Optional [str ]:
0 commit comments