@@ -695,9 +695,7 @@ def _fetch_auth_info(self) -> None:
695695 from the server's /api/auth/whoami endpoint.
696696 """
697697 try :
698- response = self .session .get (
699- urljoin (self .server_url , "/api/auth/whoami" ), timeout = self .connect_timeout
700- )
698+ response = self .session .get (urljoin (self .server_url , "/api/auth/whoami" ), timeout = self .connect_timeout )
701699
702700 if response .status_code == 200 :
703701 auth_info = response .json ()
@@ -711,8 +709,7 @@ def _fetch_auth_info(self) -> None:
711709 else :
712710 self .agent_id = None
713711 logger .info (
714- f"Authenticated as { subject_type } :{ auth_info .get ('subject_id' )} "
715- f"(tenant: { self .tenant_id } )"
712+ f"Authenticated as { subject_type } :{ auth_info .get ('subject_id' )} (tenant: { self .tenant_id } )"
716713 )
717714 else :
718715 logger .debug ("Not authenticated (anonymous access)" )
@@ -725,14 +722,10 @@ def _fetch_auth_info(self) -> None:
725722 @retry (
726723 stop = stop_after_attempt (3 ),
727724 wait = wait_exponential (multiplier = 1 , min = 1 , max = 10 ),
728- retry = retry_if_exception_type (
729- (httpx .ConnectError , httpx .TimeoutException , RemoteConnectionError )
730- ),
725+ retry = retry_if_exception_type ((httpx .ConnectError , httpx .TimeoutException , RemoteConnectionError )),
731726 reraise = True ,
732727 )
733- def _call_rpc (
734- self , method : str , params : dict [str , Any ] | None = None , read_timeout : float | None = None
735- ) -> Any :
728+ def _call_rpc (self , method : str , params : dict [str , Any ] | None = None , read_timeout : float | None = None ) -> Any :
736729 """Make RPC call to server with automatic retry logic.
737730
738731 This method automatically retries on transient failures (connection errors,
@@ -807,9 +800,7 @@ def _call_rpc(
807800
808801 # Check HTTP status
809802 if response .status_code != 200 :
810- logger .error (
811- f"API call failed: { method } - HTTP { response .status_code } ({ elapsed :.3f} s)"
812- )
803+ logger .error (f"API call failed: { method } - HTTP { response .status_code } ({ elapsed :.3f} s)" )
813804 raise RemoteFilesystemError (
814805 f"Request failed: { response .text } " ,
815806 status_code = response .status_code ,
@@ -829,9 +820,7 @@ def _call_rpc(
829820
830821 # Check for RPC error
831822 if rpc_response .error :
832- logger .error (
833- f"API call RPC error: { method } - { rpc_response .error .get ('message' )} ({ elapsed :.3f} s)"
834- )
823+ logger .error (f"API call RPC error: { method } - { rpc_response .error .get ('message' )} ({ elapsed :.3f} s)" )
835824 self ._handle_rpc_error (rpc_response .error )
836825
837826 # Log detailed timing breakdown for grep operations
@@ -896,9 +885,7 @@ def _handle_rpc_error(self, error: dict[str, Any]) -> None:
896885 raise FileExistsError (message )
897886 elif code == RPCErrorCode .INVALID_PATH .value :
898887 raise InvalidPathError (message )
899- elif (
900- code == RPCErrorCode .ACCESS_DENIED .value or code == RPCErrorCode .PERMISSION_ERROR .value
901- ):
888+ elif code == RPCErrorCode .ACCESS_DENIED .value or code == RPCErrorCode .PERMISSION_ERROR .value :
902889 raise NexusPermissionError (message )
903890 elif code == RPCErrorCode .VALIDATION_ERROR .value :
904891 raise ValidationError (message )
@@ -1438,9 +1425,7 @@ async def semantic_search(
14381425 )
14391426 return result # type: ignore[no-any-return]
14401427
1441- async def semantic_search_index (
1442- self , path : str = "/" , recursive : bool = True
1443- ) -> dict [str , int ]:
1428+ async def semantic_search_index (self , path : str = "/" , recursive : bool = True ) -> dict [str , int ]:
14441429 """Index documents for semantic search.
14451430
14461431 Args:
@@ -1538,9 +1523,7 @@ def rollback(self, path: str, version: int, context: Any = None) -> None: # noq
15381523 # context is unused in remote client (handled server-side)
15391524 self ._call_rpc ("rollback" , {"path" : path , "version" : version })
15401525
1541- def diff_versions (
1542- self , path : str , v1 : int , v2 : int , mode : str = "metadata"
1543- ) -> dict [str , Any ] | str :
1526+ def diff_versions (self , path : str , v1 : int , v2 : int , mode : str = "metadata" ) -> dict [str , Any ] | str :
15441527 """Compare two versions of a file."""
15451528 result = self ._call_rpc ("diff_versions" , {"path" : path , "v1" : v1 , "v2" : v2 , "mode" : mode })
15461529 return result # type: ignore[no-any-return]
@@ -1904,8 +1887,7 @@ def get_acl(self, path: str) -> builtins.list[dict[str, str | bool | None]]:
19041887 - rebac_expand(): Find all subjects with a permission
19051888 """
19061889 raise NotImplementedError (
1907- "get_acl() is no longer supported. Use ReBAC instead:\n "
1908- f" nx.rebac_list_tuples(object=('file', '{ path } '))"
1890+ f"get_acl() is no longer supported. Use ReBAC instead:\n nx.rebac_list_tuples(object=('file', '{ path } '))"
19091891 )
19101892
19111893 # ============================================================
@@ -2638,9 +2620,7 @@ def revoke_consent(self, from_subject: tuple[str, str], to_subject: tuple[str, s
26382620 ... to_subject=("user", "bob")
26392621 ... )
26402622 """
2641- result = self ._call_rpc (
2642- "revoke_consent" , {"from_subject" : from_subject , "to_subject" : to_subject }
2643- )
2623+ result = self ._call_rpc ("revoke_consent" , {"from_subject" : from_subject , "to_subject" : to_subject })
26442624 return result # type: ignore[no-any-return]
26452625
26462626 def make_public (self , resource : tuple [str , str ], tenant_id : str | None = None ) -> str :
@@ -3064,9 +3044,7 @@ def list_saved_mounts(
30643044 >>> # List mounts for specific user
30653045 >>> alice_mounts = nx.list_saved_mounts(owner_user_id="google:alice123")
30663046 """
3067- result = self ._call_rpc (
3068- "list_saved_mounts" , {"owner_user_id" : owner_user_id , "tenant_id" : tenant_id }
3069- )
3047+ result = self ._call_rpc ("list_saved_mounts" , {"owner_user_id" : owner_user_id , "tenant_id" : tenant_id })
30703048 return result # type: ignore[no-any-return]
30713049
30723050 def load_mount (self , mount_point : str ) -> str :
@@ -3350,8 +3328,7 @@ def register_workspace(
33503328 created_by : str | None = None ,
33513329 tags : builtins .list [str ] | None = None ,
33523330 metadata : dict [str , Any ] | None = None ,
3353- session_id : str
3354- | None = None , # v0.5.0: If provided, workspace is session-scoped (temporary)
3331+ session_id : str | None = None , # v0.5.0: If provided, workspace is session-scoped (temporary)
33553332 ttl : timedelta | None = None , # v0.5.0: Time-to-live for auto-expiry
33563333 ) -> dict [str , Any ]:
33573334 """Register a directory as a workspace.
@@ -3755,9 +3732,7 @@ def ace_add_feedback(
37553732 result = self ._call_rpc ("ace_add_feedback" , params )
37563733 return result # type: ignore[no-any-return]
37573734
3758- def ace_get_trajectory_feedback (
3759- self , trajectory_id : str , context : dict | None = None
3760- ) -> builtins .list [dict ]:
3735+ def ace_get_trajectory_feedback (self , trajectory_id : str , context : dict | None = None ) -> builtins .list [dict ]:
37613736 """Get all feedback for a trajectory.
37623737
37633738 Args:
0 commit comments