Skip to content

Commit 99132cf

Browse files
fixed pre commit checks
1 parent 321119c commit 99132cf

4 files changed

Lines changed: 20 additions & 14 deletions

File tree

singlestoredb/apps/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from ._cloud_functions import run_function_app # noqa: F401
22
from ._dashboards import run_dashboard_app # noqa: F401
3-
from ._python_udfs import run_udf_app # noqa: F401
3+
from ._python_udfs import run_udf_app # noqa: F401

singlestoredb/apps/_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def from_env(cls) -> 'AppConfig':
5858
user_token=user_token,
5959
running_interactively=running_interactively,
6060
is_gateway_enabled=is_gateway_enabled,
61-
is_local_dev=is_local_dev_env_var=="true"
61+
is_local_dev=is_local_dev_env_var == 'true',
6262
)
6363

6464
@property
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from dataclasses import dataclass
2-
from typing import Optional, Dict, Any
2+
from typing import Any
3+
from typing import Dict
4+
from typing import Optional
35

46

57
@dataclass
@@ -9,7 +11,8 @@ class ConnectionInfo:
911
# Only present in interactive mode
1012
token: Optional[str]
1113

14+
1215
@dataclass
1316
class UdfConnectionInfo:
1417
url: str
15-
functions: Dict[str, Any]
18+
functions: Dict[str, Any]

singlestoredb/apps/_python_udfs.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import os
33
import typing
44

5+
from ..functions.ext.asgi import Application
56
from ._config import AppConfig
6-
from ._connection_info import ConnectionInfo, UdfConnectionInfo
7+
from ._connection_info import UdfConnectionInfo
78
from ._process import kill_process_by_port
8-
from ..functions.ext.asgi import Application
99

1010
if 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

Comments
 (0)