instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
.HTTPError, json.JSONDecodeError) as ex: print(f"Internal error: failed to fetch components list due to: {ex}") return for c in component_list: c["downloads_last_month"] = c["downloads"]["last_month"] c["keywords"] = [ keyword for ...
@rx.event def delta_limit(self, limit: str) -> None: self.current_limit = int(limit) self.offset = 0 self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit self.paginate() @rx.event def previous(self) -> None: ...
self.current_page = (self.offset // self.current_limit) + 1
return for c in component_list: c["downloads_last_month"] = c["downloads"]["last_month"] c["keywords"] = [ keyword for keyword in c["keywords"] or [] if "reflex" not in keyword.lower() ] c["download_url"] = pa...
self.offset = 0 self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit self.paginate() @rx.event def previous(self) -> None: if self.offset >= self.current_limit: self.offset -= self.current_limit else: ...
self.current_limit = int(limit)
_list: c["downloads_last_month"] = c["downloads"]["last_month"] c["keywords"] = [ keyword for keyword in c["keywords"] or [] if "reflex" not in keyword.lower() ] c["download_url"] = package_url(c["package_name"]) as...
self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit self.paginate() @rx.event def previous(self) -> None: if self.offset >= self.current_limit: self.offset -= self.current_limit else: self.offset ...
self.offset = 0
wnloads_last_month"] = c["downloads"]["last_month"] c["keywords"] = [ keyword for keyword in c["keywords"] or [] if "reflex" not in keyword.lower() ] c["download_url"] = package_url(c["package_name"]) async with self: ...
self.paginate() @rx.event def previous(self) -> None: if self.offset >= self.current_limit: self.offset -= self.current_limit else: self.offset = 0 self.paginate() @rx.event def next(self) -> None: if self.offset + self.current_limit < s...
self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit
[] if "reflex" not in keyword.lower() ] c["download_url"] = package_url(c["package_name"]) async with self: self.original_components_list = component_list self.number_of_rows = len(component_list) self.total_pages = ( ...
@rx.event def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SO...
def previous(self) -> None: if self.offset >= self.current_limit: self.offset -= self.current_limit else: self.offset = 0 self.paginate()
in keyword.lower() ] c["download_url"] = package_url(c["package_name"]) async with self: self.original_components_list = component_list self.number_of_rows = len(component_list) self.total_pages = ( self.number_of_rows + self.current_l...
self.paginate() @rx.event def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter ...
if self.offset >= self.current_limit: self.offset -= self.current_limit else: self.offset = 0
with self: self.original_components_list = component_list self.number_of_rows = len(component_list) self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit yield CustomComponentGalleryState.paginate() @rx...
self.paginate() @rx.event def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter ...
self.offset = 0
ponent_list self.number_of_rows = len(component_list) self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit yield CustomComponentGalleryState.paginate() @rx.event def paginate(self) -> None: start = self...
@rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambda x: x["updated_at"] ) # Both "Recent" and "Downloads" should be sorted in reverse order (newest/highest...
def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate()
ber_of_rows = len(component_list) self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit yield CustomComponentGalleryState.paginate() @rx.event def paginate(self) -> None: start = self.offset end = start + se...
self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambda x: x["updated_at"] ) # Both "Recent" and "Downloads" should be sorted in rever...
if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit
f.current_limit yield CustomComponentGalleryState.paginate() @rx.event def paginate(self) -> None: start = self.offset end = start + self.current_limit self.paginated_data = self.original_components_list[start:end] self.current_page = (self.offset // self.current_lim...
@rx.event def set_selected_filter(self, filter_text: str): # Reset to the first page when the filter is changed self.selected_filter = filter_text self.offset = 0 # Reset pagination self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self...
def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambda x: x["updated_at"] ) # Both "Recent" and "Downloads" should be sorted in reverse order (newest/highest first) if s...
inate(self) -> None: start = self.offset end = start + self.current_limit self.paginated_data = self.original_components_list[start:end] self.current_page = (self.offset // self.current_limit) + 1 @rx.event def delta_limit(self, limit: str) -> None: self.current_limit = ...
# Both "Recent" and "Downloads" should be sorted in reverse order (newest/highest first) if self.selected_filter in ["Recent", "Downloads"]: self.original_components_list.sort(key=sorting_function, reverse=True) else: # Default sorting behavior, if no filter selected ...
sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambda x: x["updated_at"] )
_limit) + 1 @rx.event def delta_limit(self, limit: str) -> None: self.current_limit = int(limit) self.offset = 0 self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit self.paginate() @rx.event def previous(self) ->...
# After sorting, paginate the data self.paginate() @rx.event def set_selected_filter(self, filter_text: str): # Reset to the first page when the filter is changed self.selected_filter = filter_text self.offset = 0 # Reset pagination self.total_pages = ( ...
if self.selected_filter in ["Recent", "Downloads"]: self.original_components_list.sort(key=sorting_function, reverse=True) else: # Default sorting behavior, if no filter selected self.original_components_list.sort(key=sorting_function, reverse=False)
self.offset -= self.current_limit else: self.offset = 0 self.paginate() @rx.event def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_component...
# Update paginated data def filter_item( icon: str, text: str, border: bool = False, on_click=None ) -> rx.Component: is_selected = CustomComponentGalleryState.selected_filter == text return rx.box( get_icon(icon, class_name="py-[2px]", opacity=rx.cond(is_selected, 0.64, 1)), rx.text(tex...
def set_selected_filter(self, filter_text: str): # Reset to the first page when the filter is changed self.selected_filter = filter_text self.offset = 0 # Reset pagination self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit # Re...
def next(self) -> None: if self.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.g...
self.offset = 0 # Reset pagination self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit # Recalculate total pages self.sort_components() # Sort components based on selected filter self.paginate() # Update paginated data def ...
self.selected_filter = filter_text
.offset + self.current_limit < self.number_of_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambd...
# Reset pagination self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit # Recalculate total pages self.sort_components() # Sort components based on selected filter self.paginate() # Update paginated data def filter_item( icon: s...
self.offset = 0
f_rows: self.offset += self.current_limit self.paginate() @rx.event def sort_components(self): # Get the sorting function based on the selected filter sorting_function = SORTING_CRITERIA.get( self.selected_filter, lambda x: x["updated_at"] ) # Bo...
# Recalculate total pages self.sort_components() # Sort components based on selected filter self.paginate() # Update paginated data def filter_item( icon: str, text: str, border: bool = False, on_click=None ) -> rx.Component: is_selected = CustomComponentGalleryState.selected_filter == tex...
self.total_pages = ( self.number_of_rows + self.current_limit - 1 ) // self.current_limit
filter, lambda x: x["updated_at"] ) # Both "Recent" and "Downloads" should be sorted in reverse order (newest/highest first) if self.selected_filter in ["Recent", "Downloads"]: self.original_components_list.sort(key=sorting_function, reverse=True) else: # Default...
chips_box_style = { "width": ["100%", "100%", "auto"], "box-sizing": "border-box", "display": "flex", "flex-direction": "row", "align_items": "center", "padding": "6px 12px", "cursor": "pointer", "box-shadow": shadows["large"], "border-radius": "1000px", "transition": "backgro...
def filter_item( icon: str, text: str, border: bool = False, on_click=None ) -> rx.Component: is_selected = CustomComponentGalleryState.selected_filter == text return rx.box( get_icon(icon, class_name="py-[2px]", opacity=rx.cond(is_selected, 0.64, 1)), rx.text(text, opacity=rx.cond(is_select...
in reverse order (newest/highest first) if self.selected_filter in ["Recent", "Downloads"]: self.original_components_list.sort(key=sorting_function, reverse=True) else: # Default sorting behavior, if no filter selected self.original_components_list.sort(key=sorting_fu...
return rx.box( get_icon(icon, class_name="py-[2px]", opacity=rx.cond(is_selected, 0.64, 1)), rx.text(text, opacity=rx.cond(is_selected, 0.64, 1), class_name="font-small"), rx.spacer(), rx.cond( is_selected, rx.box( class_name="size-2 justify-e...
is_selected = CustomComponentGalleryState.selected_filter == text
) # Sort components based on selected filter self.paginate() # Update paginated data def filter_item( icon: str, text: str, border: bool = False, on_click=None ) -> rx.Component: is_selected = CustomComponentGalleryState.selected_filter == text return rx.box( get_icon(icon, class_name="p...
# Sorting sorting_box_style = { "gap": "12px", "outline": "none", "_focus": { "outline": "none", }, **chips_box_style, } menu_item_style = { "box-sizing": "border-box", "width": "191px", "height": "auto", "overflow": "hidden", "padding": "0px", "cursor": "default",...
chips_box_style = { "width": ["100%", "100%", "auto"], "box-sizing": "border-box", "display": "flex", "flex-direction": "row", "align_items": "center", "padding": "6px 12px", "cursor": "pointer", "box-shadow": shadows["large"], "border-radius": "1000px", "transition": "background...
=rx.cond(is_selected, 0.64, 1), class_name="font-small"), rx.spacer(), rx.cond( is_selected, rx.box( class_name="size-2 justify-end bg-violet-9 rounded-full", ), ), class_name="flex flex-row gap-[14px] items-center justify-start w-full ...
menu_item_style = { "box-sizing": "border-box", "width": "191px", "height": "auto", "overflow": "hidden", "padding": "0px", "cursor": "default", "background_color": c_color("slate", 2), "border": f"1px solid {c_color('slate', 5)}", "box-shadow": "0px 2px 4px rgba(0, 0, 0, 0.05)", ...
sorting_box_style = { "gap": "12px", "outline": "none", "_focus": { "outline": "none", }, **chips_box_style, }
class_name="size-2 justify-end bg-violet-9 rounded-full", ), ), class_name="flex flex-row gap-[14px] items-center justify-start w-full cursor-pointer hover:bg-slate-3 transition-bg text-nowrap overflow-hidden p-[8px_14px]", border_top=f"1px solid {c_color('slate', 5)...
def sorting_filters() -> rx.Component: return rx.vstack( filter_item( "history", "Recent", on_click=lambda: CustomComponentGalleryState.set_selected_filter("Recent"), ), filter_item( "arrow_down_big", "Downloads", bor...
menu_item_style = { "box-sizing": "border-box", "width": "191px", "height": "auto", "overflow": "hidden", "padding": "0px", "cursor": "default", "background_color": c_color("slate", 2), "border": f"1px solid {c_color('slate', 5)}", "box-shadow": "0px 2px 4px rgba(0, 0, 0, 0.05)", ...
, 5)}" if border else "none", on_click=on_click, ) chips_box_style = { "width": ["100%", "100%", "auto"], "box-sizing": "border-box", "display": "flex", "flex-direction": "row", "align_items": "center", "padding": "6px 12px", "cursor": "pointer", "box-shadow": shadows["larg...
def sorting_filters_dropdown_menu() -> rx.Component: condition = CustomComponentGalleryState.selected_filter != "" conditional_style = { "background": rx.cond( condition, c_color("violet", 9), c_color("slate", 1), ), "color": rx.cond( co...
def sorting_filters() -> rx.Component: return rx.vstack( filter_item( "history", "Recent", on_click=lambda: CustomComponentGalleryState.set_selected_filter("Recent"), ), filter_item( "arrow_down_big", "Downloads", border...
one", }, **chips_box_style, } menu_item_style = { "box-sizing": "border-box", "width": "191px", "height": "auto", "overflow": "hidden", "padding": "0px", "cursor": "default", "background_color": c_color("slate", 2), "border": f"1px solid {c_color('slate', 5)}", "box-shadow":...
conditional_style = { "background": rx.cond( condition, c_color("violet", 9), c_color("slate", 1), ), "color": rx.cond( condition, "white", c_color("slate", 9), ), "border": rx.cond( conditio...
condition = CustomComponentGalleryState.selected_filter != ""
x-sizing": "border-box", "width": "191px", "height": "auto", "overflow": "hidden", "padding": "0px", "cursor": "default", "background_color": c_color("slate", 2), "border": f"1px solid {c_color('slate', 5)}", "box-shadow": "0px 2px 4px rgba(0, 0, 0, 0.05)", "border-radius": "12px", ...
return rx.menu.root( rx.menu.trigger( rx.el.button( rx.text( "Sort", rx.cond( condition, rx.text( f": {CustomComponentGalleryState.selected_filter}", ...
conditional_style = { "background": rx.cond( condition, c_color("violet", 9), c_color("slate", 1), ), "color": rx.cond( condition, "white", c_color("slate", 9), ), "border": rx.cond( condition, ...
.button( rx.text( "Sort", rx.cond( condition, rx.text( f": {CustomComponentGalleryState.selected_filter}", as_="span", class_name="t...
def download(download_url: str) -> rx.Component: return rx.link( get_icon(icon="new_tab"), underline="none", href=download_url, is_external=True, class_name="text-slate-9 hover:!text-slate-9 bg-slate-1 hover:bg-slate-3 transition-bg cursor-pointer rounded-[6px]", t...
def package_url(package_name: str) -> str: return f"https://pypi.org/pypi/{package_name}/"
condition, rx.text( f": {CustomComponentGalleryState.selected_filter}", as_="span", class_name="text-nowrap", ), ), as_="span", ...
def table_rows(category: dict): name = rx.Var( f"{category['package_name']!s}.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')", ) updated_at = rx.Var( f"({category['updated_at']}).split('T')[0].split('-').map((part, index) => index === 1 ? 'JanFebMarAprMayJ...
def download(download_url: str) -> rx.Component: return rx.link( get_icon(icon="new_tab"), underline="none", href=download_url, is_external=True, class_name="text-slate-9 hover:!text-slate-9 bg-slate-1 hover:bg-slate-3 transition-bg cursor-pointer rounded-[6px]", titl...
e="font-small", ), get_icon( icon="select", ), justify_content="space-between", ), style=sorting_box_style | conditional_style, ), rx.menu.content( rx.menu.item(sorting_filters(), styl...
def component_grid(): table = rx.table.root( rx.table.header( rx.table.row( rx.foreach( ["Package Name", "Last Updated", "Install Command", "Docs"], lambda column_name: rx.table.column_header_cell( rx.text(column_...
def table_rows(category: dict): name = rx.Var( f"{category['package_name']!s}.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')", ) updated_at = rx.Var( f"({category['updated_at']}).split('T')[0].split('-').map((part, index) => index === 1 ? 'JanFebMarAprMayJunJ...
get_icon( icon="select", ), justify_content="space-between", ), style=sorting_box_style | conditional_style, ), rx.menu.content( rx.menu.item(sorting_filters(), style=menu_item_style), bg="...
updated_at = rx.Var( f"({category['updated_at']}).split('T')[0].split('-').map((part, index) => index === 1 ? 'JanFebMarAprMayJunJulAugSepOctNovDec'.slice(part * 3, part * 3 + 3) : part.padStart(2, '0'))" f".slice(1).join(' ') + ', ' + ({category['updated_at']}).split('T')[0].split('-')[0]" ) ...
name = rx.Var( f"{category['package_name']!s}.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')", )
style=sorting_box_style | conditional_style, ), rx.menu.content( rx.menu.item(sorting_filters(), style=menu_item_style), bg="transparent", box_shadow="None", padding="0px", overflow="visible", border="none", ali...
return rx.table.row( rx.table.cell(name), rx.table.cell(updated_at), rx.table.cell( rx.box( rx.text( "pip install " + category["package_name"], as_="p", class_name="font-small truncate flex-1 min-w-0", ...
updated_at = rx.Var( f"({category['updated_at']}).split('T')[0].split('-').map((part, index) => index === 1 ? 'JanFebMarAprMayJunJulAugSepOctNovDec'.slice(part * 3, part * 3 + 3) : part.padStart(2, '0'))" f".slice(1).join(' ') + ', ' + ({category['updated_at']}).split('T')[0].split('-')[0]" )
part * 3 + 3) : part.padStart(2, '0'))" f".slice(1).join(' ') + ', ' + ({category['updated_at']}).split('T')[0].split('-')[0]" ) return rx.table.row( rx.table.cell(name), rx.table.cell(updated_at), rx.table.cell( rx.box( rx.text( "...
def create_pagination(): return rx.hstack( rx.hstack( rx.text("Rows per page", weight="bold", font_size="12px"), rx.select( CustomComponentGalleryState.limits, default_value="50", on_change=CustomComponentGalleryState.delta_limit, ...
def component_grid(): table = rx.table.root( rx.table.header( rx.table.row( rx.foreach( ["Package Name", "Last Updated", "Install Command", "Docs"], lambda column_name: rx.table.column_header_cell( rx.text(column_nam...
art(2, '0'))" f".slice(1).join(' ') + ', ' + ({category['updated_at']}).split('T')[0].split('-')[0]" ) return rx.table.row( rx.table.cell(name), rx.table.cell(updated_at), rx.table.cell( rx.box( rx.text( "pip install " + category["...
return rx.box( table, class_name="w-full h-full min-h-[60vh] flex flex-col items-start justify-start", ) def create_pagination(): return rx.hstack( rx.hstack( rx.text("Rows per page", weight="bold", font_size="12px"), rx.select( CustomCompo...
table = rx.table.root( rx.table.header( rx.table.row( rx.foreach( ["Package Name", "Last Updated", "Install Command", "Docs"], lambda column_name: rx.table.column_header_cell( rx.text(column_name, size="1"), ...
rx.button( rx.icon( tag="chevron-left", on_click=CustomComponentGalleryState.previous, size=25, cursor="pointer", ), color_scheme="gray", variant="surface", siz...
def custom_components() -> rx.Component: return rx.box( rx.box( h1_comp(text="Custom Components"), rx.box( text_comp_2( text="Reflex has a growing ecosystem of custom components that you can use to build your apps. Below is a list of some of the cu...
"""Module for documenting Reflex environment variables."""
import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classm...
from __future__ import annotations
"""Module for documenting Reflex environment variables.""" from __future__ import annotations
from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def ge...
import inspect
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect
import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: ...
from typing import Any, List, Optional, Tuple
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple
from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all en...
import reflex as rx
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx
from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class....
from reflex.config import EnvironmentVariables
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables
from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list...
from pcweb.flexdown import markdown
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown
class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list of tuples containing the environment variable name and its En...
from pcweb.templates.docpage import docpage, h1_comp, h2_comp
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_c...
@classmethod def get_env_var_docstring(cls, name: str) -> Optional[str]: """Get the docstring for an environment variable. Args: name: The name of the environment variable. Returns: The docstring for the environment variable, or None if not found. """ ...
def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list of tuples containing the environment variable name and its EnvVar instance. """ env_vars = [] for name, attr in inspect.getmembers(Environ...
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_c...
for name, attr in inspect.getmembers(EnvironmentVariables): if name.startswith("_") or not hasattr(attr, "name"): continue env_vars.append((name, attr)) return env_vars @classmethod def get_env_var_docstring(cls, name: str) -> Optional[str]: """G...
env_vars = []
"""Module for documenting Reflex environment variables.""" from __future__ import annotations import inspect from typing import Any, List, Optional, Tuple import reflex as rx from reflex.config import EnvironmentVariables from pcweb.flexdown import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_c...
return env_vars @classmethod def get_env_var_docstring(cls, name: str) -> Optional[str]: """Get the docstring for an environment variable. Args: name: The name of the environment variable. Returns: The docstring for the environment variable, or None if...
for name, attr in inspect.getmembers(EnvironmentVariables): if name.startswith("_") or not hasattr(attr, "name"): continue env_vars.append((name, attr))
n import markdown from pcweb.templates.docpage import docpage, h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: ...
lines = source_code.splitlines() for i, line in enumerate(lines): if f"{name}:" in line and "EnvVar" in line: j = i - 1 comments = [] while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1...
source_code = inspect.getsource(EnvironmentVariables)
h1_comp, h2_comp class EnvVarDocs: """Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list of tuples containing the environment variabl...
for i, line in enumerate(lines): if f"{name}:" in line and "EnvVar" in line: j = i - 1 comments = [] while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1:].strip()) j -= 1 ...
lines = source_code.splitlines()
"""Documentation for Reflex environment variables.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list of tuples containing the environment variable name and its EnvVar instance. ""...
return None @classmethod def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component: """Generate a table of environment variables. Args: include_internal: Whether to include internal environment variables. Returns: A Reflex compone...
for i, line in enumerate(lines): if f"{name}:" in line and "EnvVar" in line: j = i - 1 comments = [] while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1:].strip()) j -= 1 ...
bles.""" @classmethod def get_all_env_vars(cls) -> List[Tuple[str, Any]]: """Get all environment variables from the environment class. Returns: A list of tuples containing the environment variable name and its EnvVar instance. """ env_vars = [] for name, att...
return None @classmethod def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component: """Generate a table of environment variables. Args: include_internal: Whether to include internal environment variables. Returns: A Reflex compone...
if f"{name}:" in line and "EnvVar" in line: j = i - 1 comments = [] while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1:].strip()) j -= 1 if comments: return "...
"""Get all environment variables from the environment class. Returns: A list of tuples containing the environment variable name and its EnvVar instance. """ env_vars = [] for name, attr in inspect.getmembers(EnvironmentVariables): if name.startswith("_") or ...
while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1:].strip()) j -= 1 if comments: return "\n".join(comments) return None @classmethod def generate_env_var_table(cls, includ...
comments = []
riables from the environment class. Returns: A list of tuples containing the environment variable name and its EnvVar instance. """ env_vars = [] for name, attr in inspect.getmembers(EnvironmentVariables): if name.startswith("_") or not hasattr(attr, "name"): ...
if comments: return "\n".join(comments) return None @classmethod def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component: """Generate a table of environment variables. Args: include_internal: Whether to include in...
while j >= 0 and lines[j].strip().startswith("#"): comments.insert(0, lines[j].strip()[1:].strip()) j -= 1
env_vars = [] for name, attr in inspect.getmembers(EnvironmentVariables): if name.startswith("_") or not hasattr(attr, "name"): continue env_vars.append((name, attr)) return env_vars @classmethod def get_env_var_docstring(cls, name: str) -> Optional...
return None @classmethod def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component: """Generate a table of environment variables. Args: include_internal: Whether to include internal environment variables. Returns: A Reflex compone...
if comments: return "\n".join(comments)
me of the environment variable. Returns: The docstring for the environment variable, or None if not found. """ source_code = inspect.getsource(EnvironmentVariables) lines = source_code.splitlines() for i, line in enumerate(lines): if f"{name}:" in line a...
if not include_internal: env_vars = [ (name, var) for name, var in env_vars if not getattr(var, "internal", False) ] env_vars.sort(key=lambda x: x[0]) return rx.box( rx.table.root( rx.table.he...
env_vars = cls.get_all_env_vars()
turns: The docstring for the environment variable, or None if not found. """ source_code = inspect.getsource(EnvironmentVariables) lines = source_code.splitlines() for i, line in enumerate(lines): if f"{name}:" in line and "EnvVar" in line: j = i ...
env_vars.sort(key=lambda x: x[0]) return rx.box( rx.table.root( rx.table.header( rx.table.row( rx.table.column_header_cell( "Name", class_name="font-small text-slate-12 text...
if not include_internal: env_vars = [ (name, var) for name, var in env_vars if not getattr(var, "internal", False) ]
the environment variable, or None if not found. """ source_code = inspect.getsource(EnvironmentVariables) lines = source_code.splitlines() for i, line in enumerate(lines): if f"{name}:" in line and "EnvVar" in line: j = i - 1 comments = [] ...
env_vars.sort(key=lambda x: x[0]) return rx.box( rx.table.root( rx.table.header( rx.table.row( rx.table.column_header_cell( "Name", class_name="font-small text-slate-12 text...
env_vars = [ (name, var) for name, var in env_vars if not getattr(var, "internal", False) ]
), width="100%", overflow_x="visible", class_name="w-full", ), ) def env_vars_page(): """Generate the environment variables documentation page. Returns: A Reflex component containing the documentation. """ retur...
env_vars_doc.title = "Environment Variables"
env_vars_doc = docpage( "/docs/api-reference/environment-variables/", "Environment Variables", right_sidebar=False, )(env_vars_page)
) def env_vars_page(): """Generate the environment variables documentation page. Returns: A Reflex component containing the documentation. """ return rx.box( h1_comp(text="Environment Variables"), rx.code( "reflex.config.EnvironmentVariables", class_name="code-styl...
env_vars_doc.title = "Environment Variables"
from reflex.utils.format import to_snake_case, to_title_case from pcweb.components.icons import get_icon from pcweb.templates.docpage import docpage, h1_comp, text_comp_2 def component_grid(): from pcweb.components.docpage.sidebar.sidebar_items import get_component_link from pcweb.pages.docs import componen...
import reflex as rx
import reflex as rx
from pcweb.components.icons import get_icon from pcweb.templates.docpage import docpage, h1_comp, text_comp_2 def component_grid(): from pcweb.components.docpage.sidebar.sidebar_items import get_component_link from pcweb.pages.docs import component_list, graphing_components def generate_gallery( ...
from reflex.utils.format import to_snake_case, to_title_case
import reflex as rx from reflex.utils.format import to_snake_case, to_title_case
from pcweb.templates.docpage import docpage, h1_comp, text_comp_2 def component_grid(): from pcweb.components.docpage.sidebar.sidebar_items import get_component_link from pcweb.pages.docs import component_list, graphing_components def generate_gallery( components, prefix: str = "", )...
from pcweb.components.icons import get_icon
import reflex as rx from reflex.utils.format import to_snake_case, to_title_case from pcweb.components.icons import get_icon
def component_grid(): from pcweb.components.docpage.sidebar.sidebar_items import get_component_link from pcweb.pages.docs import component_list, graphing_components def generate_gallery( components, prefix: str = "", ): sidebar = [ rx.box( rx.link(...
from pcweb.templates.docpage import docpage, h1_comp, text_comp_2
import reflex as rx from reflex.utils.format import to_snake_case, to_title_case from pcweb.components.icons import get_icon from pcweb.templates.docpage import docpage, h1_comp, text_comp_2 def component_grid():
from pcweb.pages.docs import component_list, graphing_components def generate_gallery( components, prefix: str = "", ): sidebar = [ rx.box( rx.link( rx.el.h1( to_title_case(to_snake_case(category), sep=" "), ...
from pcweb.components.docpage.sidebar.sidebar_items import get_component_link
import reflex as rx from reflex.utils.format import to_snake_case, to_title_case from pcweb.components.icons import get_icon from pcweb.templates.docpage import docpage, h1_comp, text_comp_2 def component_grid(): from pcweb.components.docpage.sidebar.sidebar_items import get_component_link
def generate_gallery( components, prefix: str = "", ): sidebar = [ rx.box( rx.link( rx.el.h1( to_title_case(to_snake_case(category), sep=" "), class_name="font-large text-slate-12", ...
from pcweb.pages.docs import component_list, graphing_components
ransition-bg flex flex-row justify-between items-center !text-slate-12", ), rx.box( *[ rx.link( to_title_case(to_snake_case(c[0]), sep=" "), href=get_component_link( ...
# add `graphing/` prefix when generating graphing components to assume the url `/docs/library/graphing/<category>/<component>`. graphs = generate_gallery( components=graphing_components, prefix="/graphing/", ) return rx.box( rx.box( *core, class_name="gri...
core = generate_gallery( components=component_list, )
_title_case(to_snake_case(c[0]), sep=" "), href=get_component_link( category=category, clist=c, prefix=prefix, ), class_name="font-small tex...
return rx.box( rx.box( *core, class_name="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-6", ), rx.box( h1_comp( text="Graphing Components", ), text_comp_2( text="Discover our range of components...
graphs = generate_gallery( components=graphing_components, prefix="/graphing/", )
from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_titles(path): title_...
import reflex as rx
import reflex as rx
def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_titles(path): title_without_ext = path.split(".")[0] parts = title_without_ext.split("/") ...
from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2
def format_titles(path): title_without_ext = path.split(".")[0] parts = title_without_ext.split("/") last_part = parts[-1] capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part def component_grid(): from pcweb.pages.docs import recipes_list icons = { ...
def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}"
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str:
return f"/docs/recipes/{category}/{file_name_without_extension}" def format_titles(path): title_without_ext = path.split(".")[0] parts = title_without_ext.split("/") last_part = parts[-1] capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part def component_...
file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-")
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}"
def component_grid(): from pcweb.pages.docs import recipes_list icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", } sidebar = [] for item in recipes_list: category = item.split("/")[-1] sidebar.append( rx....
def format_titles(path): title_without_ext = path.split(".")[0] parts = title_without_ext.split("/") last_part = parts[-1] capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
parts = title_without_ext.split("/") last_part = parts[-1] capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part def component_grid(): from pcweb.pages.docs import recipes_list icons = { "layout": "panels-top-left", "content": "layout-grid",...
title_without_ext = path.split(".")[0]
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
last_part = parts[-1] capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part def component_grid(): from pcweb.pages.docs import recipes_list icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", } ...
parts = title_without_ext.split("/")
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
capitalized_last_part = last_part.replace("_", "-").title() return capitalized_last_part def component_grid(): from pcweb.pages.docs import recipes_list icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", } sidebar = [] for ite...
last_part = parts[-1]
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
return capitalized_last_part def component_grid(): from pcweb.pages.docs import recipes_list icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", } sidebar = [] for item in recipes_list: category = item.split("/")[-1] ...
capitalized_last_part = last_part.replace("_", "-").title()
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", } sidebar = [] for item in recipes_list: category = item.split("/")[-1] sidebar.append( rx.box( rx.box( rx.el.h1( ...
from pcweb.pages.docs import recipes_list
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
sidebar = [] for item in recipes_list: category = item.split("/")[-1] sidebar.append( rx.box( rx.box( rx.el.h1( rx.utils.format.to_title_case(category), class_name="font-large text-slate-12", ...
icons = { "layout": "panels-top-left", "content": "layout-grid", "auth": "lock-keyhole", }
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
for item in recipes_list: category = item.split("/")[-1] sidebar.append( rx.box( rx.box( rx.el.h1( rx.utils.format.to_title_case(category), class_name="font-large text-slate-12", ), ...
sidebar = []
import reflex as rx from pcweb.templates.docpage import docpage, h1_comp, h2_comp, text_comp_2 def get_component_link(category, clist) -> str: file_name_without_extension = clist.split("/")[-1].split(".")[0].replace("_", "-") return f"/docs/recipes/{category}/{file_name_without_extension}" def format_title...
sidebar.append( rx.box( rx.box( rx.el.h1( rx.utils.format.to_title_case(category), class_name="font-large text-slate-12", ), rx.icon( icons.get(categor...
category = item.split("/")[-1]
import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. ...
import dataclasses
import dataclasses
import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type ...
import inspect
import dataclasses import inspect import re # Get the comment for a specific field.
import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwarg...
from typing import Callable, Type
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type
from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initia...
import reflex as rx
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx
from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the source code parser.""" ...
from pcweb.flexdown import markdown
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown
class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get t...
from pcweb.templates.docpage import h1_comp, h2_comp
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The compon...
def get_docs(self) -> str: """Get the docstring of the component. Returns: The docstring of the component. """ return self.module.__doc__ @staticmethod def get_comment(comments: list[str]): return "".join([comment.strip().strip("#") for comment in comm...
def __init__(self, *args, **kwargs): """Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get the source code. self.code = [ line for line in inspect.getsource(self.module).splitlines() if len(line) > 0 ]
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The compon...
def get_docs(self) -> str: """Get the docstring of the component. Returns: The docstring of the component. """ return self.module.__doc__ @staticmethod def get_comment(comments: list[str]): return "".join([comment.strip().strip("#") for comment in comm...
self.code = [ line for line in inspect.getsource(self.module).splitlines() if len(line) > 0 ]
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The compon...
@staticmethod def get_comment(comments: list[str]): return "".join([comment.strip().strip("#") for comment in comments]) def get_name(self) -> str: return ".".join((self.module.__module__, self.module.__qualname__)) def get_overview(self) -> str: return inspect.cleandoc(self....
def get_docs(self) -> str: """Get the docstring of the component. Returns: The docstring of the component. """ return self.module.__doc__
import dataclasses import inspect import re # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The compon...
def get_name(self) -> str: return ".".join((self.module.__module__, self.module.__qualname__)) def get_overview(self) -> str: return inspect.cleandoc(self.module.__doc__ or "") def get_class_fields(self) -> list[dict]: if not issubclass(self.module, rx.Base): return [...
def get_comment(comments: list[str]): return "".join([comment.strip().strip("#") for comment in comments])
e # Get the comment for a specific field. from typing import Callable, Type import reflex as rx from pcweb.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The ...
def get_overview(self) -> str: return inspect.cleandoc(self.module.__doc__ or "") def get_class_fields(self) -> list[dict]: if not issubclass(self.module, rx.Base): return [] out = self.get_annotations(self.module.__class_vars__) return out def get_fields(self...
def get_name(self) -> str: return ".".join((self.module.__module__, self.module.__qualname__))
b.flexdown import markdown from pcweb.templates.docpage import h1_comp, h2_comp class Source(rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the so...
def get_class_fields(self) -> list[dict]: if not issubclass(self.module, rx.Base): return [] out = self.get_annotations(self.module.__class_vars__) return out def get_fields(self) -> list[dict]: if dataclasses.is_dataclass(self.module): return self.get_...
def get_overview(self) -> str: return inspect.cleandoc(self.module.__doc__ or "")
rx.Base): """Parse the source code of a component.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get the source code. ...
def get_fields(self) -> list[dict]: if dataclasses.is_dataclass(self.module): return self.get_annotations( {f.name: f for f in dataclasses.fields(self.module)} ) elif isinstance(self.module, type) and issubclass(self.module, rx.Base): return self...
def get_class_fields(self) -> list[dict]: if not issubclass(self.module, rx.Base): return [] out = self.get_annotations(self.module.__class_vars__) return out
ent.""" # The component to parse. module: Type # The source code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get the source code. self.code = [ line ...
out = self.get_annotations(self.module.__class_vars__) return out def get_fields(self) -> list[dict]: if dataclasses.is_dataclass(self.module): return self.get_annotations( {f.name: f for f in dataclasses.fields(self.module)} ) elif isinstanc...
if not issubclass(self.module, rx.Base): return []
ce code. code: list[str] = [] def __init__(self, *args, **kwargs): """Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get the source code. self.code = [ line for line in inspect.getsource(self.module).splitlines() if...
return out def get_fields(self) -> list[dict]: if dataclasses.is_dataclass(self.module): return self.get_annotations( {f.name: f for f in dataclasses.fields(self.module)} ) elif isinstance(self.module, type) and issubclass(self.module, rx.Base): ...
out = self.get_annotations(self.module.__class_vars__)
"""Initialize the source code parser.""" super().__init__(*args, **kwargs) # Get the source code. self.code = [ line for line in inspect.getsource(self.module).splitlines() if len(line) > 0 ] def get_docs(self) -> str: """Get the doc...
def get_methods(self): return [ { "name": name, "signature": str( inspect.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ...
def get_fields(self) -> list[dict]: if dataclasses.is_dataclass(self.module): return self.get_annotations( {f.name: f for f in dataclasses.fields(self.module)} ) elif isinstance(self.module, type) and issubclass(self.module, rx.Base): return self.get_a...
" super().__init__(*args, **kwargs) # Get the source code. self.code = [ line for line in inspect.getsource(self.module).splitlines() if len(line) > 0 ] def get_docs(self) -> str: """Get the docstring of the component. Returns: ...
return [] def get_methods(self): return [ { "name": name, "signature": str( inspect.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ...
if dataclasses.is_dataclass(self.module): return self.get_annotations( {f.name: f for f in dataclasses.fields(self.module)} ) elif isinstance(self.module, type) and issubclass(self.module, rx.Base): return self.get_annotations(self.module.__fields__)
tlines() if len(line) > 0 ] def get_docs(self) -> str: """Get the docstring of the component. Returns: The docstring of the component. """ return self.module.__doc__ @staticmethod def get_comment(comments: list[str]): return "".join(...
return [] def get_methods(self): return [ { "name": name, "signature": str( inspect.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ...
elif isinstance(self.module, type) and issubclass(self.module, rx.Base): return self.get_annotations(self.module.__fields__)
fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ).parameters ), "ret": inspect.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ...
# Loop through the source code. for i, line in enumerate(self.code): # Check if we've reached the functions. reached_functions = re.search("def ", line) if reached_functions: # We've reached the functions, so stop. break #...
comments = []
meters ), "ret": inspect.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ).return_annotation, } for name, fn in self.module.__dict__.items() if ( fn.__func__.__doc__ ...
if reached_functions: # We've reached the functions, so stop. break # If we've reached a docstring, clear the comments. if line.strip() == '"""': comments.clear() continue # Get comments for prop ...
reached_functions = re.search("def ", line)
.signature( fn.__func__ if isinstance(fn, (classmethod, staticmethod)) else fn ).return_annotation, } for name, fn in self.module.__dict__.items() if ( fn.__func__.__doc__ if isinstance(fn, (classmethod, staticmethod...
# If we've reached a docstring, clear the comments. if line.strip() == '"""': comments.clear() continue # Get comments for prop if line.strip().startswith("#"): comments.append(line) continue ...
if reached_functions: # We've reached the functions, so stop. break
self.module.__dict__.items() if ( fn.__func__.__doc__ if isinstance(fn, (classmethod, staticmethod)) else fn.__doc__ ) and isinstance(fn, (Callable, classmethod, staticmethod)) and not name.startswith("_") and n...
# Get comments for prop if line.strip().startswith("#"): comments.append(line) continue # Check if this line has a prop. match = re.search("\\w+:", line) if match is None: # This line doesn't have a var, so co...
if line.strip() == '"""': comments.clear() continue
aticmethod)) else fn.__doc__ ) and isinstance(fn, (Callable, classmethod, staticmethod)) and not name.startswith("_") and name != "Config" ] def get_annotations(self, props) -> list[dict]: """Get a dictionary of the props and their des...
# Check if this line has a prop. match = re.search("\\w+:", line) if match is None: # This line doesn't have a var, so continue. continue # Get the prop. prop = match.group(0).strip(":") if prop not in props or pr...
if line.strip().startswith("#"): comments.append(line) continue
startswith("_") and name != "Config" ] def get_annotations(self, props) -> list[dict]: """Get a dictionary of the props and their descriptions. Returns: A dictionary of the props and their descriptions. """ # The output. out = [] com...
if match is None: # This line doesn't have a var, so continue. continue # Get the prop. prop = match.group(0).strip(":") if prop not in props or prop.startswith("_"): # This isn't a prop, so continue. comme...
match = re.search("\\w+:", line)
ig" ] def get_annotations(self, props) -> list[dict]: """Get a dictionary of the props and their descriptions. Returns: A dictionary of the props and their descriptions. """ # The output. out = [] comments = [] # Loop through the source ...
# Get the prop. prop = match.group(0).strip(":") if prop not in props or prop.startswith("_"): # This isn't a prop, so continue. comments.clear() continue prop = props[prop] # redundant check just to double-ch...
if match is None: # This line doesn't have a var, so continue. continue