mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 00:55:06 -04:00
Add type hints to groups code. (#9393)
This commit is contained in:
parent
e1071fd625
commit
d2f0ec12d5
9 changed files with 341 additions and 124 deletions
|
@ -14,7 +14,9 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json
|
||||
|
@ -26,6 +28,9 @@ from synapse.util import json_encoder
|
|||
_DEFAULT_CATEGORY_ID = ""
|
||||
_DEFAULT_ROLE_ID = ""
|
||||
|
||||
# A room in a group.
|
||||
_RoomInGroup = TypedDict("_RoomInGroup", {"room_id": str, "is_public": bool})
|
||||
|
||||
|
||||
class GroupServerWorkerStore(SQLBaseStore):
|
||||
async def get_group(self, group_id: str) -> Optional[Dict[str, Any]]:
|
||||
|
@ -72,7 +77,7 @@ class GroupServerWorkerStore(SQLBaseStore):
|
|||
|
||||
async def get_rooms_in_group(
|
||||
self, group_id: str, include_private: bool = False
|
||||
) -> List[Dict[str, Union[str, bool]]]:
|
||||
) -> List[_RoomInGroup]:
|
||||
"""Retrieve the rooms that belong to a given group. Does not return rooms that
|
||||
lack members.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue