utils
Class info¶
🛈 DocStrings¶
GitLab helper functions and utilities.
create_asset_model
¶
create_asset_model(gl_asset: Any) -> Asset
Create Asset model from GitLab asset object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_branch_model
¶
create_branch_model(branch: ProjectBranch) -> Branch
Create Branch model from GitLab ProjectBranch object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_comment_model
¶
create_comment_model(gl_comment: Any) -> Comment
Create Comment model from GitLab comment/note object or dict.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_commit_model
¶
create_commit_model(commit: RESTObject) -> Commit
Create Commit model from GitLab commit object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_issue_model
¶
create_issue_model(issue: Any) -> Issue
Create Issue model from GitLab issue object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_label_model
¶
create_label_model(gl_label: RESTObject) -> Label
Create Label model from GitLab label object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_pull_request_model
¶
create_pull_request_model(mr: Any) -> PullRequest
Create PullRequest model from GitLab merge request object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_release_model
¶
create_release_model(release: Any) -> Release
Create Release model from GitLab release object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_tag_model
¶
create_tag_model(tag: Any) -> Tag
Create Tag model from GitLab tag object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_user_model
¶
create_user_model(gl_user: RESTObject | dict[str, Any]) -> User
create_user_model(gl_user: RESTObject | dict[str, Any] | None) -> User | None
Create User model from GitLab user object or dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gl_user
|
RESTObject | dict[str, Any] | None
|
GitLab user object, dict, or None |
required |
Returns:
| Type | Description |
|---|---|
User | None
|
User model instance or None if input is None |
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_workflow_model
¶
create_workflow_model(pipeline: Any) -> Workflow
Create Workflow model from GitLab pipeline object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
create_workflow_run_model
¶
create_workflow_run_model(job: Any) -> WorkflowRun
Create WorkflowRun model from GitLab job object.
Source code in src/githarbor/providers/gitlab_provider/utils.py
handle_gitlab_errors
¶
Decorator to handle GitLab API exceptions consistently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error_msg_template
|
str
|
Message template with format placeholders |
required |
Example
@handle_gitlab_errors("Could not fetch branch {branch_name}") def get_branch(self, branch_name: str) -> Branch: ...
Source code in src/githarbor/providers/gitlab_provider/utils.py
parse_timestamp
¶
Parse GitLab timestamp string to datetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
str
|
Timestamp string from GitLab API |
required |