Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit ecb7211

Browse files
committed
refactor: s/"--"/UNKNOWN_VERSION_STRING/ in code, not test
1 parent b575a16 commit ecb7211

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

google/api_core/_python_package_support.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
DependencyVersion = namedtuple("DependencyVersion", ["version", "version_string"])
3131

32+
UNKNOWN_VERSION_STRING = "--"
33+
3234

3335
def get_dependency_version(
3436
dependency_name: str,
@@ -43,9 +45,11 @@ def get_dependency_version(
4345
dependency_name: The distribution name of the package (e.g., 'requests').
4446
4547
Returns:
46-
A DependencyVersion namedtuple with `version` and `version_string`
47-
attributes, or `DependencyVersion(None, '--')` if the package is not
48-
found or another error occurs during version discovery.
48+
A DependencyVersion namedtuple with `version` and
49+
`version_string` attributes, or `DependencyVersion(None,
50+
UNKNOWN_VERSION_STRING)` if the package is not found or
51+
another error occurs during version discovery.
52+
4953
"""
5054
try:
5155
if sys.version_info >= (3, 8):
@@ -64,7 +68,7 @@ def get_dependency_version(
6468
return DependencyVersion(parse_version(version_string), version_string)
6569

6670
except Exception:
67-
return DependencyVersion(None, "--")
71+
return DependencyVersion(None, UNKNOWN_VERSION_STRING)
6872

6973

7074
def warn_deprecation_for_versions_less_than(

0 commit comments

Comments
 (0)