Function
_patch_report_body_institution
(body: str, institution: str)
Source from the content-addressed store, hash-verified
| 610 | return _extract_institution_from_pdf(metadata.get("pdf_path")) |
| 611 | |
| 612 | |
| 613 | def _patch_report_body_institution(body: str, institution: str) -> str: |
| 614 | if not institution: |
| 615 | return body |
| 616 | return re.sub( |
| 617 | r"(^-\s*(?:机构|Affiliation)\s*[::]\s*)(?:未提供|Not provided|unknown|Unknown)\s*$", |
| 618 | rf"\g<1>{institution}", |
| 619 | body, |
| 620 | flags=re.MULTILINE, |
| 621 | ) |
| 622 | |
| 623 | |
Tested by
no test coverage detected