Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion google/cloud/aiplatform/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
reservation_affinity_v1 as gca_reservation_affinity_v1,
)

_CAMEL_TO_SNAKE_RE = re.compile(r"([A-Z]+)")

VertexAiServiceClient = TypeVar(
"VertexAiServiceClient",
# v1beta1
Expand Down Expand Up @@ -260,7 +262,7 @@ def convert_camel_case_resource_noun_to_snake_case(resource_noun: str) -> str:
Returns:
Singular snake case resource noun.
"""
snake_case = re.sub("([A-Z]+)", r"_\1", resource_noun).lower()
snake_case = _CAMEL_TO_SNAKE_RE.sub(r"_\1", resource_noun).lower()

# plural to singular
if snake_case in _SINGULAR_RESOURCE_NOUNS or not snake_case.endswith("s"):
Expand Down