(version_cache_path: Path)
return latest_version
Return latest Version of bento-cli available.

        Checks local version cache to save from making network call
        but if cache is invalid makes network call and writes to cache.

        Returns None if cache is invalid and network call fails for
        any reason
Return latest Version of bento-cli available.
Return latest Version of bento - cli available .
def _get_latest_version(version_cache_path: Path) -> Optional[Version]:
    """
        Return latest Version of bento-cli available.

        Checks local version cache to save from making network call
        but if cache is invalid makes network call and writes to cache.

        Returns None if cache is invalid and network call fails for
        any reason
    """
    latest_version = _get_version_from_cache(version_cache_path)
    if latest_version is None:
        latest_version_str, _ = bento.network.fetch_latest_version()
        if latest_version_str is None:
            # Request timed out or invalid
            return None

        try:
            latest_version = Version(latest_version_str)
        except InvalidVersion:
            # latest version str from server incorrect
            return None

        # Write to version cache
        with version_cache_path.open("w") as f:
            # Integer time so no need to deal with str float conversions
            f.write(f"{int(time.time())}\n")
            f.write(latest_version_str)

    return latest_version
def _get_latest_version ( version_cache_path : Path ) -> Optional [ Version ] : latest_version = _get_version_from_cache ( version_cache_path ) if latest_version is None : latest_version_str , _ = bento . network . fetch_latest_version ( ) if latest_version_str is None : # Request timed out or invalid return None try : latest_version = Version ( latest_version_str ) except InvalidVersion : # latest version str from server incorrect return None # Write to version cache with version_cache_path . open ( "w" ) as f : # Integer time so no need to deal with str float conversions f . write ( f"{int(time.time())}\n" ) f . write ( latest_version_str ) return latest_version