Skip to content

Commit d67a895

Browse files
committed
Doc: Update documentation for get_best_claim methods
- add version strings - add references notes - update ROADMAP.rst Change-Id: I91d37d637e621cb817174a73eb5bbf44dc7f6a67
1 parent 9bf3b28 commit d67a895

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

ROADMAP.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Current Release Changes
22
=======================
33

4-
* (no changes yet)
4+
* Implement :meth:`pywikibot.ItemPage.get_best_claim` (:phab:`T400610`)
5+
* Add *expiry* parameter to :meth:`BasePage.watch()<page.BasePage.watch>` and
6+
:meth:`Site.watch()<pywikibot.site._apisite.APISite.watch>` (:phab:`T330839`)
7+
58

69
Deprecations
710
============

pywikibot/page/_page.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,20 @@ def set_redirect_target(
182182
if save:
183183
self.save(**kwargs)
184184

185-
def get_best_claim(self, prop: str):
185+
def get_best_claim(self, prop: str) -> pywikibot.Claim | None:
186186
"""Return the first best Claim for this page.
187187
188188
Return the first 'preferred' ranked Claim specified by Wikibase
189189
property or the first 'normal' one otherwise.
190190
191191
.. versionadded:: 3.0
192192
193-
:param prop: property id, "P###"
193+
.. seealso:: :meth:`pywikibot.ItemPage.get_best_claim`
194+
195+
:param prop: Wikibase property ID, must be of the form ``P``
196+
followed by one or more digits (e.g. ``P31``).
194197
:return: Claim object given by Wikibase property number
195198
for this page object.
196-
:rtype: pywikibot.Claim or None
197199
198200
:raises UnknownExtensionError: site has no Wikibase extension
199201
"""

pywikibot/page/_wikibase.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,16 +1341,20 @@ def isRedirectPage(self):
13411341
return self._isredir
13421342
return super().isRedirectPage()
13431343

1344-
def get_best_claim(self, prop: str):
1344+
def get_best_claim(self, prop: str) -> pywikibot.Claim | None:
13451345
"""Return the first best Claim for this page.
13461346
13471347
Return the first 'preferred' ranked Claim specified by Wikibase
13481348
property or the first 'normal' one otherwise.
13491349
1350-
:param prop: property id, "P###"
1350+
.. versionadded:: 10.4
1351+
1352+
.. seealso:: :meth:`pywikibot.Page.get_best_claim`
1353+
1354+
:param prop: Wikibase property ID, must be of the form ``P``
1355+
followed by one or more digits (e.g. ``P31``).
13511356
:return: Claim object given by Wikibase property number
13521357
for this page object.
1353-
:rtype: pywikibot.Claim or None
13541358
13551359
:raises UnknownExtensionError: site has no Wikibase extension
13561360
"""

0 commit comments

Comments
 (0)