Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 218e22a

Browse files
committed
Fix circular dependency
1 parent 7fe8554 commit 218e22a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

synapse/appservice/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from typing import TYPE_CHECKING, List
1818

1919
from synapse.api.constants import EventTypes
20-
from synapse.appservice.api import ApplicationServiceApi
2120
from synapse.events import EventBase
2221
from synapse.types import GroupID, UserID, get_domain_from_id
2322
from synapse.util.caches.descriptors import _CacheContext, cached
@@ -164,7 +163,7 @@ async def _matches_user(self, event, store):
164163

165164
@cached(num_args=1, cache_context=True)
166165
async def matches_user_in_member_list(
167-
self, room_id: str, store: DataStore, cache_context: _CacheContext
166+
self, room_id: str, store, cache_context: _CacheContext
168167
):
169168
member_list = await store.get_users_in_room(room_id)
170169

@@ -212,7 +211,7 @@ async def is_interested(self, event, store=None) -> bool:
212211

213212
@cached(num_args=1, cache_context=True)
214213
async def is_interested_in_presence(
215-
self, user_id: UserID, store: DataStore, cache_context: _CacheContext
214+
self, user_id: UserID, store, cache_context: _CacheContext
216215
):
217216
# Find all the rooms the sender is in
218217
if self.is_interested_in_user(user_id.to_string()):
@@ -303,7 +302,7 @@ def __init__(
303302
self.events = events
304303
self.ephemeral = ephemeral
305304

306-
async def send(self, as_api: ApplicationServiceApi) -> bool:
305+
async def send(self, as_api) -> bool:
307306
"""Sends this transaction using the provided AS API interface.
308307
309308
Args:

synapse/appservice/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
# limitations under the License.
1515
import logging
1616
import urllib
17-
from typing import Any, List, Optional
17+
from typing import TYPE_CHECKING, Any, List, Optional
1818

1919
from prometheus_client import Counter
2020

2121
from synapse.api.constants import EventTypes, ThirdPartyEntityKind
2222
from synapse.api.errors import CodeMessageException
23-
from synapse.appservice import ApplicationService
2423
from synapse.events import EventBase
2524
from synapse.events.utils import serialize_event
2625
from synapse.http.client import SimpleHttpClient
2726
from synapse.types import JsonDict, ThirdPartyInstanceID
2827
from synapse.util.caches.response_cache import ResponseCache
2928

29+
if TYPE_CHECKING:
30+
from synapse.appservice import ApplicationService
31+
3032
logger = logging.getLogger(__name__)
3133

3234
sent_transactions_counter = Counter(
@@ -202,7 +204,7 @@ async def _get() -> Optional[JsonDict]:
202204

203205
async def push_bulk(
204206
self,
205-
service: ApplicationService,
207+
service: "ApplicationService",
206208
events: List[EventBase],
207209
ephemeral: Optional[Any] = None,
208210
txn_id: Optional[int] = None,

0 commit comments

Comments
 (0)