Skip to content

Commit

Permalink
Run pre-commit on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonmeso committed May 9, 2024
1 parent 991d1a2 commit e3322e9
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: Lint with ruff
run: |
poetry run ruff giza
- name: Pre-commit check
run: |
poetry run pre-commit run --all-files
- name: Testing
run: |
poetry run pytest --cov=giza --cov-report term-missing --cov-fail-under=60
50 changes: 35 additions & 15 deletions giza/commands/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ def list(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -155,9 +159,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -229,9 +237,13 @@ def list_proofs(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -278,9 +290,13 @@ def get_proof(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -335,9 +351,13 @@ def download_proof(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
30 changes: 21 additions & 9 deletions giza/commands/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -110,9 +114,13 @@ def list(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -168,9 +176,13 @@ def create(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
14 changes: 10 additions & 4 deletions giza/commands/reset_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ def handle_http_error(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -97,7 +101,9 @@ def reset_password(
if token is None:
token = prompt_for_input("Please enter your reset token 🎟️")

new_password = prompt_for_input("Please enter your new password 🔑", hide_input=True)
new_password = prompt_for_input(
"Please enter your new password 🔑", hide_input=True
)
confirm_password = prompt_for_input(
"Please confirm your new password 🔑", hide_input=True
)
Expand Down
40 changes: 28 additions & 12 deletions giza/commands/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ def create(debug: Optional[bool] = DEBUG_OPTION) -> None:
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -126,9 +130,13 @@ def login(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -170,9 +178,13 @@ def create_api_key(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -238,9 +250,13 @@ def resend_email(debug: Optional[bool] = DEBUG_OPTION) -> None:
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
30 changes: 21 additions & 9 deletions giza/commands/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -114,9 +118,13 @@ def create(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -157,9 +165,13 @@ def delete(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
44 changes: 31 additions & 13 deletions giza/frameworks/cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ def prove(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -196,9 +200,13 @@ def deploy(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -364,9 +372,13 @@ def transpile(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -456,7 +468,9 @@ def verify(
while True:
current_job: Job = client.get(job.id, params={"kind": JobKind.VERIFY})
if current_job.status == JobStatus.COMPLETED:
live.update(echo.format_message("Verification job is successful ✅"))
live.update(
echo.format_message("Verification job is successful ✅")
)
break
elif current_job.status == JobStatus.FAILED:
live.update(
Expand Down Expand Up @@ -485,9 +499,13 @@ def verify(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Loading

0 comments on commit e3322e9

Please sign in to comment.