Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff #1219

Merged
merged 2 commits into from
Feb 26, 2025
Merged

ruff #1219

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
4 changes: 1 addition & 3 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def run_migrations_online() -> None:
)

with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
context.configure(connection=connection, target_metadata=target_metadata)

with context.begin_transaction():
context.run_migrations()
Expand Down
55 changes: 30 additions & 25 deletions alembic/versions/0e2da5026c00_.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
"""empty message

Revision ID: 0e2da5026c00
Revises:
Revises:
Create Date: 2024-05-22 17:31:15.245402

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel

# revision identifiers, used by Alembic.
revision: str = '0e2da5026c00'
revision: str = "0e2da5026c00"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('customer',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('phone', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"customer",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("phone", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_table('feedback',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column('feedback', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('score', sa.Integer(), nullable=True),
sa.Column('date_created', sa.DateTime(), nullable=False),
sa.Column('page', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"feedback",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("feedback", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("score", sa.Integer(), nullable=True),
sa.Column("date_created", sa.DateTime(), nullable=False),
sa.Column("page", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_table('waitlist',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('date_created', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"waitlist",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("date_created", sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###

Expand All @@ -58,9 +62,10 @@ def upgrade() -> None:
('Hank Brown', '[email protected]', '012-345-6789', '707 Oak Street, Springfield');
""")


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('waitlist')
op.drop_table('feedback')
op.drop_table('customer')
op.drop_table("waitlist")
op.drop_table("feedback")
op.drop_table("customer")
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion pcweb/components/docpage/navbar/inkeep.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""UI and logic inkeep chat component."""

from typing import List, Set
from typing import List

import reflex as rx
from reflex.event import EventHandler
Expand Down
8 changes: 2 additions & 6 deletions pcweb/components/docpage/navbar/navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
styling,
custom_components as custom_c,
getting_started,
hosting,
)
from pcweb.components.button import button
from pcweb.pages.docs.library import library
Expand All @@ -19,14 +18,10 @@
from .buttons.sidebar import navbar_sidebar_button
from .search import search_bar

from pcweb.pages.docs import getting_started, hosting
from pcweb.pages.faq import faq
from pcweb.pages.pricing.pricing import pricing
from pcweb.pages.errors import errors
from pcweb.pages.docs.library import library
from pcweb.pages.blog import blogs
from pcweb.pages.changelog import changelog
from pcweb.pages.gallery import gallery
from pcweb.components.hosting_banner import hosting_banner
from pcweb.pages.blog.paths import blog_data

Expand Down Expand Up @@ -142,7 +137,7 @@ def blog_section() -> rx.Component:
class_name="z-[2] flex flex-row justify-between px-[1.125rem] pb-[0.875rem] w-full",
),
rx.box(
background_image=f'linear-gradient(to top, rgba(0, 0, 0, 3) 0%, rgba(0, 0, 0, 0) 35%), url({list(blog_data.values())[0].metadata["image"]})',
background_image=f"linear-gradient(to top, rgba(0, 0, 0, 3) 0%, rgba(0, 0, 0, 0) 35%), url({list(blog_data.values())[0].metadata['image']})",
class_name="group-hover:scale-105 absolute inset-0 bg-cover bg-no-repeat bg-center rounded-md transition-all duration-150 ease-out brightness-[0.8] group-hover:brightness-100",
),
href="/" + list(blog_data.keys())[0],
Expand Down Expand Up @@ -370,6 +365,7 @@ def new_component_section() -> rx.Component:
),
)


@rx.memo
def navbar() -> rx.Component:
return rx.box(
Expand Down
2 changes: 1 addition & 1 deletion pcweb/components/docpage/navbar/navmenu/navmenu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Reflex custom component NavMenu."""

import reflex as rx
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, Literal
from reflex.vars import Var


Expand Down
5 changes: 4 additions & 1 deletion pcweb/components/docpage/navbar/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import reflex as rx
from .inkeep import inkeep


@rx.memo
def search_bar() -> rx.Component:
return rx.box(inkeep(), class_name="w-full h-full min-w-0 max-w-[256px] max-h-[32px]")
return rx.box(
inkeep(), class_name="w-full h-full min-w-0 max-w-[256px] max-h-[32px]"
)
1 change: 0 additions & 1 deletion pcweb/components/docpage/navbar/state.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""The state for the navbar component."""
import os

import reflex as rx

Expand Down
11 changes: 8 additions & 3 deletions pcweb/components/docpage/sidebar/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import reflex_chakra as rc
from pcweb.components.docpage.navbar.state import NavbarState
from .state import SidebarState, SideBarItem, SideBarBase
import reflex_chakra as rc

from .sidebar_items.learn import learn, frontend, backend, hosting
from .sidebar_items.component_lib import (
Expand Down Expand Up @@ -354,7 +353,9 @@ def sidebar_comp(
"Learn", getting_started.introduction.path, "graduation-cap", 0
),
sidebar_category("Components", library.path, "layout-panel-left", 1),
sidebar_category("Deploy", hosting_page.deploy_quick_start.path, "cloud", 2),
sidebar_category(
"Deploy", hosting_page.deploy_quick_start.path, "cloud", 2
),
sidebar_category("API Reference", pages[0].path, "book-text", 3),
class_name="flex flex-col items-start gap-1 w-full list-none",
),
Expand All @@ -378,7 +379,11 @@ def sidebar_comp(
url,
),
create_sidebar_section(
"State", state.overview.path, filter_out_non_sidebar_items(backend), backend_index, url
"State",
state.overview.path,
filter_out_non_sidebar_items(backend),
backend_index,
url,
),
create_sidebar_section(
"Recipes", overview.path, recipes, recipes_index, url
Expand Down
2 changes: 1 addition & 1 deletion pcweb/components/docpage/sidebar/sidebar_items/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .component_lib import get_component_link
from .component_lib import get_component_link as get_component_link
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def get_category_children(category, category_list, prefix=""):

def get_sidebar_items_component_lib():
from pcweb.pages.docs import component_list
from pcweb.pages.docs.library import library

library_item_children = []

Expand All @@ -61,9 +60,8 @@ def get_sidebar_items_graphings():
)
graphing_children.append(category_item)

return [
*graphing_children
]
return [*graphing_children]


component_lib = get_sidebar_items_component_lib()
graphing_libs = get_sidebar_items_graphings()
4 changes: 2 additions & 2 deletions pcweb/components/docpage/sidebar/sidebar_items/item.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pcweb.route import Route
from ..state import SidebarState, SideBarItem
from ..state import SideBarItem


def create_item(route: Route, children=None):
Expand All @@ -14,7 +14,7 @@ def create_item(route: Route, children=None):
alt_name_for_next_prev = ""
name = name.replace("Api", "API").replace("Cli", "CLI")
return SideBarItem(
names=name, alt_name_for_next_prev=alt_name_for_next_prev, link=route.path
names=name, alt_name_for_next_prev=alt_name_for_next_prev, link=url
)
return SideBarItem(
names=route,
Expand Down
25 changes: 10 additions & 15 deletions pcweb/components/docpage/sidebar/sidebar_items/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_sidebar_items_frontend():
SideBarSection(
names="User Interface Overview",
alt_name_for_next_prev="",
link=ui.overview.path
link=ui.overview.path,
),
create_item(
"Components",
Expand Down Expand Up @@ -123,9 +123,7 @@ def get_sidebar_items_backend():

items = [
SideBarSection(
names="State Overview",
alt_name_for_next_prev="",
link=state.overview.path
names="State Overview", alt_name_for_next_prev="", link=state.overview.path
),
create_item(
"Vars",
Expand Down Expand Up @@ -211,32 +209,29 @@ def get_sidebar_items_hosting():
children=[
hosting.adding_members,
],
),
),
create_item(
"App",
children=[
hosting.app_management,
hosting.machine_types,
hosting.regions,
hosting.regions,
hosting.logs,
hosting.secrets_environment_vars,
hosting.custom_domains,
hosting.config_file,
hosting.tokens,
hosting.deploy_with_github_actions,
],
),
create_item(
"Usage",
children=[
hosting.billing,
hosting.compute,
]
),
create_item(
"CLI Reference",
children=cloud_cliref.pages
"Usage",
children=[
hosting.billing,
hosting.compute,
],
),
create_item("CLI Reference", children=cloud_cliref.pages),
create_item(
"Self Hosting",
children=[hosting.self_hosting],
Expand Down
7 changes: 2 additions & 5 deletions pcweb/components/docpage/sidebar/sidebar_items/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ def get_sidebar_items_recipes():
from pcweb.pages.docs import (
recipes,
)
from pcweb.pages.docs.recipes_overview import (
overview,
)

return [
create_item(
Expand All @@ -33,7 +30,7 @@ def get_sidebar_items_recipes():
children=[
recipes.auth.login_form,
recipes.auth.signup_form,
]
],
),
create_item(
"Other",
Expand All @@ -43,7 +40,7 @@ def get_sidebar_items_recipes():
recipes.others.chips,
recipes.others.speed_dial,
recipes.others.dark_mode_toggle,
]
],
),
]

Expand Down
4 changes: 2 additions & 2 deletions pcweb/components/docpage/sidebar/sidebar_items/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def get_sidebar_items_api_reference():
return [
create_item(
"API Reference",
children=apiref.pages + [
children=apiref.pages
+ [
api_reference.var_system,
api_reference.cli,
api_reference.event_triggers,
Expand All @@ -19,7 +20,6 @@ def get_sidebar_items_api_reference():
]



def get_sidebar_items_tutorials():
from pcweb.pages.docs import (
datatable_tutorial,
Expand Down
2 changes: 1 addition & 1 deletion pcweb/components/docpage/sidebar/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def sidebar_index(self) -> int:
return 0
if "hosting" in route:
return 2
return self._sidebar_index
return self._sidebar_index
3 changes: 2 additions & 1 deletion pcweb/components/hint.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import reflex as rx


def hint(
text: str,
content: rx.Component,
side: str = "top",
align: str = "center",
active: bool = False,
class_name: str = "",
**props
**props,
) -> rx.Component:
return rx.hover_card.root(
rx.hover_card.trigger(content, height="fit-content"),
Expand Down
1 change: 1 addition & 0 deletions pcweb/components/hosting_banner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import reflex as rx
from pcweb.constants import REFLEX_CLOUD_URL


def glow() -> rx.Component:
return rx.box(
class_name="absolute w-[120rem] h-[23.75rem] flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[0] top-[-16rem]",
Expand Down
4 changes: 3 additions & 1 deletion pcweb/components/icon_button.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import reflex as rx
from typing import Literal, Callable

LiteralButtonVariant = Literal["primary", "success", "destructive", "secondary", "muted"]
LiteralButtonVariant = Literal[
"primary", "success", "destructive", "secondary", "muted"
]

default_class_name = "rounded-full w-8 h-8 inline-flex items-center justify-center cursor-pointer relative border-t border-[rgba(255,255,255,0.21)] shrink-0"
after_class_name = "after:absolute after:inset-[1px] after:border-t after:rounded-[11px] after:border-white after:opacity-[0.22]"
Expand Down
2 changes: 1 addition & 1 deletion pcweb/components/icons/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .icons import get_icon
from .icons import get_icon as get_icon
Loading