| 423 | # ============================================================ |
| 424 | |
| 425 | def filter_pages(pages, filters): |
| 426 | out = [] |
| 427 | for p in pages: |
| 428 | ok = True |
| 429 | for key, val in filters.items(): |
| 430 | if val is None: |
| 431 | continue |
| 432 | if key == "type" and p.type != val: |
| 433 | ok = False |
| 434 | elif key == "status" and p.status != val: |
| 435 | ok = False |
| 436 | elif key == "confidence" and p.confidence != val: |
| 437 | ok = False |
| 438 | elif key == "tag" and val not in p.tags: |
| 439 | ok = False |
| 440 | elif key == "modified_by" and p.last_modified_by != val: |
| 441 | ok = False |
| 442 | if ok: |
| 443 | out.append(p) |
| 444 | return out |
| 445 | |
| 446 | |
| 447 | def find_orphans(pages, backlinks): |