Add more type hints

This commit is contained in:
Tulir Asokan
2018-07-25 10:40:31 -04:00
parent ae334b9a04
commit dbfb980bde
20 changed files with 751 additions and 595 deletions
+6 -7
View File
@@ -23,15 +23,14 @@ from .. import puppet as pu, portal as po
ManagementRoomList = List[Tuple[str, str]]
RoomIDList = List[str]
PortalList = List[po.Portal]
async def _find_rooms(intent: IntentAPI) -> Tuple[
ManagementRoomList, RoomIDList, PortalList, PortalList]:
async def _find_rooms(intent: IntentAPI) -> Tuple[ManagementRoomList, RoomIDList,
List["po.Portal"], List["po.Portal"]]:
management_rooms = [] # type: ManagementRoomList
unidentified_rooms = [] # type: RoomIDList
portals = [] # type: PortalList
empty_portals = [] # type: PortalList
portals = [] # type: List[po.Portal]
empty_portals = [] # type: List[po.Portal]
rooms = await intent.get_joined_rooms()
for room in rooms:
@@ -108,8 +107,8 @@ async def clean_rooms(evt: CommandEvent):
async def set_rooms_to_clean(evt, management_rooms: ManagementRoomList,
unidentified_rooms: RoomIDList, portals: PortalList,
empty_portals: PortalList):
unidentified_rooms: RoomIDList, portals: List["po.Portal"],
empty_portals: List["po.Portal"]):
command = evt.args[0]
rooms_to_clean = []
if command == "clean-recommended":
+1 -1
View File
@@ -222,7 +222,7 @@ async def bridge(evt: CommandEvent):
"chat to this room, use `$cmdprefix+sp continue`")
async def cleanup_old_portal_while_bridging(evt: CommandEvent, portal: po.Portal):
async def cleanup_old_portal_while_bridging(evt: CommandEvent, portal: "po.Portal"):
if not portal.mxid:
await evt.reply("The portal seems to have lost its Matrix room between you"
"calling `$cmdprefix+sp bridge` and this command.\n\n"