-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Marketplace model support in HubService #4916
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
Changes from 2 commits
0092ff4
8b0ec90
273449c
a8a2453
d4430e2
cd82335
0b73463
3ca1deb
4bdd822
79a1163
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 |
---|---|---|
|
@@ -18,13 +18,12 @@ | |
from typing import Any, Dict, List, Optional | ||
|
||
|
||
def camel_to_snake(camel_case_string: str) -> str: | ||
"""Converts camelCaseString or UpperCamelCaseString to snake_case_string.""" | ||
snake_case_string = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", camel_case_string) | ||
if "-" in snake_case_string: | ||
# remove any hyphen from the string for accurate conversion. | ||
snake_case_string = snake_case_string.replace("-", "") | ||
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", snake_case_string).lower() | ||
def pascal_to_snake(camel_case_string: str) -> str: | ||
"""Converts PascalCase to snake_case_string using a regex. | ||
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. Inconsistent regex and method name. Careful with renaming the method though, it would be backward incompatible. 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. True, let me rewrite that docstring. This regex can handle camelCase as well as PascalCase |
||
|
||
This regex cannot handle whitespace ("PascalString TwoWords") | ||
""" | ||
return re.sub(r"(?<!^)(?=[A-Z])", "_", camel_case_string).lower() | ||
|
||
|
||
def snake_to_upper_camel(snake_case_string: str) -> str: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sanity-check: will the pySDK still understand previous schema?