utils
Class info¶
🛈 DocStrings¶
Azure DevOps helper functions and decorators.
create_comment_model
¶
create_comment_model(azure_comment: Any) -> Comment
Create Comment model from Azure DevOps comment object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_commit_model
¶
create_commit_model(commit: GitCommit) -> Commit
Create Commit model from Azure DevOps commit object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_issue_model
¶
create_issue_model(work_item: WorkItem) -> Issue
Create Issue model from Azure DevOps work item object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_label_model
¶
create_label_model(azure_label: Any) -> Label
Create Label model from Azure DevOps label object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_pull_request_model
¶
create_pull_request_model(pr: GitPullRequest) -> PullRequest
Create PullRequest model from Azure DevOps pull request object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_release_model
¶
create_release_model(tag: Any) -> Release
Create Release model from Azure DevOps tag object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_user_model
¶
create_user_model(azure_user: Any) -> User
create_user_model(azure_user: Any) -> User | None
Create User model from Azure DevOps identity dict, IdentityRef, or GitUserDate.
Source code in src/githarbor/providers/azure_provider/utils.py
create_workflow_model
¶
create_workflow_model(definition: Any) -> Workflow
Create Workflow model from Azure DevOps build definition object.
Source code in src/githarbor/providers/azure_provider/utils.py
create_workflow_run_model
¶
create_workflow_run_model(build: Any) -> WorkflowRun
Create WorkflowRun model from Azure DevOps build object.
Source code in src/githarbor/providers/azure_provider/utils.py
download_from_azure
¶
download_from_azure(
organization: str,
project: str,
repo: str,
path: str | PathLike[str],
destination: JoinablePathLike,
token: str | None = None,
recursive: bool = False,
)
Download files from Azure DevOps repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
organization
|
str
|
Azure DevOps organization name |
required |
project
|
str
|
Project name |
required |
repo
|
str
|
Repository name |
required |
path
|
str | PathLike[str]
|
Path to file/folder to download |
required |
destination
|
JoinablePathLike
|
Local destination path |
required |
token
|
str | None
|
Personal access token |
None
|
recursive
|
bool
|
Whether to download recursively |
False
|
Source code in src/githarbor/providers/azure_provider/utils.py
handle_azure_errors
¶
Decorator to handle Azure DevOps API exceptions consistently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error_msg_template
|
str
|
Message template with format placeholders |
required |
Example
@handle_azure_errors("Could not fetch branch {branch_name}") def get_branch(self, branch_name: str) -> Branch: ...