# HG changeset patch # User Mads Kiilerich # Date 2021-02-06 20:39:27 # Node ID 7b58d01e925ab169536ed5aa2e06757d44594882 # Parent 252b86664549ae747484efa24d84b7ef5bd21522 pytype: add assertion to guide pytype through Whoosh usage Mute pytype warnings: File "kallithea/controllers/admin/admin.py", line 105, in _journal_filter: No attribute 'fieldname' on None [attribute-error] In Optional[Any] File "kallithea/controllers/admin/admin.py", line 106, in _journal_filter: No attribute 'text' on None [attribute-error] In Optional[Any] File "kallithea/controllers/admin/admin.py", line 107, in _journal_filter: No attribute 'startdate' on None [attribute-error] In Optional[Any] File "kallithea/controllers/admin/admin.py", line 107, in _journal_filter: No attribute 'enddate' on None [attribute-error] In Optional[Any] diff --git a/kallithea/controllers/admin/admin.py b/kallithea/controllers/admin/admin.py --- a/kallithea/controllers/admin/admin.py +++ b/kallithea/controllers/admin/admin.py @@ -102,6 +102,7 @@ def _journal_filter(user_log, search_ter if not isinstance(qry, query.And): qry = [qry] for term in qry: + assert term is not None, term field = term.fieldname val = (term.text if not isinstance(term, query.DateRange) else [term.startdate, term.enddate])