Skip to content

Commit

Permalink
Make Ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Aug 5, 2024
1 parent 81dbf50 commit a1bc880
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
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 a1bc880

Please sign in to comment.