def calculate_mypypath() -> List[str]:
    'Return MYPYPATH so that stubs have precedence over local sources.'
    typeshed_root = None
    count = 0
    started = time.time()
    for parent in itertools.chain(Path(__file__).parents, Path(mypy.api.__file__).parents, Path(os.__file__).parents):
        count += 1
        candidate = (((parent / 'lib') / 'mypy') / 'typeshed')
        if candidate.is_dir():
            typeshed_root = candidate
            break
        candidate = (parent / 'typeshed')
        if candidate.is_dir():
            typeshed_root = candidate
            break
    LOG.debug('Checked %d paths in %.2fs looking for typeshed. Found %s', count, (time.time() - started), typeshed_root)
    if (not typeshed_root):
        return []
    stdlib_dirs = ('3.7', '3.6', '3.5', '3.4', '3.3', '3.2', '3', '2and3')
    stdlib_stubs = [((typeshed_root / 'stdlib') / stdlib_dir) for stdlib_dir in stdlib_dirs]
    third_party_dirs = ('3.7', '3.6', '3', '2and3')
    third_party_stubs = [((typeshed_root / 'third_party') / tp_dir) for tp_dir in third_party_dirs]
    return [str(p) for p in (stdlib_stubs + third_party_stubs)]
Return MYPYPATH so that stubs have precedence over local sources.
def calculate_mypypath() -> List[str]:
    
    typeshed_root = None
    count = 0
    started = time.time()
    for parent in itertools.chain(Path(__file__).parents, Path(mypy.api.__file__).parents, Path(os.__file__).parents):
        count += 1
        candidate = (((parent / 'lib') / 'mypy') / 'typeshed')
        if candidate.is_dir():
            typeshed_root = candidate
            break
        candidate = (parent / 'typeshed')
        if candidate.is_dir():
            typeshed_root = candidate
            break
    LOG.debug('Checked %d paths in %.2fs looking for typeshed. Found %s', count, (time.time() - started), typeshed_root)
    if (not typeshed_root):
        return []
    stdlib_dirs = ('3.7', '3.6', '3.5', '3.4', '3.3', '3.2', '3', '2and3')
    stdlib_stubs = [((typeshed_root / 'stdlib') / stdlib_dir) for stdlib_dir in stdlib_dirs]
    third_party_dirs = ('3.7', '3.6', '3', '2and3')
    third_party_stubs = [((typeshed_root / 'third_party') / tp_dir) for tp_dir in third_party_dirs]
    return [str(p) for p in (stdlib_stubs + third_party_stubs)]