Skip to content

Commit

Permalink
Make ItemClaimFilter.__filter_match always return bool
Browse files Browse the repository at this point in the history
And also improve ItemClaimFilter.filter's documentation.

Change-Id: Ifecbc61809a4cf1a6c736deb8b70601f19f8d404
  • Loading branch information
matejsuchanek committed Jan 21, 2017
1 parent 45444fe commit d41f37f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pywikibot/pagegenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,20 +1518,21 @@ def __filter_match(cls, page, prop, claim, qualifiers=None):
if not page_claim.has_qualifier(prop, val):
return False
return True
return False

@classmethod
def filter(cls, generator, prop, claim, qualifiers=None, negate=False):
"""
Yield all ItemPages which does contain certain claim in a property.
Yield all ItemPages which contain certain claim in a property.
@param prop: property id to check
@type prop: str
@param claim: value of the property to check. Can be exact value (for
instance, ItemPage instance) or ItemPage ID string (e.g. 'Q37470').
instance, ItemPage instance) or a string (e.g. 'Q37470').
@param qualifiers: dict of qualifiers that must be present, or None if
qualifiers are irrelevant
@type qualifiers: dict or None
@param negate: true if pages that does *not* contain specified claim
@param negate: true if pages that do *not* contain specified claim
should be yielded, false otherwise
@type negate: bool
"""
Expand Down

0 comments on commit d41f37f

Please sign in to comment.