Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Commit e45d7a2

Browse files
committed
convert ones i can find
1 parent f7f5227 commit e45d7a2

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

pcweb/components/docpage/sidebar/state.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
from __future__ import annotations
44

5+
from dataclasses import dataclass, field
6+
57
import reflex as rx
6-
from reflex.base import Base
78

89

9-
class SideBarBase(Base):
10+
@dataclass(kw_only=True)
11+
class SideBarBase:
1012
"""Base class for the Side bar."""
1113

1214
# The name to display in the sidebar.
@@ -18,7 +20,7 @@ class SideBarBase(Base):
1820
link: str = ""
1921

2022
# The children items.
21-
children: list[SideBarItem] = []
23+
children: list[SideBarItem] = field(default_factory=list)
2224

2325
# Whether the item is a category. Occurs if a single item is at the top level of the sidebar for aesthetics.
2426
outer = False

pcweb/pages/docs/apiref.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
modules = [
1010
rx.App,
11-
rx.Base,
1211
rx.Component,
1312
rx.ComponentState,
1413
(rx.Config, rx.config.BaseConfig),

pcweb/pages/docs/component.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class PropDocsState(rx.State):
7878

7979
def render_select(prop: PropDocumentation, component: type[Component], prop_dict: dict):
8080
if (
81-
not rx.utils.types._issubclass(
81+
not safe_issubclass(
8282
component, (RadixThemesComponent, RadixPrimitiveComponent)
8383
)
8484
or component.__name__ in EXCLUDED_COMPONENTS
@@ -248,6 +248,11 @@ def color_scheme_hovercard(literal_values: list[str]) -> rx.Component:
248248
),
249249
)
250250

251+
def safe_issubclass(cls, class_or_tuple):
252+
try:
253+
return issubclass(cls, class_or_tuple)
254+
except TypeError:
255+
return False
251256

252257
def prop_docs(
253258
prop: PropDocumentation,
@@ -258,9 +263,10 @@ def prop_docs(
258263
"""Generate the docs for a prop."""
259264
# Get the type of the prop.
260265
type_ = prop.type
261-
if rx.utils.types._issubclass(prop.type, rx.Var):
266+
origin = get_origin(type_)
267+
if safe_issubclass(prop.type, rx.Var):
262268
# For vars, get the type of the var.
263-
type_ = rx.utils.types.get_args(type_)[0]
269+
type_ = get_args(type_)[0]
264270

265271
origin = get_origin(type_)
266272
args = get_args(type_)
@@ -448,7 +454,7 @@ def generate_props(
448454
prop_dict = {}
449455

450456
is_interactive = True
451-
if not rx.utils.types._issubclass(
457+
if not issubclass(
452458
component, (RadixThemesComponent, RadixPrimitiveComponent)
453459
) or component.__name__ in [
454460
"Theme",

0 commit comments

Comments
 (0)