Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
b-per committed Jan 15, 2024
1 parent 7b5af2d commit 9042958
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ class DBTCloud:
"""A minimalistic API client for fetching dbt Cloud data."""

def __init__(
self, account_id: int, api_key: str, base_url: str = "https://cloud.getdbt.com", disable_ssl_verification: bool = False
self,
account_id: int,
api_key: str,
base_url: str = "https://cloud.getdbt.com",
disable_ssl_verification: bool = False,
) -> None:
self.account_id = account_id
self._api_key = api_key
Expand Down Expand Up @@ -128,7 +132,7 @@ def get_jobs(self) -> List[JobDefinition]:
url=f"{self.base_url}/api/v2/accounts/{self.account_id}/jobs/",
params=parameters,
headers=self._headers,
verify=self._verify
verify=self._verify,
)

job_data = response.json()
Expand Down Expand Up @@ -178,7 +182,7 @@ def get_env_vars(
f"{self.base_url}/api/v3/accounts/{self.account_id}/projects/{project_id}/environment-variables/job/?job_definition_id={job_id}"
),
headers=self._headers,
verify=self._verify
verify=self._verify,
)

variables = {
Expand All @@ -205,7 +209,7 @@ def create_env_var(
f"{self.base_url}/api/v3/accounts/{self.account_id}/projects/{env_var.project_id}/environment-variables/",
headers=self._headers,
data=env_var.json(),
verify=self._verify
verify=self._verify,
)
logger.debug(response.json())

Expand Down Expand Up @@ -249,10 +253,7 @@ def update_env_var(
)

response = requests.post(
url=url,
headers=self._headers,
data=payload.json(),
verify=self._verify
url=url, headers=self._headers, data=payload.json(), verify=self._verify
)

if response.status_code >= 400:
Expand All @@ -271,7 +272,7 @@ def delete_env_var(self, project_id: int, env_var_id: int) -> None:
response = requests.delete(
url=f"{self.base_url}/api/v3/accounts/{self.account_id}/projects/{project_id}/environment-variables/{env_var_id}/",
headers=self._headers,
verify=self._verify
verify=self._verify,
)

if response.status_code >= 400:
Expand Down
12 changes: 10 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
from rich.console import Console

# adding the ability to disable ssl verification, useful for self-signed certificates and local testing
option_disable_ssl_verification = click.option('--disable-ssl-verification', is_flag=True, envvar='DBT_JOBS_AS_CODE_DISABLE_SSL_VERIFICATION', show_envvar=True, default=False)
option_disable_ssl_verification = click.option(
"--disable-ssl-verification",
is_flag=True,
envvar="DBT_JOBS_AS_CODE_DISABLE_SSL_VERIFICATION",
show_envvar=True,
default=False,
)


def build_change_set(config, disable_ssl_verification):
"""Compares the config of YML files versus dbt Cloud.
Expand Down Expand Up @@ -164,6 +171,7 @@ def build_change_set(config, disable_ssl_verification):
def cli():
pass


@cli.command()
@option_disable_ssl_verification
@click.argument("config", type=click.File("r"))
Expand All @@ -186,7 +194,7 @@ def sync(config, disable_ssl_verification):
@cli.command()
@option_disable_ssl_verification
@click.argument("config", type=click.File("r"))
def plan(config, disable_ssl_verification):
def plan(config, disable_ssl_verification):
"""Check the difference between a local file and dbt Cloud without updating dbt Cloud.
CONFIG is the path to your jobs.yml config file.
Expand Down

0 comments on commit 9042958

Please sign in to comment.