|
25 | 25 | import functools |
26 | 26 | import logging |
27 | 27 | import os |
28 | | -from typing import Any, Callable, Dict, List, Optional, TypeVar, cast |
| 28 | +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, TypeVar, cast |
29 | 29 |
|
30 | 30 | import twisted |
31 | 31 | from twisted.mail.smtp import sendmail |
|
69 | 69 | from synapse.handlers.groups_local import GroupsLocalHandler, GroupsLocalWorkerHandler |
70 | 70 | from synapse.handlers.initial_sync import InitialSyncHandler |
71 | 71 | from synapse.handlers.message import EventCreationHandler, MessageHandler |
72 | | -from synapse.handlers.oidc_handler import OidcHandler |
73 | 72 | from synapse.handlers.pagination import PaginationHandler |
74 | 73 | from synapse.handlers.password_policy import PasswordPolicyHandler |
75 | 74 | from synapse.handlers.presence import PresenceHandler |
|
85 | 84 | from synapse.handlers.room_list import RoomListHandler |
86 | 85 | from synapse.handlers.room_member import RoomMemberMasterHandler |
87 | 86 | from synapse.handlers.room_member_worker import RoomMemberWorkerHandler |
88 | | -from synapse.handlers.saml_handler import SamlHandler |
89 | 87 | from synapse.handlers.set_password import SetPasswordHandler |
90 | 88 | from synapse.handlers.stats import StatsHandler |
91 | 89 | from synapse.handlers.sync import SyncHandler |
|
120 | 118 |
|
121 | 119 | logger = logging.getLogger(__name__) |
122 | 120 |
|
| 121 | +if TYPE_CHECKING: |
| 122 | + from synapse.handlers.oidc_handler import OidcHandler |
| 123 | + from synapse.handlers.saml_handler import SamlHandler |
| 124 | + |
123 | 125 |
|
124 | 126 | T = TypeVar("T", bound=Callable[..., Any]) |
125 | 127 |
|
@@ -603,12 +605,14 @@ def get_cas_handler(self) -> CasHandler: |
603 | 605 | return CasHandler(self) |
604 | 606 |
|
605 | 607 | @cache_in_self |
606 | | - def get_saml_handler(self) -> SamlHandler: |
| 608 | + def get_saml_handler(self) -> "SamlHandler": |
| 609 | + from synapse.handlers.saml_handler import SamlHandler |
607 | 610 |
|
608 | 611 | return SamlHandler(self) |
609 | 612 |
|
610 | 613 | @cache_in_self |
611 | | - def get_oidc_handler(self) -> OidcHandler: |
| 614 | + def get_oidc_handler(self) -> "OidcHandler": |
| 615 | + from synapse.handlers.oidc_handler import OidcHandler |
612 | 616 |
|
613 | 617 | return OidcHandler(self) |
614 | 618 |
|
|
0 commit comments