id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
145,245
import argparse import builtins import math import os import random import shutil import time import warnings import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.multiprocessing as mp import torch.utils.data im...
null
145,246
import torch import torch.nn as nn The provided code snippet includes necessary dependencies for implementing the `concat_all_gather` function. Write a Python function `def concat_all_gather(tensor)` to solve the following problem: Performs all_gather operation on the provided tensors. *** Warning ***: torch.distribut...
Performs all_gather operation on the provided tensors. *** Warning ***: torch.distributed.all_gather has no gradient.
145,247
import json import os from torchvision import datasets, transforms from torchvision.datasets.folder import ImageFolder, default_loader from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD import oxford_flowers_dataset, oxford_pets_dataset def build_transform(is_train, args): transform_train =...
null
145,248
from PyInstaller.compat import is_win from vlc import dll as vlc_dll from vlc import plugin_path import os plugins_dlls = [ # (subdir, fname) ('access', 'libfilesystem_plugin'), ('codec', 'libdxva2_plugin'), ('codec', 'libavcodec_plugin'), ('audio_output', 'libdirectsound_plugin'), ('audio_mixer...
null
145,249
def _translate(context, text, disambig): return QApplication.translate(context, text, disambig)
null
145,250
import os import datetime import logging import sys def get_submod_log(submod_name): return logging.getLogger('Main' + '.' + submod_name) class LoggerStream(object): """假 stream,将 stdout/stderr 流重定向到日志,避免win上无头模式运行时报错。 ref: https://docs.python.org/3/library/sys.html#sys.__stdout__ """ def __init__(s...
null
145,251
def uncaughtExceptionHandler(exctype, value, tb): logging.error("\n************!!!UNCAUGHT EXCEPTION!!!*********************\n" + ("Type: %s" % exctype) + '\n' + ("Value: %s" % value) + '\n' + ("Traceback:" + '\n') + " ".join(traceback.form...
null
145,252
def unraisableExceptionHandler(exc_type,exc_value,exc_traceback,err_msg,object): logging.error("\n************!!!UNHANDLEABLE EXCEPTION!!!******************\n" + ("Type: %s" % exc_type) + '\n' + ("Value: %s" % exc_value) + '\n' + ("Message: %s " % err_msg) + '...
null
145,253
def thraedingExceptionHandler(exc_type,exc_value,exc_traceback,thread): logging.error("\n************!!!UNCAUGHT THREADING EXCEPTION!!!***********\n" + ("Type: %s" % exc_type) + '\n' + ("Value: %s" % exc_value) + '\n' + ("Traceback on thread %s: " % thread + '...
null
145,254
import os, sys, time, datetime, subprocess, logging, traceback, platform from PyQt5.Qt import * def loggingSystemInfo(): systemCmd = "" gpuCmd = "" if platform.system() == 'Windows': systemCmd = r"\u C:\Windows\System32\systeminfo.exe" wmi_exe = r"C:\Windows\System32\wbem\WMIC.exe" ...
null
145,255
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
Get a unique variable name. Returns: The unique variable name.
145,256
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
Encode the state name into a formatted var. Args: value: The value to encode the state name into. Returns: The encoded var.
145,257
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
Decode the state name from a formatted var. Args: value: The value to extract the state name from. Returns: The extracted state name and the value without the state name.
145,258
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
Extract the var imports and hooks from an iterable containing a Var. Args: value: The iterable to extract the VarData from Returns: The extracted VarDatas.
145,259
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
A ComputedVar decorator with or without kwargs. Args: fget: The getter function. initial_value: The initial value of the computed var. cache: Whether to cache the computed value. **kwargs: additional attributes to set on the instance Returns: A ComputedVar instance.
145,260
from __future__ import annotations import contextlib import dataclasses import dis import functools import inspect import json import random import re import string import sys from types import CodeType, FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Li...
Return a var that generates UUIDs via .web/utils/state.js. Returns: the var to generate UUIDs at runtime.
145,267
from __future__ import annotations from typing import Any DECORATED_PAGES = [] The provided code snippet includes necessary dependencies for implementing the `page` function. Write a Python function `def page( route: str | None = None, title: str | None = None, image: str | None = None, description: st...
Decorate a function as a page. rx.App() will automatically call add_page() for any method decorated with page when App.compile is called. All defaults are None because they will use the one from add_page(). Note: the decorated functions still need to be imported. Args: route: The route to reach the page. title: The tit...
145,268
from __future__ import annotations from typing import Any DECORATED_PAGES = [] The provided code snippet includes necessary dependencies for implementing the `get_decorated_pages` function. Write a Python function `def get_decorated_pages() -> list[dict]` to solve the following problem: Get the decorated pages. Return...
Get the decorated pages. Returns: The decorated pages.
145,269
from __future__ import annotations import asyncio import concurrent.futures import contextlib import copy import functools import os from typing import ( Any, AsyncIterator, Callable, Coroutine, Dict, List, Optional, Set, Type, Union, get_args, get_type_hints, ) from fast...
Default overlay_component attribute for App. Returns: The default overlay_component, which is a connection_modal.
145,270
from __future__ import annotations import asyncio import concurrent.futures import contextlib import copy import functools import os from typing import ( Any, AsyncIterator, Callable, Coroutine, Dict, List, Optional, Set, Type, Union, get_args, get_type_hints, ) from fast...
Process an event. Args: app: The app to process the event for. event: The event to process. sid: The Socket.IO session id. headers: The client headers. client_ip: The client_ip. Yields: The state updates after processing the event.
145,271
from __future__ import annotations import asyncio import concurrent.futures import contextlib import copy import functools import os from typing import ( Any, AsyncIterator, Callable, Coroutine, Dict, List, Optional, Set, Type, Union, get_args, get_type_hints, ) from fast...
Test API endpoint. Returns: The response.
145,272
from __future__ import annotations import asyncio import concurrent.futures import contextlib import copy import functools import os from typing import ( Any, AsyncIterator, Callable, Coroutine, Dict, List, Optional, Set, Type, Union, get_args, get_type_hints, ) from fast...
Upload a file. Args: app: The app to upload the file for. Returns: The upload function.
145,273
from __future__ import annotations import os from typing import Any, Callable, Dict, Optional, Type, Union from urllib.parse import urlparse from pydantic.fields import ModelField from reflex import constants from reflex.components.base import ( Body, Description, DocumentHead, Head, Html, Image...
Get the path for an asset. Args: filename: If given, is added to the root path of assets dir. Returns: The path of the asset.
145,274
from __future__ import annotations import os from typing import Any, Callable, Dict, Optional, Type, Union from urllib.parse import urlparse from pydantic.fields import ModelField from reflex import constants from reflex.components.base import ( Body, Description, DocumentHead, Head, Html, Image...
Add metadata to a page. Args: page: The component for the page. title: The title of the page. image: The image for the page. description: The description of the page. meta: The metadata list. Returns: The component with the metadata added.
145,275
from __future__ import annotations import os from typing import Any, Callable, Dict, Optional, Type, Union from urllib.parse import urlparse from pydantic.fields import ModelField from reflex import constants from reflex.components.base import ( Body, Description, DocumentHead, Head, Html, Image...
Write the given code to the given path. Args: path: The path to write the code to. code: The code to write.
145,276
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the root stylesheet. Args: stylesheets: The stylesheets to include in the root stylesheet. Returns: The path and code of the compiled root stylesheet.
145,277
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile a single component. Args: component: The component to compile. Returns: The compiled component.
145,278
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the document root. Args: head_components: The components to include in the head. html_lang: The language of the document, will be added to the html root element. html_custom_attrs: custom attributes added to the html root element. Returns: The path and code of the compiled document root.
145,279
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the app root. Args: app_root: The app root component to compile. Returns: The path and code of the compiled app wrapper.
145,280
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the theme. Args: style: The style to compile. Returns: The path and code of the compiled theme.
145,281
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the initial state / context. Args: state: The app state. theme: The top-level app theme. Returns: The path and code of the compiled context.
145,282
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile a single page. Args: path: The path to compile the page to. component: The component to compile. state: The app state. Returns: The path and code of the compiled page.
145,283
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the custom components. Args: components: The custom components to compile. Returns: The path and code of the compiled components.
145,284
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Separately compile components that depend on State vars. StatefulComponents are compiled as their own component functions with their own useContext declarations, which allows page components to be stateless and avoid re-rendering along with parts of the page that actually depend on state. Args: pages: The pages to extr...
145,285
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Compile the Tailwind config. Args: config: The Tailwind config. Returns: The compiled Tailwind config.
145,286
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
If tailwind is not to be used, remove it from postcss.config.js. Returns: The path and code of the compiled postcss.config.js.
145,287
from __future__ import annotations import os from pathlib import Path from typing import Dict, Iterable, Optional, Type, Union from reflex import constants from reflex.compiler import templates, utils from reflex.components.component import ( BaseComponent, Component, ComponentStyle, CustomComponent, ...
Empty out .web/pages directory.
145,288
from jinja2 import Environment, FileSystemLoader, Template from reflex import constants from reflex.utils.format import format_state_name, json_dumps class ReflexJinjaEnvironment(Environment): """The template class for jinja environment.""" def __init__(self) -> None: """Set default environment.""" ...
Get render function that work with a template. Args: name: The template name. "/" is used as the path separator. Returns: A render function.
145,293
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Decorator to mark event handler as running in the background. Args: fn: The function to decorate. Returns: The same function, but with a marker set. Raises: TypeError: If the function is not a coroutine function or async generator.
145,294
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Protect against directly chaining a background task from another event handler. Args: state_cls: The state class that the event handler is in. name: The name of the background task. fn: The background task coroutine function / generator. Returns: A compatible coroutine function / generator that raises a runtime error. ...
145,295
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Redirect to a new path. Args: path: The path to redirect to. external: Whether to open in new tab or not. Returns: An event to redirect to the path.
145,296
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Do a console.log on the browser. Args: message: The message to log. Returns: An event to log the message.
145,297
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Create a window alert on the browser. Args: message: The message to alert. Returns: An event to alert the message.
145,298
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Set focus to specified ref. Args: ref: The ref. Returns: An event to set focus on the ref
145,299
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Set the value of a ref. Args: ref: The ref. value: The value to set. Returns: An event to set the ref.
145,300
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Remove a cookie on the frontend. Args: key: The key identifying the cookie to be removed. options: Support all the cookie options from RFC 6265 Returns: EventSpec: An event to remove a cookie.
145,301
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Set a value in the local storage on the frontend. Returns: EventSpec: An event to clear the local storage.
145,302
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Set a value in the local storage on the frontend. Args: key: The key identifying the variable in the local storage to remove. Returns: EventSpec: An event to remove an item based on the provided key in local storage.
145,303
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Set the text in content in the clipboard. Args: content: The text to add to clipboard. Returns: EventSpec: An event to set some content in the clipboard.
145,304
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Download the file at a given path or with the specified data. Args: url: The URL to the file to download. filename: The name that the file should be saved as after download. data: The data to download. Raises: ValueError: If the URL provided is invalid, both URL and data are provided, or the data is not an expected typ...
145,305
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Get the name of the hydrate event for the state. Args: state: The state. Returns: The name of the hydrate event.
145,306
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Get the handler args for the given event spec. Args: event_spec: The event spec. Returns: The handler args.
145,307
from __future__ import annotations import inspect from base64 import b64encode from types import FunctionType from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union, ) from reflex import constants from reflex.base import Base from reflex.utils imp...
Fix a list of events returned by an event handler. Args: events: The events to fix. token: The user token. router_data: The optional router data to set in the event. Returns: The fixed events.
145,308
from __future__ import annotations import os import platform from types import SimpleNamespace from .base import IS_WINDOWS, Dirs, Reflex The provided code snippet includes necessary dependencies for implementing the `get_fnm_name` function. Write a Python function `def get_fnm_name() -> str | None` to solve the follo...
Get the appropriate fnm executable name based on the current platform. Returns: The fnm executable name for the current platform.
145,309
from __future__ import annotations import os from collections import defaultdict from pathlib import Path from typing import Any, Optional import alembic.autogenerate import alembic.command import alembic.config import alembic.operations.ops import alembic.runtime.environment import alembic.script import alembic.util i...
Get a session to interact with the database. Args: url: The database url. Returns: A database session.
145,310
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Get the Reflex version. Args: value: Whether the version flag was passed. Raises: typer.Exit: If the version flag was passed.
145,311
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Initialize a new Reflex app in the current directory.
145,312
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Authenticate with Reflex hosting service.
145,313
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Log out of access to Reflex hosting service.
145,314
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Create database schema and migration configuration.
145,315
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Create autogenerated alembic migration scripts.
145,316
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Change all rx.<component> references to rx.chakra.<component>, to preserve Chakra UI usage.
145,317
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Deploy the app to the Reflex hosting service.
145,318
from __future__ import annotations import atexit import os import webbrowser from pathlib import Path from typing import List, Optional import typer import typer.core from reflex_cli.deployments import deployments_cli from reflex_cli.utils import dependency from reflex import constants from reflex.config import get_con...
Run the demo app.
145,319
from __future__ import annotations import re from reflex import constants def catchall_in_route(route: str) -> str: """Extract the catchall part from a route. Args: route: the route from which to extract Returns: str: the catchall part of the URI """ match_ = constants.RouteRegex.CAT...
Verify if the route is valid, and throw an error if not. Args: route: The route that need to be checked Raises: ValueError: If the route is invalid.
145,320
from __future__ import annotations import re from reflex import constants The provided code snippet includes necessary dependencies for implementing the `get_route_args` function. Write a Python function `def get_route_args(route: str) -> dict[str, str]` to solve the following problem: Get the dynamic arguments for th...
Get the dynamic arguments for the given route. Args: route: The route to get the arguments for. Returns: The route arguments.
145,321
from __future__ import annotations import re from reflex import constants def catchall_in_route(route: str) -> str: """Extract the catchall part from a route. Args: route: the route from which to extract Returns: str: the catchall part of the URI """ match_ = constants.RouteRegex.CAT...
Extract the prefix part from a route that contains a catchall. Args: route: the route from which to extract Returns: str: the prefix part of the URI
145,322
from __future__ import annotations import textwrap from functools import lru_cache from hashlib import md5 from typing import Any, Callable, Dict, Union from reflex.compiler import utils from reflex.components.component import Component, CustomComponent from reflex.components.radix.themes.layout.list import ( ListI...
Get the base component map. Returns: The base component map.
145,324
from __future__ import annotations from reflex import constants from reflex.components.component import Component from reflex.components.core.cond import cond from reflex.vars import Var route_not_found: Var = Var.create_safe(constants.ROUTE_NOT_FOUND) class ClientSideRouting(Component): """The client-side routing ...
Wait for a redirect to occur before rendering a component. This prevents the 404 page from flashing while the redirect is happening. Args: component: The component to render after the redirect. Returns: The conditionally rendered component.
145,325
from __future__ import annotations from typing import Any, Dict, Optional, overload from reflex.components.base.fragment import Fragment from reflex.components.component import BaseComponent, Component, MemoizationLeaf from reflex.components.tags import CondTag, Tag from reflex.constants import Dirs from reflex.constan...
Create a component or Prop based on color_mode. Args: light: The component or prop to render if color_mode is default dark: The component or prop to render if color_mode is non-default Returns: The conditional component or prop.
145,326
from __future__ import annotations from typing import Optional from reflex.components.base.bare import Bare from reflex.components.component import Component from reflex.components.core.cond import cond from reflex.components.el.elements.typography import Div from reflex.components.lucide.icon import Icon from reflex.c...
Get the default connection error message. Returns: The default connection error message.
145,327
from reflex.components.chakra.layout.box import Box class Box(ChakraComponent): """A generic container component that can contain other components.""" tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. element: Var[str] # The sour...
Create a component that is only visible on mobile. Args: *children: The children to pass to the component. **props: The props to pass to the component. Returns: The component.
145,328
from reflex.components.chakra.layout.box import Box class Box(ChakraComponent): """A generic container component that can contain other components.""" tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. element: Var[str] # The sour...
Create a component that is only visible on tablet. Args: *children: The children to pass to the component. **props: The props to pass to the component. Returns: The component.
145,329
from reflex.components.chakra.layout.box import Box class Box(ChakraComponent): """A generic container component that can contain other components.""" tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. element: Var[str] # The sour...
Create a component that is only visible on desktop. Args: *children: The children to pass to the component. **props: The props to pass to the component. Returns: The component.
145,330
from reflex.components.chakra.layout.box import Box class Box(ChakraComponent): """A generic container component that can contain other components.""" tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. element: Var[str] # The sour...
Create a component that is only visible on tablet and desktop. Args: *children: The children to pass to the component. **props: The props to pass to the component. Returns: The component.
145,331
from reflex.components.chakra.layout.box import Box class Box(ChakraComponent): """A generic container component that can contain other components.""" tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. element: Var[str] # The sour...
Create a component that is only visible on mobile and tablet. Args: *children: The children to pass to the component. **props: The props to pass to the component. Returns: The component.
145,334
from reflex.constants.colors import Color, ColorType, ShadeType from reflex.utils.types import validate_parameter_literals ColorType = Literal[ "gray", "mauve", "slate", "sage", "olive", "sand", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "viole...
Create a color object. Args: color: The color to use. shade: The shade of the color to use. alpha: Whether to use the alpha variant of the color. Returns: The color object.
145,335
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Get the list of selected files. Args: id_: The id of the upload to get the selected files for. Returns: A var referencing the list of selected file paths.
145,336
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Clear the list of selected files. Args: id_: The id of the upload to clear. Returns: An event spec that clears the list of selected files when triggered.
145,337
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Cancel an upload. Args: upload_id: The id of the upload to cancel. Returns: An event spec that cancels the upload when triggered.
145,338
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Get the directory where uploaded files are stored. Returns: The directory where uploaded files are stored.
145,339
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Get the URL of an uploaded file. Args: file_path: The path of the uploaded file. Returns: The URL of the uploaded file to be rendered from the frontend (as a str-encoded Var).
145,340
from __future__ import annotations import os from pathlib import Path from typing import Any, Callable, ClassVar, Dict, List, Optional, Union from reflex import constants from reflex.components.chakra.forms.input import Input from reflex.components.chakra.layout.box import Box from reflex.components.component import Co...
Args spec for the on_drop event trigger. Args: files: The files to upload. Returns: Signature for on_drop handler including the files to upload.
145,347
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.match import Match from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPri...
Get the theme for the accordion root component. Args: variant: The variant of the accordion. color_scheme: The color of the accordion. Returns: The theme for the accordion root component.
145,348
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.match import Match from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPri...
Get the theme for the accordion item component. Returns: The theme for the accordion item component.
145,349
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.match import Match from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPri...
Get the theme for the accordion header component. Returns: The theme for the accordion header component.
145,350
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.match import Match from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPri...
Get the theme for the accordion trigger component. Args: variant: The variant of the accordion. color_scheme: The color of the accordion. Returns: The theme for the accordion trigger component.
145,351
from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import Component, ComponentNamespace from reflex.components.core.match import Match from reflex.components.lucide.icon import Icon from reflex.components.radix.primitives.base import RadixPri...
Get the theme for the accordion content component. Args: variant: The variant of the accordion. color_scheme: The color of the accordion. Returns: The theme for the accordion content component.
145,357
from __future__ import annotations from enum import Enum from typing import Any, Callable, Dict, List, Literal, Optional, Union from reflex.base import Base from reflex.components.component import Component, NoSSRComponent from reflex.components.literals import LiteralRowMarker from reflex.utils import console, format,...
The serializer for the data editor theme. Args: theme: The theme to serialize. Returns: The serialized theme.
145,359
from collections import defaultdict from reflex.utils import format from .html import ATTR_TO_ELEMENTS from .react import POSSIBLE_STANDARD_NAMES ATTR_TO_PROP_OVERRIDES = { "async": "async_", # `async` is a reserved keyword in Python. } POSSIBLE_STANDARD_NAMES = { # HTML "accept": "accept", "acceptcha...
Convert an HTML attribute name to its Reflex name. This function first uses React's `possibleStandardNames` to convert the HTML attribute name to its standard React name, then converts the standard name to a Reflex name. Args: attr_name: The HTML attribute name. Returns: A Reflex prop name that maps to the HTML attribu...
145,360
from __future__ import annotations import copy import typing from abc import ABC, abstractmethod from functools import lru_cache, wraps from hashlib import md5 from types import SimpleNamespace from typing import ( Any, Callable, ClassVar, Dict, Iterator, List, Optional, Set, Type, ...
Evaluate namespaces in the style. Args: style: The style to evaluate. Returns: The evaluated style.
145,361
from __future__ import annotations import copy import typing from abc import ABC, abstractmethod from functools import lru_cache, wraps from hashlib import md5 from types import SimpleNamespace from typing import ( Any, Callable, ClassVar, Dict, Iterator, List, Optional, Set, Type, ...
Create a custom component from a function. Args: component_fn: The function that creates the component. Returns: The decorated function.
145,362
from __future__ import annotations import copy import typing from abc import ABC, abstractmethod from functools import lru_cache, wraps from hashlib import md5 from types import SimpleNamespace from typing import ( Any, Callable, ClassVar, Dict, Iterator, List, Optional, Set, Type, ...
Serialize a component. Args: comp: The component to serialize. Returns: The serialized component.
145,363
from __future__ import annotations import asyncio import contextlib import copy import functools import inspect import json import traceback import urllib.parse import uuid from abc import ABC, abstractmethod from collections import defaultdict from types import FunctionType, MethodType from typing import ( Any, ...
Split the substate key into token and state name. Args: substate_key: The substate key. Returns: Tuple of token and state name.
145,364
from __future__ import annotations import asyncio import contextlib import copy import functools import inspect import json import traceback import urllib.parse import uuid from abc import ABC, abstractmethod from collections import defaultdict from types import FunctionType, MethodType from typing import ( Any, ...
Get the state manager for the app that is currently running. Returns: The state manager.
145,365
from __future__ import annotations import asyncio import contextlib import copy import functools import inspect import json import traceback import urllib.parse import uuid from abc import ABC, abstractmethod from collections import defaultdict from types import FunctionType, MethodType from typing import ( Any, ...
Serialize the wrapped value of a MutableProxy. Args: mp: The MutableProxy to serialize. Returns: The serialized wrapped object. Raises: ValueError: when the wrapped object is not serializable.
145,366
from __future__ import annotations import asyncio import contextlib import copy import functools import inspect import json import traceback import urllib.parse import uuid from abc import ABC, abstractmethod from collections import defaultdict from types import FunctionType, MethodType from typing import ( Any, ...
Check if the rendered Javascript uses state contexts. Args: javascript_code: The Javascript code to check. Returns: True if the code attempts to access a member of StateContexts.
145,367
from __future__ import annotations import os from typing import Any, List, Type import pydantic from pydantic import BaseModel from pydantic.fields import ModelField from reflex import constants The provided code snippet includes necessary dependencies for implementing the `validate_field_name` function. Write a Pytho...
Ensure that the field's name does not shadow an existing attribute of the model. Args: bases: List of base models to check for shadowed attrs. field_name: name of attribute Raises: NameError: If state var field shadows another in its parent state
145,368
from __future__ import annotations import os import re import subprocess import sys from collections import namedtuple from contextlib import contextmanager from pathlib import Path from typing import Optional import typer from reflex import constants from reflex.config import get_config from reflex.constants import Cu...
Initialize a custom component. Args: library_name: The name of the library. install: Whether to install package from this local custom component in editable mode. loglevel: The log level to use. Raises: Exit: If the pyproject.toml already exists.
145,369
from __future__ import annotations import os import re import subprocess import sys from collections import namedtuple from contextlib import contextmanager from pathlib import Path from typing import Optional import typer from reflex import constants from reflex.config import get_config from reflex.constants import Cu...
Publish a custom component. Must be run from the project root directory where the pyproject.toml is. Args: repository: The name of the Python package repository, such pypi, testpypi. token: The token to use for authentication on python package repository. If token is provided, no username/password should be provided at...