Преглед на файлове

GUI: Revert types file name (#906)

* GUI: Revert types file name

* fix linter

* fix ruff error
Dinh Long Nguyen преди 1 година
родител
ревизия
05e421cc15

+ 2 - 2
taipy/gui/_renderers/builder.py

@@ -20,8 +20,8 @@ from inspect import isclass
 from urllib.parse import quote
 
 from .._warnings import _warn
-from ..gui_types import PropertyType, _get_taipy_type
 from ..partial import Partial
+from ..types import PropertyType, _get_taipy_type
 from ..utils import (
     _date_to_string,
     _get_broadcast_var_name,
@@ -69,7 +69,7 @@ class _Builder:
         "apply",
         "style",
         "tooltip",
-        "lov"
+        "lov",
     ]
 
     def __init__(

+ 1 - 1
taipy/gui/_renderers/factory.py

@@ -13,7 +13,7 @@ import re
 import typing as t
 from datetime import datetime
 
-from ..gui_types import PropertyType
+from ..types import PropertyType
 from .builder import _Builder
 
 if t.TYPE_CHECKING:

+ 2 - 2
taipy/gui/_renderers/utils.py

@@ -12,7 +12,7 @@
 import typing as t
 
 from .._warnings import _warn
-from ..gui_types import NumberTypes
+from ..types import NumberTypes
 from ..utils import _RE_PD_TYPE, _get_date_col_str_name, _MapDict
 
 
@@ -57,7 +57,7 @@ def _get_columns_dict(  # noqa: C901
     if isinstance(columns, str):
         col_dict = _get_columns_dict_from_list([s.strip() for s in columns.split(";")], col_types_keys, value)
     elif isinstance(columns, (list, tuple)):
-        col_dict = _get_columns_dict_from_list(columns, col_types_keys, value) # type: ignore[arg-type]
+        col_dict = _get_columns_dict_from_list(columns, col_types_keys, value)  # type: ignore[arg-type]
     elif isinstance(columns, _MapDict):
         col_dict = columns._dict.copy()
     elif isinstance(columns, dict):

+ 5 - 5
taipy/gui/_warnings.py

@@ -32,11 +32,11 @@ class TaipyGuiWarning(UserWarning):
 
 def _warn(message: str, e: t.Optional[BaseException] = None):
     warnings.warn(
-        f"{message}:\n{''.join(traceback.format_exception(type(e), e, e.__traceback__))}"
-        if e and TaipyGuiWarning._tp_debug_mode
-        else f"{message}:\n{e}"
-        if e
-        else message,
+        (
+            f"{message}:\n{''.join(traceback.format_exception(type(e), e, e.__traceback__))}"
+            if e and TaipyGuiWarning._tp_debug_mode
+            else f"{message}:\n{e}" if e else message
+        ),
         TaipyGuiWarning,
         stacklevel=2,
     )

+ 2 - 2
taipy/gui/data/decimator/rdp.py

@@ -61,7 +61,7 @@ class RDP(Decimator):
         xdiff = P2[0] - P1[0]
         ydiff = P2[1] - P1[1]
         nom = (ydiff * points[:, 0] - xdiff * points[:, 1] + P2[0] * P1[1] - P2[1] * P1[0]) ** 2
-        denom = ydiff ** 2 + xdiff ** 2
+        denom = ydiff**2 + xdiff**2
         return np.divide(nom, denom)
 
     @staticmethod
@@ -89,7 +89,7 @@ class RDP(Decimator):
             points = data[start + 1 : end]
             dsq = RDP.dsquared_line_points(P1, P2, points)
 
-            mask_eps = dsq > epsilon ** 2
+            mask_eps = dsq > epsilon**2
 
             if mask_eps.any():
                 # max point outside eps

+ 1 - 1
taipy/gui/data/pandas_data_accessor.py

@@ -18,7 +18,7 @@ import pandas as pd
 
 from .._warnings import _warn
 from ..gui import Gui
-from ..gui_types import PropertyType
+from ..types import PropertyType
 from ..utils import _RE_PD_TYPE, _get_date_col_str_name
 from .data_accessor import _DataAccessor
 from .data_format import _DataFormat

+ 1 - 1
taipy/gui/extension/__init__.py

@@ -9,5 +9,5 @@
 # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 # specific language governing permissions and limitations under the License.
 
-from ..gui_types import PropertyType
+from ..types import PropertyType
 from .library import Element, ElementLibrary, ElementProperty

+ 1 - 1
taipy/gui/extension/library.py

@@ -20,7 +20,7 @@ from urllib.parse import urlencode
 
 from .._renderers.builder import _Builder
 from .._warnings import _warn
-from ..gui_types import PropertyType
+from ..types import PropertyType
 from ..utils import _get_broadcast_var_name, _TaipyBase, _to_camel_case
 
 if t.TYPE_CHECKING:

+ 2 - 2
taipy/gui/gui.py

@@ -56,11 +56,11 @@ from .data.data_accessor import _DataAccessor, _DataAccessors
 from .data.data_format import _DataFormat
 from .data.data_scope import _DataScopes
 from .extension.library import Element, ElementLibrary
-from .gui_types import _WsType
 from .page import Page
 from .partial import Partial
 from .server import _Server
 from .state import State
+from .types import _WsType
 from .utils import (
     _delscopeattr,
     _filter_locals,
@@ -1229,7 +1229,7 @@ class Gui:
 
     def __send_ws_update_with_dict(self, modified_values: dict) -> None:
         payload = [
-            {"name": _get_client_var_name(k), "payload": (v if isinstance(v, dict) and "value" in v else {"value": v})}
+            {"name": _get_client_var_name(k), "payload": v if isinstance(v, dict) and "value" in v else {"value": v}}
             for k, v in modified_values.items()
         ]
         if self._is_broadcasting():

+ 1 - 3
taipy/gui/page.py

@@ -85,9 +85,7 @@ class Page:
         return (
             self._class_locals
             if self._is_class_module()
-            else None
-            if (frame := self._get_frame()) is None
-            else _filter_locals(frame.f_locals)
+            else None if (frame := self._get_frame()) is None else _filter_locals(frame.f_locals)
         )
 
     def _is_class_module(self):

+ 1 - 1
taipy/gui/setup.py

@@ -89,7 +89,7 @@ setup(
     install_requires=get_requirements(),
     license="Apache License 2.0",
     include_package_data=True,
-    data_files=[('version', ['version.json'])],
+    data_files=[("version", ["version.json"])],
     keywords="taipy-gui",
     name="taipy-gui",
     packages=find_namespace_packages(where=".") + find_packages(include=["taipy", "taipy.gui", "taipy.gui.*"]),

+ 2 - 4
taipy/gui/gui_types.py → taipy/gui/types.py

@@ -144,8 +144,7 @@ class PropertyType(Enum):
 
 
 @t.overload  # noqa: F811
-def _get_taipy_type(a_type: None) -> None:
-    ...
+def _get_taipy_type(a_type: None) -> None: ...
 
 
 @t.overload
@@ -161,8 +160,7 @@ def _get_taipy_type(a_type: PropertyType) -> t.Type[_TaipyBase]:  # noqa: F811
 @t.overload
 def _get_taipy_type(  # noqa: F811
     a_type: t.Optional[t.Union[t.Type[_TaipyBase], t.Type[Decimator], PropertyType]]
-) -> t.Optional[t.Union[t.Type[_TaipyBase], t.Type[Decimator], PropertyType]]:
-    ...
+) -> t.Optional[t.Union[t.Type[_TaipyBase], t.Type[Decimator], PropertyType]]: ...
 
 
 def _get_taipy_type(  # noqa: F811

+ 1 - 3
taipy/gui/utils/boolean.py

@@ -16,9 +16,7 @@ def _is_boolean_true(s: t.Union[bool, str]) -> bool:
     return (
         s
         if isinstance(s, bool)
-        else s.lower() in ["true", "1", "t", "y", "yes", "yeah", "sure"]
-        if isinstance(s, str)
-        else False
+        else s.lower() in ["true", "1", "t", "y", "yes", "yeah", "sure"] if isinstance(s, str) else False
     )
 
 

+ 6 - 6
taipy/gui/utils/chart_config_builder.py

@@ -16,7 +16,7 @@ from enum import Enum
 
 from .._renderers.utils import _get_columns_dict
 from .._warnings import _warn
-from ..gui_types import PropertyType
+from ..types import PropertyType
 from ..utils import _MapDict
 
 if t.TYPE_CHECKING:
@@ -250,11 +250,11 @@ def _build_chart_config(gui: "Gui", attributes: t.Dict[str, t.Any], col_types: t
             "orientations": [tr[_Chart_iprops.orientation.value] for tr in traces],
             "names": [tr[_Chart_iprops._name.value] for tr in traces],
             "lines": [
-                tr[_Chart_iprops.line.value]
-                if isinstance(tr[_Chart_iprops.line.value], (dict, _MapDict))
-                else {"dash": tr[_Chart_iprops.line.value]}
-                if tr[_Chart_iprops.line.value]
-                else None
+                (
+                    tr[_Chart_iprops.line.value]
+                    if isinstance(tr[_Chart_iprops.line.value], (dict, _MapDict))
+                    else {"dash": tr[_Chart_iprops.line.value]} if tr[_Chart_iprops.line.value] else None
+                )
                 for tr in traces
             ],
             "textAnchors": [tr[_Chart_iprops.text_anchor.value] for tr in traces],