jenkins-bot submitted this change.
[doc] add __doc__ for classes from LogEntryFactory
Change-Id: Ieba1a824dab1c19459781b6897cf3da1b4d9c463
---
M pywikibot/logentries.py
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 9208ec0..00aed03 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -9,7 +9,7 @@
from typing import Any, Optional, Type, Union
import pywikibot
-from pywikibot.backports import Dict, List, Tuple
+from pywikibot.backports import Dict, List
from pywikibot.exceptions import Error, HiddenKeyError
from pywikibot.tools import cached
@@ -363,15 +363,21 @@
or use the get_valid_entry_class instance method instead.
"""
if logtype not in cls._logtypes:
- bases: Tuple['LogEntry', ...] = (OtherLogEntry, )
- if logtype in ('newusers', 'thanks'):
- bases = (UserTargetLogEntry, OtherLogEntry)
-
- classname = str(logtype.capitalize() + 'Entry'
- if logtype is not None
- else OtherLogEntry.__name__)
- cls._logtypes[logtype] = type(
- classname, bases, {'_expected_type': logtype})
+ if logtype is None:
+ cls._logtypes[logtype] = OtherLogEntry
+ else:
+ if logtype in ('newusers', 'thanks'):
+ bases = (UserTargetLogEntry, OtherLogEntry)
+ else:
+ bases = (OtherLogEntry,)
+ cls._logtypes[logtype] = type(
+ f'{logtype.capitalize()}Entry',
+ bases,
+ {
+ '__doc__': f'{logtype.capitalize()} log entry',
+ '_expected_type': logtype,
+ },
+ )
return cls._logtypes[logtype]
def _create_from_data(self, logdata: Dict[str, Any]) -> LogEntry:
To view, visit change 886952. To unsubscribe, or for help writing mail filters, visit settings.