def build_mypy_re(self, filename: Union[(str, Path)]) -> Pattern:
    filename = Path(filename)
    if filename.is_absolute():
        prefix = Path('.').absolute()
        try:
            filename = filename.relative_to(prefix)
        except ValueError:
            pass
    re_filename = re.escape(str(filename))
    if re_filename.startswith('\\./'):
        re_filename = re_filename[3:]
    return re.compile(MYPY_ERROR_TEMPLATE.format(filename=re_filename), re.VERBOSE)
def build_mypy_re(self, filename: Union[(str, Path)]) -> Pattern:
    filename = Path(filename)
    if filename.is_absolute():
        prefix = Path('.').absolute()
        try:
            filename = filename.relative_to(prefix)
        except ValueError:
            pass
    re_filename = re.escape(str(filename))
    if re_filename.startswith('\\./'):
        re_filename = re_filename[3:]
    return re.compile(MYPY_ERROR_TEMPLATE.format(filename=re_filename), re.VERBOSE)