def METHOD_NAME(cls, filename: str, modname: str) -> ModuleAnalyzer:
    if ('file', filename) in cls.cache:
        return cls.cache['file', filename]
    try:
        with tokenize.open(filename) as f:
            string = f.read()
        obj = cls(string, modname, filename)
        cls.cache['file', filename] = obj
    except Exception as err:
        raise PycodeError('error opening %r' % filename, err) from err
    return obj