Skip to content

Commit

Permalink
Formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
franalgaba committed Dec 12, 2023
1 parent 86fc31b commit 06874c6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions giza/commands/prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

def prove(
data: str = typer.Argument(None),
model_id: Optional[str] = typer.Option(None, "--model-id", "-m"),
version_id: Optional[str] = typer.Option(None, "--version-id", "-v"),
model_id: Optional[int] = typer.Option(None, "--model-id", "-m"),
version_id: Optional[int] = typer.Option(None, "--version-id", "-v"),
size: JobSize = typer.Option(JobSize.S, "--size", "-s"),
framework: Framework = typer.Option(Framework.CAIRO, "--framework", "-f"),
output_path: str = typer.Option("zk.proof", "--output-path", "-o"),
Expand Down
11 changes: 6 additions & 5 deletions giza/commands/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import typer
import requests
import typer

from giza.callbacks import version_callback
from giza import __version__
from giza.utils.echo import Echo

Expand All @@ -11,10 +10,12 @@ def check_version(ctx: typer.Context):
Check if there is a new version available of the cli in pypi to suggest upgrade
"""
current_version = __version__
response = requests.get('https://pypi.org/pypi/giza/json')
latest_version = response.json()['info']['version']
response = requests.get("https://pypi.org/pypi/giza/json")
latest_version = response.json()["info"]["version"]

if latest_version > current_version:
echo = Echo()
echo.warning(f"Current version of Giza CLI: {current_version}")
echo.warning(f"A new version ({latest_version}) is available. Please upgrade :bell:")
echo.warning(
f"A new version ({latest_version}) is available. Please upgrade :bell:"
)
5 changes: 2 additions & 3 deletions giza/commands/versions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import os
import zipfile
from io import BytesIO
from typing import Optional
Expand Down Expand Up @@ -69,7 +68,7 @@ def transpile(
None, help="The ID of the model where a new version will be created"
),
desc: str = typer.Option(None, help="Description of the version"),
model_desc: int = typer.Option(
model_desc: str = typer.Option(
None, help="Description of the Model to create if model_id is not provided"
),
framework: Framework = typer.Option(Framework.CAIRO, "--framework", "-f"),
Expand Down Expand Up @@ -320,7 +319,7 @@ def download_original(
echo("ONNX model is ready, downloading! ✅")
onnx_model = client.download_original(model_id, version.version)

with open(output_path, 'wb') as f:
with open(output_path, "wb") as f:
f.write(onnx_model)

echo(f"ONNX model saved at: {output_path}")
Expand Down
4 changes: 1 addition & 3 deletions giza/frameworks/cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ def transpile(
"""
echo = Echo(debug=debug)
if model_path is None:
echo.error(
"No model name provided, please provide a model path ⛔️"
)
echo.error("No model name provided, please provide a model path ⛔️")
sys.exit(1)
if model_id is None:
model_name = model_path.split("/")[-1].split(".")[0]
Expand Down
6 changes: 3 additions & 3 deletions giza/frameworks/ezkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setup(
model_path: str,
model_id: int,
desc: str,
model_desc: int,
model_desc: str,
input_data: str,
debug: Optional[bool],
size: JobSize = JobSize.S,
Expand Down Expand Up @@ -229,8 +229,8 @@ def verify(
proof_id: Optional[int],
model_id: Optional[int],
version_id: Optional[int],
proof: str = None,
debug: bool = False,
proof: Optional[str] = None,
debug: Optional[bool] = False,
size: JobSize = JobSize.S,
):
"""
Expand Down
7 changes: 4 additions & 3 deletions giza/utils/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def format_error(self, message: str) -> str:
str: error formatted message
"""
return self.format_message(rf"[red]{message}[/red]", "ERROR", "red")

def format_warning(self, message: str) -> str:
"""
Specific format for warning purposes
Expand All @@ -74,8 +74,9 @@ def format_warning(self, message: str) -> str:
str: error formatted message
"""
yellow = typer.colors.YELLOW
return self.format_message(rf"[{yellow}]{message}[/{yellow}]", "WARNING", f"{yellow}")

return self.format_message(
rf"[{yellow}]{message}[/{yellow}]", "WARNING", f"{yellow}"
)

def echo(self, message: str, formatted: str) -> None:
"""
Expand Down

0 comments on commit 06874c6

Please sign in to comment.