jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/886952 )

Change subject: [doc] add __doc__ for classes from LogEntryFactory
......................................................................

[doc] add __doc__ for classes from LogEntryFactory

Change-Id: Ieba1a824dab1c19459781b6897cf3da1b4d9c463
---
M pywikibot/logentries.py
1 file changed, 25 insertions(+), 10 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified




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 https://gerrit.wikimedia.org/r/c/pywikibot/core/+/886952
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ieba1a824dab1c19459781b6897cf3da1b4d9c463
Gerrit-Change-Number: 886952
Gerrit-PatchSet: 5
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to