Skip to content

Commit

Permalink
chore(deps): pre-commit autoupdate (#179)
Browse files Browse the repository at this point in the history
<!--pre-commit.ci start-->
updates:
- [github.com/tox-dev/pyproject-fmt: 2.1.4 →
2.2.1](tox-dev/pyproject-fmt@2.1.4...2.2.1)
- [github.com/astral-sh/ruff-pre-commit: v0.5.5 →
v0.5.6](astral-sh/ruff-pre-commit@v0.5.5...v0.5.6)
<!--pre-commit.ci end-->

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Edgar Ramírez-Mondragón <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and edgarrmondragon authored Aug 5, 2024
1 parent 997941c commit 78ddb53
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
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

0 comments on commit 78ddb53

Please sign in to comment.