Skip to content

Commit

Permalink
[SDK/CLI] Hide internal constants (#552)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes]**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.
  • Loading branch information
0mza987 authored Sep 19, 2023
1 parent 12e28d9 commit 617d7d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/dev/documentation_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class MyClass:
- Single backticks (`): Single backticks are used to represent inline code elements within the text. It is typically used to highlight function names, variable names, or any other code elements within the documentation.
- Double backticks(``): Double backticks are typically used to highlight a literal value.
8. If there are any class level constants you don't want to expose to doc site, make sure to add `_` in front of the constant to hide it.
### Write function docstring
Expand Down
9 changes: 5 additions & 4 deletions src/promptflow/promptflow/azure/operations/_run_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ class RunOperations(_ScopeDependentOperations):
attaches it as an attribute.
"""

DATASTORE_PATH_PATTERN = re.compile(r"azureml://datastores/(?P<datastore>[\w/]+)/paths/(?P<path>.*)$")
ASSET_ID_PATTERN = re.compile(r"azureml:/.*?/data/(?P<name>.*?)/versions/(?P<version>.*?)$")
# add "_" in front of the constant to hide them from the docstring
_DATASTORE_PATH_PATTERN = re.compile(r"azureml://datastores/(?P<datastore>[\w/]+)/paths/(?P<path>.*)$")
_ASSET_ID_PATTERN = re.compile(r"azureml:/.*?/data/(?P<name>.*?)/versions/(?P<version>.*?)$")

def __init__(
self,
Expand Down Expand Up @@ -131,7 +132,7 @@ def _get_input_portal_url_from_input_uri(self, input_uri):
return None
if input_uri.startswith("azureml://"):
# input uri is a datastore path
match = self.DATASTORE_PATH_PATTERN.match(input_uri)
match = self._DATASTORE_PATH_PATTERN.match(input_uri)
if not match or len(match.groups()) != 2:
logger.warning(error_msg)
return None
Expand All @@ -156,7 +157,7 @@ def _get_portal_url_from_asset_id(self, output_uri):
error_msg = f"Failed to get portal url: {output_uri!r} is not a valid azureml asset id."
if not output_uri:
return None
match = self.ASSET_ID_PATTERN.match(output_uri)
match = self._ASSET_ID_PATTERN.match(output_uri)
if not match or len(match.groups()) != 2:
logger.warning(error_msg)
return None
Expand Down

0 comments on commit 617d7d3

Please sign in to comment.