Skip to content

Commit 73e78dc

Browse files
authored
add ruff and bump deps (#1656)
1 parent 16a1b77 commit 73e78dc

File tree

156 files changed

+2767
-2033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2767
-2033
lines changed

.github/workflows/pre-commit.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: pre-commit
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
pre-commit:
14+
name: Pre-commit
15+
timeout-minutes: 30
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install UV
20+
uses: astral-sh/setup-uv@v6
21+
with:
22+
python-version: "3.12"
23+
activate-environment: true
24+
25+
- name: Install Requirements
26+
run: uv sync
27+
28+
- run: pre-commit run --all-files --show-diff-on-failure --color=always

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fail_fast: true
2+
3+
repos:
4+
- repo: https://github.com/charliermarsh/ruff-pre-commit
5+
rev: v0.14.0
6+
hooks:
7+
- id: ruff-format
8+
- id: ruff
9+
args: ["--fix", "--exit-non-zero-on-fix", "--no-unsafe-fixes"]

alembic/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
2+
23
from logging.config import fileConfig
34

4-
from sqlalchemy import engine_from_config
5-
from sqlalchemy import pool
5+
from sqlalchemy import engine_from_config, pool
66

77
from alembic import context
88

alembic/versions/0e2da5026c00_.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""empty message
1+
"""empty message.
22
33
Revision ID: 0e2da5026c00
44
Revises:
@@ -8,10 +8,11 @@
88

99
from typing import Sequence, Union
1010

11-
from alembic import op
1211
import sqlalchemy as sa
1312
import sqlmodel
1413

14+
from alembic import op
15+
1516
# revision identifiers, used by Alembic.
1617
revision: str = "0e2da5026c00"
1718
down_revision: Union[str, None] = None
@@ -49,7 +50,7 @@ def upgrade() -> None:
4950
)
5051
# ### end Alembic commands ###
5152

52-
op.execute("""INSERT INTO Customer (name, email, phone, address) VALUES
53+
op.execute("""INSERT INTO Customer (name, email, phone, address) VALUES
5354
('John Doe', '[email protected]', '123-456-7890', '123 Elm Street, Springfield'),
5455
('Jane Smith', '[email protected]', '234-567-8901', '456 Oak Street, Springfield'),
5556
('Alice Johnson', '[email protected]', '345-678-9012', '789 Pine Street, Springfield'),

docs/getting_started/chat_tutorial_style.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@
33

44
shadow = "rgba(0, 0, 0, 0.15) 0px 2px 8px"
55
chat_margin = "20%"
6-
message_style = dict(
7-
padding="1em",
8-
border_radius="5px",
9-
margin_y="0.5em",
10-
box_shadow=shadow,
11-
max_width="30em",
12-
display="inline-block",
13-
)
6+
message_style = {
7+
"padding": "1em",
8+
"border_radius": "5px",
9+
"margin_y": "0.5em",
10+
"box_shadow": shadow,
11+
"max_width": "30em",
12+
"display": "inline-block",
13+
}
1414

1515
# Set specific styles for questions and answers.
16-
question_style = message_style | dict(
17-
background_color=rx.color("gray", 4), margin_left=chat_margin
18-
)
19-
answer_style = message_style | dict(
20-
background_color=rx.color("accent", 8), margin_right=chat_margin
21-
)
16+
question_style = message_style | {
17+
"background_color": rx.color("gray", 4),
18+
"margin_left": chat_margin,
19+
}
20+
answer_style = message_style | {
21+
"background_color": rx.color("accent", 8),
22+
"margin_right": chat_margin,
23+
}
2224

2325
# Styles for the action bar.
24-
input_style = dict(border_width="1px", box_shadow=shadow, width="350px")
25-
button_style = dict(background_color=rx.color("accent", 10), box_shadow=shadow)
26+
input_style = {"border_width": "1px", "box_shadow": shadow, "width": "350px"}
27+
button_style = {"background_color": rx.color("accent", 10), "box_shadow": shadow}

pcweb/components/button.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
from typing import Callable, Literal
2+
13
import reflex as rx
2-
from typing import Literal, Callable
4+
35
from pcweb.components.icons import get_icon
46

57
LiteralButtonVariant = Literal[
@@ -40,22 +42,22 @@ def get_variant_class(variant: str) -> str:
4042
def button(
4143
text: str,
4244
variant: LiteralButtonVariant = "primary",
43-
onclick: Callable = None,
44-
style: dict = {},
45+
onclick: Callable | None = None,
46+
style: dict | None = None,
4547
class_name: str = "",
4648
*children,
4749
**props,
4850
) -> rx.Component:
4951
return rx.el.button(
5052
text,
53+
*children,
5154
onclick=onclick,
52-
style=style,
55+
style=style if style is not None else {},
5356
class_name=default_class_name
5457
+ " "
5558
+ variant_styles[variant]["class_name"]
5659
+ " "
5760
+ class_name,
58-
*children,
5961
**props,
6062
)
6163

@@ -64,22 +66,22 @@ def button_with_icon(
6466
text: str,
6567
icon: str,
6668
variant: LiteralButtonVariant = "primary",
67-
onclick: Callable = None,
68-
style: dict = {},
69+
onclick: Callable | None = None,
70+
style: dict | None = None,
6971
class_name: str = "",
7072
*children,
7173
**props,
7274
) -> rx.Component:
7375
return rx.el.button(
7476
get_icon(icon, class_name="[&>svg]:size-5"),
7577
text,
78+
*children,
7679
onclick=onclick,
77-
style=style,
80+
style=style if style is not None else {},
7881
class_name=default_class_name
7982
+ " "
8083
+ variant_styles[variant]["class_name"]
8184
+ " "
8285
+ class_name,
83-
*children,
8486
**props,
8587
)

pcweb/components/docpage/navbar/buttons/color.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import reflex as rx
2-
from pcweb.components.icons import get_icon
3-
4-
52
from reflex.style import toggle_color_mode
63

4+
from pcweb.components.icons import get_icon
5+
76

87
def color() -> rx.Component:
98
return rx.el.button(

pcweb/components/docpage/navbar/buttons/discord.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import reflex as rx
2+
23
from pcweb.components.icons.icons import get_icon
34
from pcweb.constants import DISCORD_URL
45

pcweb/components/docpage/navbar/buttons/github.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import reflex as rx
2-
from pcweb.constants import GITHUB_URL
2+
33
from pcweb.components.icons.icons import get_icon
4+
from pcweb.constants import GITHUB_URL
45
from pcweb.github import GithubStarState
56

67

pcweb/components/docpage/navbar/buttons/sidebar.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import reflex as rx
2+
from reflex.style import toggle_color_mode
3+
24
from pcweb.components.icons.icons import get_icon
3-
from pcweb.constants import GITHUB_URL, TWITTER_URL, DISCORD_URL
5+
from pcweb.constants import DISCORD_URL, GITHUB_URL, TWITTER_URL
6+
from pcweb.pages.blog import blogs
47
from pcweb.pages.docs import getting_started
5-
from pcweb.pages.hosting.hosting import hosting_landing
68
from pcweb.pages.docs.library import library
7-
from pcweb.pages.blog import blogs
8-
from pcweb.pages.gallery import gallery
99
from pcweb.pages.framework.framework import framework
10-
from reflex.style import toggle_color_mode
10+
from pcweb.pages.gallery import gallery
11+
from pcweb.pages.hosting.hosting import hosting_landing
1112

1213

1314
def social_menu_item(

0 commit comments

Comments
 (0)