havanagrawal / wikidata-toolkit

Bot for Wikidata to fix consistency and constraint issues on television series :tv:
MIT License
5 stars 8 forks source link

Filter for scripts has substring bug #6

Open havanagrawal opened 5 years ago

havanagrawal commented 5 years ago

Problem

One of the options for scripts is --filter which can accept property IDs such as P143. However, the way we check this has a bug, where it will also match properties such as P1436.

def should_fix(fix, filters):
    return any(filter in fix.summary for filter in filters)

Proposed Solution

Split the summary by spaces (and other token characters), and then for each filter, check containment, instead of checking the string directly.