repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/_parser.py
.py
"""Parse Reflex documentation markdown files using mistletoe.""" from __future__ import annotations import re from collections.abc import Sequence from typing import TYPE_CHECKING, cast from reflex_docgen.markdown._types import ( Block, BoldSpan, CodeBlock, CodeSpan, ComponentPreview, Directi...
423
13,157
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/_types.py
.py
"""Markdown document types — spans, blocks, and document.""" from __future__ import annotations from collections.abc import Mapping from dataclasses import dataclass, field # --------------------------------------------------------------------------- # Span types — inline content without exposing mistletoe # -------...
348
8,588
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/_base.py
.py
"""Generic document transformer — maps markdown AST nodes to arbitrary types.""" from __future__ import annotations from typing import Generic, TypeVar from reflex_docgen.markdown._types import ( Block, BoldSpan, CodeBlock, CodeSpan, DirectiveBlock, Document, FrontMatter, HeadingBlock...
415
11,542
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/_markdown.py
.py
"""Markdown-string transformer — renders a Document back to markdown text.""" from __future__ import annotations import re from reflex_docgen.markdown._types import ( BoldSpan, CodeBlock, CodeSpan, DirectiveBlock, Document, FrontMatter, HeadingBlock, ImageSpan, ItalicSpan, Lin...
203
7,229
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/reflex.py
.py
"""Reflex-component transformer — renders a Document to ``rx.Component`` trees. This is the default way to turn parsed markdown into Reflex components. It covers the lean element set the content sites actually use and exposes two customization layers that together replace the old flexdown ``component_map``: * **Subcl...
415
13,297
reflex
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/__init__.py
.py
"""Document transformers for converting parsed markdown into other formats. The reflex-dependent :class:`~reflex_docgen.markdown.transformer.reflex.ReflexComponentTransformer` lives in the :mod:`reflex_docgen.markdown.transformer.reflex` submodule so that importing this package (and the markdown-string transformer) st...
22
735
reflex
packages/reflex-components-lucide/src/reflex_components_lucide/__init__.py
.py
"""Lucide Icon Component.""" from .icon import Icon icon = Icon.create
6
73
reflex
packages/reflex-components-lucide/src/reflex_components_lucide/icon.py
.py
"""Lucide Icon component.""" from reflex_base.components.component import Component, field from reflex_base.utils import console, format from reflex_base.utils.imports import ImportVar from reflex_base.vars.base import LiteralVar, Var from reflex_base.vars.sequence import LiteralStringVar, StringVar LUCIDE_LIBRARY = ...
1,928
39,633
reflex
packages/reflex-components-code/src/reflex_components_code/shiki_code_block.py
.py
"""Shiki syntax hghlighter component.""" from __future__ import annotations import dataclasses import re from collections import defaultdict from dataclasses import dataclass from typing import Any, Literal from reflex_base.components.component import Component, ComponentNamespace, field from reflex_base.components....
867
24,349
reflex
packages/reflex-components-code/src/reflex_components_code/code.py
.py
"""A code component.""" from __future__ import annotations import dataclasses from collections.abc import Iterator from typing import ClassVar, Literal from reflex_base.components.component import Component, ComponentNamespace, field from reflex_base.constants.colors import Color from reflex_base.event import set_cl...
569
14,629
reflex
packages/reflex-base/src/reflex_base/breakpoints.py
.py
"""Breakpoints utility.""" from __future__ import annotations from typing import TypeVar breakpoints_values = ["30em", "48em", "62em", "80em", "96em"] breakpoint_names = ["xs", "sm", "md", "lg", "xl"] def set_breakpoints(values: tuple[str, str, str, str, str]): """Overwrite default breakpoint values. Args...
92
2,600
reflex
packages/reflex-base/src/reflex_base/environment.py
.py
"""Environment variable management.""" from __future__ import annotations import dataclasses import enum import importlib import os from collections.abc import Sequence from functools import lru_cache from pathlib import Path from typing import ( TYPE_CHECKING, Annotated, Any, Generic, Literal, ...
820
27,097
reflex
packages/reflex-base/src/reflex_base/registry.py
.py
"""A contextual registry for state and event handlers.""" from __future__ import annotations import dataclasses from typing import TYPE_CHECKING, Any from typing_extensions import Self from reflex_base.context.base import BaseContext from reflex_base.utils.exceptions import ReflexRuntimeError, StateValueError if T...
266
9,260
reflex
packages/reflex-base/src/reflex_base/style.py
.py
"""Handle styling.""" from __future__ import annotations from collections.abc import Mapping from typing import Any from reflex_base import constants from reflex_base.breakpoints import Breakpoints, breakpoints_values from reflex_base.constants.base import DARK_COLOR_MODE as DARK_COLOR_MODE from reflex_base.constant...
416
13,486
reflex
packages/reflex-base/src/reflex_base/config.py
.py
"""The Reflex config.""" import dataclasses import importlib import os import sys import threading import urllib.parse from collections.abc import Sequence from importlib.util import find_spec from pathlib import Path from types import ModuleType from typing import TYPE_CHECKING, Annotated, Any, ClassVar, Literal fro...
926
36,151
reflex
packages/reflex-base/src/reflex_base/telemetry_context.py
.py
"""Compile-time telemetry context. Lives in ``reflex_base`` (not ``reflex``) so deep packages like ``reflex_components_core`` — which depend on ``reflex_base`` but not ``reflex`` — can read the active context without inverting the dependency hierarchy. """ from __future__ import annotations import dataclasses import...
125
3,902
reflex
packages/reflex-base/src/reflex_base/event/__init__.py
.py
"""Define event classes to connect the frontend and backend.""" import copy import dataclasses import inspect import sys import types import warnings from base64 import b64encode from collections.abc import Callable, Mapping, Sequence from functools import lru_cache, partial from typing import ( TYPE_CHECKING, ...
3,117
98,852
reflex
packages/reflex-base/src/reflex_base/event/context.py
.py
"""The context and associated metadata for handling an event.""" from __future__ import annotations import dataclasses import functools import uuid from collections.abc import Callable, Mapping from typing import TYPE_CHECKING, Any, Protocol from reflex_base.context.base import BaseContext from reflex_base.utils.for...
147
4,531
reflex
packages/reflex-base/src/reflex_base/event/processor/timeout.py
.py
"""DrainTimeoutManager: manages an optional combined timeout over multiple calls.""" from __future__ import annotations import dataclasses import time @dataclasses.dataclass(kw_only=True, slots=True) class DrainTimeoutManager: """Manages an optional combined timeout over multiple calls. Each time the conte...
53
1,612
reflex
packages/reflex-base/src/reflex_base/event/processor/__init__.py
.py
"""Procedures for handling events.""" from reflex_base.event.processor.base_state_processor import BaseStateEventProcessor from reflex_base.event.processor.event_processor import EventProcessor, EventQueueEntry from reflex_base.event.processor.future import EventFuture from reflex_base.event.processor.timeout import D...
15
476
reflex
packages/reflex-base/src/reflex_base/event/processor/compat.py
.py
"""Compatibility shims since asyncio changes quite a bit from 3.11 to 3.14.""" import asyncio import sys if sys.version_info >= (3, 13): from asyncio import as_completed as as_completed else: # The following implementation of as_completed is adapted from Python 3.14 # python/cpython@9e1f1644cd7b7661f0748b...
88
3,491
reflex
packages/reflex-base/src/reflex_base/event/processor/event_processor.py
.py
"""Base EventProcessor class for handling backend event queue.""" from __future__ import annotations import asyncio import collections import contextlib import dataclasses import inspect import sys import time import traceback from collections.abc import AsyncGenerator, Callable, Coroutine, Mapping, Sequence from con...
781
31,631
reflex
packages/reflex-base/src/reflex_base/event/processor/base_state_processor.py
.py
"""Functions for processing BaseState-derived event handlers.""" from __future__ import annotations import dataclasses import functools import inspect import warnings from collections.abc import Mapping, Sequence from enum import Enum from importlib.util import find_spec from typing import TYPE_CHECKING, Any from re...
422
14,837
reflex
packages/reflex-base/src/reflex_base/event/processor/future.py
.py
"""EventFuture: a future that tracks child futures for hierarchical event processing.""" from __future__ import annotations import asyncio import contextlib import dataclasses from typing import Any @dataclasses.dataclass(kw_only=True, slots=True, eq=False) class EventFuture(asyncio.Future): """A future that tr...
101
3,183
reflex
packages/reflex-base/src/reflex_base/context/base.py
.py
"""Shared contextvars wrapper for contextual globals.""" from __future__ import annotations import dataclasses from contextvars import ContextVar, Token from typing import ClassVar from typing_extensions import Self @dataclasses.dataclass(frozen=True, slots=True, kw_only=True, eq=False) class BaseContext: """B...
82
2,538
reflex
packages/reflex-base/src/reflex_base/utils/types.py
.py
"""Contains custom types and methods to check types.""" from __future__ import annotations import dataclasses import sys import types from collections.abc import Callable, Iterable, Mapping, Sequence from enum import Enum from functools import cached_property, lru_cache from importlib.util import find_spec from types...
1,236
38,712
reflex
packages/reflex-base/src/reflex_base/utils/pyi_generator.py
.py
"""The pyi generator module.""" from __future__ import annotations import ast import contextlib import importlib import inspect import json import logging import multiprocessing import os import re import subprocess import sys import typing from collections import deque from collections.abc import Callable, Iterable,...
1,825
62,381
reflex
packages/reflex-base/src/reflex_base/utils/exceptions.py
.py
"""Custom Exceptions.""" from __future__ import annotations from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from reflex_base.vars import Var class ReflexError(Exception): """Base exception for all Reflex exceptions.""" class ConfigError(ReflexError): """Custom exception for config related err...
295
9,157
reflex
packages/reflex-base/src/reflex_base/utils/memo_paths.py
.py
"""Mirror user-app Python module paths into the compiler's ``.web`` output. The compiler uses these helpers to write each memo's compiled JSX to a path under ``.web/app_components/`` that mirrors its Python source module, instead of bundling everything into one file. This module owns the small set of helpers that: - ...
318
11,854
reflex
packages/reflex-base/src/reflex_base/utils/format.py
.py
"""Formatting operations.""" from __future__ import annotations import inspect import json import os import re from functools import lru_cache from typing import TYPE_CHECKING, Any from rich.markup import escape as escape_markup from reflex_base import constants from reflex_base.utils import exceptions if TYPE_CHE...
803
22,254
reflex
packages/reflex-base/src/reflex_base/utils/decorator.py
.py
"""Decorator utilities.""" import functools from collections.abc import Callable from pathlib import Path from typing import ParamSpec, TypeVar, cast T = TypeVar("T") def once(f: Callable[[], T]) -> Callable[[], T]: """A decorator that calls the function once and caches the result. Args: f: The fun...
149
3,959
reflex
packages/reflex-base/src/reflex_base/utils/serializers.py
.py
"""Serializers used to convert Var types to JSON strings.""" from __future__ import annotations import contextlib import dataclasses import decimal import functools import inspect import json import uuid import warnings from collections.abc import Callable, Mapping, Sequence from datetime import date, datetime, time,...
510
13,418
reflex
packages/reflex-base/src/reflex_base/utils/console.py
.py
"""Functions to communicate to the user via console.""" from __future__ import annotations import contextlib import datetime import functools import inspect import os import shutil import sys import time from pathlib import Path from types import FrameType, ModuleType from rich.console import Console from rich.progr...
517
14,905
reflex
packages/reflex-base/src/reflex_base/utils/streaming_response.py
.py
"""Internal helpers for streaming responses.""" from __future__ import annotations import builtins import contextlib import sys from collections.abc import Awaitable, Callable, Generator from functools import partial from typing import Any import anyio from starlette.requests import ClientDisconnect from starlette.r...
136
4,753
reflex
packages/reflex-base/src/reflex_base/utils/lazy_loader.py
.py
"""Module to implement lazy loading in reflex. BSD 3-Clause License Copyright (c) 2022--2023, Scientific Python project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source co...
143
5,598
reflex
packages/reflex-base/src/reflex_base/utils/compat.py
.py
"""Compatibility hacks and helpers.""" import sys from collections.abc import Mapping from typing import Any async def windows_hot_reload_lifespan_hack(): """[REF-3164] A hack to fix hot reload on Windows. Uvicorn has an issue stopping itself on Windows after detecting changes in the filesystem. Th...
51
1,490
reflex
packages/reflex-base/src/reflex_base/utils/imports.py
.py
"""Import operations.""" from __future__ import annotations import dataclasses from collections import defaultdict from collections.abc import Mapping, Sequence # Absolute import paths beginning with one of these reserved ``.web`` # subdirectories are rewritten to ``$``-prefixed module specifiers. ABSOLUTE_IMPORT_PR...
157
4,432
reflex
packages/reflex-base/src/reflex_base/constants/installer.py
.py
"""File for constants related to the installation process. (Bun/Node).""" from __future__ import annotations import os from types import SimpleNamespace from .base import IS_WINDOWS from .utils import classproperty # Bun config. class Bun(SimpleNamespace): """Bun constants.""" # The Bun version. VERSI...
164
4,800
reflex
packages/reflex-base/src/reflex_base/constants/state.py
.py
"""State-related constants.""" from enum import Enum class StateManagerMode(str, Enum): """State manager constants.""" DISK = "disk" MEMORY = "memory" REDIS = "redis" FIELD_MARKER = "_rx_state_" MEMO_MARKER = "_rx_memo_" CAMEL_CASE_MEMO_MARKER = "RxMemo"
17
277
reflex
packages/reflex-base/src/reflex_base/constants/utils.py
.py
"""Utility functions for constants.""" from collections.abc import Callable from typing import Any, Generic, TypeVar T = TypeVar("T") V = TypeVar("V") class classproperty(Generic[T, V]): """A class property decorator.""" def __init__(self, getter: Callable[[type[T]], V]) -> None: """Initialize the ...
32
780
reflex
packages/reflex-base/src/reflex_base/constants/custom_components.py
.py
"""Constants for the custom components.""" from __future__ import annotations from pathlib import Path from types import SimpleNamespace class CustomComponents(SimpleNamespace): """Constants for the custom components.""" # The name of the custom components source directory. SRC_DIR = Path("custom_compo...
36
1,317
reflex
packages/reflex-base/src/reflex_base/constants/route.py
.py
"""Route constants.""" import re from types import SimpleNamespace class RouteArgType(SimpleNamespace): """Type of dynamic route arg extracted from URI route.""" SINGLE = "arg_single" LIST = "arg_list" # the name of the backend var containing path and client information ROUTER = "router" ROUTER_DATA =...
95
2,682
reflex
packages/reflex-base/src/reflex_base/constants/__init__.py
.py
"""The constants package.""" from .base import ( APP_HARNESS_FLAG, COOKIES, DARK_COLOR_MODE, IS_LINUX, IS_MACOS, IS_WINDOWS, LIGHT_COLOR_MODE, LOCAL_STORAGE, POLLING_MAX_HTTP_BUFFER_SIZE, PYTEST_CURRENT_TEST, REFLEX_VAR_CLOSING_TAG, REFLEX_VAR_OPENING_TAG, SESSION_ST...
137
2,554
reflex
packages/reflex-base/src/reflex_base/constants/event.py
.py
"""Event-related constants.""" from enum import Enum from types import SimpleNamespace class Endpoint(Enum): """Endpoints for the reflex backend API.""" PING = "ping" EVENT = "_event" UPLOAD = "_upload" AUTH_CODESPACE = "auth-codespace" HEALTH = "_health" ALL_ROUTES = "_all_routes" ...
114
3,262
reflex
packages/reflex-base/src/reflex_base/constants/config.py
.py
"""Config constants.""" from pathlib import Path from types import SimpleNamespace from reflex_base.constants.base import Dirs, Reflex from .compiler import Ext # Alembic migrations ALEMBIC_CONFIG = "alembic.ini" class Config(SimpleNamespace): """Config constants.""" # The name of the reflex config modul...
100
2,628
reflex
packages/reflex-base/src/reflex_base/constants/compiler.py
.py
"""Compiler variables.""" import dataclasses import enum from enum import Enum from types import SimpleNamespace from reflex_base.constants import Dirs from reflex_base.utils.imports import ImportVar # The prefix used to create setters for state vars. SETTER_PREFIX = "set_" # The file used to specify no compilation...
246
7,637
reflex
packages/reflex-base/src/reflex_base/constants/colors.py
.py
"""The colors used in Reflex are a wrapper around https://www.radix-ui.com/colors.""" from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Literal, get_args if TYPE_CHECKING: from reflex_base.vars import Var ColorType = Literal[ "gray", "mauve", "sla...
100
2,058
reflex
packages/reflex-base/src/reflex_base/constants/base.py
.py
"""Base file for constants that don't fit any other categories.""" from __future__ import annotations import platform from enum import Enum from importlib import metadata from pathlib import Path from types import SimpleNamespace from typing import Literal from platformdirs import PlatformDirs IS_WINDOWS = platform...
297
8,420
reflex
packages/reflex-base/src/reflex_base/vars/sequence.py
.py
"""Collection of string classes and utilities.""" from __future__ import annotations import collections.abc import dataclasses import decimal import inspect import json import re from collections.abc import Callable, Iterable, Mapping, Sequence from typing import TYPE_CHECKING, Any, Literal, TypeVar, get_args, overlo...
2,160
62,850
reflex
packages/reflex-base/src/reflex_base/vars/color.py
.py
"""Vars for colors.""" import dataclasses from reflex_base.constants.colors import Color from reflex_base.vars.base import ( CachedVarOperation, LiteralVar, Var, VarData, cached_property_no_lock, get_python_literal, ) from reflex_base.vars.number import ternary_operation from reflex_base.vars....
167
4,883
reflex
packages/reflex-base/src/reflex_base/vars/number.py
.py
"""Immutable number vars.""" from __future__ import annotations import dataclasses import decimal import json import math from collections.abc import Callable from typing import TYPE_CHECKING, Any, NoReturn, TypeVar, overload from typing_extensions import TypeVar as TypeVarExt from reflex_base.constants.base import...
1,149
28,901
reflex
packages/reflex-base/src/reflex_base/vars/__init__.py
.py
"""Immutable-Based Var System.""" from . import base, color, datetime, function, number, object, sequence from .base import ( EMPTY_VAR_INT, EMPTY_VAR_STR, BaseStateMeta, EvenMoreBasicBaseState, Field, LiteralVar, Var, VarData, field, get_unique_variable_name, get_uuid_strin...
72
1,543
reflex
packages/reflex-base/src/reflex_base/vars/datetime.py
.py
"""Immutable datetime and date vars.""" from __future__ import annotations import dataclasses from datetime import date, datetime from typing import Any, Literal, TypeVar from reflex_base.utils.exceptions import VarTypeError from reflex_base.vars.number import BooleanVar from .base import ( CustomVarOperationRe...
267
6,910
reflex
packages/reflex-base/src/reflex_base/vars/hybrid_property.py
.py
"""hybrid_property decorator which functions like a normal python property but additionally allows (class-level) access from the frontend. You can use the same code for frontend and backend, or implement 2 different methods.""" from collections.abc import Callable from typing import Any from reflex_base.utils.excepti...
142
5,689
reflex
packages/reflex-base/src/reflex_base/vars/function.py
.py
"""Immutable function vars.""" from __future__ import annotations import dataclasses from collections.abc import Callable, Sequence from typing import Any, Concatenate, Generic, ParamSpec, Protocol, TypeVar, overload from reflex_base.utils import format from reflex_base.utils.types import GenericType from .base imp...
558
16,270
reflex
packages/reflex-base/src/reflex_base/vars/dep_tracking.py
.py
"""Collection of base classes.""" from __future__ import annotations import contextlib import dataclasses import dis import enum import importlib import inspect import sys from types import CellType, CodeType, FunctionType, ModuleType from typing import TYPE_CHECKING, Any, ClassVar, cast from reflex_base.utils.excep...
494
20,811
reflex
packages/reflex-base/src/reflex_base/vars/base.py
.py
"""Collection of base classes.""" from __future__ import annotations import builtins import contextlib import copy import dataclasses import datetime import functools import inspect import json import re import string import uuid import warnings from abc import ABCMeta from collections.abc import Callable, Coroutine,...
3,929
121,809
reflex
packages/reflex-base/src/reflex_base/vars/object.py
.py
"""Classes for immutable object vars.""" from __future__ import annotations import collections.abc import dataclasses import typing from collections.abc import Mapping from importlib.util import find_spec from typing import ( Any, NoReturn, TypeVar, get_args, get_type_hints, is_typeddict, ...
678
19,183
reflex
packages/reflex-base/src/reflex_base/components/field.py
.py
"""Shared field infrastructure for components and props.""" from __future__ import annotations from collections.abc import Callable from dataclasses import _MISSING_TYPE, MISSING from typing import Annotated, Any, Generic, TypeVar, get_origin from reflex_base.utils import types from reflex_base.utils.compat import a...
187
6,055
reflex
packages/reflex-base/src/reflex_base/components/literals.py
.py
"""Literal custom type used by Reflex.""" from typing import Literal # Base Literals LiteralInputType = Literal[ "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "re...
35
527
reflex
packages/reflex-base/src/reflex_base/components/dynamic.py
.py
"""Components that are dynamically generated on the backend.""" from typing import TYPE_CHECKING, Union from reflex_base import constants from reflex_base.registry import RegistrationContext, _default_bundled_libraries from reflex_base.utils import imports from reflex_base.utils.exceptions import DynamicComponentMiss...
215
7,717
reflex
packages/reflex-base/src/reflex_base/components/state_context.py
.py
"""App-wrap components mounting the state and event-loop React providers. These wrap children in the ``StateProvider`` / ``EventLoopProvider`` JS functions emitted into ``utils/context.js`` by ``compile_contexts``. They are attached to the VarData returned by :meth:`reflex_base.vars.base.VarData.from_state` so the com...
69
2,428
reflex
packages/reflex-base/src/reflex_base/components/memoize_helpers.py
.py
"""Memoization helpers for auto-memoized and pseudo-stateful components. These helpers wrap a component's non-lifecycle event triggers in ``useCallback`` so that React can skip re-renders of subtrees whose event handlers have stable identities. They are used by both the compiler auto-memoization plugin (see ``reflex.c...
272
9,423
reflex
packages/reflex-base/src/reflex_base/components/props.py
.py
"""A class that holds props to be passed or applied to a component.""" from __future__ import annotations import builtins from collections.abc import Callable from dataclasses import _MISSING_TYPE, MISSING from typing import Any, TypeVar, get_args, get_origin from typing_extensions import dataclass_transform from r...
443
15,037
reflex
packages/reflex-base/src/reflex_base/components/component.py
.py
"""Base component definitions.""" from __future__ import annotations import builtins import contextlib import copy import dataclasses import enum import functools import operator import typing from abc import ABC, ABCMeta, abstractmethod from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from...
2,572
89,980
reflex
packages/reflex-base/src/reflex_base/components/memo.py
.py
"""Memo support for vars and components.""" from __future__ import annotations import dataclasses import inspect import sys from collections.abc import Callable, Mapping, Sequence from copy import copy from enum import Enum from functools import cache, partial, update_wrapper from types import UnionType from typing i...
2,118
76,492
reflex
packages/reflex-base/src/reflex_base/components/tags/match_tag.py
.py
"""Tag to conditionally match cases.""" import dataclasses from collections.abc import Iterator, Mapping, Sequence from typing import Any from reflex_base.components.tags.tag import Tag @dataclasses.dataclass(frozen=True, kw_only=True) class MatchTag(Tag): """A match tag.""" # The condition to determine wh...
32
810
reflex
packages/reflex-base/src/reflex_base/components/tags/cond_tag.py
.py
"""Tag to conditionally render components.""" import dataclasses from collections.abc import Iterator, Mapping from typing import Any from reflex_base.components.tags.tag import Tag @dataclasses.dataclass(frozen=True, kw_only=True) class CondTag(Tag): """A conditional tag.""" # The condition to determine w...
32
854
reflex
packages/reflex-base/src/reflex_base/components/tags/__init__.py
.py
"""Representations for React tags.""" from .cond_tag import CondTag from .iter_tag import IterTag from .match_tag import MatchTag from .tag import Tag __all__ = ["CondTag", "IterTag", "MatchTag", "Tag"]
9
205
reflex
packages/reflex-base/src/reflex_base/components/tags/tagless.py
.py
"""A tag with no tag.""" import dataclasses from reflex_base.components.tags import Tag from reflex_base.utils import format @dataclasses.dataclass(frozen=True, kw_only=True) class Tagless(Tag): """A tag with no tag.""" # The inner contents of the tag. contents: str def __str__(self) -> str: ...
37
914
reflex
packages/reflex-base/src/reflex_base/components/tags/tag.py
.py
"""A React tag.""" from __future__ import annotations import dataclasses from collections.abc import Iterator, Mapping, Sequence from typing import Any from reflex_base.event import EventChain from reflex_base.utils import format from reflex_base.vars.base import LiteralVar, Var def render_prop(value: Any) -> Any:...
138
3,868
reflex
packages/reflex-base/src/reflex_base/components/tags/iter_tag.py
.py
"""Tag to loop through a list of components.""" from __future__ import annotations import dataclasses import inspect from collections.abc import Callable, Iterable from typing import TYPE_CHECKING from reflex_base.components.tags.tag import Tag from reflex_base.utils.types import GenericType from reflex_base.vars im...
118
3,757
reflex
packages/reflex-base/src/reflex_base/compiler/templates.py
.py
"""Templates to use in the reflex compiler.""" from __future__ import annotations import json import re from collections.abc import Iterable, Mapping from typing import TYPE_CHECKING, Any, Literal from reflex_base import constants from reflex_base.constants import Hooks from reflex_base.utils import memo_paths from ...
909
28,041
reflex
packages/reflex-base/src/reflex_base/plugins/embed.py
.py
"""Plugin that compiles a Reflex app for embedding into a host page. When this plugin is registered in ``rx.Config.plugins``, the compiler swaps the framework-mode entry for an embed-aware variant that mounts the app into a host-page DOM element (selected by ``mount_target``) instead of taking over the document. A rou...
364
12,541
reflex
packages/reflex-base/src/reflex_base/plugins/_screenshot.py
.py
"""Plugin to enable screenshot functionality.""" from typing import TYPE_CHECKING from reflex_base.plugins.base import Plugin as BasePlugin if TYPE_CHECKING: from starlette.requests import Request from starlette.responses import Response from typing_extensions import Unpack from reflex.app import Ap...
149
4,125
reflex
packages/reflex-base/src/reflex_base/plugins/tailwind_v3.py
.py
"""Base class for all plugins.""" import dataclasses from pathlib import Path from types import SimpleNamespace from reflex_base.constants.base import Dirs from reflex_base.constants.compiler import Ext, PageNames from reflex_base.plugins.shared_tailwind import ( TailwindConfig, TailwindPlugin, tailwind_c...
191
5,473
reflex
packages/reflex-base/src/reflex_base/plugins/__init__.py
.py
"""Reflex Plugin System.""" from . import embed, sitemap, tailwind_v3, tailwind_v4 from ._screenshot import ScreenshotPlugin as _ScreenshotPlugin from .base import ( CommonContext, Plugin, PostBuildContext, PostCompileContext, PreCompileContext, RegisterRouteContext, get_plugin, ) from .com...
51
1,087
reflex
packages/reflex-base/src/reflex_base/plugins/tailwind_v4.py
.py
"""Base class for all plugins.""" import dataclasses from pathlib import Path from types import SimpleNamespace from reflex_base.constants.base import Dirs from reflex_base.constants.compiler import Ext, PageNames from reflex_base.plugins.shared_tailwind import ( TailwindConfig, TailwindPlugin, tailwind_c...
198
6,115
reflex
packages/reflex-base/src/reflex_base/plugins/sitemap.py
.py
"""Sitemap plugin for Reflex.""" import datetime from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from types import SimpleNamespace from typing import TYPE_CHECKING, Literal, TypedDict from xml.etree.ElementTree import Element, SubElement, indent, tostring from typing_ex...
241
7,229
reflex
packages/reflex-base/src/reflex_base/plugins/shared_tailwind.py
.py
"""Tailwind CSS configuration types for Reflex plugins.""" import dataclasses from collections.abc import Mapping from copy import deepcopy from typing import Any, Literal, TypedDict from typing_extensions import NotRequired, Unpack from .base import Plugin as PluginBase TailwindPluginImport = TypedDict( "Tailw...
236
7,241
reflex
packages/reflex-base/src/reflex_base/plugins/compiler.py
.py
"""Compiler plugin infrastructure: protocols, contexts, and dispatch.""" from __future__ import annotations import copy import dataclasses import inspect from collections.abc import Callable, Sequence from contextvars import ContextVar, Token from types import TracebackType from typing import TYPE_CHECKING, Any, Clas...
875
30,528
reflex
packages/reflex-base/src/reflex_base/plugins/base.py
.py
"""Base class for all plugins.""" from collections.abc import Callable, Mapping, Sequence from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar, ParamSpec, Protocol, TypedDict, TypeVar from typing_extensions import Unpack from reflex_base.utils.exceptions import ConfigError ...
363
11,832
reflex
packages/reflex-hosting-cli/src/reflex_cli/deployments.py
.py
"""Disabled Hosting CLI deployments sub-commands.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING import click from reflex_cli import constants from reflex_cli.utils import disabled_v1_hosting if TYPE_CHECKING: import typer TIME_FORMAT_HELP = "Accep...
243
6,454
reflex
packages/reflex-hosting-cli/src/reflex_cli/cli.py
.py
"""Disabled V1 CLI for the hosting service.""" from __future__ import annotations from reflex_cli.utils import disabled_v1_hosting login = disabled_v1_hosting logout = disabled_v1_hosting deploy = disabled_v1_hosting
10
220
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/secrets.py
.py
"""Secrets commands for the Reflex Cloud CLI.""" from __future__ import annotations import click from reflex_cli import constants from reflex_cli.utils import console from reflex_cli.utils.exceptions import NotAuthenticatedError @click.group() def secrets_cli(): """Commands for managing secrets.""" @secrets_...
243
7,497
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/apps.py
.py
"""App commands for the Reflex Cloud CLI.""" from __future__ import annotations import json from typing import Any import click from reflex_cli import constants from reflex_cli.core.config import Config from reflex_cli.utils import console from reflex_cli.utils.exceptions import ( ConfigInvalidFieldValueError, ...
1,001
32,784
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/scan.py
.py
"""The `reflex cloud scan` command: a Reflex-aware security review.""" from __future__ import annotations import io import json import os import time import zipfile from pathlib import Path from typing import Any import click from reflex_cli import constants from reflex_cli.utils import console from reflex_cli.util...
263
8,525
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/gcp.py
.py
"""GCP Cloud Run deploy commands for the Reflex Cloud CLI. Fetches a Dockerfile + bash deploy script from Reflex and runs the script against the user's source directory. The Dockerfile is materialized inside a Cloud Build job (via a ``cloudbuild.yaml`` written to a tempfile and referenced with ``gcloud builds submit -...
777
26,223
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/deployments.py
.py
"""The Hosting CLI deployments sub-commands.""" from __future__ import annotations import importlib.metadata from importlib.util import find_spec from typing import TYPE_CHECKING import click from packaging import version from reflex_cli import constants from reflex_cli.utils import console from reflex_cli.v2.apps ...
160
5,004
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/project.py
.py
"""Project commands for the Reflex Cloud CLI.""" import json import click from reflex_cli import constants from reflex_cli.utils import console from reflex_cli.utils.exceptions import NotAuthenticatedError @click.group() def project_cli(): """Commands for managing projects.""" @project_cli.command(name="crea...
536
17,050
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/cli.py
.py
"""CLI for the hosting service.""" from __future__ import annotations import contextlib import dataclasses import json import os import shutil import tempfile from collections.abc import Callable, Iterator from pathlib import Path from typing import Any import click from packaging import version from reflex_cli imp...
724
27,343
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/vmtypes_regions.py
.py
"""VMTypes and Regions commands for the Reflex Cloud CLI.""" import json import click from reflex_cli import constants from reflex_cli.utils import console @click.group() def vm_types_regions_cli(): """Commands for VM types and regions.""" @vm_types_regions_cli.command("create-token") @click.argument("name",...
199
5,469
reflex
packages/reflex-hosting-cli/src/reflex_cli/v2/providers.py
.py
"""Cloud provider commands for the Reflex Cloud CLI. Read-only visibility into the cloud providers connected to your organization (currently GCP for bring-your-own-cloud deploys). Connecting or removing a provider account uploads and validates a service-account key and is done from the Reflex Cloud dashboard (Organiza...
212
6,796
reflex
packages/reflex-hosting-cli/src/reflex_cli/core/config.py
.py
"""Module for the Config class.""" from __future__ import annotations import dataclasses import typing from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from typing import Any, Literal, get_origin from reflex_cli import constants from reflex_cli.utils.exceptions import C...
323
10,373
reflex
packages/reflex-hosting-cli/src/reflex_cli/utils/dependency.py
.py
"""Building the app and initializing all prerequisites.""" from __future__ import annotations import importlib.metadata import io import re import subprocess import sys from pathlib import Path from urllib.parse import urlparse from reflex_cli import constants from reflex_cli.utils import console def detect_encodi...
171
4,762
reflex
packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py
.py
"""Hosting service related utilities.""" from __future__ import annotations import contextlib import dataclasses import importlib.metadata import json import platform import re import subprocess import sys import time import uuid import webbrowser from collections.abc import Mapping from enum import Enum from http im...
2,781
85,492
reflex
packages/reflex-hosting-cli/src/reflex_cli/utils/exceptions.py
.py
"""Custom Exceptions.""" class ReflexHostingCliError(Exception): """Base exception for all Reflex Hosting CLI exceptions.""" class NotAuthenticatedError(ReflexHostingCliError): """Raised when the user is not authenticated.""" class TokenValidationError(ReflexHostingCliError): """Raised when validating...
60
1,655
reflex
packages/reflex-hosting-cli/src/reflex_cli/utils/__init__.py
.py
"""Reflex utilities.""" import click from reflex_cli.constants.hosting import ReflexHostingCli from . import console def disabled_v1_hosting(*args, **kwargs): """Print error and exit when using v1 hosting commands. Args: *args: ignored. **kwargs: ignored. Raises: Exit: Always....
26
578
reflex
packages/reflex-hosting-cli/src/reflex_cli/utils/console.py
.py
"""Functions to communicate to the user via console.""" from __future__ import annotations from collections.abc import Sequence from typing import overload from rich.console import Console from reflex_cli.constants import LogLevel # Console for pretty printing. _console = Console() # The current log level. _LOG_L...
227
4,744
reflex
packages/reflex-hosting-cli/src/reflex_cli/constants/hosting.py
.py
"""Constants related to hosting.""" import os from pathlib import Path from types import SimpleNamespace from packaging import version from reflex_cli.constants.base import Reflex class ReflexHostingCli(SimpleNamespace): """Constants related to reflex-hosting-cli.""" MODULE_NAME = "reflex-hosting-cli" ...
57
1,592