Skip to content

Commit 969ee97

Browse files
committed
refactor: new imports
1 parent e7f8f37 commit 969ee97

File tree

18 files changed

+78
-30
lines changed

18 files changed

+78
-30
lines changed

backend/api/browse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from typing import Literal
22

3-
from nxtools import slugify
43
from pydantic import Field
54

65
import nebula
76
from nebula.common import SerializableValue, sql_list
87
from nebula.enum import MetaClass
98
from nebula.exceptions import NebulaException
109
from nebula.metadata.normalize import normalize_meta
10+
from nx.utils import slugify
1111
from server.dependencies import CurrentUser
1212
from server.models import RequestModel, ResponseModel
1313
from server.request import APIRequest

backend/api/jobs/actions_request.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from nxtools import xml
21
from pydantic import Field
32

43
import nebula
54
from nebula.enum import * # noqa
5+
from nx.utils import xml
66
from server.dependencies import CurrentUser
77
from server.models import RequestModel, ResponseModel
88
from server.request import APIRequest
@@ -55,6 +55,8 @@ async def handle(
5555
continue
5656

5757
action_settings = xml(row["settings"])
58+
if action_settings is None:
59+
continue
5860

5961
if allow_if_elm := action_settings.findall("allow_if"):
6062
allow_if_cond = allow_if_elm[0].text

backend/api/jobs/jobs_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import time
22
from typing import Literal
33

4-
from nxtools import slugify
54
from pydantic import Field
65

76
import nebula
87
from nebula.enum import JobState
8+
from nx.utils import slugify
99
from server.dependencies import CurrentUser
1010
from server.models import RequestModel, ResponseModel
1111
from server.request import APIRequest

backend/api/scheduler/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncpg
2-
from nxtools import format_time
32

43
import nebula
4+
from nx.utils import format_time
55

66

77
async def get_event_at_time(id_channel: int, timestamp: int) -> nebula.Event | None:

backend/nebula/db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
class DB:
15-
_pool: asyncpg.pool.Pool | None = None # type: ignore
15+
_pool: asyncpg.pool.Pool | None = None
1616

1717
async def init_connection(self, conn) -> None: # type: ignore
1818
await conn.set_type_codec(
@@ -30,7 +30,7 @@ async def connect(self) -> None:
3030
)
3131
assert self._pool is not None
3232

33-
async def pool(self) -> asyncpg.pool.Pool: # type: ignore
33+
async def pool(self) -> asyncpg.pool.Pool:
3434
"""Return the Postgres connection pool. If it doesn't exist, create it."""
3535
if self._pool is None:
3636
await self.connect()
@@ -67,6 +67,6 @@ async def iterate(self, query: str, *args: Any) -> AsyncGenerator[asyncpg.Record
6767
yield record
6868

6969

70-
DatabaseConnection = asyncpg.pool.PoolConnectionProxy | DB # type: ignore
70+
DatabaseConnection = asyncpg.pool.PoolConnectionProxy | DB
7171

7272
db = DB()

backend/nebula/helpers/scheduling.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import datetime
22
from typing import TYPE_CHECKING, Any
33

4-
from nxtools import datestr2ts, s2time
5-
64
import nebula
5+
from nx.utils import datestr2ts, s2time
76

87
if TYPE_CHECKING:
98
from nebula.settings.models import AcceptModel, PlayoutChannelSettings

backend/nebula/metadata/format.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from typing import TYPE_CHECKING, Any
22

3-
from nxtools import format_filesize, format_time, s2tc
4-
53
from nebula.enum import ContentType, MediaType, MetaClass, ObjectStatus, QCState
64
from nebula.metadata.utils import get_cs_titles
75
from nebula.settings import settings
6+
from nx.utils import format_filesize, format_time, s2tc
87

98
if TYPE_CHECKING:
109
from nebula.objects.base import BaseObject

backend/nebula/metadata/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
from functools import lru_cache
44
from typing import Any
55

6-
from nxtools import unaccent
7-
86
from nebula.settings import settings
97
from nebula.settings.common import LanguageCode
8+
from nx.utils import unaccent
109

1110

1211
@lru_cache(maxsize=512)

backend/nebula/objects/asset.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
22

3-
from nxtools import get_base_name, slugify
4-
53
from nebula.enum import ContentType, MediaType, ObjectStatus
64
from nebula.objects.base import BaseObject
75
from nebula.settings import settings
86
from nebula.storages import storages
7+
from nx.utils import get_base_name, slugify
98

109

1110
class Asset(BaseObject):

backend/nebula/objects/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Any, TypeVar
33

44
import asyncpg
5-
from nxtools import slugify
65

76
from nebula.db import DB, DatabaseConnection, db
87
from nebula.enum import ObjectTypeId
@@ -16,6 +15,7 @@
1615
from nebula.metadata.format import format_meta
1716
from nebula.metadata.normalize import normalize_meta
1817
from nebula.settings import settings
18+
from nx.utils import slugify
1919

2020
T = TypeVar("T", bound="BaseObject")
2121

0 commit comments

Comments
 (0)