Skip to content

Commit

Permalink
fix lint and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mde-pach committed Feb 20, 2024
1 parent 6534a4e commit 6cf00c1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 21 deletions.
16 changes: 4 additions & 12 deletions blitz/cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ class BlitzProjectCreator:
DEMO_BLITZ_APP_DESCRIPTION = "This is a demo blitz app"
DEMO_BLITZ_APP_NAME = "Demo Blitz App"

def __init__(
self, name: str, description: str, file_format: str, demo: bool = False
) -> None:
def __init__(self, name: str, description: str, file_format: str, demo: bool = False) -> None:
self.name = name
self.description = description
self.file_format = file_format
Expand Down Expand Up @@ -95,9 +93,7 @@ def create_file_or_exit(self) -> None:
raise typer.Exit(code=1)

def print_success_message(self) -> None:
print(
f"\n[medium_purple1 bold]{self.name}[/medium_purple1 bold] created successfully !"
)
print(f"\n[medium_purple1 bold]{self.name}[/medium_purple1 bold] created successfully !")
print("To start your app, you can use:")
print(f" [bold medium_purple1]blitz start {self.path}[/bold medium_purple1]")

Expand Down Expand Up @@ -127,9 +123,7 @@ def _write_blitz_file(self) -> Path:
raise Exception()
match self.file_format:
case "json":
blitz_file_data = self.blitz_file.model_dump_json(
indent=4, by_alias=True, exclude_unset=True
)
blitz_file_data = self.blitz_file.model_dump_json(indent=4, by_alias=True, exclude_unset=True)
case "yaml":
blitz_file_data = yaml.dump(
self.blitz_file.model_dump(by_alias=True, exclude_unset=True),
Expand All @@ -151,9 +145,7 @@ def _print_file_error(error: Exception) -> None:

@staticmethod
def _print_directory_error(error: Exception) -> None:
print(
f"[red bold]Error[/red bold] while creating the blitz app in the file system: {error}"
)
print(f"[red bold]Error[/red bold] while creating the blitz app in the file system: {error}")


def create_blitz_app(
Expand Down
3 changes: 1 addition & 2 deletions blitz/ui/components/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from typing import Any, Self, TypeVar
from blitz.ui.blitz_ui import BlitzUI, get_blitz_ui

Expand Down Expand Up @@ -58,4 +57,4 @@ def variant(cls, name: str, *, props: str = "", classes: str = "", **kwargs: Any
"props": props,
"classes": classes,
},
)
)
1 change: 0 additions & 1 deletion blitz/ui/components/buttons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
"FlatButton",
"Button",
]

2 changes: 1 addition & 1 deletion blitz/ui/components/buttons/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def render(self) -> None:
on_click=self.on_click,
color=self.color,
icon=self.icon,
).props(self.props).classes(self.classes)
).props(self.props).classes(self.classes)
2 changes: 1 addition & 1 deletion blitz/ui/components/buttons/flat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .base import BaseButton


FlatButton = BaseButton.variant("Flat", props="flat")
FlatButton = BaseButton.variant("Flat", props="flat")
2 changes: 1 addition & 1 deletion blitz/ui/components/buttons/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def __init__(
icon=icon,
props=f"{props} color={icon_color} size={icon_size}",
classes=classes,
)
)
5 changes: 2 additions & 3 deletions blitz/ui/components/gpt_chat_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
from pydantic import ValidationError
from blitz.models.blitz.file import BlitzFile
from openai.types.chat import ChatCompletionMessageParam
from blitz.ui.components import buttons
from blitz.ui.components.buttons import FlatButton

import yaml
from blitz.ui.components.buttons.base import BaseButton

from blitz.ui.components.buttons.icon import IconButton

Expand Down Expand Up @@ -205,6 +203,7 @@ class GPTResponse(GPTChatComponent):

def __init__(self, text: str = "", text_is_finished: bool = False) -> None:
super().__init__(label=self.LABEL, text=text, icon=self.ICON, avatar_color=self.AVATAR_COLOR)
self._text_is_finished: bool
self.text_is_finished = text_is_finished

def add(self, text: str) -> None:
Expand Down Expand Up @@ -254,4 +253,4 @@ def from_gpt_dict(cls, gpt_dict: dict[str, Any]) -> "GPTChatComponent":
return cls(
text=gpt_dict.get("content", ""),
text_is_finished=gpt_dict.get("text_is_finished", False),
)
)

0 comments on commit 6cf00c1

Please sign in to comment.