Skip to content

Commit

Permalink
generate pyi for __init__ files
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahAhianyo committed May 24, 2024
1 parent 0539b63 commit 675c8c6
Show file tree
Hide file tree
Showing 20 changed files with 697 additions and 116 deletions.
4 changes: 1 addition & 3 deletions reflex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,5 @@
__getattr__, __dir__, __all__ = lazy.attach(
__name__,
submodules=_SUBMODULES,
submod_attrs=_MAPPING,
submod_attrs=_SUBMOD_ATTRS,
)


51 changes: 27 additions & 24 deletions reflex/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,33 @@

import lazy_loader as lazy

_SUBMODULES: set[str] = {
"lucide",
"core",
"datadisplay",
"gridjs",
"markdown",
"moment",
"plotly",
"radix",
"react_player",
"sonner",
"suneditor",
"chakra",
"el",
"base",
"recharts",
}

_SUBMOD_ATTRS: dict[str, list[str]] = {
"component": [
"Component",
"NoSSRComponent",
],
"next": ["NextLink", "next_link"],
}
__getattr__, __dir__, __all__ = lazy.attach(
__name__,
submodules={
"lucide",
"core",
"datadisplay",
"gridjs",
"markdown",
"moment",
"plotly",
"radix",
"react_player",
"sonner",
"suneditor",
"chakra",
"el",
"base",
"recharts",
},
submod_attrs={
"component": [
"Component",
"NoSSRComponent",
],
"next": ["NextLink", "next_link"],
},
submodules=_SUBMODULES,
submod_attrs=_SUBMOD_ATTRS,
)
30 changes: 30 additions & 0 deletions reflex/components/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Stub file for reflex/components/__init__.py"""
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------

from . import base as base
from . import chakra as chakra
from . import core as core
from . import datadisplay as datadisplay
from . import el as el
from . import gridjs as gridjs
from . import lucide as lucide
from . import markdown as markdown
from . import moment as moment
from . import plotly as plotly
from . import radix as radix
from . import react_player as react_player
from . import recharts as recharts
from . import sonner as sonner
from . import suneditor as suneditor

from component import Component as Component
from component import NoSSRComponent as NoSSRComponent
from next import NextLink as NextLink
from next import next_link as next_link
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
import lazy_loader as lazy
2 changes: 1 addition & 1 deletion reflex/components/el/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

_SUBMODULES: set[str] = {"elements"}
_SUBMOD_ATTRS: dict[str, list[str]] = {
f"elements.{k}": v for k, v in elements.MAPPING.items()
f"elements.{k}": v for k, v in elements._MAPPING.items()
}

__getattr__, __dir__, __all__ = lazy.attach(
Expand Down
8 changes: 5 additions & 3 deletions reflex/components/el/elements/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Element classes."""
import lazy_loader as lazy

MAPPING = {
_MAPPING = {
"forms": [
"button",
"fieldset",
Expand Down Expand Up @@ -123,10 +123,12 @@


EXCLUDE = ["del_", "Del", "image"]
for _, v in MAPPING.items():
for _, v in _MAPPING.items():
v.extend([mod.capitalize() for mod in v if mod not in EXCLUDE])

_SUBMOD_ATTRS: dict[str, list[str]] = _MAPPING

__getattr__, __dir__, __all__ = lazy.attach(
__name__,
submod_attrs=MAPPING,
submod_attrs=_SUBMOD_ATTRS,
)
Loading

0 comments on commit 675c8c6

Please sign in to comment.