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

Change subject: [IMPR] Add some classes and functions to __all__ variable in 
pywikibot
......................................................................

[IMPR] Add some classes and functions to __all__ variable in pywikibot

- ignore deprecated setAction function
- ignore stopme function which is always used at exit time
  and it is not needed to call it
- remove inputChoice which has been dropped
- update documentation and fix reST markup

Bug: T122879
Change-Id: I08ad939bdb53c565adaf922a0547354be7676998
---
M pywikibot/__init__.py
1 file changed, 49 insertions(+), 50 deletions(-)

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



diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 97dadda..ca7e428 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -15,6 +15,7 @@
 from contextlib import suppress
 from decimal import Decimal
 from queue import Queue
+from typing import Optional, Union
 from warnings import warn

 from pywikibot.__metadata__ import (
@@ -84,23 +85,23 @@
     '__maintainer__', '__maintainer_email__', '__name__', '__release__',
     '__url__', '__version__',
     'BadTitle', 'Bot', 'calledModuleName', 'CaptchaError', 'CascadeLockedPage',
-    'Category', 'CircularRedirect', 'Claim', 'config',
+    'Category', 'CircularRedirect', 'Claim', 'config', 'Coordinate',
     'CoordinateGlobeUnknownException', 'critical', 'CurrentPageBot', 'debug',
     'EditConflict', 'error', 'Error', 'exception', 'FatalServerError',
     'FilePage', 'handle_args', 'handleArgs', 'html2unicode', 'input',
-    'input_choice', 'input_yn', 'inputChoice', 'InterwikiRedirectPage',
-    'InvalidTitle', 'IsNotRedirectPage', 'IsRedirectPage', 'ItemPage', 'Link',
-    'LockedNoPage', 'LockedPage', 'log', 'NoCreateError', 'NoMoveTarget',
-    'NoPage', 'NoSuchSite', 'NoUsername', 'NoWikibaseEntity',
-    'OtherPageSaveError', 'output', 'Page', 'PageCreatedConflict',
-    'PageDeletedConflict', 'PageNotSaved', 'PageRelatedError',
-    'PageSaveRelatedError', 'PropertyPage', 'QuitKeyboardInterrupt',
-    'SectionError', 'Server504Error', 'ServerError', 'showHelp', 'Site',
-    'SiteDefinitionError', 'SiteLink', 'SpamblacklistError', 'stdout',
-    'TitleblacklistError', 'translate', 'ui', 'unicode2html',
-    'UnknownExtension', 'UnknownFamily', 'UnknownSite', 'UnsupportedPage',
-    'UploadWarning', 'url2unicode', 'User', 'UserBlocked', 'warning',
-    'WikiBaseError', 'WikidataBot',
+    'input_choice', 'input_yn', 'InterwikiRedirectPage', 'InvalidTitle',
+    'IsNotRedirectPage', 'IsRedirectPage', 'ItemPage', 'Link', 'LockedNoPage',
+    'LockedPage', 'log', 'NoCreateError', 'NoMoveTarget', 'NoPage',
+    'NoSuchSite', 'NoUsername', 'NoWikibaseEntity', 'OtherPageSaveError',
+    'output', 'Page', 'PageCreatedConflict', 'PageDeletedConflict',
+    'PageNotSaved', 'PageRelatedError', 'PageSaveRelatedError', 'PropertyPage',
+    'QuitKeyboardInterrupt', 'SectionError', 'Server504Error', 'ServerError',
+    'showDiff', 'showHelp', 'Site', 'SiteDefinitionError', 'SiteLink',
+    'SpamblacklistError', 'stdout', 'Timestamp', 'TitleblacklistError',
+    'translate', 'ui', 'unicode2html', 'UnknownExtension', 'UnknownFamily',
+    'UnknownSite', 'UnsupportedPage', 'UploadWarning', 'url2unicode', 'User',
+    'UserBlocked', 'warning', 'WbGeoShape', 'WbMonolingualText', 'WbQuantity',
+    'WbTabularData', 'WbTime', 'WbUnknown', 'WikiBaseError', 'WikidataBot',
 )
 __all__ += textlib_methods

@@ -336,7 +337,7 @@
                    globe, site=site, globe_item=data['globe'])

     @property
-    def precision(self):
+    def precision(self) -> Optional[float]:
         """
         Return the precision of the geo coordinate.

@@ -360,10 +361,9 @@
         M{r_φ = r cos φ}, where r is the radius of earth, φ the latitude

         Therefore::
+
             precision = math.degrees(
                 self._dim/(radius*math.cos(math.radians(self.lat))))
-
-        @rtype: float or None
         """
         if self._dim is None and self._precision is None:
             return None
@@ -377,7 +377,7 @@
     def precision(self, value):
         self._precision = value

-    def precisionToDim(self):
+    def precisionToDim(self) -> Optional[int]:
         """
         Convert precision from Wikibase to GeoData's dim and return the latter.

@@ -387,17 +387,18 @@

         Carrying on from the earlier derivation of precision, since
         precision = math.degrees(dim/(radius*math.cos(math.radians(self.lat))))
-        we get:
+        we get::
+
             dim = math.radians(
                 precision)*radius*math.cos(math.radians(self.lat))
+
         But this is not valid, since it returns a float value for dim which is
         an integer. We must round it off to the nearest integer.

         Therefore::
+
             dim = int(round(math.radians(
                 precision)*radius*math.cos(math.radians(self.lat))))
-
-        @rtype: int or None
         """
         if self._dim is None and self._precision is None:
             raise ValueError('No values set for dim or precision')
@@ -461,12 +462,20 @@
     _items = ('year', 'month', 'day', 'hour', 'minute', 'second',
               'precision', 'before', 'after', 'timezone', 'calendarmodel')

-    def __init__(self, year=None, month=None, day=None,
-                 hour=None, minute=None, second=None,
-                 precision=None, before=0, after=0,
-                 timezone=0, calendarmodel=None, site=None):
-        """
-        Create a new WbTime object.
+    def __init__(self,
+                 year: Optional[int] = None,
+                 month: Optional[int] = None,
+                 day: Optional[int] = None,
+                 hour: Optional[int] = None,
+                 minute: Optional[int] = None,
+                 second: Optional[int] = None,
+                 precision: Union[int, str, None] = None,
+                 before: int = 0,
+                 after: int = 0,
+                 timezone: int = 0,
+                 calendarmodel: Optional[str] = None,
+                 site=None):
+        """Create a new WbTime object.

         The precision can be set by the Wikibase int value (0-14) or by a human
         readable string, e.g., 'hour'. If no precision is given, it is set
@@ -474,6 +483,7 @@

         Timezone information is given in three different ways depending on the
         time:
+
         * Times after the implementation of UTC (1972): as an offset from UTC
           in minutes;
         * Times before the implementation of UTC: the offset of the time zone
@@ -483,29 +493,18 @@
           to minutes.

         @param year: The year as a signed integer of between 1 and 16 digits.
-        @type year: int
         @param month: Month
-        @type month: int
         @param day: Day
-        @type day: int
         @param hour: Hour
-        @type hour: int
         @param minute: Minute
-        @type minute: int
         @param second: Second
-        @type second: int
         @param precision: The unit of the precision of the time.
-        @type precision: int or str
         @param before: Number of units after the given time it could be, if
             uncertain. The unit is given by the precision.
-        @type before: int
         @param after: Number of units before the given time it could be, if
             uncertain. The unit is given by the precision.
-        @type after: int
         @param timezone: Timezone information in minutes.
-        @type timezone: int
         @param calendarmodel: URI identifying the calendar model
-        @type calendarmodel: str
         @param site: The Wikibase site
         @type site: pywikibot.site.DataSite
         """
@@ -555,12 +554,18 @@
                 raise ValueError('Invalid precision: "%s"' % precision)

     @classmethod
-    def fromTimestr(cls, datetimestr, precision=14, before=0, after=0,
-                    timezone=0, calendarmodel=None, site=None):
-        """
-        Create a new WbTime object from a UTC date/time string.
+    def fromTimestr(cls,
+                    datetimestr: str,
+                    precision: Union[int, str] = 14,
+                    before: int = 0,
+                    after: int = 0,
+                    timezone: int = 0,
+                    calendarmodel: Optional[str] = None,
+                    site=None):
+        """Create a new WbTime object from a UTC date/time string.

         The timestamp differs from ISO 8601 in that:
+
         * The year is always signed and having between 1 and 16 digits;
         * The month, day and time are zero if they are unknown;
         * The Z is discarded since time zone is determined from the timezone
@@ -568,19 +573,13 @@

         @param datetimestr: Timestamp in a format resembling ISO 8601,
             e.g. +2013-01-01T00:00:00Z
-        @type datetimestr: str
         @param precision: The unit of the precision of the time.
-        @type precision: int or str
         @param before: Number of units after the given time it could be, if
             uncertain. The unit is given by the precision.
-        @type before: int
         @param after: Number of units before the given time it could be, if
             uncertain. The unit is given by the precision.
-        @type after: int
         @param timezone: Timezone information in minutes.
-        @type timezone: int
         @param calendarmodel: URI identifying the calendar model
-        @type calendarmodel: str
         @param site: The Wikibase site
         @type site: pywikibot.site.DataSite
         @rtype: pywikibot.WbTime
@@ -925,13 +924,14 @@
         raise NotImplementedError

     @classmethod
-    def _get_type_specifics(cls, site):
+    def _get_type_specifics(cls, site) -> dict:
         """
         Return the specifics for a given data type.

         Must be implemented in the extended class.

         The dict should have three keys:
+
         * ending: str, required filetype-like ending in page titles.
         * label: str, describing the data type for use in error messages.
         * data_site: pywikibot.site.APISite, site serving as a repository for
@@ -939,7 +939,6 @@
 
         @param site: The Wikibase site
         @type site: pywikibot.site.APISite
-        @rtype: dict
         """
         raise NotImplementedError


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/629062
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: I08ad939bdb53c565adaf922a0547354be7676998
Gerrit-Change-Number: 629062
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to