Skip to content
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

chore(deps): pre-commit autoupdate #179

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
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: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.4"
rev: "2.2.1"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.5.5'
rev: 'v0.5.6'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand Down
6 changes: 5 additions & 1 deletion tap_circle_ci/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def get_url_params(
context: dict | None,
next_page_token: str | None,
) -> dict[str, Any]:
"""Return a dictionary of values to be used in URL parameterization."""
"""Get URL query parameters.
Returns:
A dictionary of values to be used in URL parameterization.
"""
params: dict = {}
if next_page_token:
params["page-token"] = next_page_token
Expand Down
24 changes: 20 additions & 4 deletions tap_circle_ci/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class PipelinesStream(CircleCIStream):

@override
def get_child_context(self, record: dict, context: dict | None) -> dict:
"""Return a context dictionary for child streams."""
"""Return a context dictionary for child streams.

Returns:
A dictionary with the context values.
"""
return {"pipeline_id": record["id"], "project_slug": record["project_slug"]}

@override
Expand All @@ -37,7 +41,11 @@ def get_url_params(
context: dict | None,
next_page_token: str | None,
) -> dict[str, t.Any]:
"""Return a dictionary of values to be used in URL parameterization."""
"""Get URL query parameters.

Returns:
A dictionary with the URL parameters.
"""
params = super().get_url_params(context, next_page_token)
params["org-slug"] = self.config.get("org_slug")
return params
Expand All @@ -54,7 +62,11 @@ class WorkflowsStream(CircleCIStream):

@override
def get_child_context(self, record: dict, context: dict | None) -> dict:
"""Return a context dictionary for child streams."""
"""Return a context dictionary for child streams.

Returns:
A dictionary with the context values.
"""
return {"workflow_id": record["id"]}


Expand All @@ -69,7 +81,11 @@ class JobsStream(CircleCIStream):

@override
def post_process(self, row: dict, context: dict | None = None) -> dict | None:
"""Add the Workflow ID to the row."""
"""Add the Workflow ID to the row.

Returns:
The row with the transformed data.
"""
if row and context:
row["_workflow_id"] = context["workflow_id"]
return row
12 changes: 10 additions & 2 deletions tap_circle_ci/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class TapCircleCI(Tap):

@classproperty
def config_jsonschema(cls): # noqa: ANN201, N805
"""Return a list of configuration properties read by the tap."""
"""Return a list of configuration properties read by the tap.
Returns:
A JSON schema object.
"""
return th.PropertiesList(
th.Property(
"token",
Expand Down Expand Up @@ -50,7 +54,11 @@ def config_jsonschema(cls): # noqa: ANN201, N805
).to_dict()

def discover_streams(self) -> list[Stream]:
"""Return a list of discovered streams."""
"""Return a list of discovered streams.
Returns:
A list of stream instances.
"""
return [
streams.JobsStream(tap=self),
streams.PipelinesStream(tap=self),
Expand Down