Skip to content

Commit

Permalink
reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed May 17, 2024
1 parent d67e23e commit 4ba0a2f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion services/engine/dataherald/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Settings(BaseSettings):
encrypt_key: str = os.environ.get("ENCRYPT_KEY")
s3_aws_access_key_id: str | None = os.environ.get("S3_AWS_ACCESS_KEY_ID")
s3_aws_secret_access_key: str | None = os.environ.get("S3_AWS_SECRET_ACCESS_KEY")
#Needed for Azure OpenAI integration:
# Needed for Azure OpenAI integration:
azure_api_key: str | None = os.environ.get("AZURE_API_KEY")
embedding_model: str | None = os.environ.get("EMBEDDING_MODEL")
azure_api_version: str | None = os.environ.get("AZURE_API_VERSION")
Expand Down
4 changes: 2 additions & 2 deletions services/engine/dataherald/services/sql_generations.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def update_the_initial_sql_generation(
initial_sql_generation.intermediate_steps = sql_generation.intermediate_steps
return self.sql_generation_repository.update(initial_sql_generation)

def create( # noqa: PLR0912
def create( # noqa: PLR0912
self, prompt_id: str, sql_generation_request: SQLGenerationRequest
) -> SQLGeneration: # noqa: PLR0912
) -> SQLGeneration: # noqa: PLR0912
initial_sql_generation = SQLGeneration(
prompt_id=prompt_id,
created_at=datetime.now(),
Expand Down
1 change: 0 additions & 1 deletion services/enterprise/exceptions/exception_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


async def exception_handler(request: Request, exc: BaseError): # noqa: ARG001

trace_id = exc.trace_id
error_code = exc.error_code
status_code = exc.status_code
Expand Down
1 change: 0 additions & 1 deletion services/enterprise/exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(
description: str = None,
detail: dict = None,
) -> None:

if type(self) is BaseError:
raise TypeError("BaseError class may not be instantiated directly")

Expand Down
1 change: 0 additions & 1 deletion services/enterprise/modules/db_connection/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ async def ac_get_db_connection(
id: ObjectIdString,
user: User = Security(authenticate_user),
) -> DBConnectionResponse:

return db_connection_service.get_db_connection(id, user.organization_id)


Expand Down
10 changes: 6 additions & 4 deletions services/enterprise/modules/db_connection/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ async def add_db_connection(
)

if organization.llm_api_key:
db_connection_internal_request.llm_api_key = FernetEncrypt().decrypt(organization.llm_api_key)
db_connection_internal_request.llm_api_key = FernetEncrypt().decrypt(
organization.llm_api_key
)

if db_connection_request.use_ssh:
db_connection_internal_request.ssh_settings.private_key_password = (
Expand Down Expand Up @@ -140,8 +142,9 @@ async def update_db_connection(
)

if organization.llm_api_key:
db_connection_internal_request.llm_api_key = FernetEncrypt().decrypt(organization.llm_api_key)

db_connection_internal_request.llm_api_key = FernetEncrypt().decrypt(
organization.llm_api_key
)

if db_connection_request.use_ssh:
db_connection_internal_request.ssh_settings.private_key_password = (
Expand All @@ -163,7 +166,6 @@ async def update_db_connection(
async def add_sample_db_connection(
self, sample_request: SampleDBRequest, org_id: str
) -> DBConnectionResponse:

sample_db_dict = await self.sample_db.add_sample_db(
sample_request.sample_db_id, org_id
)
Expand Down
19 changes: 10 additions & 9 deletions services/enterprise/modules/organization/invoice/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def update_spending_limit(
raise CannotUpdateSpendingLimitError(org_id)

def get_pending_invoice(self, org_id: str) -> InvoiceResponse:

organization = self.org_repo.get_organization(org_id)
current_period_start, current_period_end = (
self.billing.get_current_subscription_period_with_anchor(
organization.invoice_details.billing_cycle_anchor
)
(
current_period_start,
current_period_end,
) = self.billing.get_current_subscription_period_with_anchor(
organization.invoice_details.billing_cycle_anchor
)
upcoming_invoice = self.billing.get_upcoming_invoice(
organization.invoice_details.stripe_customer_id
Expand Down Expand Up @@ -304,10 +304,11 @@ def check_usage(
):
raise SubscriptionCanceledError(org_id)
raise UnknownSubscriptionStatusError(org_id)
start_date, end_date = (
self.billing.get_current_subscription_period_with_anchor(
organization.invoice_details.billing_cycle_anchor
)
(
start_date,
end_date,
) = self.billing.get_current_subscription_period_with_anchor(
organization.invoice_details.billing_cycle_anchor
)
usages = self.repo.get_usages(org_id, start_date, end_date)
usage = Usage(
Expand Down

0 comments on commit 4ba0a2f

Please sign in to comment.