22import os
33import typing
44
5+ from ..functions .ext .asgi import Application
56from ._config import AppConfig
6- from ._connection_info import ConnectionInfo , UdfConnectionInfo
7+ from ._connection_info import UdfConnectionInfo
78from ._process import kill_process_by_port
8- from ..functions .ext .asgi import Application
99
1010if typing .TYPE_CHECKING :
1111 from ._uvicorn_util import AwaitableUvicornServer
@@ -18,7 +18,7 @@ async def run_udf_app(
1818 replace_existing : bool ,
1919 log_level : str = 'error' ,
2020 kill_existing_app_server : bool = True ,
21- ) -> ConnectionInfo :
21+ ) -> UdfConnectionInfo :
2222 global _running_server
2323 from ._uvicorn_util import AwaitableUvicornServer
2424
@@ -41,10 +41,10 @@ async def run_udf_app(
4141 kill_process_by_port (app_config .listen_port )
4242
4343 base_url = generate_base_url (app_config )
44-
45- udf_suffix = ""
44+
45+ udf_suffix = ''
4646 if app_config .running_interactively :
47- udf_suffix = " _test"
47+ udf_suffix = ' _test'
4848 app = Application (url = base_url , app_mode = 'managed' , name_suffix = udf_suffix )
4949
5050 config = uvicorn .Config (
@@ -65,9 +65,10 @@ async def run_udf_app(
6565
6666 return UdfConnectionInfo (base_url , app .get_function_info ())
6767
68- def generate_base_url (app_config : AppConfig ) -> str :
68+
69+ def generate_base_url (app_config : AppConfig ) -> str :
6970 if not app_config .is_gateway_enabled :
70- raise RuntimeError (" Python UDFs are not available if Nova Gateway is not enabled" )
71+ raise RuntimeError (' Python UDFs are not available if Nova Gateway is not enabled' )
7172
7273 if not app_config .running_interactively :
7374 return app_config .base_url
@@ -77,6 +78,8 @@ def generate_base_url(app_config: AppConfig) -> str :
7778 if app_config .is_local_dev :
7879 gateway_url = os .environ .get ('SINGLESTOREDB_NOVA_GATEWAY_DEV_ENDPOINT' )
7980 if gateway_url is None :
80- raise RuntimeError ("Missing SINGLESTOREDB_NOVA_GATEWAY_DEV_ENDPOINT environment variable." )
81+ raise RuntimeError (
82+ 'Missing SINGLESTOREDB_NOVA_GATEWAY_DEV_ENDPOINT environment variable.' ,
83+ )
8184
82- return f'{ gateway_url } /pythonudfs/{ app_config .notebook_server_id } /interactive'
85+ return f'{ gateway_url } /pythonudfs/{ app_config .notebook_server_id } /interactive/ '
0 commit comments