@@ -54,7 +54,10 @@ def connect(self) -> bool:
5454 self ._error = ""
5555 try :
5656 self ._ws = connect (
57- self ._url , ssl = self ._ssl_context , max_size = 16777216 , ping_interval = 20
57+ self ._url ,
58+ ssl = self ._ssl_context ,
59+ max_size = 16777216 ,
60+ ping_interval = 20 ,
5861 )
5962 except Exception as e :
6063 if "CERTIFICATE_VERIFY_FAILED" in str (e .args ):
@@ -75,7 +78,9 @@ def connect(self) -> bool:
7578 if "Connection refused" in e .args :
7679 self ._error = "connection_refused"
7780
78- if "No route to host" in e .args or "Name or service not known" in str (e ):
81+ if "No route to host" in e .args or "Name or service not known" in str (
82+ e
83+ ):
7984 self ._error = "invalid_hostname"
8085
8186 if "timed out while waiting for handshake response" in e .args :
@@ -119,7 +124,7 @@ def connect(self) -> bool:
119124 # ---------------------------
120125 def disconnect (self ) -> bool :
121126 """Return connected boolean."""
122- if hasattr (self , ' _ws' ) and self ._ws :
127+ if hasattr (self , " _ws" ) and self ._ws :
123128 self ._ws .close ()
124129
125130 self ._connected = False
@@ -190,7 +195,10 @@ def query(self, service: str, params: dict[str, Any] | None = {}) -> list | None
190195 self ._error = "malformed_result"
191196
192197 if (type (data ) is list or type (data ) is dict ) and "error" in data :
193- if "data" in data ["error" ] and "reason" in data ["error" ]["data" ]:
198+ if (
199+ "data" in data ["error" ]
200+ and "reason" in data ["error" ]["data" ]
201+ ):
194202 _LOGGER .error (
195203 "TrueNAS %s query (%s) error: %s" ,
196204 self ._host ,
0 commit comments