-
Notifications
You must be signed in to change notification settings - Fork 80
Snow 2306184 ng config support 3 #2638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a1ed92d
9490afb
4718ee1
87dd18b
d1c6b54
1f97534
a431b81
9b12fbe
a154d5b
c02a716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,9 @@ | |
| CLI_SECTION, | ||
| IGNORE_NEW_VERSION_WARNING_KEY, | ||
| get_config_bool_value, | ||
| get_config_manager, | ||
| ) | ||
| from snowflake.cli.api.secure_path import SecurePath | ||
| from snowflake.connector.config_manager import CONFIG_MANAGER | ||
|
|
||
| REPOSITORY_URL_PIP = "https://pypi.org/pypi/snowflake-cli/json" | ||
| REPOSITORY_URL_BREW = "https://formulae.brew.sh/api/formula/snowflake-cli.json" | ||
|
|
@@ -69,12 +69,14 @@ class _VersionCache: | |
| _last_time = "last_time_check" | ||
| _version = "version" | ||
| _last_time_shown = "last_time_shown" | ||
| _version_cache_file = SecurePath( | ||
| CONFIG_MANAGER.file_path.parent / ".cli_version.cache" | ||
| ) | ||
|
|
||
| @property | ||
| def _version_cache_file(self): | ||
| """Get version cache file path with lazy evaluation.""" | ||
| return SecurePath(get_config_manager().file_path.parent / ".cli_version.cache") | ||
|
|
||
| def __init__(self): | ||
| self._cache_file = _VersionCache._version_cache_file | ||
| self._cache_file = self._version_cache_file | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The property Consider modifying this approach to truly implement lazy loading: def __init__(self):
self._cache_file = None # Initialize as None
@property
def _cache_file(self):
if self.__cache_file is None:
self.__cache_file = self._version_cache_file
return self.__cache_file
@_cache_file.setter
def _cache_file(self, value):
self.__cache_file = valueThis way, the property is only evaluated when first accessed, not during initialization. Spotted by Diamond |
||
|
|
||
| def _save_latest_version(self, version: str): | ||
| data = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.