Skip to content

Commit 0496a54

Browse files
authored
Merge pull request #313 from reflex-dev/use-__fields__-and-fix-precommit
use __fields__ and fix precommit
2 parents a4a21e6 + 57be680 commit 0496a54

File tree

21 files changed

+50
-50
lines changed

21 files changed

+50
-50
lines changed

.github/workflows/check_export.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
check-export:
3030
needs: [list-examples]
3131
strategy:
32+
fail-fast: false
3233
matrix:
3334
example: ${{ fromJSON(needs.list-examples.outputs.examples) }}
3435
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
fail_fast: true
2+
13
repos:
2-
- repo: local
3-
hooks:
4-
- id: black
5-
name: black
6-
description: "Black: The uncompromising Python code formatter"
7-
entry: black
8-
language: python
9-
minimum_pre_commit_version: 2.9.2
10-
require_serial: true
11-
types_or: [python]
4+
- repo: https://github.com/charliermarsh/ruff-pre-commit
5+
rev: v0.8.5
6+
hooks:
7+
- id: ruff-format
8+
args: ["."]
9+
- id: ruff
10+
args: ["--fix", "--exit-non-zero-on-fix"]
11+
12+
- repo: https://github.com/codespell-project/codespell
13+
rev: v2.3.0
14+
hooks:
15+
- id: codespell
16+
args: ["--skip=*.txt,*.json,*.svg", "--exclude-file=reflexle/reflexle/words.py", "--ignore-words-list=HomeState,selectin", "."]

ag_grid_finance/ag_grid_finance/ag_grid_finance.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def fetch_stock_data(self):
3636

3737
# Fetch data for all tickers in a single download
3838
self.data = yf.download(
39-
companies, start=start_date, end=self.datetime_now, group_by="ticker",
39+
companies,
40+
start=start_date,
41+
end=self.datetime_now,
42+
group_by="ticker",
4043
)
4144
rows = []
4245
for ticker in companies:

azure_auth/azure_auth/auth/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def callback(self):
6868
result = sso_app.acquire_token_by_auth_code_flow(
6969
self._flow, auth_response, scopes=[]
7070
)
71-
except Exception as e:
72-
return rx.toast(f"error something went wrong")
71+
except Exception:
72+
return rx.toast("error something went wrong")
7373
# this can be used for accessing graph
7474
self._access_token = result.get("access_token")
7575
self._token = result.get("id_token_claims")

azure_auth/azure_auth/azure_auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import reflex as rx
44

5-
from rxconfig import config
6-
from azure_auth.pages import callback, home, logout
5+
from azure_auth.pages import callback, home, logout # noqa: F401
76

87

98
class State(rx.State):

basic_crud/basic_crud/basic_crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def render_product(product: Product):
136136
),
137137
rx.spacer(),
138138
border="solid black 1px",
139-
spcaing="5",
139+
spacing="5",
140140
width="100%",
141141
)
142142

chat_v2/chat_v2/components/buttons.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass, field
4-
from typing import Callable
54

65
import reflex as rx
76

chat_v2/chat_v2/components/typography.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def text_with_icon(
1111
"""Creates a text with an icon.
1212
- icon: The icon tag name.
1313
- text: The title name.
14-
- kwargs: Additonal props for the component.
14+
- kwargs: Additional props for the component.
1515
"""
1616
return rx.hstack(
1717
rx.icon(

chat_v2/chat_v2/page_chat/chat_body.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from chat_v2.page_chat.chat_messages.model_chat_message_question import (
1313
QUESTION_STYLE,
1414
)
15-
from chat_v2.templates.action_bar import action_bar
1615
from chat_v2.templates.pop_up import dialog_library
1716

1817

data_visualisation/data_visualisation/data_visualisation.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from sqlmodel import select
44
import reflex as rx
55

6-
from data_visualisation.models import Customer, Cereals, Covid, Countries
6+
from data_visualisation.models import Customer, Cereals, Covid, Countries # noqa: F401
77
from data_visualisation.data_loading import loading_data
88

99

@@ -57,7 +57,7 @@ def add_item(self):
5757
session.add(MODEL(**self.current_item))
5858
session.commit()
5959
self.load_entries()
60-
return rx.window_alert(f"Item has been added.")
60+
return rx.window_alert("Item has been added.")
6161

6262
def update_item(self):
6363
"""Update an item in the database."""
@@ -66,7 +66,7 @@ def update_item(self):
6666
select(MODEL).where(MODEL.id == self.current_item["id"])
6767
).first()
6868

69-
for field in MODEL.get_fields():
69+
for field in MODEL.__fields__:
7070
if field != "id":
7171
setattr(item, field, self.current_item[field])
7272
session.add(item)
@@ -156,11 +156,7 @@ def add_item_ui():
156156
),
157157
rx.form(
158158
rx.flex(
159-
*[
160-
add_fields(field)
161-
for field in MODEL.get_fields()
162-
if field != "id"
163-
],
159+
*[add_fields(field) for field in MODEL.__fields__ if field != "id"],
164160
rx.box(
165161
rx.button(
166162
"Submit",
@@ -225,7 +221,7 @@ def update_item_ui(item):
225221
update_fields_and_attrs(
226222
field, getattr(State.current_item, field)
227223
)
228-
for field in MODEL.get_fields()
224+
for field in MODEL.__fields__
229225
if field != "id"
230226
],
231227
rx.box(
@@ -294,7 +290,7 @@ def show_item(item: MODEL):
294290
rx.table.cell(rx.avatar(fallback="DA")),
295291
*[
296292
rx.table.cell(getattr(item, field))
297-
for field in MODEL.get_fields()
293+
for field in MODEL.__fields__
298294
if field != "id"
299295
],
300296
rx.table.cell(
@@ -323,7 +319,7 @@ def content():
323319
),
324320
rx.spacer(),
325321
rx.select(
326-
[*[field for field in MODEL.get_fields() if field != "id"]],
322+
[*[field for field in MODEL.__fields__ if field != "id"]],
327323
placeholder="Sort By: Name",
328324
size="3",
329325
on_change=lambda sort_value: State.sort_values(sort_value),
@@ -340,7 +336,7 @@ def content():
340336
rx.table.column_header_cell("Icon"),
341337
*[
342338
rx.table.column_header_cell(field)
343-
for field in MODEL.get_fields()
339+
for field in MODEL.__fields__
344340
if field != "id"
345341
],
346342
rx.table.column_header_cell("Edit"),

0 commit comments

Comments
 (0)