Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ying Chen committed Dec 6, 2023
1 parent 91cf864 commit 83b0d61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/promptflow/promptflow/_utils/version_hint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"pfazure.runs.create_or_update"]


def _get_local_versions():
def get_local_versions():
# get locally installed versions
from promptflow import __version__ as promptflow_version

Expand All @@ -22,21 +22,21 @@ def get_cached_latest_versions(cached_versions):
""" Get the latest versions from a cached file"""
import datetime

versions = _get_local_versions()
versions = get_local_versions()
if VERSION_UPDATE_TIME in cached_versions:
version_update_time = datetime.datetime.strptime(cached_versions[VERSION_UPDATE_TIME], '%Y-%m-%d %H:%M:%S.%f')
if datetime.datetime.now() < version_update_time + datetime.timedelta(days=1):
cache_versions = cached_versions['versions'] if 'versions' in cached_versions else {}
if cache_versions and cache_versions['local'] == versions['local']:
return cache_versions.copy(), True, False

versions, success = _update_latest_from_pypi(versions)
versions, success = update_latest_from_pypi(versions)
cached_versions['versions'] = versions
cached_versions[VERSION_UPDATE_TIME] = str(datetime.datetime.now())
return versions.copy(), success, True


def _update_latest_from_pypi(versions):
def update_latest_from_pypi(versions):
success = True
version = get_latest_version_from_pypi(CLI_PACKAGE_NAME)
if version is None:
Expand Down

0 comments on commit 83b0d61

Please sign in to comment.