浏览代码

move the filterwarning to appropriate file (#3952)

Thomas Brandého 8 月之前
父节点
当前提交
c46d1d9c7e
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 0 3
      reflex/components/component.py
  2. 3 0
      reflex/vars/base.py

+ 0 - 3
reflex/components/component.py

@@ -4,7 +4,6 @@ from __future__ import annotations
 
 
 import copy
 import copy
 import typing
 import typing
-import warnings
 from abc import ABC, abstractmethod
 from abc import ABC, abstractmethod
 from functools import lru_cache, wraps
 from functools import lru_cache, wraps
 from hashlib import md5
 from hashlib import md5
@@ -170,8 +169,6 @@ ComponentStyle = Dict[
 ]
 ]
 ComponentChild = Union[types.PrimitiveType, Var, BaseComponent]
 ComponentChild = Union[types.PrimitiveType, Var, BaseComponent]
 
 
-warnings.filterwarnings("ignore", message="fields may not start with an underscore")
-
 
 
 class Component(BaseComponent, ABC):
 class Component(BaseComponent, ABC):
     """A component with style, event trigger and other props."""
     """A component with style, event trigger and other props."""

+ 3 - 0
reflex/vars/base.py

@@ -13,6 +13,7 @@ import random
 import re
 import re
 import string
 import string
 import sys
 import sys
+import warnings
 from types import CodeType, FunctionType
 from types import CodeType, FunctionType
 from typing import (
 from typing import (
     TYPE_CHECKING,
     TYPE_CHECKING,
@@ -72,6 +73,8 @@ if TYPE_CHECKING:
 
 
 VAR_TYPE = TypeVar("VAR_TYPE", covariant=True)
 VAR_TYPE = TypeVar("VAR_TYPE", covariant=True)
 
 
+warnings.filterwarnings("ignore", message="fields may not start with an underscore")
+
 
 
 @dataclasses.dataclass(
 @dataclasses.dataclass(
     eq=False,
     eq=False,