jenkins-bot has submitted this change and it was merged.
Change subject: Allow hierarchical queries with other Query types than only the Tree type. ......................................................................
Allow hierarchical queries with other Query types than only the Tree type.
Currently only Claim(1:Tree(2)(3)(4)) is allowed but Claim(1:Claim(2, 3)) is also valid.
Example: tools.wmflabs.org/autolist/autolist1.html?q=CLAIM[171%3A(CLAIM[105%3A35409])]
Change-Id: I2ae37bcdef552a7a5e2655b7e2d898a63da31fd1 --- M pywikibot/data/wikidataquery.py 1 file changed, 3 insertions(+), 3 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/wikidataquery.py b/pywikibot/data/wikidataquery.py index 2af1792..80d2616 100644 --- a/pywikibot/data/wikidataquery.py +++ b/pywikibot/data/wikidataquery.py @@ -252,7 +252,7 @@ """Constructor.""" self.prop = self.convertWDType(prop)
- if isinstance(items, Tree): + if isinstance(items, Query): self.items = items elif isinstance(self, StringClaim): self.items = listify(items) @@ -269,12 +269,12 @@ return res
def validate(self): - return self.isOrContainsOnlyTypes(self.items, [int, Tree]) + return self.isOrContainsOnlyTypes(self.items, [int, Query])
def __str__(self): if isinstance(self.items, list): return "%s[%s%s]" % (self.queryType, self.prop, self.formatItems()) - elif isinstance(self.items, Tree): # maybe Query? + elif isinstance(self.items, Query): return "%s[%s:(%s)]" % (self.queryType, self.prop, self.items)
pywikibot-commits@lists.wikimedia.org