5555
5656from . import ejson as json
5757from .config import CALL_TIMEOUT
58- from .exc import ReserveFDException , ClientException , ErrnoMixin , ValidationErrors , CallTimeout
58+ from .exc import ReserveFDException , ClientException , ErrnoMixin , ValidationErrors , CallTimeout # noqa
5959from .legacy import LegacyClient
6060from .jsonrpc import CollectionUpdateParams , ErrorObj , JobFields , JSONRPCError , JSONRPCMessage , TruenasError
6161from .utils import MIDDLEWARE_RUN_DIR , ProgressBar , undefined , UndefinedType , set_socket_options
@@ -76,9 +76,8 @@ def uri_check(self, uri: str | None, py_exceptions: bool):
7676 if uri and py_exceptions and not uri .startswith (UNIX_SOCKET_PREFIX ):
7777 raise ClientException ('py_exceptions are only allowed for connections to unix domain socket' )
7878
79-
80- def __init__ (self , uri : str | None = None , reserved_ports = False , private_methods = False , py_exceptions = False ,
81- log_py_exceptions = False , call_timeout : float | UndefinedType = undefined , verify_ssl = True ):
79+ def __init__ (self , uri : str | None = None , reserved_ports = False , private_methods = False , py_exceptions = False ,
80+ log_py_exceptions = False , call_timeout : float | UndefinedType = undefined , verify_ssl = True ):
8281 """Initialize either a `JSONRPCClient` or a `LegacyClient`.
8382
8483 Use `JSONRPCClient` unless `uri` ends with '/websocket'.
@@ -124,7 +123,7 @@ class WSClient:
124123 The object used by `JSONRPCClient` to send and receive data.
125124
126125 """
127- def __init__ (self , url : str , * , client : 'JSONRPCClient' , reserved_ports : bool = False , verify_ssl : bool = True ):
126+ def __init__ (self , url : str , * , client : 'JSONRPCClient' , reserved_ports : bool = False , verify_ssl : bool = True ):
128127 """Initialize a `WSClient`.
129128
130129 Args:
@@ -303,7 +302,7 @@ class Job:
303302 Every `Job` is responsible for a corresponding `_JobDict` in the client's list of jobs.
304303
305304 """
306- def __init__ (self , client : 'JSONRPCClient' , job_id : str , callback : _JobCallback | None = None ):
305+ def __init__ (self , client : 'JSONRPCClient' , job_id : str , callback : _JobCallback | None = None ):
307306 """Initialize `Job`.
308307
309308 Args:
@@ -705,9 +704,9 @@ def _jobs_subscribe(self):
705704 self ._jobs_watching = True
706705 self .subscribe ('core.get_jobs' , self ._jobs_callback , sync = True )
707706
708- def call (self , method : str , * params , background = False , callback : _JobCallback | None = None ,
709- job : Literal ['RETURN' ] | bool = False , register_call : bool | None = None ,
710- timeout : float | UndefinedType = undefined ) -> Any :
707+ def call (self , method : str , * params , background = False , callback : _JobCallback | None = None ,
708+ job : Literal ['RETURN' ] | bool = False , register_call : bool | None = None ,
709+ timeout : float | UndefinedType = undefined ) -> Any :
711710 """The primary way to send call requests to the API.
712711
713712 Send a JSON-RPC v2.0 Request to the server.
@@ -761,8 +760,8 @@ def call(self, method: str, *params, background=False, callback: _JobCallback |
761760 if not background :
762761 self ._unregister_call (c )
763762
764- def wait (self , c : Call , * , callback : _JobCallback | None = None , job : Literal ['RETURN' ] | bool = False ,
765- timeout : float | UndefinedType = undefined ) -> Any :
763+ def wait (self , c : Call , * , callback : _JobCallback | None = None , job : Literal ['RETURN' ] | bool = False ,
764+ timeout : float | UndefinedType = undefined ) -> Any :
766765 """Wait for an API call to return and return its result.
767766
768767 Args:
@@ -820,8 +819,8 @@ def event_payload() -> _Payload:
820819 'event' : Event (),
821820 }
822821
823- def subscribe (self , name : str , callback : _EventCallbackProtocol , payload : _Payload | None = None ,
824- sync : bool = False ) -> str :
822+ def subscribe (self , name : str , callback : _EventCallbackProtocol , payload : _Payload | None = None ,
823+ sync : bool = False ) -> str :
825824 """Subscribe to an event by calling `core.subscribe`.
826825
827826 Args:
@@ -859,7 +858,7 @@ def unsubscribe(self, id_: str):
859858 else :
860859 self ._event_callbacks .pop (k )
861860
862- def ping (self , timeout : float = 10 ) -> Literal ['pong' ]:
861+ def ping (self , timeout : float = 10 ) -> Literal ['pong' ]:
863862 """Call `core.ping` to verify connection to the server.
864863
865864 Args:
0 commit comments