Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check_export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
check-export:
needs: [list-examples]
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.list-examples.outputs.examples) }}
runs-on: ubuntu-latest
Expand Down
25 changes: 15 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
fail_fast: true

repos:
- repo: local
hooks:
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.5
hooks:
- id: ruff-format
args: ["."]
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--skip=*.txt,*.json,*.svg", "--exclude-file=reflexle/reflexle/words.py", "--ignore-words-list=HomeState,selectin", "."]
5 changes: 4 additions & 1 deletion ag_grid_finance/ag_grid_finance/ag_grid_finance.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def fetch_stock_data(self):

# Fetch data for all tickers in a single download
self.data = yf.download(
companies, start=start_date, end=self.datetime_now, group_by="ticker",
companies,
start=start_date,
end=self.datetime_now,
group_by="ticker",
)
rows = []
for ticker in companies:
Expand Down
4 changes: 2 additions & 2 deletions azure_auth/azure_auth/auth/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def callback(self):
result = sso_app.acquire_token_by_auth_code_flow(
self._flow, auth_response, scopes=[]
)
except Exception as e:
return rx.toast(f"error something went wrong")
except Exception:
return rx.toast("error something went wrong")
# this can be used for accessing graph
self._access_token = result.get("access_token")
self._token = result.get("id_token_claims")
Expand Down
3 changes: 1 addition & 2 deletions azure_auth/azure_auth/azure_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import reflex as rx

from rxconfig import config
from azure_auth.pages import callback, home, logout
from azure_auth.pages import callback, home, logout # noqa: F401


class State(rx.State):
Expand Down
2 changes: 1 addition & 1 deletion basic_crud/basic_crud/basic_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def render_product(product: Product):
),
rx.spacer(),
border="solid black 1px",
spcaing="5",
spacing="5",
width="100%",
)

Expand Down
1 change: 0 additions & 1 deletion chat_v2/chat_v2/components/buttons.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Callable

import reflex as rx

Expand Down
2 changes: 1 addition & 1 deletion chat_v2/chat_v2/components/typography.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def text_with_icon(
"""Creates a text with an icon.
- icon: The icon tag name.
- text: The title name.
- kwargs: Additonal props for the component.
- kwargs: Additional props for the component.
"""
return rx.hstack(
rx.icon(
Expand Down
1 change: 0 additions & 1 deletion chat_v2/chat_v2/page_chat/chat_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from chat_v2.page_chat.chat_messages.model_chat_message_question import (
QUESTION_STYLE,
)
from chat_v2.templates.action_bar import action_bar
from chat_v2.templates.pop_up import dialog_library


Expand Down
20 changes: 8 additions & 12 deletions data_visualisation/data_visualisation/data_visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sqlmodel import select
import reflex as rx

from data_visualisation.models import Customer, Cereals, Covid, Countries
from data_visualisation.models import Customer, Cereals, Covid, Countries # noqa: F401
from data_visualisation.data_loading import loading_data


Expand Down Expand Up @@ -57,7 +57,7 @@ def add_item(self):
session.add(MODEL(**self.current_item))
session.commit()
self.load_entries()
return rx.window_alert(f"Item has been added.")
return rx.window_alert("Item has been added.")

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

for field in MODEL.get_fields():
for field in MODEL.__fields__:
if field != "id":
setattr(item, field, self.current_item[field])
session.add(item)
Expand Down Expand Up @@ -156,11 +156,7 @@ def add_item_ui():
),
rx.form(
rx.flex(
*[
add_fields(field)
for field in MODEL.get_fields()
if field != "id"
],
*[add_fields(field) for field in MODEL.__fields__ if field != "id"],
rx.box(
rx.button(
"Submit",
Expand Down Expand Up @@ -225,7 +221,7 @@ def update_item_ui(item):
update_fields_and_attrs(
field, getattr(State.current_item, field)
)
for field in MODEL.get_fields()
for field in MODEL.__fields__
if field != "id"
],
rx.box(
Expand Down Expand Up @@ -294,7 +290,7 @@ def show_item(item: MODEL):
rx.table.cell(rx.avatar(fallback="DA")),
*[
rx.table.cell(getattr(item, field))
for field in MODEL.get_fields()
for field in MODEL.__fields__
if field != "id"
],
rx.table.cell(
Expand Down Expand Up @@ -323,7 +319,7 @@ def content():
),
rx.spacer(),
rx.select(
[*[field for field in MODEL.get_fields() if field != "id"]],
[*[field for field in MODEL.__fields__ if field != "id"]],
placeholder="Sort By: Name",
size="3",
on_change=lambda sort_value: State.sort_values(sort_value),
Expand All @@ -340,7 +336,7 @@ def content():
rx.table.column_header_cell("Icon"),
*[
rx.table.column_header_cell(field)
for field in MODEL.get_fields()
for field in MODEL.__fields__
if field != "id"
],
rx.table.column_header_cell("Edit"),
Expand Down
1 change: 0 additions & 1 deletion form-designer/form_designer/form_designer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import contextlib
import reflex as rx

import reflex_local_auth
Expand Down
1 change: 0 additions & 1 deletion form-designer/tests/test_login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import time
import pytest

import reflex as rx
Expand Down
2 changes: 1 addition & 1 deletion linkinbio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ Contributions are welcome! Please fork the repository and submit a pull request

## Contact

This template was created by @erinmikailstaples (https://github.com/erinmikailstaples). Feel free to reach out for any quesitons, feedback, or collaboration opportunities.
This template was created by @erinmikailstaples (https://github.com/erinmikailstaples). Feel free to reach out for any questions, feedback, or collaboration opportunities.
2 changes: 1 addition & 1 deletion linkinbio/linkinbio/linkinbio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reflex as rx
from linkinbio.style import *
from linkinbio.style import style

# add launchdarkly imports
import ldclient
Expand Down
2 changes: 1 addition & 1 deletion overkey/overkey/overkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def index() -> rx.Component:
rx.vstack(
rx.hstack(
rx.cond(
(OverkeyState.current_time != None),
OverkeyState.current_time.is_not_none(),
rx.fragment(
rx.icon_button(
"rotate-ccw",
Expand Down
1 change: 0 additions & 1 deletion quiz/quiz/quiz.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Welcome to Reflex! This file outlines the steps to create a basic app."""

import copy
import time
from typing import Any, List

import reflex as rx
Expand Down
6 changes: 2 additions & 4 deletions traversal/traversal/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,10 @@ def set_initial_values(self):

def path_found(self, i, j):
if self.colored_graph[i][j] == "green":
return rx._x.toast.success(
f"Path found to [{i},{j}]", position="top-center"
)
return rx.toast.success(f"Path found to [{i},{j}]", position="top-center")

def path_not_found(self):
return rx._x.toast.error("No path found", position="top-center")
return rx.toast.error("No path found", position="top-center")

def explore_neighbors(self, i, j, mode=None):
if self.colored_graph[i][j] != "red":
Expand Down
2 changes: 1 addition & 1 deletion twitter/twitter/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Re-export components."""

from .container import container
from .container import container as container
2 changes: 1 addition & 1 deletion twitter/twitter/layouts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Re-export layouts."""

from .auth import auth_layout
from .auth import auth_layout as auth_layout
6 changes: 3 additions & 3 deletions twitter/twitter/pages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Re-export pages."""

from .home import home
from .login import login
from .signup import signup
from .home import home as home
from .login import login as login
from .signup import signup as signup
11 changes: 7 additions & 4 deletions upload/upload/upload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from pathlib import Path
from typing import List

Expand Down Expand Up @@ -28,9 +27,13 @@ async def handle_upload(self, files: List[rx.UploadFile]):
# Iterate through the uploaded files.
for file in files:
upload_data = await file.read()
outfile = Path(rx.get_upload_dir()) / file.filename.lstrip("/")
outfile.parent.mkdir(parents=True, exist_ok=True)
outfile.write_bytes(upload_data)
if file.name:
outfile = Path(rx.get_upload_dir()) / file.name.lstrip("/")
outfile.parent.mkdir(parents=True, exist_ok=True)
outfile.write_bytes(upload_data)
else:
# Unlikely to happens but make pyright happy to check for empty file names.
yield rx.toast("File name is empty. Please select a valid file.")

def on_upload_progress(self, prog: dict):
print("Got progress", prog)
Expand Down
Loading