Dokuwiki: Use Dict typing over Mapping

Mapping doesn't provide __setitem__ which we need.
This commit is contained in:
Danny Robson 2019-07-07 14:35:44 +10:00
parent 93c173ae10
commit 380254d8ab

View File

@ -2,7 +2,7 @@
############################################################################### ###############################################################################
from typing import List, Mapping, Iterable, Callable, Generator from typing import List, Dict, Iterable, Callable, Generator
from operator import attrgetter from operator import attrgetter
import os.path import os.path
@ -274,8 +274,8 @@ class Dokuwiki:
editors. Either way it will never rewrite any data. editors. Either way it will never rewrite any data.
""" """
users: Mapping[str, User] users: Dict[str, User]
media: Mapping[str, List[Change]] media: Dict[str, List[Change]]
changes: List[Change] changes: List[Change]
def _record_media(self, change): def _record_media(self, change):
@ -298,7 +298,7 @@ class Dokuwiki:
for k, v in self.media.items(): for k, v in self.media.items():
v.sort(key=attrgetter('timestamp'), reverse=True) v.sort(key=attrgetter('timestamp'), reverse=True)
def _find_users(self) -> Mapping[str, User]: def _find_users(self) -> Dict[str, User]:
""" """
Parses the users.auth.php file to discover all listed users. Parses the users.auth.php file to discover all listed users.
:return: A mapping of login to User objects :return: A mapping of login to User objects