Fix MediaCache asyncio Semaphore early import bug
This commit is contained in:
parent
3a2771d138
commit
7e5896f52b
1
TODO.md
1
TODO.md
|
@ -90,7 +90,6 @@
|
||||||
|
|
||||||
- Multiaccount aliases:
|
- Multiaccount aliases:
|
||||||
- Warn when conflict with another alias
|
- Warn when conflict with another alias
|
||||||
- Forbid spaces?
|
|
||||||
- Add an explanation tooltip
|
- Add an explanation tooltip
|
||||||
- Prevent sending messages with a user not in the current room
|
- Prevent sending messages with a user not in the current room
|
||||||
- Support \ escaping
|
- Support \ escaping
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
from abc import ABC
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import TYPE_CHECKING, Any, Optional
|
from typing import TYPE_CHECKING, Any, Optional
|
||||||
|
|
||||||
import pyotherside
|
import pyotherside
|
||||||
|
|
||||||
from .models import SyncId
|
|
||||||
from .utils import serialize_value_for_qml
|
from .utils import serialize_value_for_qml
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from .models import SyncId
|
||||||
from .models.model_item import ModelItem
|
from .models.model_item import ModelItem
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +65,7 @@ class LoopException(PyOtherSideEvent):
|
||||||
class ModelItemInserted(PyOtherSideEvent):
|
class ModelItemInserted(PyOtherSideEvent):
|
||||||
"""Indicate a `ModelItem` insertion into a `Backend` `Model`."""
|
"""Indicate a `ModelItem` insertion into a `Backend` `Model`."""
|
||||||
|
|
||||||
sync_id: SyncId = field()
|
sync_id: "SyncId" = field()
|
||||||
index: int = field()
|
index: int = field()
|
||||||
item: "ModelItem" = field()
|
item: "ModelItem" = field()
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ class ModelItemInserted(PyOtherSideEvent):
|
||||||
class ModelItemFieldChanged(PyOtherSideEvent):
|
class ModelItemFieldChanged(PyOtherSideEvent):
|
||||||
"""Indicate a `ModelItem`'s field value change in a `Backend` `Model`."""
|
"""Indicate a `ModelItem`'s field value change in a `Backend` `Model`."""
|
||||||
|
|
||||||
sync_id: SyncId = field()
|
sync_id: "SyncId" = field()
|
||||||
item_index_then: int = field()
|
item_index_then: int = field()
|
||||||
item_index_now: int = field()
|
item_index_now: int = field()
|
||||||
changed_field: str = field()
|
changed_field: str = field()
|
||||||
|
@ -86,7 +85,7 @@ class ModelItemFieldChanged(PyOtherSideEvent):
|
||||||
class ModelItemDeleted(PyOtherSideEvent):
|
class ModelItemDeleted(PyOtherSideEvent):
|
||||||
"""Indicate the removal of a `ModelItem` from a `Backend` `Model`."""
|
"""Indicate the removal of a `ModelItem` from a `Backend` `Model`."""
|
||||||
|
|
||||||
sync_id: SyncId = field()
|
sync_id: "SyncId" = field()
|
||||||
index: int = field()
|
index: int = field()
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,4 +93,4 @@ class ModelItemDeleted(PyOtherSideEvent):
|
||||||
class ModelCleared(PyOtherSideEvent):
|
class ModelCleared(PyOtherSideEvent):
|
||||||
"""Indicate that a `Backend` `Model` was cleared."""
|
"""Indicate that a `Backend` `Model` was cleared."""
|
||||||
|
|
||||||
sync_id: SyncId = field()
|
sync_id: "SyncId" = field()
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
"""Install `uvloop` if possible and provide a `QMLBridge`."""
|
"""Install `uvloop` if possible and provide a `QMLBridge`."""
|
||||||
|
|
||||||
|
# WARNING: make sure to not top-level import the media_cache module here,
|
||||||
|
# directly or indirectly via another module import (e.g. backend).
|
||||||
|
# See https://stackoverflow.com/a/55918049
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging as log
|
import logging as log
|
||||||
import signal
|
import signal
|
||||||
|
@ -11,7 +15,6 @@ from operator import attrgetter
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Coroutine, Sequence
|
from typing import Coroutine, Sequence
|
||||||
|
|
||||||
from .backend import Backend
|
|
||||||
from .pyotherside_events import CoroutineDone, LoopException
|
from .pyotherside_events import CoroutineDone, LoopException
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -36,6 +39,7 @@ class QMLBridge:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
from .backend import Backend
|
||||||
self.backend: Backend = Backend()
|
self.backend: Backend = Backend()
|
||||||
|
|
||||||
self._loop = asyncio.get_event_loop()
|
self._loop = asyncio.get_event_loop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user