From f091fd687a9f62ccef82a5ebae47267c4379cd8a Mon Sep 17 00:00:00 2001 From: Joan Fontanals Date: Wed, 3 Apr 2024 09:57:20 +0200 Subject: [PATCH] chore: update black dependency (#6162) Co-authored-by: Jina Dev Bot --- extra-requirements.txt | 2 +- jina/clients/__init__.py | 4 +--- jina/orchestrate/flow/base.py | 6 ++---- jina/serve/executors/__init__.py | 28 ++++++++++++++-------------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/extra-requirements.txt b/extra-requirements.txt index 089c12007756e..2c8de1b058d8d 100644 --- a/extra-requirements.txt +++ b/extra-requirements.txt @@ -70,7 +70,7 @@ flaky: test mock: test requests-mock: test pytest-custom_exit_code: test -black==22.3.0: test +black==24.3.0: test kubernetes>=18.20.0: test pytest-kind==22.11.1: test pytest-lazy-fixture: test diff --git a/jina/clients/__init__.py b/jina/clients/__init__.py index 14c48b4de1789..6484240d771dd 100644 --- a/jina/clients/__init__.py +++ b/jina/clients/__init__.py @@ -73,9 +73,7 @@ def Client( # overload_inject_end_client -def Client( - args: Optional['argparse.Namespace'] = None, **kwargs -) -> Union[ +def Client(args: Optional['argparse.Namespace'] = None, **kwargs) -> Union[ 'AsyncWebSocketClient', 'WebSocketClient', 'AsyncGRPCClient', diff --git a/jina/orchestrate/flow/base.py b/jina/orchestrate/flow/base.py index 6ac5c5a33111e..4e3abe955bf11 100644 --- a/jina/orchestrate/flow/base.py +++ b/jina/orchestrate/flow/base.py @@ -1778,10 +1778,8 @@ def build(self, copy_flow: bool = False, **kwargs) -> 'Flow': op_flow._deployment_nodes[GATEWAY_NAME].args.graph_description = json.dumps( op_flow._get_graph_representation() ) - op_flow._deployment_nodes[ - GATEWAY_NAME - ].args.deployments_addresses = json.dumps( - op_flow._get_deployments_addresses() + op_flow._deployment_nodes[GATEWAY_NAME].args.deployments_addresses = ( + json.dumps(op_flow._get_deployments_addresses()) ) op_flow._deployment_nodes[GATEWAY_NAME].update_pod_args() diff --git a/jina/serve/executors/__init__.py b/jina/serve/executors/__init__.py index b6c4fe2473dcf..06416159bf3fa 100644 --- a/jina/serve/executors/__init__.py +++ b/jina/serve/executors/__init__.py @@ -401,10 +401,10 @@ def __init__( self._init_monitoring() self._init_workspace = workspace if __dry_run_endpoint__ not in self.requests: - self.requests[ - __dry_run_endpoint__ - ] = _FunctionWithSchema.get_function_with_schema( - self.__class__._dry_run_func + self.requests[__dry_run_endpoint__] = ( + _FunctionWithSchema.get_function_with_schema( + self.__class__._dry_run_func + ) ) else: self.logger.warning( @@ -412,10 +412,10 @@ def __init__( f' So it is recommended not to expose this endpoint. ' ) if type(self) == BaseExecutor: - self.requests[ - __default_endpoint__ - ] = _FunctionWithSchema.get_function_with_schema( - self.__class__._dry_run_func + self.requests[__default_endpoint__] = ( + _FunctionWithSchema.get_function_with_schema( + self.__class__._dry_run_func + ) ) self._lock = contextlib.AsyncExitStack() @@ -595,14 +595,14 @@ def _add_requests(self, _requests: Optional[Dict]): _func = getattr(self.__class__, func) if callable(_func): # the target function is not decorated with `@requests` yet - self.requests[ - endpoint - ] = _FunctionWithSchema.get_function_with_schema(_func) + self.requests[endpoint] = ( + _FunctionWithSchema.get_function_with_schema(_func) + ) elif typename(_func) == 'jina.executors.decorators.FunctionMapper': # the target function is already decorated with `@requests`, need unwrap with `.fn` - self.requests[ - endpoint - ] = _FunctionWithSchema.get_function_with_schema(_func.fn) + self.requests[endpoint] = ( + _FunctionWithSchema.get_function_with_schema(_func.fn) + ) else: raise TypeError( f'expect {typename(self)}.{func} to be a function, but receiving {typename(_func)}'