def bug_number_from_url()

in probe_scraper/fog_checks.py [0:0]


def bug_number_from_url(url: str) -> Optional[int]:
    """
    Given a bug url, get its bug number.
    If we can't figure out a reasonable bug number, return None.
    """
    if "bugz" not in url:
        # Not a bugzilla url. We don't understand you.
        print(f"Can't figure out bug number for non-bugzilla url: {url}")
        return None

    bug = BUG_NUMBER_PATTERN.search(url)
    if bug is not None:
        try:
            bug = int(bug[0])
        except Exception:
            print(f"Can't figure out bug number for url: {url}")
            return None
        return bug