before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
if t.TYPE_CHECKING:
from ._renderers import Page
from .gui import Gui
_DETECT_CLOSING_TAGS = re.compile(r"<([A-Z][-\w]*)(([^>\"]+\"[^\"]*\")*\s*)?(><\/\1>)", flags=re.MULTILINE)
_SUBSTR_CLOSING_TAG = "<\\1\\2/>"
class _Page(object):
def __init__(self) -> None:
self._rendered_jsx: t.Optional[str]... | Did you change the return on the enterprise authorizedpage |
if t.TYPE_CHECKING:
from ._renderers import Page
from .gui import Gui
_DETECT_CLOSING_TAGS = re.compile(r"<([A-Z][-\w]*)(([^>\"]+\"[^\"]*\")*\s*)?(><\/\1>)", flags=re.MULTILINE)
_SUBSTR_CLOSING_TAG = "<\\1\\2/>"
class _Page(object):
def __init__(self) -> None:
self._rendered_jsx: t.Optional[str]... | @@ -36,19 +36,18 @@ def __init__(self) -> None:
self._route: t.Optional[str] = None
self._head: t.Optional[list] = None
self._script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]] = None
+ self.__pre_rendered = False
def render(self, gui: Gui, silent: t.Option... | taipy/gui/_page.py | 26 | Python | 0.286 | security | 58 | 51 | 51 | false | Manage context for pages that are not directly declared | 2,444 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | FredLL-Avaiga |
server_config=app_config.get("server_config"),
)
self._bindings()._new_scopes()
def __init_ngrok(self):
app_config = self._config.config
if hasattr(self, "_ngrok"):
# Keep the ngrok instance if token has not changed
if app_config.get("... | Reformatting might be needed for the and and curly brace close | server_config=app_config.get("server_config"),
)
self._bindings()._new_scopes()
def __init_ngrok(self):
app_config = self._config.config
if hasattr(self, "_ngrok"):
# Keep the ngrok instance if token has not changed
if app_config.get("... | @@ -2751,6 +2772,11 @@ def __init_ngrok(self):
def __bind_default_function(self):
with self.get_flask_app().app_context():
+ if additional_pages := _Hooks()._get_additional_pages():
+ # add page context for additional pages so that they can be managed by the variable directory
... | taipy/gui/gui.py | 26 | Python | 0.214 | style | 62 | 51 | 51 | false | Manage context for pages that are not directly declared | 2,444 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | FredLL-Avaiga |
elif dynamic_type == "int":
return _TemplateHandler._to_int(actual_val)
elif dynamic_type == "float":
return _TemplateHandler._to_float(actual_val)
elif dynamic_type == "datetime":
return ... | This `if` command handles the case where a dataclass instance is serialized into a dictionary.
For example, UserAttribute("email", "credential_mail", default="example@taipy.org") will be serialized to
```
{ "USER_ATTRIBUTE": {"name": "email", "credentials_name": "credentials_mail", "default": "example@taipy.org"... | if dynamic_type in cls._registered_types.keys():
return cls._registered_types[dynamic_type]._pythonify(actual_val)
if dynamic_type == "bool":
return _TemplateHandler._to_bool(actual_val)
elif dynamic_type == "int... | @@ -155,12 +159,16 @@ def _pythonify(cls, val):
return _TemplateHandler._to_function(actual_val)
elif dynamic_type == "class":
return _TemplateHandler._to_class(actual_val)
+ elif dynamic_type == "enum":
+ r... | taipy/common/config/_serializer/_base_serializer.py | 26 | Python | 1 | security | 390 | 33 | 41 | false | Feature - Allow serialize Enum object | 2,457 | Avaiga/taipy | 12,680 | Python | trgiangdo | trgiangdo |
actual_val = match.group(1)
dynamic_type = match.group(2)
if dynamic_type == "SECTION":
return actual_val
if dynamic_type in cls._registered_types.keys():
return cls._registered_types[dynamic_... | Just to be sure I understand: This case does not cover internal enums (SCOPE and FREQUENCY), as they are caught up by:
```
if dynamic_type in cls._registered_types.keys():
return cls._registered_types[dynamic_type]._pythonify(actual_val)
```
which transforms the string `SCENARIO:SCOPE` into a Scope instance wi... | if not match:
if isinstance(val, str):
TYPE_PATTERN = r"^(.+):(\b" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r"\b)?$"
if match := re.fullmatch(TYPE_PATTERN, str(val)):
actual_val = match.group(1)
dynamic_type = match.group(2)
... | @@ -155,12 +159,16 @@ def _pythonify(cls, val):
return _TemplateHandler._to_function(actual_val)
elif dynamic_type == "class":
return _TemplateHandler._to_class(actual_val)
+ elif dynamic_type == "enum":
+ r... | taipy/common/config/_serializer/_base_serializer.py | 26 | Python | 0.929 | question | 457 | 41 | 49 | false | Feature - Allow serialize Enum object | 2,457 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ```suggestion
def __init__(self) -> None:
``` | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -23,17 +23,21 @@ class _Registration:
_ID_PREFIX = "REGISTRATION"
__SEPARATOR = "_"
- def __init__(
- self,
+ def __init__(self): | taipy/core/notification/_registration.py | 26 | Python | 0.571 | suggestion | 51 | 51 | 51 | false | Make core event registration able to support multiple topics | 2,505 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
return cls.__do_register(registration)
@classmethod
def unregister(cls, registration_id: Union[str, _Registration]) -> None:
"""Unregister a listener.
!!! example "Standard usage"
```python
registration_id, registered_queue = Notifier.register(
... | Does this work if the `registration_id` is a `_Registration` object? | return cls.__do_register(registration)
@classmethod
def unregister(cls, registration_id: str) -> None:
"""Unregister a listener.
!!! example "Standard usage"
```python
registration_id, registered_queue = Notifier.register(
entity_type=EventEntit... | @@ -153,16 +147,20 @@ def unregister(cls, registration_id: str) -> None:
to_remove_registration: Optional[_Registration] = None
for _, registrations in cls._topics_registrations_list.items():
- for registration in registrations:
- if registration.registration_id == registra... | taipy/core/notification/notifier.py | 26 | Python | 0.357 | question | 68 | 51 | 51 | false | Make core event registration able to support multiple topics | 2,505 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
for all events related to this entity. Otherwise, the listener
will be notified for events related to all entities.
operation (Optional[EventOperation^]): If provided, the listener will
be notified for all events related to this operation. Otherwise,
... | ```suggestion
def unregister(cls, registration_id: str) -> None:
``` | for all events related to this entity. Otherwise, the listener
will be notified for events related to all entities.
operation (Optional[EventOperation^]): If provided, the listener will
be notified for all events related to this operation. Otherwise,
... | @@ -122,17 +122,11 @@ def register(
Returns:
A tuple containing the registration id and the event queue.
"""
- registration = _Registration(entity_type, entity_id, operation, attribute_name)
-
- if registrations := cls._topics_registrations_list.get(registration.topic, None)... | taipy/core/notification/notifier.py | 26 | Python | 0.571 | suggestion | 74 | 51 | 51 | false | Make core event registration able to support multiple topics | 2,505 | Avaiga/taipy | 12,680 | Python | jrobinAV | jrobinAV |
}
return { ...p, [propName]: val };
};
export const expandSx = (sx: SxProps | undefined, ...partials: (SxProps | undefined)[]) => {
const start = sx || {};
const end = partials.reduce((prevSx: SxProps, partialSx) => {
if (partialSx) {
return { ...prevSx, ...partialSx } as SxProps;
... | The return values can be changed by some variables created in the Stylekit | /*
* Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | @@ -168,3 +169,15 @@ export const expandSx = (sx: SxProps | undefined, ...partials: (SxProps | undefi
}, start);
return start === end ? sx : end;
};
+
+export const getInputButtonHeight = (size?: "small" | "medium" | "large") => {
+ switch (size) {
+ case "small":
+ return "32px";
+ ... | frontend/taipy-gui/src/components/Taipy/utils.ts | 26 | TypeScript | 0.286 | style | 74 | 27 | 172 | false | Refactor button and input components to use dynamic height based on size prop | 2,507 | Avaiga/taipy | 12,680 | Python | nunoferna | nunoferna |
}
const propName: keyof DateProps = withTime
? start
? "minDateTime"
: "maxDateTime"
: start
? "minDate"
: "maxDate";
if (p[propName] == val) {
return p;
}
return { ...p, [propName]: val };
};
export const expandSx = (sx: SxProps | und... | I don't feel the min-height value should be set in pixel.
I feel it should be unset when we don't want it | /*
* Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | @@ -168,3 +169,15 @@ export const expandSx = (sx: SxProps | undefined, ...partials: (SxProps | undefi
}, start);
return start === end ? sx : end;
};
+
+export const getInputButtonHeight = (size?: "small" | "medium" | "large") => { | frontend/taipy-gui/src/components/Taipy/utils.ts | 26 | TypeScript | 0.429 | suggestion | 106 | 37 | 172 | false | Refactor button and input components to use dynamic height based on size prop | 2,507 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | nunoferna |
import { getComponentClassName } from "./TaipyStyle";
interface ButtonProps extends TaipyActiveProps {
onAction?: string;
label: string;
defaultLabel?: string;
width?: string | number;
size?: "small" | "medium" | "large";
variant?: "text" | "outlined" | "contained";
}
const cardSx = { p: 0 };
... | I would propose to use the utils/expandSx function that allows to not create an object if it is not necessary
`const buttonSx = useMemo(() => expandSx(undefined, props.width ? { width: getCssSize(props.width) } : undefined, size !== "medium" ? {minHeight: "unset"}: undefined), [props.width]);` | import { getComponentClassName } from "./TaipyStyle";
interface ButtonProps extends TaipyActiveProps {
onAction?: string;
label: string;
defaultLabel?: string;
width?: string | number;
size?: "small" | "medium" | "large";
variant?: "text" | "outlined" | "contained";
}
const cardSx = { p: 0 };
... | @@ -42,7 +42,10 @@ const Button = (props: ButtonProps) => {
const className = useClassNames(props.libClassName, props.dynamicClassName, props.className);
const active = useDynamicProperty(props.active, props.defaultActive, true);
const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, u... | frontend/taipy-gui/src/components/Taipy/Button.tsx | 26 | TypeScript | 0.786 | suggestion | 295 | 51 | 51 | false | Refactor button and input components to use dynamic height based on size prop | 2,507 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | nunoferna |
display: "none",
},
"& input[type=number]": {
MozAppearance: "textfield",
},
};
const verticalDivStyle: CSSProperties = {
display: "flex",
flexDirection: "column",
gap: 0,
};
const noPaddingYSx = {py: 0};
const Input = (props: TaipyInputProps) => {
const {
type,
... | If you want to support size in input, it has to be defined on the python side too:
[here](https://github.com/Avaiga/taipy/blob/6c236cb8551765658402f6b5143be2c96505f725/taipy/gui/_renderers/factory.py#L333)
and as a property definition [there](https://github.com/Avaiga/taipy/blob/6c236cb8551765658402f6b5143be2c96505f7... | display: "none",
},
"& input[type=number]": {
MozAppearance: "textfield",
},
};
const verticalDivStyle: CSSProperties = {
display: "flex",
flexDirection: "column",
gap: 0,
};
const noPaddingYSx = {py: 0};
const Input = (props: TaipyInputProps) => {
const {
type,
... | @@ -66,6 +66,7 @@ const Input = (props: TaipyInputProps) => {
multiline = false,
actionOnBlur = false,
linesShown = 5,
+ size = "medium", | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.429 | suggestion | 412 | 51 | 51 | false | Refactor button and input components to use dynamic height based on size prop | 2,507 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | nunoferna |
if (val === "NaT") {
return nanValue || "";
}
return val ? getDateTimeString(val as string, col.format || defaultDateFormat, formatConf, col.tz) : "";
case "int":
case "float":
if (val === null) {
return nanValue || "";
... | ```suggestion
: (val as string)
```
..? | switch (col.type) {
case "datetime":
if (val === "NaT") {
return nanValue || "";
}
return val ? getDateTimeString(val as string, col.format || defaultDateFormat, formatConf, col.tz) : "";
case "int":
case "float":
if (val === nu... | @@ -262,7 +269,20 @@ const formatValue = (val: RowValue, col: ColumnDesc, formatConf: FormatConfig, n
}
return getNumberString(val as number, col.format, formatConf);
default:
- return val ? (val as string) : "";
+ return val
+ ? lineBreak
+ ... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 26 | TypeScript | 0.571 | question | 62 | 51 | 51 | false | line breaks in table cells | 2,525 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
action: string;
value: string | number | boolean | Date;
type: string;
matchcase?: boolean;
params?: number[];
}
export const defaultColumns = {} as Record<string, ColumnDesc>;
export const getSortByIndex = (cols: Record<string, ColumnDesc>) => (key1: string, key2: string) =>
cols[key1].multi ... | Could the ColumnDesc object hold that setting for a given column, just in case we want to allow walking that back? | export interface FilterDesc {
col: string;
action: string;
value: string | number | boolean | Date;
type: string;
matchcase?: boolean;
params?: number[];
}
export const defaultColumns = {} as Record<string, ColumnDesc>;
export const getSortByIndex = (cols: Record<string, ColumnDesc>) => (key1:... | @@ -245,7 +246,13 @@ export const getSortByIndex = (cols: Record<string, ColumnDesc>) => (key1: strin
? 1
: cols[key1].index - cols[key2].index;
-const formatValue = (val: RowValue, col: ColumnDesc, formatConf: FormatConfig, nanValue?: string): string => {
+const formatValue = (
+ val: RowValue,
... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 26 | TypeScript | 0.429 | question | 114 | 51 | 51 | false | line breaks in table cells | 2,525 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
name = element[0]
desc = element[1]
properties_doc = ""
property_list: List[Dict[str, Any]] = []
property_indices: List[int] = []
properties = resolve_inherit(
name,
desc["properties"],
desc.get("inhe... | ```suggestion
# Append properties doc to element doc
``` | name = element[0]
desc = element[1]
properties_doc = ""
property_list: List[Dict[str, Any]] = []
property_indices: List[int] = []
properties = resolve_inherit(
name,
desc["properties"],
desc.get("inhe... | @@ -280,26 +280,27 @@ def generate_elements(elements_by_prefix: Dict[str, List], base_class: str):
)
# Remove hidden properties
properties = [p for p in properties if not p.get("hide", False)]
- # Generate function parameters
+ # Generate function parameters ... | tools/gui/generate_pyi.py | 26 | Python | 0.571 | suggestion | 70 | 51 | 51 | false | order of parameter generation for builder | 2,530 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
if self.is_valid:
from ..scenario.scenario import Scenario
from ..taipy import get_parents
parent_scenarios: Set[Scenario] = get_parents(self)["scenario"] # type: ignore
for parent_scenario in parent_scenarios:
for ancestor_node in nx.ancestors(p... | This is a public api. we should keep it. | if self.is_valid:
from ..scenario.scenario import Scenario
from ..taipy import get_parents
parent_scenarios: Set[Scenario] = get_parents(self)["scenario"] # type: ignore
for parent_scenario in parent_scenarios:
for ancestor_node in nx.ancestors(p... | @@ -395,27 +395,16 @@ def storage_type(cls) -> str:
"""
raise NotImplementedError
- def read_or_raise(self) -> Any: | taipy/core/data/data_node.py | 26 | Python | 0.143 | suggestion | 40 | 51 | 51 | false | Refactor: route DataNode.read() and write() to _DataNodeManager | 2,533 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
[{"job_id": "a_job_id"}],
edit_in_progress=False,
prop="erty",
name="a name",
)
assert dn.config_id == "foo_bar"
assert dn.scope == Scope.SCENARIO
assert dn.id == "an_id"
assert dn.name == "a name"
assert dn.owner_id == "a_s... | We should revert that, as the Api is public. | [{"job_id": "a_job_id"}],
edit_in_progress=False,
prop="erty",
name="a name",
)
assert dn.config_id == "foo_bar"
assert dn.scope == Scope.SCENARIO
assert dn.id == "an_id"
assert dn.name == "a name"
assert dn.owner_id == "a_s... | @@ -150,9 +150,9 @@ def test_create(self):
def test_read_write(self):
dn = FakeDataNode("foo_bar")
_DataManagerFactory._build_manager()._repository._save(dn)
+ assert dn.read() is None
with pytest.raises(NoData):
- assert dn.read() is None
- dn.read_or_raise(... | tests/core/data/test_data_node.py | 26 | Python | 0.143 | suggestion | 44 | 51 | 51 | false | Refactor: route DataNode.read() and write() to _DataNodeManager | 2,533 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
return True
def _add_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
self._tags.add(tag)
def _remove_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
if self.has_tag(tag):
self._tags.... | [nitpick] Consider updating the docstring for _get_existing_data_nodes and the related __get_data_nodes, __get_additional_data_nodes, and __get_tasks methods to document the new raise_not_existing parameter for clarity. | return True
def _add_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
self._tags.add(tag)
def _remove_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
if self.has_tag(tag):
self._tags.... | @@ -638,40 +638,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.5 | suggestion | 219 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
dag = self._build_dag()
if dag.number_of_nodes() == 0:
return True
if not nx.is_directed_acyclic_graph(dag):
return False
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
... | ```suggestion
def _get_existing_data_nodes(self, additional: bool = False) -> Dict[str, DataNode]:
``` | dag = self._build_dag()
if dag.number_of_nodes() == 0:
return True
if not nx.is_directed_acyclic_graph(dag):
return False
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
... | @@ -638,40 +638,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
return True
if not nx.is_directed_acyclic_graph(dag):
return False
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
... | Verbose for more readable code
```suggestion
return self.__get_additional_data_nodes(raise_not_existing=False)
``` | return True
if not nx.is_directed_acyclic_graph(dag):
return False
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
... | @@ -638,40 +638,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.714 | suggestion | 131 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
):
continue
return False
return True
def _add_tag(s... | ```suggestion
def __get_data_nodes(self, raise_not_existing: bool = True) -> Dict[str, DataNode]:
``` | for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
):
continue
return False
return True
def _add_tag(s... | @@ -638,40 +638,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.714 | suggestion | 107 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
data_nodes_dict = self.__get_additional_data_nodes(raise_not_existing)
for _, task in self.__get_tasks(raise_not_existing).items():
data_nodes_dict.update(task.data_nodes)
return data_nodes_dict
def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, Da... | ```suggestion
def __get_tasks(self, raise_not_existing: bool = True) -> Dict[str, Task]:
``` | data_nodes_dict = self.__get_additional_data_nodes(raise_not_existing)
for _, task in self.__get_tasks(raise_not_existing).items():
data_nodes_dict.update(task.data_nodes)
return data_nodes_dict
def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, Da... | @@ -638,40 +638,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.571 | suggestion | 98 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
@property
def input_configs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)... | ```suggestion
The lowest scope of input and output data node configurations or GLOBAL if there is
``` |
@property
def input_configs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)... | @@ -99,6 +85,16 @@ def outputs(self) -> List[DataNodeConfig]:
"""The list of the output data node configurations."""
return list(self._outputs)
+ @property
+ def scope(self) -> Scope:
+ """The lowest scope of the task's data nodes.
+
+ The lowest scope of input and output data no... | taipy/core/config/task_config.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
):
continue
return False
return True
def _add_tag(s... | Consider adding a brief inline comment documenting the behavior of the 'additional' flag and how non-existing data nodes are handled when raise_not_existing is set to False.
```suggestion
def _get_existing_data_nodes(self, additional: bool = False) -> Dict[str, DataNode]:
# If `additional` is True, only ret... | for left_node, right_node in dag.edges:
if (isinstance(left_node, DataNode) and isinstance(right_node, Task)) or (
isinstance(left_node, Task) and isinstance(right_node, DataNode)
):
continue
return False
return True
def _add_tag(s... | @@ -638,38 +638,54 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 1 | suggestion | 850 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
self._skippable: bool = skippable
self.function: Optional[Callable] = function
super().__init__(id, **properties)
def __copy__(self):
return TaskConfig(
self.id, self.function, copy(self._inputs), copy(self._outputs), self.skippable, **copy(self._properties)
)
... | [nitpick] Consider clarifying, either via a comment or explicit conversion, that the min function is applied on Scope values and that the Scope enum supports this ordering to avoid potential ambiguity.
```suggestion
data_node_cfgs = list(self.inputs) + list(self.outputs)
# The Scope enum supports orderi... | """The list of the input data node configurations."""
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def output_configs(self) -> List[DataNodeConfig]... | @@ -99,6 +85,16 @@ def outputs(self) -> List[DataNodeConfig]:
"""The list of the output data node configurations."""
return list(self._outputs)
+ @property
+ def scope(self) -> Scope:
+ """The lowest scope of the task's data nodes.
+
+ The lowest scope of input and output data no... | taipy/core/config/task_config.py | 26 | Python | 0.857 | suggestion | 444 | 51 | 51 | false | #enterprise-666 prepare migration feature into release/4.1 | 2,604 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
self._tags.add(tag)
def _remove_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
if self.has_tag(tag):
self._tags.remove(tag)
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
def _get_existing_data_n... | [nitpick] Consider specifying the type more explicitly (e.g., 'List[str]') to improve code clarity and maintainability.
```suggestion
non_existing_dns: List[str] = []
``` | self._tags.add(tag)
def _remove_tag(self, tag: str) -> None:
self._tags = _Reloader()._reload("scenario", self)._tags
if self.has_tag(tag):
self._tags.remove(tag)
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
def _get_existing_data_n... | @@ -714,40 +714,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.929 | suggestion | 178 | 51 | 51 | false | Enterprise 666 prepare migration feature | 2,605 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, DataNode]:
from ..data._data_manager_factory import _DataManagerFactory
additional_data_nodes = {}
non_existing_dns: List = []
data_manager = _DataManagerFactory._build_manager()
for dn_or_id ... | [nitpick] Specify a more precise type annotation (e.g., 'List[str]') for non_existing_tasks to enhance code readability.
```suggestion
non_existing_tasks: List[str] = []
``` | def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, DataNode]:
from ..data._data_manager_factory import _DataManagerFactory
additional_data_nodes = {}
non_existing_dns: List = []
data_manager = _DataManagerFactory._build_manager()
for dn_or_id ... | @@ -714,40 +714,57 @@ def _remove_tag(self, tag: str) -> None:
def _get_set_of_tasks(self) -> Set[Task]:
return set(self.tasks.values())
- def __get_data_nodes(self) -> Dict[str, DataNode]:
- data_nodes_dict = self.__get_additional_data_nodes()
- for _, task in self.__get_tasks().items(... | taipy/core/scenario/scenario.py | 26 | Python | 0.857 | suggestion | 181 | 51 | 51 | false | Enterprise 666 prepare migration feature | 2,605 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
@property
def input_configs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
... | Consider clarifying in the docstring how the 'lowest scope' is determined and the expected ordering of Scope values.
```suggestion
The lowest scope is determined by comparing the `scope` values of all input and output
data node configurations using the `min()` function. If there are no input or output
... | @property
def input_configs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
"""The list of the input data node configurations."""
return list(self._inputs)
... | @@ -102,6 +88,16 @@ def outputs(self) -> List[DataNodeConfig]:
"""The list of the output data node configurations."""
return list(self._outputs)
+ @property
+ def scope(self) -> Scope:
+ """The lowest scope of the task's data nodes.
+
+ The lowest scope of input and output data n... | taipy/core/config/task_config.py | 26 | Python | 0.857 | suggestion | 537 | 51 | 51 | false | Enterprise 666 prepare migration feature | 2,605 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
cls._instance._no_reload_context = False # Initialize once
cls._instance._context_depth = 0 # Track nested `with` usage
return cls._instance
def _reload(self, manager: str, obj):
if self._no_reload_context:
return obj
entity = _get_manager(manager)._ge... | Do we need to have a lock when updating the `_context_depth`? | if not isinstance(cls._instance, cls):
cls._instance = super().__new__(cls)
cls._instance._no_reload_context = False # Initialize once
cls._instance._context_depth = 0 # Track nested `with` usage
return cls._instance
def _reload(self, manager: s... | @@ -41,11 +42,14 @@ def _reload(self, manager: str, obj):
return entity
def __enter__(self):
+ self._context_depth += 1
self._no_reload_context = True
return self
def __exit__(self, exc_type, exc_value, exc_traceback):
- self._no_reload_context = False
+ sel... | taipy/core/_entity/_reload.py | 26 | Python | 0.357 | question | 61 | 51 | 51 | false | Re entrant and thread safe reloader (#2589) | 2,612 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... | To ensure true thread safety during instantiation, consider wrapping the object creation logic in __new__ with _lock. | # the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... | @@ -19,12 +20,13 @@ class _Reloader:
"""The _Reloader singleton class"""
_instance = None
+ _lock = threading.RLock()
- _no_reload_context = False
-
- def __new__(cls, *args, **kwargs):
+ def __new__(cls):
if not isinstance(cls._instance, cls):
- cls._instance = object.__ne... | taipy/core/_entity/_reload.py | 26 | Python | 0.571 | suggestion | 117 | 51 | 51 | false | Re entrant and thread safe reloader (#2589) | 2,612 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
return cls._instance
def _reload(self, manager: str, obj):
if self._no_reload_context:
return obj
entity = _get_manager(manager)._get(obj, obj)
if obj._is_in_context and hasattr(entity, "_properties"):
if obj._properties._pending_changes:
ent... | [nitpick] Referencing a class-level lock via the class (e.g., `type(self)._lock`) can improve clarity that `_lock` is not an instance attribute.
```suggestion
with type(self)._lock:
self._context_depth += 1
self._no_reload_context = True
return self
def __exit__(self, exc_ty... | cls._instance = super().__new__(cls)
cls._instance._no_reload_context = False # Initialize once
cls._instance._context_depth = 0 # Track nested `with` usage
return cls._instance
def _reload(self, manager: str, obj):
if self._no_reload_context:
... | @@ -41,11 +44,16 @@ def _reload(self, manager: str, obj):
return entity
def __enter__(self):
- self._no_reload_context = True
+ with self._lock:
+ self._context_depth += 1
+ self._no_reload_context = True
return self
def __exit__(self, exc_type, exc_va... | taipy/core/_entity/_reload.py | 26 | Python | 0.929 | suggestion | 385 | 51 | 51 | false | Re entrant and thread safe reloader (#2589) | 2,612 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
data_nodes_dict = self.__get_additional_data_nodes(raise_not_existing)
for _, task in self.__get_tasks(raise_not_existing).items():
data_nodes_dict.update(task.data_nodes)
return data_nodes_dict
def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, Da... | This new helper would benefit from a brief docstring explaining its purpose and how it differs from `__get_tasks`.
```suggestion
def _get_existing_tasks(self) -> Dict[str, Task]:
"""
Retrieve all tasks associated with the scenario that currently exist.
This method differs from `__get_tasks`... | data_nodes_dict = self.__get_additional_data_nodes(raise_not_existing)
for _, task in self.__get_tasks(raise_not_existing).items():
data_nodes_dict.update(task.data_nodes)
return data_nodes_dict
def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str, Da... | @@ -669,6 +669,9 @@ def __get_additional_data_nodes(self, raise_not_existing: bool=True) -> Dict[str
self._additional_data_nodes.discard(dn_id) # type: ignore[arg-type]
return additional_data_nodes
+ def _get_existing_tasks(self) -> Dict[str, Task]: | taipy/core/scenario/scenario.py | 26 | Python | 0.929 | refactor | 581 | 51 | 51 | false | Re entrant and thread safe reloader (#2589) | 2,612 | Avaiga/taipy | 12,680 | Python | Copilot | jrobinAV |
for prop_key in properties_to_check_at_least_one:
if data_node_config.properties and prop_key in data_node_config.properties:
has_at_least_one = True
if not has_at_least_one:
self._error(
", ".join(properties_to_check_at_lea... | [nitpick] This manual loop can be simplified using Python's `any()`, for example:
```python
if not any(prop in (data_node_config.properties or {}) for prop in properties_to_check_at_least_one):
...
```
```suggestion
if not any(
data_node_config.properties and prop_key in data_node_config... | for prop_key in properties_to_check_at_least_one:
if data_node_config.properties and prop_key in data_node_config.properties:
has_at_least_one = True
if not has_at_least_one:
self._error(
", ".join(properties_to_check_at_lea... | @@ -212,6 +209,28 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
+ def _check_sql_read_write_query(self, data_node_config_id: str, data_node_config: Da... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.786 | suggestion | 415 | 51 | 51 | false | Fix/#2616 - Make read_query and write_query_builder optional for SQLDataNode | 2,649 | Avaiga/taipy | 12,680 | Python | Copilot | trgiangdo |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the... | Let me know if I'm wrong. I think we need a space here
```suggestion
"The `CoreEventConsumerBase` class is deprecated since taipy 4.1.0. "
"Please use the `GuiEventConsumer` class instead."
``` | # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the... | @@ -0,0 +1,30 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | taipy/core/notification/core_event_consumer.py | 26 | Python | 0.857 | bug | 223 | 29 | 29 | false | Make CoreEventConsumerBase deprecated | 2,650 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ```suggestion
# Copyright 2021-2025 Avaiga Private Limited
``` | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -0,0 +1,30 @@
+# Copyright 2021-2024 Avaiga Private Limited | taipy/core/notification/core_event_consumer.py | 1 | Python | 0.571 | suggestion | 64 | 26 | 26 | false | Backport compatibility on consumer to develop | 2,651 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the... | ```suggestion
"The `CoreEventConsumerBase` class is deprecated since taipy 4.1.0. "
"Please use the `GuiEventConsumer` class instead."
``` | # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the... | @@ -0,0 +1,30 @@
+# Copyright 2021-2024 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | taipy/core/notification/core_event_consumer.py | 26 | Python | 0.786 | suggestion | 165 | 29 | 29 | false | Backport compatibility on consumer to develop | 2,651 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV |
from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNodeId, Edit
class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
"""Data Node stored as... | ```suggestion
_SEPARATOR_KEY = "separator"
_DEFAULT_SEPARATOR_VALUE = ","
``` | from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNodeId, Edit
class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
"""Data Node stored as... | @@ -36,11 +36,13 @@ class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
- *default_data*: The default data of the data node. It is used at the data node instantiation
to write the data to the CSV file.
- *has_header* (`bool`): If True, indicates that the CSV file has a header.
+ ... | taipy/core/data/csv.py | 26 | Python | 0.571 | suggestion | 88 | 51 | 51 | false | Feature/#2603 - Add separator property to CSVDataNode | 2,652 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
scope: Scope,
id: Optional[DataNodeId] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
edits: Optional[List[Edit]] = None,
version: Optional[str] = None,
validity_period: Optional[ti... | ```suggestion
properties[self._SEPARATOR_KEY] = self._DEFAULT_SEPARATOR_VALUE
``` | self,
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
edits: Optional[List[Edit]] = None,
version: Optional[str] = None... | @@ -65,12 +67,15 @@ def __init__(
if properties is None:
properties = {}
- if self.__ENCODING_KEY not in properties.keys():
- properties[self.__ENCODING_KEY] = "utf-8"
+ if self._ENCODING_KEY not in properties.keys():
+ properties[self._ENCODING_KEY] = "utf-8"... | taipy/core/data/csv.py | 26 | Python | 0.571 | suggestion | 95 | 51 | 51 | false | Feature/#2603 - Add separator property to CSVDataNode | 2,652 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
from .._entity._reload import _Reloader
from .._version._version_manager_factory import _VersionManagerFactory
from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNo... | ```suggestion
_ENCODING_KEY = "encoding"
_DEFAULT_ENCODING_VALUE = "utf-8"
``` | from .._entity._reload import _Reloader
from .._version._version_manager_factory import _VersionManagerFactory
from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNo... | @@ -36,11 +36,13 @@ class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
- *default_data*: The default data of the data node. It is used at the data node instantiation
to write the data to the CSV file.
- *has_header* (`bool`): If True, indicates that the CSV file has a header.
+ ... | taipy/core/data/csv.py | 26 | Python | 0.571 | suggestion | 89 | 51 | 51 | false | Feature/#2603 - Add separator property to CSVDataNode | 2,652 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
_REQUIRED_PROPERTIES: List[str] = []
def __init__(
self,
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
last_edit_date: Optional[datetime] = None,
edits: Optio... | ```suggestion
properties[self._ENCODING_KEY] = self._DEFAULT_ENCODING_VALUE
``` | _SEPARATOR_KEY = "separator"
_DEFAULT_SEPARATOR_VALUE = ","
_REQUIRED_PROPERTIES: List[str] = []
def __init__(
self,
config_id: str,
scope: Scope,
id: Optional[DataNodeId] = None,
owner_id: Optional[str] = None,
parent_ids: Optional[Set[str]] = None,
... | @@ -65,12 +67,15 @@ def __init__(
if properties is None:
properties = {}
- if self.__ENCODING_KEY not in properties.keys():
- properties[self.__ENCODING_KEY] = "utf-8"
+ if self._ENCODING_KEY not in properties.keys():
+ properties[self._ENCODING_KEY] = "utf-8" | taipy/core/data/csv.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | Feature/#2603 - Add separator property to CSVDataNode | 2,652 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo |
from .utils.table_col_builder import _enhance_columns
from .utils.threads import _invoke_async_callback
TIMEZONE_FALLBACKS = {
"Asia/Beijing": "Asia/Shanghai",
}
def _get_valid_timezone():
"""
Determines a valid timezone name for the current system.
Returns:
str: The name of the timezone, o... | Who can throw KeyError ? or AttributeError ? | from .utils.table_col_builder import _enhance_columns
from .utils.threads import _invoke_async_callback
TIMEZONE_FALLBACKS = {
"Asia/Beijing": "Asia/Shanghai",
}
def _get_valid_timezone():
"""
Determines a valid timezone name for the current system.
Returns:
str: The name of the timezone, or... | @@ -109,6 +110,31 @@
from .utils.threads import _invoke_async_callback
+TIMEZONE_FALLBACKS = {
+ "Asia/Beijing": "Asia/Shanghai",
+}
+
+
+def _get_valid_timezone():
+ """
+ Determines a valid timezone name for the current system.
+
+ Returns:
+ str: The name of the timezone, or 'UTC' if an error... | taipy/gui/gui.py | 26 | Python | 0.214 | question | 44 | 51 | 51 | false | ZoneInfoNotFoundError: No time zone found with key Asia/Beijing | 2,697 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | KachanovYev |
_is_unnamed_function,
_LocalsContext,
_MapDict,
_setscopeattr,
_setscopeattr_drill,
_TaipyBase,
_TaipyContent,
_TaipyContentHtml,
_TaipyContentImage,
_TaipyData,
_TaipyLov,
_TaipyLovValue,
_to_camel_case,
_variable_decode,
is_debugging,
)
from .utils._adapter ... | I would add a TODO comment to open an API where developers can extend this rather specific dataset...
This can be done in an issue though. | _is_in_notebook,
_is_unnamed_function,
_LocalsContext,
_MapDict,
_setscopeattr,
_setscopeattr_drill,
_TaipyBase,
_TaipyContent,
_TaipyContentHtml,
_TaipyContentImage,
_TaipyData,
_TaipyLov,
_TaipyLovValue,
_to_camel_case,
_variable_decode,
is_debugging,
)
... | @@ -108,6 +109,38 @@
from .utils.table_col_builder import _enhance_columns
from .utils.threads import _invoke_async_callback
+TIMEZONE_FALLBACKS = { | taipy/gui/gui.py | 26 | Python | 0.357 | suggestion | 139 | 51 | 51 | false | ZoneInfoNotFoundError: No time zone found with key Asia/Beijing | 2,697 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | KachanovYev |
if _is_in_notebook() and notebook_proxy: # pragma: no cover
from ...utils.proxy import NotebookProxy
# Start proxy if not already started
self._proxy = NotebookProxy(gui=self._gui, listening_port=port)
self._proxy.run()
self._port = self._get_random_... | [nitpick] The line break in the middle of the function call parameters reduces readability. Consider keeping the entire condition on one line or breaking it at a more logical point.
```suggestion
if not self.is_running_from_reloader() and self._gui._get_config("run_browser", False) is True: # type: ignore[attr... | if _is_in_notebook() and notebook_proxy: # pragma: no cover
from ...utils.proxy import NotebookProxy
# Start proxy if not already started
self._proxy = NotebookProxy(gui=self._gui, listening_port=port)
self._proxy.run()
self._port = self._get_random_... | @@ -377,7 +377,8 @@ def run(
if client_url is not None:
client_url = client_url.format(port=port)
_TaipyLogger._get_logger().info(f" * Application is accessible at {client_url}")
- if not self.is_running_from_reloader() and self._gui._get_config("run_browser", False... | taipy/gui/servers/flask/server.py | 26 | Python | 1 | suggestion | 333 | 51 | 51 | false | [🐛 BUG] Negating run properties with CLI arguments not working | 2,702 | Avaiga/taipy | 12,680 | Python | Copilot | KachanovYev |
@classmethod
def handle_command(cls):
args, _ = _TaipyParser._parser.parse_known_args()
if getattr(args, "which", None) != "run":
return
# First 2 args are always (1) Python executable, (2) run
# Unknown args are passed when running the application but will be ignor... | The docstring should follow standard Python conventions with triple quotes on separate lines and proper formatting. Consider reformatting as a proper docstring.
```suggestion
Add the '--taipy-' prefix to command-line arguments starting with '--'.
If the argument starts with '--no-', this functi... |
@classmethod
def handle_command(cls):
args, _ = _TaipyParser._parser.parse_known_args()
if getattr(args, "which", None) != "run":
return
# First 2 args are always (1) Python executable, (2) run
# Unknown args are passed when running the application but will be ignor... | @@ -54,7 +54,17 @@ def handle_command(cls):
external_args.extend(all_args[external_args_index + 1 :])
all_args = all_args[:external_args_index]
- taipy_args = [f"--taipy-{arg[2:]}" if arg.startswith("--") else arg for arg in all_args]
+ def add_taipy_prefix(key: str):
+ ... | taipy/common/_cli/_run_cli.py | 26 | Python | 0.857 | suggestion | 616 | 43 | 43 | false | [🐛 BUG] Negating run properties with CLI arguments not working | 2,702 | Avaiga/taipy | 12,680 | Python | Copilot | KachanovYev |
@classmethod
def handle_command(cls):
args, _ = _TaipyParser._parser.parse_known_args()
if getattr(args, "which", None) != "run":
return
# First 2 args are always (1) Python executable, (2) run
# Unknown args are passed when running the application but will be ignor... | Fix the indentation
```suggestion
"""Adds the '--taipy-' prefix to command-line arguments starting with '--'.
If the argument starts with '--no-', inserts 'taipy-' after '--no-'.
Otherwise, inserts 'taipy-' after '--'.
"""
``` |
@classmethod
def handle_command(cls):
args, _ = _TaipyParser._parser.parse_known_args()
if getattr(args, "which", None) != "run":
return
# First 2 args are always (1) Python executable, (2) run
# Unknown args are passed when running the application but will be ignor... | @@ -54,7 +54,17 @@ def handle_command(cls):
external_args.extend(all_args[external_args_index + 1 :])
all_args = all_args[:external_args_index]
- taipy_args = [f"--taipy-{arg[2:]}" if arg.startswith("--") else arg for arg in all_args]
+ def add_taipy_prefix(key: str):
+ ... | taipy/common/_cli/_run_cli.py | 26 | Python | 0.786 | suggestion | 282 | 43 | 43 | false | [🐛 BUG] Negating run properties with CLI arguments not working | 2,702 | Avaiga/taipy | 12,680 | Python | trgiangdo | KachanovYev |
# Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [nitpick] The import statement is getting long and could benefit from being split across multiple lines for better readability.
```suggestion
from . import (
_date_to_string,
_is_plotly_figure,
_MapDict,
_string_to_date,
_variable_decode,
)
``` | # Copyright 2021-2025 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -15,10 +15,8 @@
from abc import ABC, abstractmethod
from datetime import datetime
-from taipy.common import _module_exists
-
from .._warnings import _warn
-from . import _date_to_string, _MapDict, _string_to_date, _variable_decode
+from . import _date_to_string, _is_plotly_figure, _MapDict, _string_to_date, _va... | taipy/gui/utils/types.py | 19 | Python | 0.857 | suggestion | 264 | 44 | 44 | false | do not check the plotly generated json | 2,717 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
_setscopeattr_drill(self, hash_expr, value) # type: ignore[arg-type]
# In case expression == hash (which is when there is only a single variable in expression)
if var_name == hash_expr or hash_expr.startswith("tpec_"):
derived_vars.update(self._re_evaluate_expr(var_n... | [nitpick] Extra blank line added unnecessarily. This appears to be accidental whitespace that should be removed.
```suggestion
``` | # Use custom attrsetter function to allow value binding for _MapDict
if propagate:
_setscopeattr_drill(self, hash_expr, value) # type: ignore[arg-type]
# In case expression == hash (which is when there is only a single variable in expression)
if var_name == hash_expr... | @@ -883,6 +885,7 @@ def _update_var(
if derived_modified is not None:
self.__send_var_list_update(list(derived_modified), var_name)
+ | taipy/gui/gui.py | 26 | Python | 0.786 | suggestion | 131 | 51 | 51 | false | do not check the plotly generated json | 2,717 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
# Try partials
if page is None:
page = self._get_partial(nav_page)
# Make sure that there is a page instance found
if page is None:
return self._server.create_http_response(
self._server.direct_render_json({"error": f"Page '{nav_page}' doesn't exis... | The type ignore comment was removed but the underlying type issue likely still exists. Consider adding proper type annotations instead of removing the type ignore. |
def _render_page(self, page_name: str) -> t.Any:
self.__set_client_id_in_context()
nav_page = self._get_navigated_page(page_name)
if not isinstance(nav_page, str):
return nav_page
page = self._get_page(nav_page)
# Try partials
if page is None:
... | @@ -2612,7 +2619,7 @@ def _render_page(self, page_name: str) -> t.Any:
):
return _Hooks()._handle_custom_page_render(self, page_name, pr)
# Handle page rendering
- context = page.render(self) # type: ignore[arg-type]
+ context = page.render(self) | taipy/gui/gui.py | 26 | Python | 0.571 | suggestion | 163 | 51 | 51 | false | do not check the plotly generated json | 2,717 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
ret_value = self.__get_content_accessor().get_info(
t.cast(str, front_var), newvalue.get(), isinstance(newvalue, _TaipyContentImage)
)
if isinstance(ret_value, tuple):
newvalue = f"/{Gui._CONTENT_ROOT}/{ret_value... | We'll make that generic at one point hu? | newvalue = {"__taipy_refresh": True}
else:
is_json = False
if isinstance(newvalue, (_TaipyContent, _TaipyContentImage)):
ret_value = self.__get_content_accessor().get_info(
t.cast(str, front_var), newvalue.get(), isi... | @@ -1204,14 +1208,17 @@ def __send_var_list_update( # noqa C901
newvalue.get_name(), newvalue.get(), id_only=isinstance(newvalue, _TaipyLovValue)
)
elif isinstance(newvalue, _TaipyBase):
+ is_json = isinstance(newvalue, _TaipyToJson)
... | taipy/gui/gui.py | 26 | Python | 0.071 | question | 40 | 51 | 51 | false | do not check the plotly generated json | 2,717 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
else:
is_json = False
if isinstance(newvalue, (_TaipyContent, _TaipyContentImage)):
ret_value = self.__get_content_accessor().get_info(
t.cast(str, front_var), newvalue.get(), isinstance(newvalue, _TaipyContentImage)
... | Inconsistent indentation: the `continue` statement should be aligned with the `if` statement above it (8 spaces instead of 12).
```suggestion
continue
``` | else:
is_json = False
if isinstance(newvalue, (_TaipyContent, _TaipyContentImage)):
ret_value = self.__get_content_accessor().get_info(
t.cast(str, front_var), newvalue.get(), isinstance(newvalue, _TaipyContentImage)
... | @@ -1095,14 +1099,17 @@ def __send_var_list_update( # noqa C901
newvalue.get_name(), newvalue.get(), id_only=isinstance(newvalue, _TaipyLovValue)
)
elif isinstance(newvalue, _TaipyBase):
+ is_json = isinstance(newvalue, _TaipyToJson)
... | taipy/gui/gui.py | 26 | Python | 0.786 | suggestion | 174 | 51 | 51 | false | do not check the plotly generated json (#2717) | 2,719 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
return self
def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is re... | [nitpick] The parameter names `is_var` and `client_var_name` are ambiguous. Consider renaming to `track_as_frontend_var` and `use_client_var_name` to clearly indicate their purpose. | return self
def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is re... | @@ -456,15 +454,20 @@ def __set_function_attribute(
if value is None:
return self
elif _is_boolean(value) and not _is_true(t.cast(str, value)):
- return self.__set_react_attribute(_to_camel_case(name), False)
+ return self.__set_react_attribute(_to_camel_case... | taipy/gui/_renderers/builder.py | 26 | Python | 0.571 | suggestion | 181 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is required for control {self.__control_type}.")
... | [nitpick] The logic combines variable tracking with value transformation. Consider separating these concerns: track the variable first, then handle the client variable name transformation separately for better readability.
```suggestion
if is_var and isinstance(value, str) and client_var_name:
value... | self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is required for control {self.__control_type}.")
... | @@ -456,15 +454,20 @@ def __set_function_attribute(
if value is None:
return self
elif _is_boolean(value) and not _is_true(t.cast(str, value)):
- return self.__set_react_attribute(_to_camel_case(name), False)
+ return self.__set_react_attribute(_to_camel_case... | taipy/gui/_renderers/builder.py | 26 | Python | 1 | suggestion | 354 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is required for control {... | ```
if is_var and isinstance(value, str):
self.__gui._add_front_end_variable(value)
if client_var_name:
value = _get_client_var_name(value)
``` |
def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is required for control {... | @@ -456,15 +454,21 @@ def __set_function_attribute(
if value is None:
return self
elif _is_boolean(value) and not _is_true(t.cast(str, value)):
- return self.__set_react_attribute(_to_camel_case(name), False)
+ return self.__set_react_attribute(_to_camel_case... | taipy/gui/_renderers/builder.py | 26 | Python | 0.714 | suggestion | 196 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
TODO-undocumented
Returns all properties defined as <property name>[<named index>] as a dict.
Arguments:
name (str): The property name.
"""
return _get_name_indexed_property(self.__prop_values, name)
def __set_json_attribute(self, name, value):
return s... | Missing code after line 227. The method appears to be cut off and should include the return statement and handle the else case. | TODO-undocumented
Returns all properties defined as <property name>[<named index>] as a dict.
Arguments:
name (str): The property name.
"""
return _get_name_indexed_property(self.__prop_values, name)
def __set_json_attribute(self, name, value):
return s... | @@ -222,12 +222,9 @@ def __set_dynamic_any_attribute(self, name: str, default_value: t.Optional[str]
if hash := self.__hashes.get(name):
if isinstance(value, (dict, _MapDict)):
hash = self.__get_typed_hash_name(hash, PropertyType.dynamic_dict)
- react_name = _to_cam... | taipy/gui/_renderers/builder.py | 26 | Python | 0.571 | suggestion | 127 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
return self
def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is re... | The logic for tracking front-end variables is overly broad. Setting `is_var=True` for all string values may register non-variable strings as front-end variables. Consider making the check more specific to actual variable names or hashes. | def __set_function_attribute(
self, name: str, default_value: t.Optional[str] = None, optional: t.Optional[bool] = True
):
value = self.__prop_values.get(name, default_value)
if value is None:
if not optional:
_warn(f"Property {name} is required for control {s... | @@ -456,15 +454,21 @@ def __set_function_attribute(
if value is None:
return self
elif _is_boolean(value) and not _is_true(t.cast(str, value)):
- return self.__set_react_attribute(_to_camel_case(name), False)
+ return self.__set_react_attribute(_to_camel_case... | taipy/gui/_renderers/builder.py | 26 | Python | 0.643 | suggestion | 237 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
return self._server.create_http_response("", 200)
def __send_var_list_update( # noqa C901
self,
modified_vars: t.List[str],
front_var: t.Optional[str] = None,
):
ws_dict = {}
is_custom_page = _Hooks()._is_in_custom_page_context()
values = {v: _getscopeat... | [nitpick] The variable filtering logic with debug logging inside a loop could impact performance. Consider using a single debug log with a list of skipped variables, or make logging conditional on debug level being enabled.
```suggestion
skipped_vars = []
for _var in modified_vars:
if not se... | else:
setattr(self._bindings(), var_name, newvalue)
return self._server.create_http_response("", 200)
def __send_var_list_update( # noqa C901
self,
modified_vars: t.List[str],
front_var: t.Optional[str] = None,
):
ws_dict = {}
... | @@ -1182,9 +1184,13 @@ def __send_var_list_update( # noqa C901
modified_vars.remove(v.get_name())
elif isinstance(v, _DoNotUpdate):
modified_vars.remove(k)
+ custom_page_filtered_types = _Hooks()._get_resource_handler_data_layer_supported_types()
+ in_custom... | taipy/gui/gui.py | 26 | Python | 1 | bug | 681 | 51 | 51 | false | block non front-end variables | 2,724 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9",
}
def _get_non_existent_file_path(dir_path: Path, file_name: str) -> Path:
if not file_name:
file_name = "taipy_file.bin"
file_path = dir_path / file_name
index = 0
file_stem = file_path.stem
file_suffix = file_path.suffix
whi... | The docstring is too brief and doesn't adequately describe the function's purpose, parameters, and return value. Consider adding a more comprehensive docstring that explains:
- What the function does (sanitizes filenames while preserving Unicode characters)
- The parameter (filename: str - the original filename to sani... | "LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9",
}
def _get_non_existent_file_path(dir_path: Path, file_name: str) -> Path:
if not file_name:
file_name = "taipy_file.bin"
file_path = dir_path / file_name
index = 0
file_stem = file_path.stem
file_suffix = file_path.suffix
whi... | @@ -23,3 +51,29 @@ def _get_non_existent_file_path(dir_path: Path, file_name: str) -> Path:
file_path = dir_path / f"{file_stem}.{index}{file_suffix}"
index += 1
return file_path
+
+
+def _secure_filename_unicode(filename: str) -> str:
+ """Modified version that preserves Unicode characters"""... | taipy/gui/utils/filename.py | 26 | Python | 0.857 | security | 1,592 | 46 | 51 | false | fix: preserve unicode characters in uploaded filenames | 2,737 | Avaiga/taipy | 12,680 | Python | Copilot | AitElBadaoui |
assert file_path.exists()
file_path = _get_non_existent_file_path(pathlib.Path(tempfile.gettempdir()), "")
assert file_path.name == f"{file_stem}.{index + 2}{file_suffix}"
@pytest.mark.parametrize(
"input_filename,expected_output",
[
("normal_file.txt", "normal_file.txt"),
("file w... | This test case is platform-dependent and will fail on Windows. On Windows, both `/` and `\` are treated as path separators and replaced with spaces (which become underscores), so `"file/test\\file.txt"` would become `"file_test_file.txt"` (with two underscores), not `"file_testfile.txt"` (with one underscore).
This te... | assert file_path.exists()
file_path = _get_non_existent_file_path(pathlib.Path(tempfile.gettempdir()), "")
assert file_path.name == f"{file_stem}.{index + 2}{file_suffix}"
@pytest.mark.parametrize(
"input_filename,expected_output",
[
("normal_file.txt", "normal_file.txt"),
("file w... | @@ -39,3 +42,120 @@ def test_existent_file(gui: Gui, helpers):
assert file_path.exists()
file_path = _get_non_existent_file_path(pathlib.Path(tempfile.gettempdir()), "")
assert file_path.name == f"{file_stem}.{index + 2}{file_suffix}"
+
+
+@pytest.mark.parametrize(
+ "input_filename,expected_output",
... | tests/gui/utils/test_filename.py | 26 | Python | 0.857 | bug | 719 | 51 | 51 | false | fix: preserve unicode characters in uploaded filenames | 2,737 | Avaiga/taipy | 12,680 | Python | Copilot | AitElBadaoui |
return interpolationNumber;
}
}
return undefined;
}
}
while (interpolations) {
const interpolationName = interpolations[1];
txt = txt.replace(
`{!${interpolationName}}!}`,
state && state[interpolationName... | The TagKeyRecord is a module-level global that persists across multiple parseJSX calls. This means keys will continuously increment rather than resetting for each parse operation, potentially causing React reconciliation issues when the same JSX is re-parsed. Consider resetting TagKeyRecord at the start of parseJSX or ... | return interpolationNumber;
}
}
return undefined;
}
}
while (interpolations) {
const interpolationName = interpolations[1];
txt = txt.replace(
`{!${interpolationName}}!}`,
state && state[interpolationName... | @@ -61,10 +61,20 @@ const replaceInterpolations = (txt: string, state?: Record<string, unknown>) =>
return txt;
};
+const TagKeyRecord: Record<string, number> = {};
+const getTagKey = (tag: string) => {
+ if (!(tag in TagKeyRecord)) {
+ TagKeyRecord[tag] = 0;
+ }
+ TagKeyRecord[tag] += 1;
+ r... | frontend/taipy-gui/src/jsx/parser.ts | 26 | TypeScript | 0.5 | suggestion | 369 | 51 | 51 | false | JSX Parser | 2,758 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
const getTagKey = (tag: string) => {
if (!(tag in TagKeyRecord)) {
TagKeyRecord[tag] = 0;
}
TagKeyRecord[tag] += 1;
return `${tag}-${TagKeyRecord[tag]}`;
};
const translate = (
root: HTMLElement,
state?: Record<string, unknown>,
components?: Record<string, React.ComponentType<object... | The nbChildren calculation occurs once per parent element, but the condition `nbChildren > 1` is evaluated for every child in the map. Consider moving this boolean calculation outside the map to avoid repeated comparisons: `const withKey = nbChildren > 1;` then pass `withKey` to the map callback. | if (!(tag in tagKeys)) {
tagKeys[tag] = 0;
}
tagKeys[tag] += 1;
return `${tag}-${tagKeys[tag]}`;
};
const translate = (
root: HTMLElement,
state?: Record<string, unknown>,
components?: Record<string, React.ComponentType<object>>,
tagKeys: Record<string, number> = {},
withKey... | @@ -73,38 +83,42 @@ const translate = (
if (!root.textContent || root.textContent.trim() === "") return null;
return "" + parseText(root.textContent, state);
}
+ const nbChildren = root.childNodes.length;
const children =
- root.childNodes.length > 0
+ nbChildren > 0
... | frontend/taipy-gui/src/jsx/parser.ts | 26 | TypeScript | 0.643 | suggestion | 297 | 51 | 51 | false | JSX Parser | 2,758 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
txt = txt.replace(
`{!${interpolationName}}!}`,
state && state[interpolationName] !== undefined ? "" + state[interpolationName] : "undefined"
);
JSX_INTERPOLATION.lastIndex = 0; // reset the regex state https://stackoverflow.com/questions/4724701/regexp-exec-returns-null-... | Use strict equality operator `===` instead of loose equality `==` for consistency with the rest of the codebase (line 99 uses `==` as well, but the codebase generally uses `===` as seen in line 89).
```suggestion
if (Array.isArray(root) && root.length === 0) return;
``` | txt = txt.replace(
`{!${interpolationName}}!}`,
state && state[interpolationName] !== undefined ? "" + state[interpolationName] : "undefined"
);
JSX_INTERPOLATION.lastIndex = 0; // reset the regex state https://stackoverflow.com/questions/4724701/regexp-exec-returns-null-... | @@ -61,10 +61,20 @@ const replaceInterpolations = (txt: string, state?: Record<string, unknown>) =>
return txt;
};
+const getTagKey = (tagKeys: Record<string, number>, tag: string) => {
+ if (!(tag in tagKeys)) {
+ tagKeys[tag] = 0;
+ }
+ tagKeys[tag] += 1;
+ return `${tag}-${tagKeys[tag]}`;
... | frontend/taipy-gui/src/jsx/parser.ts | 26 | TypeScript | 0.857 | suggestion | 274 | 51 | 51 | false | JSX Parser | 2,758 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
state?: Record<string, unknown>,
components?: Record<string, React.ComponentType<object>>,
tagKeys: Record<string, number> = {},
withKey = false
): React.ReactNode | null => {
if (Array.isArray(root) && root.length == 0) return;
if (root.nodeType === 3) {
//Textnodes
if (!root.t... | Use strict equality operator `===` instead of loose equality `==` for type-safe string comparison.
```suggestion
acc[attr.name === "class" ? "className" : attr.name] = value;
``` | state?: Record<string, unknown>,
components?: Record<string, React.ComponentType<object>>,
tagKeys: Record<string, number> = {},
withKey = false
): React.ReactNode | null => {
if (Array.isArray(root) && root.length === 0) return;
if (root.nodeType === 3) {
//Textnodes
if (!root.... | @@ -73,38 +83,44 @@ const translate = (
if (!root.textContent || root.textContent.trim() === "") return null;
return "" + parseText(root.textContent, state);
}
+ const nbChildren = root.childNodes.length;
+ const withSubKey = nbChildren > 1;
const children =
- root.childNodes.le... | frontend/taipy-gui/src/jsx/parser.ts | 26 | TypeScript | 0.929 | suggestion | 190 | 51 | 51 | false | JSX Parser | 2,758 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
def test_taipy_bool():
assert _TaipyBool(0, "v").get() is False
assert _TaipyBool(1, "v").get() is True
assert _TaipyBool(False, "v").get() is False
assert _TaipyBool(True, "v").get() is True
assert _TaipyBool("", "v").get() is False
assert _TaipyBool("hey", "v").get() is True
assert _TaipyB... | Missing blank line before function definition. PEP 8 requires two blank lines before top-level function definitions.
```suggestion
``` |
def test_taipy_data():
tb = _TaipyData("value", "hash")
assert tb.get() == "value"
assert tb.get_name() == "hash"
tb.set("a value")
assert tb.get() == "a value"
assert tb.get_hash() == "_TpD"
def test_taipy_bool():
assert _TaipyBool(0, "v").get() is False
assert _TaipyBool(1, "v").get... | @@ -52,3 +52,22 @@ def test_taipy_date():
assert _TaipyDate(None, "x").get() is None
_TaipyDate("", "x").cast_value("2022-03-03 00:00:00 UTC")
_TaipyDate("", "x").cast_value(_string_to_date("2022-03-03 00:00:00 UTC"))
+ | tests/gui/utils/test_types.py | 26 | Python | 0.714 | suggestion | 135 | 45 | 51 | false | plotly to_json | 2,761 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
if (delayCall.current > 0) {
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(
createSendUpdateAction(
updateVarName,
... | The min/max clamping logic is only present in `handleBlur` but not in `updateValueWithDelay` or other places where values are converted. This inconsistency could lead to values outside the min/max range being submitted if the blur event doesn't fire. Consider extracting this logic into a helper function and applying it... | }
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(
createSendUpdateAction(updateVarName, valToNumber(val, numberType), module, onChange, propagate)
);
}, changeDelay);
},
... | @@ -115,40 +124,66 @@ const Input = (props: TaipyInputProps) => {
dispatch(createSendUpdateAction(updateVarName, value, module, onChange, propagate));
}, changeDelay);
},
- [changeDelay, dispatch, updateVarName, module, onChange, propagate]
+ [changeDelay, numberType... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.786 | refactor | 364 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(createSendUpdateAction(updateVarName, value, module, onChange, propagate));
}, changeDelay);
},
[changeDel... | Should this be factorized in an outside the comp function ? | });
return;
}
if (delayCall.current > 0) {
clearTimeout(delayCall.current);
}
delayCall.current = window.setTimeout(() => {
delayCall.current = -1;
dispatch(createSendUpdateAction(updateVarNam... | @@ -115,40 +124,66 @@ const Input = (props: TaipyInputProps) => {
dispatch(createSendUpdateAction(updateVarName, value, module, onChange, propagate));
}, changeDelay);
},
- [changeDelay, dispatch, updateVarName, module, onChange, propagate]
+ [changeDelay, numberType... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.286 | question | 59 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | FabienLelaquais |
.map((v) => v.trim().toLowerCase())
.filter((v) => AUTHORIZED_KEYS.some((k) => k.toLowerCase() === v))
: []
).map((v) => AUTHORIZED_KEYS.find((k) => k.toLowerCase() == v) as string);
return ak.length > 0 ? ak : [AUTHORIZED_KEYS[0]];
};
const numberSx = {
"& i... | The function `valToNumber` does not return a value. Add a `return` statement before the ternary expression.
```suggestion
return numberType ? (numberType === IsInteger ? Math.round(Number(val)) : Number(val)) : val;
``` | .map((v) => v.trim().toLowerCase())
.filter((v) => AUTHORIZED_KEYS.some((k) => k.toLowerCase() === v))
: []
).map((v) => AUTHORIZED_KEYS.find((k) => k.toLowerCase() == v) as string);
return ak.length > 0 ? ak : [AUTHORIZED_KEYS[0]];
};
const numberSx = {
"& i... | @@ -53,6 +53,12 @@ const verticalDivStyle: CSSProperties = {
gap: 0,
};
const noPaddingYSx = { py: 0 };
+const IsInteger = 2;
+
+// numberType: 0 -> not a number, 1 -> number, 2 -> integer
+const valToNumber = (val: string, numberType: number) => {
+ numberType ? (numberType === IsInteger ? Math.round(Number(... | frontend/taipy-gui/src/components/Taipy/Input.tsx | 26 | TypeScript | 0.929 | suggestion | 223 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
const state: TaipyState = INITIAL_STATE;
const { getByDisplayValue } = render(
<TaipyContext.Provider value={{ state, dispatch }}>
<Input value={"33"} type="number" updateVarName="varname" />
</TaipyContext.Provider>,
);
const elt = getByDisplayVal... | The value of the id attribute must not contain any space characters. | </TaipyContext.Provider>
);
const elt = getByDisplayValue("33");
await userEvent.clear(elt);
await userEvent.type(elt, "666");
await waitFor(() => expect(dispatch).toHaveBeenCalled());
expect(dispatch).toHaveBeenLastCalledWith({
name: "varname",
... | @@ -261,7 +257,7 @@ describe("Number Component", () => {
});
it("Validates increment by step value on up click", async () => {
const { getByDisplayValue, getByLabelText } = render(
- <Input id={"Test Input"} value={"0"} type="number" step={2} />,
+ <Input id={"Test Input"} value... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.214 | suggestion | 68 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
await waitFor(() => expect(dispatch).toHaveBeenCalled());
expect(dispatch).toHaveBeenLastCalledWith({
name: "varname",
payload: { value: "666" },
propagate: true,
type: "SEND_UPDATE_ACTION",
});
});
xit("shows 0", async () => {
//no... | The value of the id attribute must not contain any space characters. | propagate: true,
type: "SEND_UPDATE_ACTION",
});
});
xit("shows 0", async () => {
//not working cf. https://github.com/testing-library/user-event/issues/1066
const { getByDisplayValue } = render(<Input value={"0"} type="number" />);
const elt = getByDispla... | @@ -270,7 +266,7 @@ describe("Number Component", () => {
});
it("Validates decrement by step value on down click", async () => {
const { getByDisplayValue, getByLabelText } = render(
- <Input id={"Test Input"} value={"0"} type="number" step={2} />,
+ <Input id={"Test Input"} val... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.214 | suggestion | 68 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
const { getByDisplayValue } = render(<Input value={"0"} type="number" />);
const elt = getByDisplayValue("0") as HTMLInputElement;
expect(elt).toBeInTheDocument();
await userEvent.type(elt, "{ArrowUp}");
expect(elt.value).toBe("1");
await userEvent.type(elt, "{ArrowDown}"... | The value of the id attribute must not contain any space characters. | expect(elt.value).toBe("1");
await userEvent.type(elt, "{ArrowDown}");
expect(elt.value).toBe("0");
});
it("Validates increment by step value on up click", async () => {
const { getByDisplayValue, getByLabelText } = render(
<Input id={"Test Input"} value={"0"} type="n... | @@ -280,7 +276,7 @@ describe("Number Component", () => {
it("Validates increment when holding shift key and clicking up", async () => {
const user = userEvent.setup();
const { getByDisplayValue, getByLabelText } = render(
- <Input id={"Test Input"} value={"0"} type="number" step={2} />... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.214 | suggestion | 68 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
);
const upSpinner = getByLabelText("Increment value");
const elt = getByDisplayValue("0") as HTMLInputElement;
await userEvent.click(upSpinner);
expect(elt.value).toBe("2");
});
it("Validates decrement by step value on down click", async () => {
const { getByDisp... | The value of the id attribute must not contain any space characters. | expect(elt.value).toBe("2");
});
it("Validates decrement by step value on down click", async () => {
const { getByDisplayValue, getByLabelText } = render(
<Input id={"Test Input"} value={"0"} type="number" step={2} />
);
const downSpinner = getByLabelText("Decrement v... | @@ -291,7 +287,7 @@ describe("Number Component", () => {
it("Validates decrement when holding shift key and clicking down", async () => {
const user = userEvent.setup();
const { getByDisplayValue, getByLabelText } = render(
- <Input id={"Test Input"} value={"0"} type="number" step={2} ... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.214 | suggestion | 68 | 51 | 51 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
const { getByDisplayValue } = render(<Input value={"0"} type="number" step={2} max={20} />);
const elt = getByDisplayValue("0") as HTMLInputElement;
await user.click(elt);
await user.keyboard("[ShiftLeft>]");
// Press the arrow up twice to validate that the value will not exceed ... | The value of the id attribute must not contain any space characters. | // Press the arrow up twice to validate that the value will not exceed the maximum value when reached
await user.keyboard("[ArrowUp]");
await user.keyboard("[ArrowUp]");
expect(elt.value).toBe("20");
});
it("Validate value when reaching min value", async () => {
const use... | @@ -339,7 +335,7 @@ describe("Number Component", () => {
});
it("should not exceed max value when incrementing", async () => {
const { getByLabelText } = render(
- <Input id={"Test Input"} type="number" value="0" max={20} step={2} stepMultiplier={15} />,
+ <Input id={"Test Input... | frontend/taipy-gui/src/components/Taipy/Input.spec.tsx | 26 | TypeScript | 0.214 | suggestion | 68 | 40 | 36 | false | 'number' control can force integer values | 2,762 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
/*
* Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | The `headerIcon` is being used for both the close button (line 179) and the open button (line 201), but these should display opposite icons. For example, when anchor is "left", the close button should show `ChevronLeftIcon` but the open button should show `ChevronRightIcon`. Consider creating a separate function like `... | <Box sx={headerSx} className={getSuffixedClassNames(className, "-header")}>
{title ? <Box sx={titleSx}>{title}</Box> : null}
<IconButton onClick={handleClose} disabled={!active}>
{headerIcon}
</IconBu... | @@ -162,9 +190,15 @@ const Pane = (props: PaneProps) => {
</Tooltip>
</Drawer>
) : showButton ? (
- <Drawer variant="permanent" sx={buttonDrawerSx} anchor={anchor} open={true} className={getSuffixedClassNames(className, "-button")}>
+ <Drawer
+ variant="permanent"
+ ... | frontend/taipy-gui/src/components/Taipy/Pane.tsx | 26 | TypeScript | 0.643 | suggestion | 381 | 208 | 33 | false | Added the title property to the pane block. | 2,772 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
case "bottom":
return baseStyle;
case "right":
return { ...baseStyle, flexDirection: "row-reverse" };
default:
return { ...baseStyle, justifyContent: "flex-end" };
}
};
const getHeaderIcon = (anchor: AnchorType): JSX.Element => {
switch (anchor) {
... | The `default` case label should be placed after all specific cases rather than before `case "top":` and `case "bottom":`. While this works correctly, having the default case at the end is a widely followed convention that improves code readability. | case "bottom":
return baseStyle;
case "right":
return { ...baseStyle, flexDirection: "row-reverse" };
default:
return { ...baseStyle, justifyContent: "flex-end" };
}
};
const getHeaderIcon = (anchor: AnchorType): JSX.Element => {
switch (anchor) {
... | @@ -45,14 +46,38 @@ interface PaneProps extends TaipyActiveProps, TaipyChangeProps {
showButton?: boolean;
}
-const getHeaderSx = (anchor: AnchorType) => {
+const getHeaderSx = (anchor: AnchorType): CSSProperties => {
+ const baseStyle = { display: "flex", alignItems: "center" };
switch (anchor) {
+ ... | frontend/taipy-gui/src/components/Taipy/Pane.tsx | 26 | TypeScript | 0.643 | suggestion | 248 | 51 | 51 | false | Added the title property to the pane block. | 2,772 | Avaiga/taipy | 12,680 | Python | Copilot | FabienLelaquais |
* The type of this variable is `React.Context<Store>`.
*/
export declare const TaipyContext: React.Context<TaipyStore>;
export interface PageStore {
module?: string;
}
export declare const PageContext: React.Context<PageStore>;
/**
* A React hook to manage a dynamic scalar property.
*
* A dynamic scalar proper... | Can you please add some doc for the backend side of things? | * The type of this variable is `React.Context<Store>`.
*/
export declare const TaipyContext: React.Context<TaipyStore>;
export interface PageStore {
module?: string;
}
export declare const PageContext: React.Context<PageStore>;
/**
* A React hook to manage a dynamic scalar property.
*
* A dynamic scalar proper... | @@ -607,16 +607,16 @@ export declare const useDynamicProperty: <T>(
nullToDefault?: boolean
) => T;
/**
- * A React hook to manage a dynamic json property.
+ * A React hook to manage a dynamic dict property (prev. useDynamicJsonProperty). | frontend/taipy-gui/packaging/taipy-gui.d.ts | 26 | TypeScript | 0.214 | question | 59 | 51 | 51 | false | rename useDynamicJsonProperty to useDynamicDictProperty | 2,777 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
):
# the event manager will take care of starting the thread
# once the current callback (or the next one) is finished
self.__event_manager._add_thread(
Thread(
target=self.__do_fire_event,
args=(event_name, client_id, payload),
)
... | `_fire_event()` now runs hook listeners inside `_get_authorization()`, which changes the execution context of all events (including custom ones) and is central to this PR’s goal. Please add/extend a unit test that registers a hook implementing both `_get_authorization` (e.g., sets a marker/context var) and `_fire_event... | def _fire_event(
self, event_name: str, client_id: t.Optional[str] = None, payload: t.Optional[t.Dict[str, t.Any]] = None
):
# the event manager will take care of starting the thread
# once the current callback (or the next one) is finished
self.__event_manager._add_thread(
... | @@ -3122,7 +3129,8 @@ def __do_fire_event(
with self.get_app_context(), self.__event_manager:
if client_id:
setattr(get_server_request_accessor(self).get_request_meta(), Gui.__ARG_CLIENT_ID, client_id)
- _Hooks()._fire_event(event_name, client_id, payloa... | taipy/gui/gui.py | 26 | Python | 0.643 | security | 444 | 50 | 51 | false | Manage authorization in events | 2,805 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
it was run in a separated thread: the *run_in_thread* parameter to the
`(Gui.)run^` method was set to True, or you are running in an IPython notebook
context.
"""
if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
self._ser... | ```suggestion
_warn("Hooks._get_authorization()", e)
``` | it was run in a separated thread: the *run_in_thread* parameter to the
`(Gui.)run^` method was set to True, or you are running in an IPython notebook
context.
"""
if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
self._ser... | @@ -3063,9 +3063,16 @@ def _get_authorization(self, client_id: t.Optional[str] = None, system: t.Option
try:
return _Hooks()._get_authorization(self, client_id, system) or contextlib.nullcontext()
except Exception as e:
- _warn("Hooks:", e)
+ _warn("Hooks: _get_autho... | taipy/gui/gui.py | 26 | Python | 0.571 | security | 68 | 51 | 51 | false | Manage authorization in events | 2,805 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
_TaipyLogger._get_logger().info("Gui server has been reloaded.")
def stop(self):
"""Stop the web server.
This function stops the underlying web server only in the situation where
it was run in a separated thread: the *run_in_thread* parameter to the
`(Gui.)run()^` metho... | ```suggestion
_warn("Hooks._is_exception_ignored()", e)
``` | _TaipyLogger._get_logger().info("Gui server has been reloaded.")
def stop(self):
"""Stop the web server.
This function stops the underlying web server only in the situation where
it was run in a separated thread: the *run_in_thread* parameter to the
`(Gui.)run()^` metho... | @@ -3063,9 +3063,16 @@ def _get_authorization(self, client_id: t.Optional[str] = None, system: t.Option
try:
return _Hooks()._get_authorization(self, client_id, system) or contextlib.nullcontext()
except Exception as e:
- _warn("Hooks:", e)
+ _warn("Hooks: _get_autho... | taipy/gui/gui.py | 26 | Python | 0.714 | suggestion | 71 | 51 | 51 | false | Manage authorization in events | 2,805 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
datanode._edit_in_progress,
datanode._editor_id,
_get_reason(is_readable(datanode), "Data node not readable"),
_get_reason(is_editable(datanode), "Data node not editable"),
isinstance(datanode, _FileD... | The new invalid-credentials suppression relies on comparing the exception type name to the string "InvalidCredentials". This is fragile (renames/subclasses won’t match; unrelated exceptions with the same name will match) and there’s no local definition/import of this exception in the repo. Prefer an `isinstance` check ... | _get_reason(is_readable(datanode), "Data node not readable"),
_get_reason(is_editable(datanode), "Data node not editable"),
isinstance(datanode, _FileDataNodeMixin),
f"Data unavailable: {reason.reasons}"
... | @@ -260,14 +262,18 @@ def get(self):
else "",
]
except Exception as e:
- _warn(f"Access to data node ({data.id if hasattr(data, 'id') else 'No_id'}) failed", e)
+ if not _is_invalidCredentials_exception(e):
+ _wa... | taipy/gui_core/_adapters.py | 26 | Python | 1 | security | 776 | 51 | 51 | false | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
(
s.get_simple_label(),
[t.id for t in s.tasks.values()] if hasattr(s, "tasks") else [],
_get_reason(is_submittable(s), "Sequence not submittable"),
_get_reason(is_... | This change introduces a new branch where warnings are suppressed for invalid credentials, but the existing adapter unit tests only cover the generic exception path (where `_warn` is expected to be called). Add a test case that raises an `InvalidCredentials` exception (or a stub with that name) to assert that `_warn` i... | (
s.get_simple_label(),
[t.id for t in s.tasks.values()] if hasattr(s, "tasks") else [],
_get_reason(is_submittable(s), "Sequence not submittable"),
_get_reason(is_... | @@ -111,7 +111,8 @@ def get(self):
_get_reason(is_editable(scenario), "Scenario not editable"),
]
except Exception as e:
- _warn(f"Access to scenario ({data.id if hasattr(data, 'id') else 'No_id'}) failed", e)
+ if not _is_invalidC... | taipy/gui_core/_adapters.py | 26 | Python | 0.786 | security | 335 | 51 | 51 | false | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
data-id={property.id}
onChange={updatePropertyField}
slotProps={{ htmlInput: { onKeyDown, "data-enter": true } }}
/>
... | The Apply button is now disabled when the key is empty, but pressing Enter in the Value field still triggers `editProperty()` via `onKeyDown` and can dispatch an update with an empty key. Add a validation guard in `editProperty` (or in `onKeyDown`) to prevent submitting when `property.key`/`newProp.key` is empty. | variant="outlined"
value={property.value}
sx={FieldNoMaxWidth}
disabled={!isDefined}
... | @@ -232,8 +232,9 @@ const PropertiesEditor = (props: PropertiesEditorProps) => {
data-id={property.id}
onClick={editProperty}
size="small"
+ ... | frontend/taipy/src/PropertiesEditor.tsx | 26 | TypeScript | 0.571 | suggestion | 314 | 51 | 51 | false | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
// Properties
const updatePropertyField = useCallback((e: ChangeEvent<HTMLInputElement>) => {
const { id = "", name = "" } = e.currentTarget.parentElement?.parentElement?.dataset || {};
if (name) {
if (id) {
setProperties((ps) => ps.map((p) => (id === p.id ? { ...p, [... | I don't think we need this test... | // Properties
const updatePropertyField = useCallback((e: ChangeEvent<HTMLInputElement>) => {
const { id = "", name = "" } = e.currentTarget.parentElement?.parentElement?.dataset || {};
if (name) {
if (id) {
setProperties((ps) => ps.map((p) => (id === p.id ? { ...p, [... | @@ -95,22 +95,27 @@ const PropertiesEditor = (props: PropertiesEditorProps) => {
const { id: propId = "" } = dataset || e?.currentTarget.dataset || {};
const property = propId ? properties.find((p) => p.id === propId) : newProp;
if (property) {
+ if ... | frontend/taipy/src/PropertiesEditor.tsx | 26 | TypeScript | 0.071 | suggestion | 34 | 51 | 51 | false | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
if scenario.properties
else [],
[
(
s.get_simple_label(),
[t.id for t in s.tasks.values()] if hasattr(s, "tasks") else [],
_... | I would really prefer something clearer:
`_warn(f"Access to scenario '{data.id}'" if hasattr(data, 'id') else "Access to anonymous scenario"})`
... and everywhere this occurs | if scenario.properties
else [],
[
(
s.get_simple_label(),
[t.id for t in s.tasks.values()] if hasattr(s, "tasks") else [],
_... | @@ -111,7 +111,8 @@ def get(self):
_get_reason(is_editable(scenario), "Scenario not editable"),
]
except Exception as e:
- _warn(f"Access to scenario ({data.id if hasattr(data, 'id') else 'No_id'}) failed", e)
+ if not _is_invalidC... | taipy/gui_core/_adapters.py | 26 | Python | 0.571 | suggestion | 174 | 51 | 51 | false | auth and not auth related or otherwise | 2,815 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga |
if isinstance(val, datetime):
val = _date_to_string(val)
elif val is not None:
val = str(val)
return val
def cast_value(self, value: t.Any):
if isinstance(value, str):
return datetime.strptime(value, "%Y-%m-%dT%H:%M:%S")
return super().cas... | Using `isinstance(val, (Mapping, Iterable))` is too broad and creates multiple issues:
1. It catches many unintended types like bytes, generators, file objects, sets, frozensets, and any custom iterables that should use to_json methods
2. Custom classes implementing Mapping/Iterable with to_json methods will have thei... | if isinstance(val, datetime):
val = _date_to_string(val)
elif val is not None:
val = str(val)
return val
def cast_value(self, value: t.Any):
if isinstance(value, str):
return datetime.strptime(value, "%Y-%m-%dT%H:%M:%S")
return super().cas... | @@ -221,14 +222,12 @@ def get_hash():
class _TaipyToJson(_TaipyBase):
def get(self):
val = super().get()
- if not val:
- return val
if isinstance(val, JsonProperty):
try:
return val.to_json()
except Exception as e:
_wa... | taipy/gui/utils/types.py | 26 | Python | 0.786 | suggestion | 800 | 46 | 46 | false | use lower level class to test instances in json type | 2,817 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
tb = _TaipyToJson("a string", "hash")
assert tb.get() == "a string"
def test_taipy_to_json_with_non_serializable():
class NonSerializable:
pass
with warnings.catch_warnings(record=True) as w:
tb = _TaipyToJson(NonSerializable(), "hash")
assert tb.get() is None
assert l... | Consider adding test cases for set and frozenset types to verify the behavior when these Iterable types are passed to _TaipyToJson. Sets and frozensets are JSON-serializable (can be converted to lists) but the current implementation with isinstance(val, Iterable) will return them directly, which may cause serialization... | assert tb.get() == []
tb = _TaipyToJson(["key", "value"], "hash")
assert tb.get() == ["key", "value"]
def test_taipy_to_json_with_tuple():
tb = _TaipyToJson((), "hash")
assert tb.get() == ()
tb = _TaipyToJson(("key", "value"), "hash")
assert tb.get() == ("key", "value")
def test_taipy_... | @@ -103,3 +105,69 @@ def to_json(self):
assert tb.get() == {"data": [], "layout": {}}
assert _TaipyToJson(None, "hash").get() is None
+
+def test_taipy_to_json_with_dict():
+ tb = _TaipyToJson({}, "hash")
+ assert tb.get() == {}
+
+ tb = _TaipyToJson({"key": "value"}, "hash")
+ assert tb.get() =... | tests/gui/utils/test_types.py | 26 | Python | 0.643 | suggestion | 385 | 27 | 51 | false | use lower level class to test instances in json type | 2,817 | Avaiga/taipy | 12,680 | Python | Copilot | FredLL-Avaiga |
[
("id",),
("columns[mobile]",),
("gap",),
]
),
"login": lambda gui, control_type, attrs: _Builder(
gui=gui, control_type=control_type, element_name="Login", attributes=attrs, default_value=None
)
.set_va... | No issues found. | [
("id",),
("columns[mobile]",),
("gap",),
]
),
"login": lambda gui, control_type, attrs: _Builder(
gui=gui, control_type=control_type, element_name="Login", attributes=attrs, default_value=None
)
.set_va... | @@ -437,6 +437,7 @@ class _Factory:
("value_by_id", PropertyType.boolean),
("max", PropertyType.number, 100),
("min", PropertyType.number, 0),
+ ("step", PropertyType.number, 1),
("orientation"),
("width", PropertyType.s... | taipy/gui/_renderers/factory.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Added Step Property to the Slider component | 800 | Avaiga/taipy | 12,680 | Python | Satoshi-Sh | |
def input_configs(self) -> List[DataNodeConfig]:
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
return list(self._inputs)
@property
def output_configs(self) -> List[DataNodeConfig]:
return list(self._outputs)
@property
def outputs(sel... | No issues found. | def input_configs(self) -> List[DataNodeConfig]:
return list(self._inputs)
@property
def inputs(self) -> List[DataNodeConfig]:
return list(self._inputs)
@property
def output_configs(self) -> List[DataNodeConfig]:
return list(self._outputs)
@property
def outputs(sel... | @@ -10,7 +10,7 @@
# specific language governing permissions and limitations under the License.
from copy import copy
-from typing import Any, Dict, List, Optional, Union, cast
+from typing import Any, Callable, Dict, List, Optional, Union, cast
from taipy.config._config import _Config
from taipy.config.common._... | taipy/core/config/task_config.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Removing useless type annotation | 1,193 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
dn_2_1.last_edit_date = current_datetime + timedelta(6)
assert dn_1_1.is_up_to_date
assert dn_2_1.is_up_to_date
assert dn_1_2.is_up_to_date
assert dn_2_2.is_up_to_date
assert not dn_3.is_up_to_date
dn_2_1.last_edit_date = current_datetime + timedelta(2)
... | No issues found. |
dn_2_1.last_edit_date = current_datetime + timedelta(6)
assert dn_1_1.is_up_to_date
assert dn_2_1.is_up_to_date
assert dn_1_2.is_up_to_date
assert dn_2_2.is_up_to_date
assert not dn_3.is_up_to_date
dn_2_1.last_edit_date = current_datetime + timedelta(2)
... | @@ -75,6 +75,21 @@ def test_create_with_default_values(self):
assert not dn.is_ready_for_reading
assert len(dn.properties) == 0
+ def test_is_up_to_date_when_not_written(self):
+ dn_confg_1 = Config.configure_in_memory_data_node("dn_1", default_data="a")
+ dn_confg_2 = Config.config... | tests/core/data/test_data_node.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | <DataNode>.is_up_to_date raises error when never written before | 1,224 | Avaiga/taipy | 12,680 | Python | yaten2302 | |
def test_get_inputs():
data_node_1 = DataNode("foo", Scope.SCENARIO, "s1")
data_node_2 = DataNode("bar", Scope.SCENARIO, "s2")
data_node_3 = DataNode("baz", Scope.SCENARIO, "s3")
data_node_4 = DataNode("qux", Scope.SCENARIO, "s4")
data_node_5 = DataNode("quux", Scope.SCENARIO, "s5")
data_node_... | No issues found. |
def test_get_inputs():
data_node_1 = DataNode("foo", Scope.SCENARIO, "s1")
data_node_2 = DataNode("bar", Scope.SCENARIO, "s2")
data_node_3 = DataNode("baz", Scope.SCENARIO, "s3")
data_node_4 = DataNode("qux", Scope.SCENARIO, "s4")
data_node_5 = DataNode("quux", Scope.SCENARIO, "s5")
data_node_... | @@ -13,6 +13,7 @@
import pytest
+from taipy.config import Config
from taipy.config.common.scope import Scope
from taipy.core.common._utils import _Subscriber
from taipy.core.data._data_manager_factory import _DataManagerFactory
@@ -28,6 +29,25 @@
from taipy.core.task.task import Task, TaskId
+def test_sequ... | tests/core/sequence/test_sequence.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feature/#1099 added check instance types in equal functions | 1,227 | Avaiga/taipy | 12,680 | Python | toan-quach | |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -9,6 +9,7 @@
# 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.
+import os
from unittest.mock import patch
import pytest
@@ -29,3 +30,19 @@ def test_create_cli_with_u... | tests/templates/test_template_cli.py | 0 | Python | 1 | none | 16 | 49 | 49 | true | Fix/#1202 - Catch cookiecutter.OutputDirExistsException and exit | 1,228 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
def get_primary_scenarios(
is_sorted: bool = False,
descending: bool = False,
sort_key: Literal["name", "id", "config_id", "creation_date", "tags"] = "name",
) -> List[Scenario]:
"""Retrieve a list of all primary scenarios.
Parameters:
is_sorted (bool): If True, sort the output list of scen... | No issues found. | def get_primary_scenarios(
is_sorted: bool = False,
descending: bool = False,
sort_key: Literal["name", "id", "config_id", "creation_date", "tags"] = "name",
) -> List[Scenario]:
"""Retrieve a list of all primary scenarios.
Parameters:
is_sorted (bool): If True, sort the output list of scen... | @@ -519,24 +519,25 @@ def get_scenarios(
"""Retrieve a list of existing scenarios filtered by cycle or tag.
This function allows you to retrieve a list of scenarios based on optional
- filtering criteria. If both a _cycle_ and a _tag_ are provided, the returned
- list contains scenarios that belong to... | taipy/core/taipy.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix/doc#913 - Update refman on get_scenarios methods | 1,259 | Avaiga/taipy | 12,680 | Python | trgiangdo | |
from taipy.core.common.reason import Reason
def test_create_reason():
reason = Reason("entity_id")
assert reason.entity_id == "entity_id"
assert reason._reasons == {}
assert reason
assert not reason._entity_id_exists_in_reason("entity_id")
assert reason.reasons == ""
def test_add_and_remove... | No issues found. |
from taipy.core.common.reason import Reason
def test_create_reason():
reason = Reason("entity_id")
assert reason.entity_id == "entity_id"
assert reason._reasons == {}
assert reason
assert not reason._entity_id_exists_in_reason("entity_id")
assert reason.reasons == ""
def test_add_and_remove... | @@ -0,0 +1,69 @@
+# Copyright 2021-2024 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | tests/core/common/test_reason.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feature/#746 added reason class | 1,276 | Avaiga/taipy | 12,680 | Python | toan-quach | |
@property
def properties(self):
self._properties = _Reloader()._reload(self._MANAGER_NAME, self)._properties
return self._properties
@property
def creation_date(self):
return self._creation_date
def get_label(self) -> str:
"""Returns the submission simple label pref... | No issues found. | @property
def properties(self):
self._properties = _Reloader()._reload(self._MANAGER_NAME, self)._properties
return self._properties
@property
def creation_date(self):
return self._creation_date
def get_label(self) -> str:
"""Returns the submission simple label pref... | @@ -14,15 +14,13 @@
from datetime import datetime
from typing import Any, Dict, List, Optional, Set, Union
-from taipy.logger._taipy_logger import _TaipyLogger
-
from .._entity._entity import _Entity
from .._entity._labeled import _Labeled
from .._entity._properties import _Properties
from .._entity._reload imp... | taipy/core/submission/submission.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | feature/#1197 pass job as metadata for event | 1,277 | Avaiga/taipy | 12,680 | Python | toan-quach | |
("id",),
("columns[mobile]",),
("gap",),
]
),
"login": lambda gui, control_type, attrs: _Builder(
gui=gui, control_type=control_type, element_name="Login", attributes=attrs, default_value=None
)
.set_value_and_defaul... | No issues found. | ("id",),
("columns[mobile]",),
("gap",),
]
),
"login": lambda gui, control_type, attrs: _Builder(
gui=gui, control_type=control_type, element_name="Login", attributes=attrs, default_value=None
)
.set_value_and_defaul... | @@ -57,7 +57,7 @@ class _Factory:
"text": "value",
"toggle": "value",
"tree": "value",
- "metric": "value"
+ "metric": "value",
}
_TEXT_ATTRIBUTES = ["format", "id", "hover_text", "raw"]
@@ -280,7 +280,6 @@ class _Factory:
("value", PropertyType.dyna... | taipy/gui/_renderers/factory.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Remove hover_text from Indicator | 1,282 | Avaiga/taipy | 12,680 | Python | Satoshi-Sh | |
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import LinearProgress from "@mui/material/LinearProgress";
import Typography from "@mui/material/Typography";
import { useDynamicProperty } from "../../utils/hooks";
interface ProgressBarProps {
linear?: boolean; /... | No issues found. | import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import LinearProgress from "@mui/material/LinearProgress";
import Typography from "@mui/material/Typography";
import { useDynamicProperty } from "../../utils/hooks";
interface ProgressBarProps {
linear?: boolean; /... | @@ -0,0 +1,80 @@
+/*
+ * Copyright 2021-2024 Avaiga Private Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unles... | frontend/taipy-gui/src/components/Taipy/Progress.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Created a new visual element - progress bar | 1,303 | Avaiga/taipy | 12,680 | Python | yaten2302 | |
/**
* A series of LoV elements.
*/
export declare type LoV = LoVElt[];
/**
* A React hook that returns a LoV list from the LoV default value and the LoV bound value.
* @param lov - The bound lov value.
* @param defaultLov - The JSON-stringified default LoV value.
* @param tree - This flag indicates if the LoV lis... | No issues found. | /**
* A series of LoV elements.
*/
export declare type LoV = LoVElt[];
/**
* A React hook that returns a LoV list from the LoV default value and the LoV bound value.
* @param lov - The bound lov value.
* @param defaultLov - The JSON-stringified default LoV value.
* @param tree - This flag indicates if the LoV lis... | @@ -304,23 +304,31 @@ export interface ColumnDesc {
title?: string;
/** The order of the column. */
index: number;
- /** The width. */
+ /** The column width. */
width?: number | string;
- /** If set to true, the column should not be editable. */
+ /** If true, the column cannot be edite... | frontend/taipy-gui/packaging/taipy-gui.d.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Filter scenarios | 1,307 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
def __get_status_notifier_callbacks(cls, scenario: Scenario) -> List:
return [partial(c.callback, *c.params, scenario) for c in scenario.subscribers]
@classmethod
def _get_primary(cls, cycle: Cycle) -> Optional[Scenario]:
scenarios = cls._get_all_by_cycle(cycle)
for scenario in scen... | No issues found. | def __get_status_notifier_callbacks(cls, scenario: Scenario) -> List:
return [partial(c.callback, *c.params, scenario) for c in scenario.subscribers]
@classmethod
def _get_primary(cls, cycle: Cycle) -> Optional[Scenario]:
scenarios = cls._get_all_by_cycle(cycle)
for scenario in scen... | @@ -23,7 +23,6 @@
from .._repository._abstract_repository import _AbstractRepository
from .._version._version_manager_factory import _VersionManagerFactory
from .._version._version_mixin import _VersionMixin
-from ..common.reason import Reason
from ..common.warn_if_inputs_not_ready import _warn_if_inputs_not_ready
... | taipy/core/scenario/_scenario_manager.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Enterprise/bug/#389 fix insufficient permissions on enterprise | 1,329 | Avaiga/taipy | 12,680 | Python | toan-quach | |
return isinstance(other, Sequence) and self.id == other.id
def __getattr__(self, attribute_name):
protected_attribute_name = _validate_id(attribute_name)
if protected_attribute_name in self._properties:
return _tpl._replace_templates(self._properties[protected_attribute_name])
... | No issues found. | return isinstance(other, Sequence) and self.id == other.id
def __getattr__(self, attribute_name):
protected_attribute_name = _validate_id(attribute_name)
if protected_attribute_name in self._properties:
return _tpl._replace_templates(self._properties[protected_attribute_name])
... | @@ -37,8 +37,79 @@
class Sequence(_Entity, Submittable, _Labeled):
- """List of `Task^`s and additional attributes representing a set of data processing
- elements connected as a direct acyclic graph.
+ """A subset of scenario tasks grouped to be executed together independently of the others.
+
+ A seq... | taipy/core/sequence/sequence.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | #709 userman update | 1,333 | Avaiga/taipy | 12,680 | Python | jrobinAV | |
if (action.payload.fromBackend) {
mode = getLocalStorageValue("theme", mode, ["light", "dark"]);
}
localStorage && localStorage.setItem("theme", mode);
if (mode !== state.theme.palette.mode) {
return {
...state,
... | No issues found. | if (action.payload.fromBackend) {
mode = getLocalStorageValue("theme", mode, ["light", "dark"]);
}
localStorage && localStorage.setItem("theme", mode);
if (mode !== state.theme.palette.mode) {
return {
...state,
... | @@ -11,19 +11,19 @@
* specific language governing permissions and limitations under the License.
*/
-import { Dispatch } from "react";
import { PaletteMode } from "@mui/material";
import { createTheme, Theme } from "@mui/material/styles";
-import { io, Socket } from "socket.io-client";
import merge from "lodas... | frontend/taipy-gui/src/context/taipyReducers.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | navigate and download only for the browser window that requests it | 1,336 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
}
set onChange(handler: OnChangeHandler | undefined) {
if (handler !== undefined && handler.length !== 3) {
throw new Error("onChange() requires three parameters");
}
this._onChange = handler;
}
get onNotify() {
return this._onNotify;
}
set onNotify(h... | No issues found. | }
set onChange(handler: OnChangeHandler | undefined) {
if (handler !== undefined && handler.length !== 3) {
throw new Error("onChange() requires three parameters");
}
this._onChange = handler;
}
get onNotify() {
return this._onNotify;
}
set onNotify(h... | @@ -43,6 +43,7 @@ export class TaipyApp {
this.routes = undefined;
this.path = path;
this.socket = socket;
+ // Init socket io connection
initSocket(socket, this);
}
| frontend/taipy-gui/base/src/app.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Cache dependencies on github actions (#1296) | 1,337 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | |
)
);
return [key];
}
});
},
[updateVarName, dispatch, multiple, propagate, updateVars, valueById, props.onChange, module]
);
const clickHandler = useCallback(
(evt: MouseEvent<HTMLElement>) => {
... | No issues found. | )
);
return [key];
}
});
},
[updateVarName, dispatch, multiple, propagate, updateVars, valueById, props.onChange, module]
);
const clickHandler = useCallback(
(evt: MouseEvent<HTMLElement>) => {
... | @@ -11,7 +11,18 @@
* specific language governing permissions and limitations under the License.
*/
-import React, { useState, useCallback, useEffect, useMemo, CSSProperties, MouseEvent, ChangeEvent } from "react";
+import React, {
+ useState,
+ useCallback,
+ useEffect,
+ useMemo,
+ CSSProperties,
... | frontend/taipy-gui/src/components/Taipy/Selector.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | support filter on selector dropdown | 1,338 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | |
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | No issues found. | # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | @@ -0,0 +1,28 @@
+# Copyright 2021-2024 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | doc/gui/examples/controls/metric-range.py | 0 | Python | 1 | none | 16 | 29 | 29 | true | [DOCS] Metric component examples | 1,356 | Avaiga/taipy | 12,680 | Python | namnguyen20999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.