-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Pydantic from some classes (#3907)
* half of the way there * add dataclass support * Forbid Computed var shadowing (#3843) * get it right pyright * fix unit tests * rip out more pydantic * fix weird issues with merge_imports * add missing docstring * make special props a list instead of a set * fix moment pyi * actually ignore the runtime error * it's ruff out there --------- Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com>
- Loading branch information
1 parent
76307dc
commit 454a098
Showing
27 changed files
with
395 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
"""Tag to conditionally render components.""" | ||
|
||
import dataclasses | ||
from typing import Any, Dict, Optional | ||
|
||
from reflex.components.tags.tag import Tag | ||
from reflex.ivars.base import LiteralVar | ||
from reflex.vars import Var | ||
|
||
|
||
@dataclasses.dataclass() | ||
class CondTag(Tag): | ||
"""A conditional tag.""" | ||
|
||
# The condition to determine which component to render. | ||
cond: Var[Any] | ||
cond: Var[Any] = dataclasses.field(default_factory=lambda: LiteralVar.create(True)) | ||
|
||
# The code to render if the condition is true. | ||
true_value: Dict | ||
true_value: Dict = dataclasses.field(default_factory=dict) | ||
|
||
# The code to render if the condition is false. | ||
false_value: Optional[Dict] | ||
false_value: Optional[Dict] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
"""Tag to conditionally match cases.""" | ||
|
||
import dataclasses | ||
from typing import Any, List | ||
|
||
from reflex.components.tags.tag import Tag | ||
from reflex.ivars.base import LiteralVar | ||
from reflex.vars import Var | ||
|
||
|
||
@dataclasses.dataclass() | ||
class MatchTag(Tag): | ||
"""A match tag.""" | ||
|
||
# The condition to determine which case to match. | ||
cond: Var[Any] | ||
cond: Var[Any] = dataclasses.field(default_factory=lambda: LiteralVar.create(True)) | ||
|
||
# The list of match cases to be matched. | ||
match_cases: List[Any] | ||
match_cases: List[Any] = dataclasses.field(default_factory=list) | ||
|
||
# The catchall case to match. | ||
default: Any | ||
default: Any = dataclasses.field(default=LiteralVar.create(None)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.