before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import logging
from taipy.gui import Gui
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def print_value_on_key_pressed(state, id, payload):
key = payload.get('args', [None])[0]
if key == 'F1':
logging.info("F1 key pressed")
elif ke... | ```suggestion
<|{value}|input|change_delay=300|on_action=key_pressed|action_keys=F1;F2;F3|>
``` | # 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,45 @@
+# 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/input_on_action.py | 26 | Python | 0.643 | suggestion | 97 | 31 | 37 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_on_action.py
PR Title: Input example
BEFORE CODE: import logging
from taipy.gui import Gui
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def print_value_on_ke... | ```suggestion
<|{value}|input|change_delay=300|on_action=key_pressed|action_keys=F1;F2;F3|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
def key_pressed(state, id, payload):
``` | # 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,45 @@
+# 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/input_on_action.py | 24 | Python | 0.571 | suggestion | 56 | 46 | 37 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_on_action.py
PR Title: Input example
BEFORE CODE: # 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... | ```suggestion
def key_pressed(state, id, payload):
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
<|input|password|>
``` | # 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,23 @@
+# 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/input_password.py | 19 | Python | 0.429 | suggestion | 38 | 24 | 24 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_password.py
PR Title: Input example
BEFORE CODE: # 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.... | ```suggestion
<|input|password|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
Gui(page).run(title="Input - Password")
``` | # 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,23 @@
+# 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/input_password.py | 23 | Python | 0.571 | suggestion | 63 | 24 | 24 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_password.py
PR Title: Input example
BEFORE CODE: # 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.... | ```suggestion
Gui(page).run(title="Input - Password")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def print_value_on_key_pressed(state, id, payload):
key = payload.get('args', [None])[0]
if key == 'F1':
logging.info("F1 key pressed")
elif key == 'F2':
logging.info("F2 key pre... | ```suggestion
Gui(page).run(title="Input - On change")
``` | # 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,45 @@
+# 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/input_on_action.py | 26 | Python | 0.643 | suggestion | 64 | 27 | 37 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_on_action.py
PR Title: Input example
BEFORE CODE: # Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def print_value_on_key_pressed(state, id, payload):
key = pa... | ```suggestion
Gui(page).run(title="Input - On change")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
Gui(page).run(title="Input - Type")
``` | # 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,25 @@
+# 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/input_type.py | 25 | Python | 0.714 | suggestion | 59 | 26 | 26 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_type.py
PR Title: Input example
BEFORE CODE: # 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... | ```suggestion
Gui(page).run(title="Input - Type")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
<|{number}|input|type=number|>
``` | # 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,25 @@
+# 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/input_type.py | 21 | Python | 0.714 | suggestion | 50 | 26 | 26 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_type.py
PR Title: Input example
BEFORE CODE: # 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... | ```suggestion
<|{number}|input|type=number|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | Isn't that some kind of reserved identifier?
What about 'value'? | # 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,25 @@
+# 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/input_type.py | 18 | Python | 0.214 | question | 65 | 26 | 26 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_type.py
PR Title: Input example
BEFORE CODE: # 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... | Isn't that some kind of reserved identifier?
What about 'value'? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | Better?
```
if key in ["F1", "F2", "F3"]:
logging.info(f"{key} key pressed")
```
Also, this function returns 'None'. Why? | # 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,44 @@
+# 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/input_on_action.py | 26 | Python | 0.786 | question | 132 | 45 | 37 | false | Input example | 1,880 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/input_on_action.py
PR Title: Input example
BEFORE CODE: # 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... | Better?
```
if key in ["F1", "F2", "F3"]:
logging.info(f"{key} key pressed")
```
Also, this function returns 'None'. Why? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
application. If there is no such function, actions will not trigger anything.<br/>
The signature of the *on_action* callback function must be:
- *state*: the `State^` instance of the caller.
- *id* (optional): a string representing the identifier of the caller.
... | I'm going to cry for more information.
"is loaded" is slightly vague, as we mentioned . | application. If there is no such function, actions will not trigger anything.<br/>
The signature of the *on_action* callback function must be:
- *state*: the `State^` instance of the caller.
- *id* (optional): a string representing the identifier of the caller.
... | @@ -143,6 +143,14 @@ class Gui:
The signature of the *on_init* callback function must be:
- *state*: the `State^` instance of the caller.
+ on_page_load (Callable): The function that is called when a page is loaded.<br/> | taipy/gui/gui.py | 26 | Python | 0.214 | style | 88 | 51 | 51 | false | add on page load (#1883) | 1,884 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | dinhlongviolin1 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: add on page load (#1883)
BEFORE CODE: application. If there is no such function, actions will not trigger anything.<br/>
The signature of the *on_action* callback function must be:
- *state*: the ... | I'm going to cry for more information.
"is loaded" is slightly vague, as we mentioned . | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if parent is not None:
parent.add(obj)
return obj
def __init__(self, *args, **kwargs) -> None:
self._properties: t.Dict[str, t.Any] = {}
self._lambdas: t.Dict[str, str] = {}
self.__calling_frame = t.cast(
FrameType, t.cast(FrameType, t.cast(FrameType,... | Is this necessary?
If it's a fear for overflow, why not a far larger value? closer to MAX_INT? | if parent is not None:
parent.add(obj)
return obj
def __init__(self, *args, **kwargs) -> None:
self._properties: t.Dict[str, t.Any] = {}
self._lambdas: t.Dict[str, str] = {}
self.__calling_frame = t.cast(
FrameType, t.cast(FrameType, t.cast(FrameType,... | @@ -67,6 +66,12 @@ def update(self, **kwargs):
self._properties.update(kwargs)
self.parse_properties()
+ @staticmethod
+ def __get_lambda_index():
+ _Element.__LAMBDA_VALUE_IDX += 1
+ _Element.__LAMBDA_VALUE_IDX %= 10000 | taipy/gui/builder/_element.py | 26 | Python | 0.357 | bug | 95 | 51 | 51 | false | add context to lambda var | 1,897 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/builder/_element.py
PR Title: add context to lambda var
BEFORE CODE: if parent is not None:
parent.add(obj)
return obj
def __init__(self, *args, **kwargs) -> None:
self._properties: t.Dict[str, t.Any] = {}
... | Is this necessary?
If it's a fear for overflow, why not a far larger value? closer to MAX_INT? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
with open("config_doc.txt", "a") as f:
from inspect import signature
# Add the documentation for configure methods
for exposed_configuration_method, configuration_method in configuration_methods:
annotation = " @staticmethod\n"
sign = " ... | ```suggestion
def _config_doc_for_section(func):
``` | if os.environ.get("GENERATING_TAIPY_DOC", None) and os.environ["GENERATING_TAIPY_DOC"] == "true":
with open("config_doc.txt", "a") as f:
from inspect import signature
# Add the documentation for configure methods
for exposed_configuration_method, configuration_method in ... | @@ -55,40 +56,50 @@
from .unique_section import UniqueSection
-def _config_doc(func):
- def func_with_doc(section, attr_name, default, configuration_methods, add_to_unconflicted_sections=False):
- import os
-
- if os.environ.get("GENERATING_TAIPY_DOC", None) and os.environ["GENERATING_TAIPY_DOC"] ... | taipy/common/config/__init__.py | 26 | Python | 0.571 | suggestion | 54 | 51 | 51 | false | feature/enterprise/#398 external services integration preparation | 1,913 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: feature/enterprise/#398 external services integration preparation
BEFORE CODE: with open("config_doc.txt", "a") as f:
from inspect import signature
# Add the documentation for configure... | ```suggestion
def _config_doc_for_section(func):
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
content = " pass\n\n"
f.write(annotation + sign + doc + content)
# Add the documentation for the attribute
annotation = " @property\n"
sign = f" def {attr_name} (self) -> {section.__name__}:\n"
if issubclass(section, UniqueSec... | ```suggestion
def _config_doc_for_method(func):
``` | doc = ' """' + configuration_method.__doc__ + '"""\n'
content = " pass\n\n"
f.write(annotation + sign + doc + content)
def __write_section_to_doc(section, attr_name):
if os.environ.get("GENERATING_TAIPY_DOC", None) and os.environ["GENERATING_TAIPY_DOC"... | @@ -55,40 +56,50 @@
from .unique_section import UniqueSection
-def _config_doc(func):
- def func_with_doc(section, attr_name, default, configuration_methods, add_to_unconflicted_sections=False):
- import os
-
- if os.environ.get("GENERATING_TAIPY_DOC", None) and os.environ["GENERATING_TAIPY_DOC"] ... | taipy/common/config/__init__.py | 26 | Python | 0.571 | suggestion | 53 | 51 | 51 | false | feature/enterprise/#398 external services integration preparation | 1,913 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: feature/enterprise/#398 external services integration preparation
BEFORE CODE: content = " pass\n\n"
f.write(annotation + sign + doc + content)
# Add the documentatio... | ```suggestion
def _config_doc_for_method(func):
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@_config_doc_for_config_section
def _inject_section(
section_clazz,
attribute_name: str,
default: Section,
configuration_methods: List[tuple],
add_to_unconflicted_sections: bool = False,
):
Config._register_default(default)
if issubclass(section_clazz, UniqueSection):
setattr(Config... | Why do we need the attribute name here? | __write_method_to_doc(configuration_methods)
return func(configuration_methods)
return func_with_doc
@_config_doc_for_section
def _inject_section(
section_clazz,
attribute_name: str,
default: Section,
configuration_methods: List[tuple],
add_to_unconflicted_sections: bool = Fal... | @@ -110,3 +121,9 @@ def _inject_section(
for exposed_configuration_method, configuration_method in configuration_methods:
setattr(Config, exposed_configuration_method, configuration_method)
+
+
+@_config_doc_for_config_method
+def _inject_method(section, attribute_name, configuration_methods: List[tuple... | taipy/common/config/__init__.py | 26 | Python | 0.071 | question | 39 | 29 | 35 | false | feature/enterprise/#398 external services integration preparation | 1,913 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: feature/enterprise/#398 external services integration preparation
BEFORE CODE: @_config_doc_for_config_section
def _inject_section(
section_clazz,
attribute_name: str,
default: Section,
configuration_me... | Why do we need the attribute name here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Add the documentation for configure methods
for exposed_configuration_method, configuration_method in configuration_methods:
annotation = " @staticmethod\n"
sign = " def " + exposed_configuration_method + str(signature(configuration_method)) + ":\n"
... | This part of the code should only be executed for documenting a section. Not a configure method. | from inspect import signature
# Add the documentation for configure methods
for exposed_configuration_method, configuration_method in configuration_methods:
annotation = " @staticmethod\n"
sign = " def " + exposed_configuration_method + str(sign... | @@ -55,40 +56,50 @@
from .unique_section import UniqueSection
-def _config_doc(func):
- def func_with_doc(section, attr_name, default, configuration_methods, add_to_unconflicted_sections=False):
- import os
-
- if os.environ.get("GENERATING_TAIPY_DOC", None) and os.environ["GENERATING_TAIPY_DOC"] ... | taipy/common/config/__init__.py | 26 | Python | 0.286 | suggestion | 96 | 51 | 51 | false | feature/enterprise/#398 external services integration preparation | 1,913 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: feature/enterprise/#398 external services integration preparation
BEFORE CODE:
# Add the documentation for configure methods
for exposed_configuration_method, configuration_method in configurat... | This part of the code should only be executed for documenting a section. Not a configure method. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
# This script needs to run in a Python environment where the Matplotlib library is
# installed.
# ------------------------------------------------------------------------------... | I guess this should be `tgb.html("h1", "Taipy Example for Matplotlib Integration")` | # Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
# This script needs to run in a Python environment where the Matplotlib library is
# installed.
# ------------------------------------------------------------------------------... | @@ -0,0 +1,44 @@
+# 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/charts/matplotlib/builder.py | 26 | Python | 0.429 | suggestion | 83 | 33 | 33 | false | Added an example on how to integrate Matplotlib | 1,930 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | SGCODEX | Review this pull request change.
Language: Python
File: doc/gui/examples/charts/matplotlib/builder.py
PR Title: Added an example on how to integrate Matplotlib
BEFORE CODE: # Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------... | I guess this should be `tgb.html("h1", "Taipy Example for Matplotlib Integration")` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | ```
import numpy as np
import matplotlib.pyplot as plt
import taipy.gui.builder as tgb
from taipy.gui import Gui
``` | # 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,44 @@
+# 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/charts/matplotlib/builder.py | 24 | Python | 0.714 | suggestion | 123 | 45 | 45 | false | Added an example on how to integrate Matplotlib | 1,930 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | SGCODEX | Review this pull request change.
Language: Python
File: doc/gui/examples/charts/matplotlib/builder.py
PR Title: Added an example on how to integrate Matplotlib
BEFORE CODE: # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file exce... | ```
import numpy as np
import matplotlib.pyplot as plt
import taipy.gui.builder as tgb
from taipy.gui import Gui
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | ```
import numpy as np
import matplotlib.pyplot as plt
from taipy.gui import Gui, Markdown
``` | # 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,43 @@
+# 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/charts/matplotlib/markdown.py | 23 | Python | 0.714 | suggestion | 100 | 44 | 44 | false | Added an example on how to integrate Matplotlib | 1,930 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | SGCODEX | Review this pull request change.
Language: Python
File: doc/gui/examples/charts/matplotlib/markdown.py
PR Title: Added an example on how to integrate Matplotlib
BEFORE CODE: # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file exc... | ```
import numpy as np
import matplotlib.pyplot as plt
from taipy.gui import Gui, Markdown
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
class _GuiCoreDatanodeAdapter(_TaipyBase):
@staticmethod
def _is_tabular_data(datanode: DataNode, value: t.Any):
return isinstance(datanode, _TabularDataNodeMixin) or isinstance(
value, (pd.DataFrame, pd.Series, list, tuple, dict)
)
def __get_data(self, dn: DataNode):
if... | do you want to use the JsonAdapter that we use in the gui | class _GuiCoreDatanodeAdapter(_TaipyBase):
@staticmethod
def _is_tabular_data(datanode: DataNode, value: t.Any):
return isinstance(datanode, _TabularDataNodeMixin) or isinstance(
value, (pd.DataFrame, pd.Series, list, tuple, dict)
)
def __get_data(self, dn: DataNode):
if... | @@ -206,11 +206,17 @@ def __get_data(self, dn: DataNode):
)
if isinstance(value, float) and math.isnan(value):
value = None
+ error = None
+ if val_type not in ("date", "int", "float", "string"):
+ try:
+ ... | taipy/gui_core/_adapters.py | 26 | Python | 0.286 | suggestion | 57 | 51 | 51 | false | display unsupported data in datanode with error message | 1,951 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui_core/_adapters.py
PR Title: display unsupported data in datanode with error message
BEFORE CODE: class _GuiCoreDatanodeAdapter(_TaipyBase):
@staticmethod
def _is_tabular_data(datanode: DataNode, value: t.Any):
return isinstance(datano... | do you want to use the JsonAdapter that we use in the gui | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "axios";
import { getLocalStorageValue } from "../../src/context/utils";
export const TAIPY_RESOURCE_HANDLER = "tprh";
declare global {
interface Window {
deleteCookie: () ... | Not sure about the init Socket inside the CookieHandler ... | import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "axios";
import { getLocalStorageValue } from "../../src/context/utils";
export const TAIPY_RESOURCE_HANDLER = "tprh";
export class CookieHandler {
resourceHandlerId: string;
c... | @@ -0,0 +1,66 @@
+import { Socket } from "socket.io-client";
+import { TaipyApp } from "./app";
+import { initSocket } from "./socket";
+import axios from "axios";
+import { getLocalStorageValue } from "../../src/context/utils";
+
+export const TAIPY_RESOURCE_HANDLER = "tprh";
+
+declare global {
+ interface Window ... | frontend/taipy-gui/base/src/cookieHandler.ts | 23 | TypeScript | 0.357 | nitpick | 59 | 48 | 48 | false | use taipy resource handler route to resolve cookies | 1,956 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/base/src/cookieHandler.ts
PR Title: use taipy resource handler route to resolve cookies
BEFORE CODE: import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "a... | Not sure about the init Socket inside the CookieHandler ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "axios";
import { getLocalStorageValue } from "../../src/context/utils";
export const TAIPY_RESOURCE_HANDLER = "tprh";
declare global {
interface Window {
deleteCookie: () ... | is this declaration not available by default ? | import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "axios";
import { getLocalStorageValue } from "../../src/context/utils";
export const TAIPY_RESOURCE_HANDLER = "tprh";
export class CookieHandler {
resourceHandlerId: string;
c... | @@ -0,0 +1,66 @@
+import { Socket } from "socket.io-client";
+import { TaipyApp } from "./app";
+import { initSocket } from "./socket";
+import axios from "axios";
+import { getLocalStorageValue } from "../../src/context/utils";
+
+export const TAIPY_RESOURCE_HANDLER = "tprh";
+
+declare global {
+ interface Window ... | frontend/taipy-gui/base/src/cookieHandler.ts | 11 | TypeScript | 0.071 | question | 46 | 36 | 36 | false | use taipy resource handler route to resolve cookies | 1,956 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/base/src/cookieHandler.ts
PR Title: use taipy resource handler route to resolve cookies
BEFORE CODE: import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "a... | is this declaration not available by default ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
this.resourceHandlerId = getLocalStorageValue(TAIPY_RESOURCE_HANDLER, "");
}
async init(socket: Socket, taipyApp: TaipyApp) {
const hasValidCookies = await this.verifyCookieStatus();
if (!hasValidCookies) {
await this.deleteCookie();
localStorage.removeItem(TAIPY_... | could this be if (data?.rh_id !== this.resourceHandlerId) ? | localStorage.removeItem(TAIPY_RESOURCE_HANDLER);
window.location.reload();
return;
}
this.addBeforeUnloadListener();
initSocket(socket, taipyApp);
}
async verifyCookieStatus(): Promise<boolean> {
// check to see if local storage has the resour... | @@ -0,0 +1,66 @@
+import { Socket } from "socket.io-client";
+import { TaipyApp } from "./app";
+import { initSocket } from "./socket";
+import axios from "axios";
+import { getLocalStorageValue } from "../../src/context/utils";
+
+export const TAIPY_RESOURCE_HANDLER = "tprh";
+
+declare global {
+ interface Window ... | frontend/taipy-gui/base/src/cookieHandler.ts | 26 | TypeScript | 0.429 | question | 60 | 50 | 41 | false | use taipy resource handler route to resolve cookies | 1,956 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/base/src/cookieHandler.ts
PR Title: use taipy resource handler route to resolve cookies
BEFORE CODE: this.resourceHandlerId = getLocalStorageValue(TAIPY_RESOURCE_HANDLER, "");
}
async init(socket: Socket, taipyApp: TaipyA... | could this be if (data?.rh_id !== this.resourceHandlerId) ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
initSocket(socket, taipyApp);
}
async verifyCookieStatus(): Promise<boolean> {
// check to see if local storage has the resource handler id (potentially having a cookie)
// If not, then some part of the code must have removed the cookie
// or wants to remove the cookie by removi... | why do you need to make it an window attribute ? | // or wants to remove the cookie by removing the local storage
if (!this.resourceHandlerId) {
return new Promise((resolve) => resolve(false));
}
try {
// call to get cookie status
const { data } = await axios.get("taipy-rh");
// validate co... | @@ -0,0 +1,66 @@
+import { Socket } from "socket.io-client";
+import { TaipyApp } from "./app";
+import { initSocket } from "./socket";
+import axios from "axios";
+import { getLocalStorageValue } from "../../src/context/utils";
+
+export const TAIPY_RESOURCE_HANDLER = "tprh";
+
+declare global {
+ interface Window ... | frontend/taipy-gui/base/src/cookieHandler.ts | 26 | TypeScript | 0.071 | question | 48 | 39 | 30 | false | use taipy resource handler route to resolve cookies | 1,956 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/base/src/cookieHandler.ts
PR Title: use taipy resource handler route to resolve cookies
BEFORE CODE: initSocket(socket, taipyApp);
}
async verifyCookieStatus(): Promise<boolean> {
// check to see if local storage... | why do you need to make it an window attribute ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// If not, then some part of the code must have removed the cookie
// or wants to remove the cookie by removing the local storage
if (!this.resourceHandlerId) {
return new Promise((resolve) => resolve(false));
}
try {
// call to get cookie status
... | why not use `self.deleteCookie()`
with `const self = this;` before the addEventListener | import { Socket } from "socket.io-client";
import { TaipyApp } from "./app";
import { initSocket } from "./socket";
import axios from "axios";
import { getLocalStorageValue } from "../../src/context/utils";
export const TAIPY_RESOURCE_HANDLER = "tprh";
export class CookieHandler {
resourceHandlerId: string;
c... | @@ -0,0 +1,66 @@
+import { Socket } from "socket.io-client";
+import { TaipyApp } from "./app";
+import { initSocket } from "./socket";
+import axios from "axios";
+import { getLocalStorageValue } from "../../src/context/utils";
+
+export const TAIPY_RESOURCE_HANDLER = "tprh";
+
+declare global {
+ interface Window ... | frontend/taipy-gui/base/src/cookieHandler.ts | 26 | TypeScript | 0.429 | suggestion | 88 | 34 | 58 | false | use taipy resource handler route to resolve cookies | 1,956 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/base/src/cookieHandler.ts
PR Title: use taipy resource handler route to resolve cookies
BEFORE CODE: // If not, then some part of the code must have removed the cookie
// or wants to remove the cookie by removing the loca... | why not use `self.deleteCookie()`
with `const self = this;` before the addEventListener | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
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._serv... | I don't quite understand this exception.
Whether there are no hooks, then nullcontext is fine.
Or there are, then live and let live... | 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._serv... | @@ -2880,7 +2880,11 @@ def stop(self):
_TaipyLogger._get_logger().info("Gui server has been stopped.")
def _get_authorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False):
- return contextlib.nullcontext()
+ try:
+ return _Hooks()._get_authoriza... | taipy/gui/gui.py | 26 | Python | 0.5 | suggestion | 136 | 50 | 50 | false | nullcontext is not always good :-) | 1,972 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: nullcontext is not always good :-)
BEFORE CODE: 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.
... | I don't quite understand this exception.
Whether there are no hooks, then nullcontext is fine.
Or there are, then live and let live... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | Although this is the proper way to do in Python, and you've used it elsewhere, I think it's simpler to use a raw 'print' (like in `doc/gui/examples/controls/table_guard_edits.py`, with the '# noqa: F401, T201' comment for linters). | # 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... | @@ -0,0 +1,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.643 | style | 231 | 34 | 28 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 writi... | Although this is the proper way to do in Python, and you've used it elsewhere, I think it's simpler to use a raw 'print' (like in `doc/gui/examples/controls/table_guard_edits.py`, with the '# noqa: F401, T201' comment for linters). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#
# 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 t... | ```suggestion
Gui(page).run(title="Menu - Label")
``` | #
# 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 t... | @@ -0,0 +1,27 @@
+# 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/menu_label.py | 26 | Python | 0.571 | suggestion | 59 | 27 | 26 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_label.py
PR Title: Fix current page on menu
BEFORE CODE: #
# 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 ... | ```suggestion
Gui(page).run(title="Menu - Label")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
<|menu|lov={options}|label=Pick an option|>
``` | # 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,27 @@
+# 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/menu_label.py | 23 | Python | 0.571 | suggestion | 63 | 28 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_label.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 L... | ```suggestion
<|menu|lov={options}|label=Pick an option|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
```
Shorter is better | # 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,27 @@
+# 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/menu_label.py | 18 | Python | 0.786 | suggestion | 125 | 28 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_label.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 L... | ```suggestion
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
```
Shorter is better | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
Gui(page).run(title="Menu - Inactive")
``` | # 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,26 @@
+# 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/menu_inactive.py | 26 | Python | 0.571 | suggestion | 62 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_inactive.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# th... | ```suggestion
Gui(page).run(title="Menu - Inactive")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
```
Shorter is better | # 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,26 @@
+# 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/menu_inactive.py | 18 | Python | 0.786 | suggestion | 125 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_inactive.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# th... | ```suggestion
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
```
Shorter is better | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
page = """
``` | # 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,27 @@
+# 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/menu_label.py | 22 | Python | 0.429 | suggestion | 30 | 28 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_label.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 L... | ```suggestion
page = """
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
``` | # 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,36 @@
+# 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/menu_on_action.py | 23 | Python | 0.714 | suggestion | 106 | 37 | 31 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# t... | ```suggestion
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
```
Not the topic of this example | # 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,36 @@
+# 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/menu_on_action.py | 24 | Python | 0.429 | suggestion | 49 | 37 | 31 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# t... | ```suggestion
```
Not the topic of this example | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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. See the License for the
# specific language governing p... | ```suggestion
page = """
``` | # 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. See the License for the
# specific language governing p... | @@ -0,0 +1,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.429 | suggestion | 30 | 32 | 26 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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... | ```suggestion
page = """
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
... | ```suggestion
Gui(page).run(title="Menu - Action")
``` | # 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,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.571 | suggestion | 60 | 27 | 31 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed ... | ```suggestion
Gui(page).run(title="Menu - Action")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#
# 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. See the License for the
# specific language governing permissions and limitations under the License.
# ----... | ```suggestion
<|menu|lov={options}|on_action=menu_action|>
``` | # 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,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.571 | suggestion | 64 | 31 | 31 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: #
# 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 CONDIT... | ```suggestion
<|menu|lov={options}|on_action=menu_action|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
def menu_action(_1, _2, payload)
``` | # 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,36 @@
+# 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/menu_on_action.py | 21 | Python | 0.571 | suggestion | 52 | 37 | 31 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# t... | ```suggestion
def menu_action(_1, _2, payload)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#
# 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 t... | ```suggestion
selected_options = payload["args"]
``` | #
# 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 t... | @@ -0,0 +1,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.571 | suggestion | 58 | 36 | 30 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: #
# 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 Lice... | ```suggestion
selected_options = payload["args"]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
for option in selected_options:
``` | # 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,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.571 | suggestion | 55 | 35 | 29 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 Licens... | ```suggestion
for option in selected_options:
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | ```suggestion
print(f"Menu option {option} selected") # noqa: F401, T201
``` | # 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... | @@ -0,0 +1,36 @@
+# 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/menu_on_action.py | 26 | Python | 0.571 | suggestion | 87 | 34 | 28 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_on_action.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 writi... | ```suggestion
print(f"Menu option {option} selected") # noqa: F401, T201
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
<|menu|lov={options}|not active|>
``` | # 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,26 @@
+# 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/menu_inactive.py | 22 | Python | 0.571 | suggestion | 53 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_inactive.py
PR Title: Fix current page on menu
BEFORE CODE: # 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
# th... | ```suggestion
<|menu|lov={options}|not active|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
``` | # 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,26 @@
+# 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/menu_simple.py | 18 | Python | 0.714 | suggestion | 106 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_simple.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 ... | ```suggestion
options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
<|menu|lov={options}|>
``` | # 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,26 @@
+# 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/menu_simple.py | 22 | Python | 0.429 | suggestion | 42 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_simple.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 ... | ```suggestion
<|menu|lov={options}|>
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
page = """
``` | # 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,26 @@
+# 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/menu_simple.py | 21 | Python | 0.429 | suggestion | 30 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_simple.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 ... | ```suggestion
page = """
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
Gui(page).run(title="Menu - Simple")
``` | # 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,26 @@
+# 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/menu_simple.py | 26 | Python | 0.571 | suggestion | 60 | 27 | 27 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/menu_simple.py
PR Title: Fix current page on menu
BEFORE CODE: # 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 ... | ```suggestion
Gui(page).run(title="Menu - Simple")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
("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_default(default_val="Log-in")
... | `selected_ids` should be named `selected_items` and have property type `lov_value` if it is the result of the selection of `lov` | .set_attributes(
[
("active", PropertyType.dynamic_boolean, True),
("hover_text", PropertyType.dynamic_string),
("on_change", PropertyType.function),
("on_action", PropertyType.function),
("action_keys",),
... | @@ -335,14 +335,15 @@ class _Factory:
)
.set_attributes(
[
- ("active", PropertyType.dynamic_boolean, True),
+ ("lov", PropertyType.lov),
("label",),
- ("width",),
- ("width[mobile]",),
("on_acti... | taipy/gui/_renderers/factory.py | 26 | Python | 0.714 | suggestion | 128 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/_renderers/factory.py
PR Title: Fix current page on menu
BEFORE CODE: ("columns[mobile]",),
("gap",),
]
),
"login": lambda gui, control_type, attrs: _Builder(
gui=gui, control_ty... | `selected_ids` should be named `selected_items` and have property type `lov_value` if it is the result of the selection of `lov` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import Tooltip from "@mui/material/Tooltip";
import { TypographyProps } from "@mui/material";
import { SxProps } from "@mui/system";
import { TaipyActiveProps, TaipyChangeProps, TaipyLabelProps } from "./utils";
import { getInitials } from "../../utils";
import { LovItem } from "../../utils/lov";
import { stringIcon, ... | that would be value & defaultValue | import Tooltip from "@mui/material/Tooltip";
import { TypographyProps } from "@mui/material";
import { SxProps } from "@mui/system";
import { TaipyActiveProps, TaipyChangeProps, TaipyLabelProps } from "./utils";
import { getInitials } from "../../utils";
import { LovItem } from "../../utils/lov";
import { stringIcon, ... | @@ -41,6 +41,8 @@ export interface LovProps<T = string | string[], U = string> extends TaipyActive
defaultValue?: U;
height?: string | number;
valueById?: boolean;
+ selectedIds?: LoV;
+ defaultSelectedIds?: U; | frontend/taipy-gui/src/components/Taipy/lovUtils.tsx | 26 | TypeScript | 0.071 | suggestion | 34 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/lovUtils.tsx
PR Title: Fix current page on menu
BEFORE CODE: import Tooltip from "@mui/material/Tooltip";
import { TypographyProps } from "@mui/material";
import { SxProps } from "@mui/system";
import { TaipyActiveP... | that would be value & defaultValue | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
useDispatchRequestUpdateOnFirstRender,
useDynamicProperty,
useIsMobile,
useModule,
} from "../../utils/hooks";
import { createSetMenuAction } from "../../context/taipyReducers";
import { MenuProps } from "../../utils/lov";
interface MenuCtlProps extends LovProps<string> {
label?: string;
width?... | unnecessary, just handle value & defaultValue | useDispatchRequestUpdateOnFirstRender,
useDynamicProperty,
useIsMobile,
useModule,
} from "../../utils/hooks";
import {createSetMenuAction} from "../../context/taipyReducers";
import {MenuProps} from "../../utils/lov";
interface MenuCtlProps extends LovProps<string> {
label?: string;
width?: st... | @@ -35,6 +42,7 @@ const MenuCtl = (props: MenuCtlProps) => {
defaultLov = "",
width = "15vw",
width_Mobile_ = "85vw",
+ defaultSelectedIds = "", | frontend/taipy-gui/src/components/Taipy/MenuCtl.tsx | 26 | TypeScript | 0.214 | suggestion | 45 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/MenuCtl.tsx
PR Title: Fix current page on menu
BEFORE CODE: useDispatchRequestUpdateOnFirstRender,
useDynamicProperty,
useIsMobile,
useModule,
} from "../../utils/hooks";
import { createSetMenuAction ... | unnecessary, just handle value & defaultValue | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
interface MenuCtlProps extends LovProps<string> {
label?: string;
width?: string;
width_Mobile_?: string;
onAction?: string;
inactiveIds?: string[];
defaultInactiveIds?: string;
selected?: string[];
defaultSelected?: string;
}
const MenuCtl = (props: MenuCtlProps) => {
const { id, ... | looks like there is no link between `inactiveIds` and `selected`, they should be in 2 separated `useMemo` |
interface MenuCtlProps extends LovProps<string> {
label?: string;
width?: string;
width_Mobile_?: string;
onAction?: string;
inactiveIds?: string[];
defaultInactiveIds?: string;
selected?: string[];
defaultSelected?: string;
}
const MenuCtl = (props: MenuCtlProps) => {
const {id, l... | @@ -47,19 +49,34 @@ const MenuCtl = (props: MenuCtlProps) => {
const lovList = useLovListMemo(props.lov, defaultLov, true);
- const inactiveIds = useMemo(() => {
+ const { inactiveIds, selected } = useMemo(() => { | frontend/taipy-gui/src/components/Taipy/MenuCtl.tsx | 26 | TypeScript | 0.571 | suggestion | 105 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/MenuCtl.tsx
PR Title: Fix current page on menu
BEFORE CODE:
interface MenuCtlProps extends LovProps<string> {
label?: string;
width?: string;
width_Mobile_?: string;
onAction?: string;
inactiveId... | looks like there is no link between `inactiveIds` and `selected`, they should be in 2 separated `useMemo` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { emptyArray, getInitials } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => theme.palette.text.primary };
const baseTitleProps = { noWrap: tru... | we don't want frontend->backend update for selected | import { emptyArray } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => theme.palette.text.primary };
const baseTitleProps = { noWrap: true, variant: "... | @@ -49,13 +50,17 @@ const Menu = (props: MenuProps) => {
(evt: MouseEvent<HTMLElement>) => {
if (active) {
const { id: key = "" } = evt.currentTarget.dataset;
- setSelectedValue(() => {
- dispatch(createSendActionNameAction("menu", module, onActio... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.214 | suggestion | 51 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: import { emptyArray, getInitials } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as... | we don't want frontend->backend update for selected | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
{
width: drawerWidth,
flexShrink: 0,
"& .MuiDrawer-paper": {
width: drawerWidth,
boxSizing: "border-box",
transition: "width 0.3s",
},
transition: "width 0.3s",
... | Why is it not possible to re-use SingleItem ? | const drawerWidth = opened ? width : `calc(${theme.spacing(9)} + 1px)`;
const titleWidth = opened ? `calc(${width} - ${theme.spacing(10)})` : undefined;
return [
{
width: drawerWidth,
flexShrink: 0,
"& .MuiDrawer-paper": {
... | @@ -65,48 +70,74 @@ const Menu = (props: MenuProps) => {
const [drawerSx, titleProps] = useMemo(() => {
const drawerWidth = opened ? width : `calc(${theme.spacing(9)} + 1px)`;
- const titleWidth = opened ? `calc(${width} - ${theme.spacing(10)})`: undefined;
- return [{
- width: ... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.143 | question | 45 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: {
width: drawerWidth,
flexShrink: 0,
"& .MuiDrawer-paper": {
width: drawerWidth... | Why is it not possible to re-use SingleItem ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const openHandler = useCallback((evt: MouseEvent<HTMLElement>) => {
evt.stopPropagation();
setOpened((o) => !o);
}, []);
const [drawerSx, titleProps] = useMemo(() => {
const drawerWidth = opened ? width : `calc(${theme.spacing(9)} + 1px)`;
const titleWidth = opened ? `calc($... | combine with current selection if any | }, []);
const selected = useMemo(() => {
const selected = Array.isArray(props.selected) ? props.selected : [];
if (selectedValue && !selected.includes(selectedValue)) {
return [...selected, selectedValue];
}
return selected;
}, [props.selected, selectedValue]);
... | @@ -65,31 +68,47 @@ const Menu = (props: MenuProps) => {
const [drawerSx, titleProps] = useMemo(() => {
const drawerWidth = opened ? width : `calc(${theme.spacing(9)} + 1px)`;
- const titleWidth = opened ? `calc(${width} - ${theme.spacing(10)})`: undefined;
- return [{
- width: ... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.071 | suggestion | 37 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: const openHandler = useCallback((evt: MouseEvent<HTMLElement>) => {
evt.stopPropagation();
setOpened((o) => !o);
}, []);
const [dr... | combine with current selection if any | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => them... | is there a need after the useEffect ? | import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => them... | @@ -51,11 +51,14 @@ const Menu = (props: MenuProps) => {
const { id: key = "" } = evt.currentTarget.dataset;
setSelectedValue(() => {
dispatch(createSendActionNameAction("menu", module, onAction, key));
+ if (props.selected) { | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.143 | question | 37 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils";
import { getComponentClassName } from "./T... | is there a need after the useEffect ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const openHandler = useCallback((evt: MouseEvent<HTMLElement>) => {
evt.stopPropagation();
setOpened((o) => !o);
}, []);
const [drawerSx, titleProps] = useMemo(() => {
const drawerWidth = opened ? width : `calc(${theme.spacing(9)} + 1px)`;
const titleWidth = opened ? `calc($... | what if currentSelection is in props.selected or currentSelection is not defined ? | setOpened((o) => !o);
}, []);
const selected = useMemo(() => {
const selected = Array.isArray(props.selected) ? props.selected : [];
if (selectedValue && !selected.includes(selectedValue)) {
return [...selected, selectedValue];
}
return selected;
}, [prop... | @@ -86,9 +85,10 @@ const Menu = (props: MenuProps) => {
useEffect(() => {
if (props.selected) {
- setSelectedValue(props.selected);
+ const updatedSelected = [...props.selected, currentSelection]; | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.214 | question | 82 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: const openHandler = useCallback((evt: MouseEvent<HTMLElement>) => {
evt.stopPropagation();
setOpened((o) => !o);
}, []);
const [dr... | what if currentSelection is in props.selected or currentSelection is not defined ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => theme.palette.text.primary };
const baseTitleProps = { noWrap: true, variant: "h6" } as const;
const Menu = (props: Menu... | here you are replacing selectedValue by key ie loosing all previous selection | import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const avatarSx = { bgcolor: (theme: Theme) => theme.palette.text.primary };
const baseTitleProps = { noWrap: true, variant: "h6" } as const;
const Menu = (props: Menu... | @@ -49,16 +50,14 @@ const Menu = (props: MenuProps) => {
(evt: MouseEvent<HTMLElement>) => {
if (active) {
const { id: key = "" } = evt.currentTarget.dataset;
+ setCurrentSelection(key);
setSelectedValue(() => {
dispatch(createS... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.214 | suggestion | 77 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const ... | here you are replacing selectedValue by key ie loosing all previous selection | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import ListItemButton from "@mui/material/ListItemButton";
import Drawer from "@mui/material/Drawer";
import List from "@mui/material/List";
import Avatar from "@mui/material/Avatar";
import CardHeader from "@mui/material/CardHeader";
import ListItemAvatar from "@mui/material/ListItemAvatar";
import Box from "@mui/mate... | I don't think we need a separate selection management | import ListItemButton from "@mui/material/ListItemButton";
import Drawer from "@mui/material/Drawer";
import List from "@mui/material/List";
import Avatar from "@mui/material/Avatar";
import CardHeader from "@mui/material/CardHeader";
import ListItemAvatar from "@mui/material/ListItemAvatar";
import Box from "@mui/mate... | @@ -38,6 +38,7 @@ const baseTitleProps = { noWrap: true, variant: "h6" } as const;
const Menu = (props: MenuProps) => {
const { label, onAction = "", lov, width, inactiveIds = emptyArray, active = true } = props;
const [selectedValue, setSelectedValue] = useState<string | string[]>("");
+ const [currentSe... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.214 | suggestion | 53 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: import ListItemButton from "@mui/material/ListItemButton";
import Drawer from "@mui/material/Drawer";
import List from "@mui/material/List";
import Avatar from... | I don't think we need a separate selection management | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { MenuProps } from "../../utils/lov";
import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const... | props.selected should have no impact here.
so back to original code | import { MenuProps } from "../../utils/lov";
import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils";
import { getComponentClassName } from "./TaipyStyle";
const boxDrawerStyle = { overflowX: "hidden" } as CSSProperties;
const headerSx = { padding: 0 };
const... | @@ -49,13 +49,13 @@ const Menu = (props: MenuProps) => {
(evt: MouseEvent<HTMLElement>) => {
if (active) {
const { id: key = "" } = evt.currentTarget.dataset;
- setSelectedValue(() => {
- dispatch(createSendActionNameAction("menu", module, onActio... | frontend/taipy-gui/src/components/Taipy/Menu.tsx | 26 | TypeScript | 0.286 | suggestion | 68 | 51 | 51 | false | Fix current page on menu | 1,974 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Menu.tsx
PR Title: Fix current page on menu
BEFORE CODE: import { MenuProps } from "../../utils/lov";
import { useClassNames, useDispatch, useModule } from "../../utils/hooks";
import { emptyArray } from "../../utils... | props.selected should have no impact here.
so back to original code | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self.__send_ws(
{
"type": _WsType.CLIENT_ID.value,
"id": id,
},
allow_grouping=False,
)
def __send_ws_download(self, content: str, name: str, on_action: str) -> None:
self.__send_ws(
{"type": _WsType.DOWNLOAD_FI... | No need for a new ws function, we can re-use `__send_ws_alert` | to=t.cast(str, self.__get_ws_receiver(True)),
)
time.sleep(0.001)
except Exception as e: # pragma: no cover
_warn(f"Exception raised in WebSocket communication (send ack) in '{self.__frame.f_code.co_name}'", e)
def _send_ws_id(self, i... | @@ -1335,6 +1335,15 @@ def __send_ws_alert(self, type: str, message: str, system_notification: bool, du
}
)
+ def __send_ws_close_notification(self, notification_id: str) -> None: | taipy/gui/gui.py | 26 | Python | 0.429 | suggestion | 63 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: self.__send_ws(
{
"type": _WsType.CLIENT_ID.value,
"id": id,
},
allow_grouping=False,
... | No need for a new ws function, we can re-use `__send_ws_alert` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
on_action = on_action_name
else:
_warn("download() on_action is invalid.")
content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_action) if on_action is not None else "")
def _notify(
... | should check for non empty also ie `if notification_id:` should be enough | on_action = on_action_name
else:
_warn("download() on_action is invalid.")
content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_action) if on_action is not None else "")
def _notify(
... | @@ -2253,6 +2263,14 @@ def _notify(
self._get_config("notification_duration", 3000) if duration is None else duration,
)
+ def _close_notification(
+ self,
+ notification_id: t.Optional[str] = None,
+ ):
+ if notification_id is not None: # Check if notification_id is ... | taipy/gui/gui.py | 26 | Python | 0.429 | suggestion | 73 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: on_action = on_action_name
else:
_warn("download() on_action is invalid.")
content_str = self._get_content("Gui.downl... | should check for non empty also ie `if notification_id:` should be enough | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self._bind_var_val(on_action_name, on_action)
on_action = on_action_name
else:
_warn("download() on_action is invalid.")
content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_acti... | This should not be optional. ... or how come would it be? | else:
_warn("download() on_action is invalid.")
content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_action) if on_action is not None else "")
def _notify(
self,
notification_type: str = "I... | @@ -2245,14 +2256,31 @@ def _notify(
message: str = "",
system_notification: t.Optional[bool] = None,
duration: t.Optional[int] = None,
+ notification_id: t.Optional[str] = None,
):
self.__send_ws_alert(
notification_type,
message,
s... | taipy/gui/gui.py | 26 | Python | 0.286 | question | 57 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: self._bind_var_val(on_action_name, on_action)
on_action = on_action_name
else:
_warn("download() on_action is... | This should not be optional. ... or how come would it be? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_action) if on_action is not None else "")
def _notify(
self,
notification_type: str = "I",
message: str = "",
system_notification: t.Optional[bool] ... | sorry my comment was not clear,
I think we should re-use self.__send_ws_alert( |
def _notify(
self,
notification_type: str = "I",
message: str = "",
system_notification: t.Optional[bool] = None,
duration: t.Optional[int] = None,
notification_id: t.Optional[str] = None,
):
if not notification_id:
notification_id = str(uuid.... | @@ -2245,14 +2256,31 @@ def _notify(
message: str = "",
system_notification: t.Optional[bool] = None,
duration: t.Optional[int] = None,
+ notification_id: t.Optional[str] = None,
):
self.__send_ws_alert(
notification_type,
message,
s... | taipy/gui/gui.py | 26 | Python | 0.286 | suggestion | 79 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: content_str = self._get_content("Gui.download", content, False)
self.__send_ws_download(content_str, str(name), str(on_action) if on_action is not None e... | sorry my comment was not clear,
I think we should re-use self.__send_ws_alert( | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < nodeList.length; i++) {
if (nodeList[i].getAttribute("rel") == "icon" || nodeList[i].getAttribute("rel") == "shortcut icon") {
return nodeList[i].getAttribute("h... | - on creation (type != ""), you need to pass the id as a key to `enqueueSnackbar` options
- on deletion, you need to use that id as an argument to `closeSnackbar`
- I guess we don't need the lastKey ref anymore | const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < nodeList.length; i++) {
if (nodeList[i].getAttribute("rel") == "icon" || nodeList[i].getAttribute("rel") == "shortcut icon") {
return nodeList[i].getAttribute("h... | @@ -70,7 +70,7 @@ const Alert = ({ alerts }: AlertProps) => {
});
alert.system && new Notification(document.title || "Taipy", { body: alert.message, icon: faviconUrl });
}
- dispatch(createDeleteAlertAction()); | frontend/taipy-gui/src/components/Taipy/Alert.tsx | 26 | TypeScript | 0.786 | suggestion | 213 | 38 | 35 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Alert.tsx
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < n... | - on creation (type != ""), you need to pass the id as a key to `enqueueSnackbar` options
- on deletion, you need to use that id as an argument to `closeSnackbar`
- I guess we don't need the lastKey ref anymore | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
aType = aType.charAt(0).toLowerCase();
switch (aType) {
case "e":
return "error";
case "w":
return "warning";
case "s":
return "success";
default:
return "info";
}
}
return aTy... | What do we need a random identifier for?
| if (aType) {
aType = aType.charAt(0).toLowerCase();
switch (aType) {
case "e":
return "error";
case "w":
return "warning";
case "s":
return "success";
default:
return "info";
}
... | @@ -812,16 +819,22 @@ const getAlertType = (aType: string) => {
return aType;
};
+const generateUniqueId = () => {
+ return '_' + Math.random().toString(36).substr(2, 9);
+};
+
export const createAlertAction = (alert: AlertMessage): TaipyAlertAction => ({
type: Types.SetAlert,
atype: getAlertType(... | frontend/taipy-gui/src/context/taipyReducers.ts | 26 | TypeScript | 0.071 | question | 42 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/context/taipyReducers.ts
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: aType = aType.charAt(0).toLowerCase();
switch (aType) {
case "e":
return "error";
... | What do we need a random identifier for?
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notification_id: string;
}
interface TaipyAction extends NamePayload, TaipyBaseAction {
propagate?: boolean;
context?: string;
}
interface TaipyMultipleAction extends TaipyBaseAction {
p... | I would even say:
```suggestion
notification_id?: string;
```
Unidentified notifications cannot be revoked specifically. | }
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notificationId?: string;
}
interface TaipyAction extends NamePayload, TaipyBaseAction {
propagate?: boolean;
context?: string;
}
interface TaipyMultipleAction extends TaipyBaseAction {
... | @@ -108,6 +109,10 @@ interface TaipyMultipleMessageAction extends TaipyBaseAction {
interface TaipyAlertAction extends TaipyBaseAction, AlertMessage {}
+interface TaipyDeleteAlertAction extends TaipyBaseAction {
+ notification_id: string; | frontend/taipy-gui/src/context/taipyReducers.ts | 26 | TypeScript | 0.714 | suggestion | 128 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/context/taipyReducers.ts
PR Title: #1801 Added close a specific notification feature
BEFORE CODE:
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notification_i... | I would even say:
```suggestion
notification_id?: string;
```
Unidentified notifications cannot be revoked specifically. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
navigateTab?: string;
navigateForce?: boolean;
id: string;
menu: MenuProps;
download?: FileDownloadProps;
ackList: string[];
}
/**
* Application actions as used by the application reducer.
*/
export interface TaipyBaseAction {
type: Types;
}
export interface NamePayload {
name: strin... | ```suggestion
notification_id?: string;
```
See below | navigateParams?: Record<string, string>;
navigateTab?: string;
navigateForce?: boolean;
id: string;
menu: MenuProps;
download?: FileDownloadProps;
ackList: string[];
}
/**
* Application actions as used by the application reducer.
*/
export interface TaipyBaseAction {
type: Types;
}
e... | @@ -91,6 +91,7 @@ export interface AlertMessage {
message: string;
system: boolean;
duration: number;
+ notification_id: string; | frontend/taipy-gui/src/context/taipyReducers.ts | 26 | TypeScript | 0.571 | suggestion | 60 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/context/taipyReducers.ts
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: navigateTab?: string;
navigateForce?: boolean;
id: string;
menu: MenuProps;
download?: FileDownloadProps;
ackL... | ```suggestion
notification_id?: string;
```
See below | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < nodeList.length; i++) {
if (nodeList[i].getAttribute("rel") == "icon" || nodeList[i].getAttribute("rel") == "shortcut icon") {
return nodeList[i].getAttribute("h... | this is still needed because we don't want to keep a ref to the notification in the state
But you should pass it the notification id | const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < nodeList.length; i++) {
if (nodeList[i].getAttribute("rel") == "icon" || nodeList[i].getAttribute("rel") == "shortcut icon") {
return nodeList[i].getAttribute("h... | @@ -57,20 +57,18 @@ const Alert = ({ alerts }: AlertProps) => {
useEffect(() => {
if (alert) {
+ const notificationId = alert.notification_id || nanoid();
if (alert.atype === "") {
- if (lastKey.current) {
- closeSnackbar(lastKey.current);
- ... | frontend/taipy-gui/src/components/Taipy/Alert.tsx | 26 | TypeScript | 0.429 | suggestion | 133 | 36 | 35 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Alert.tsx
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: const faviconUrl = useMemo(() => {
const nodeList = document.getElementsByTagName("link");
for (let i = 0; i < n... | this is still needed because we don't want to keep a ref to the notification in the state
But you should pass it the notification id | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
),
[props.width, withBorder]
);
const handleFiles = useCallback(
(files: FileList | undefined | null, evt: Event | ChangeEvent) => {
evt.stopPropagation();
evt.preventDefault();
if (files?.length) {
setUpload(true... | no need, notification_id will be generated in the alert | ),
[props.width, withBorder]
);
const handleFiles = useCallback(
(files: FileList | undefined | null, evt: Event | ChangeEvent) => {
evt.stopPropagation();
evt.preventDefault();
if (files?.length) {
setUpload(true);
... | @@ -116,14 +117,14 @@ const FileSelector = (props: FileSelectorProps) => {
onAction && dispatch(createSendActionNameAction(id, module, onAction));
notify &&
dispatch(
- createAlertAction({ atype: "success", mes... | frontend/taipy-gui/src/components/Taipy/FileSelector.tsx | 26 | TypeScript | 0.214 | suggestion | 55 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/FileSelector.tsx
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: )
),
[props.width, withBorder]
);
const handleFiles = useCallback(
(file... | no need, notification_id will be generated in the alert | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notification_id: string;
}
interface TaipyAction extends NamePayload, TaipyBaseAction {
propagate?: boolean;
context?: string;
}
interface TaipyMultipleAction extends TaipyBaseAction {
p... | we use CamelCase on the frontend => `notificationId` | }
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notificationId?: string;
}
interface TaipyAction extends NamePayload, TaipyBaseAction {
propagate?: boolean;
context?: string;
}
interface TaipyMultipleAction extends TaipyBaseAction {
... | @@ -108,6 +109,10 @@ interface TaipyMultipleMessageAction extends TaipyBaseAction {
interface TaipyAlertAction extends TaipyBaseAction, AlertMessage {}
+interface TaipyDeleteAlertAction extends TaipyBaseAction {
+ notification_id: string; | frontend/taipy-gui/src/context/taipyReducers.ts | 26 | TypeScript | 0.429 | style | 52 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/context/taipyReducers.ts
PR Title: #1801 Added close a specific notification feature
BEFORE CODE:
export interface AlertMessage {
atype: string;
message: string;
system: boolean;
duration: number;
notification_i... | we use CamelCase on the frontend => `notificationId` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
},
[closeSnackbar]
);
const notifAction = useCallback(
(key: SnackbarKey) => (
<IconButton size="small" aria-label="close" color="inherit" onClick={resetAlert(key)}>
<CloseIcon fontSize="small" />
</IconButton>
),
[resetAlert]
... | notificationId should never be unset | },
[closeSnackbar]
);
const notifAction = useCallback(
(key: SnackbarKey) => (
<IconButton size="small" aria-label="close" color="inherit" onClick={resetAlert(key)}>
<CloseIcon fontSize="small" />
</IconButton>
),
[resetAlert]
... | @@ -57,20 +57,18 @@ const Alert = ({ alerts }: AlertProps) => {
useEffect(() => {
if (alert) {
+ const notificationId = alert.notification_id || nanoid(); | frontend/taipy-gui/src/components/Taipy/Alert.tsx | 26 | TypeScript | 0.143 | suggestion | 36 | 49 | 48 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Alert.tsx
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: },
[closeSnackbar]
);
const notifAction = useCallback(
(key: SnackbarKey) => (
<IconBut... | notificationId should never be unset | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
allow_grouping=False,
)
def __send_ws_download(self, content: str, name: str, on_action: str) -> None:
self.__send_ws(
{"type": _WsType.DOWNLOAD_FILE.value, "content": content, "name": name, "onAction": on_action},
send_back_only=True,
)
def __send_w... | payload["notification_id"] = notification_id =>payload["notificationId"] = notification_id | },
allow_grouping=False,
)
def __send_ws_download(self, content: str, name: str, on_action: str) -> None:
self.__send_ws(
{"type": _WsType.DOWNLOAD_FILE.value, "content": content, "name": name, "onAction": on_action},
send_back_only=True,
)
... | @@ -1330,15 +1330,26 @@ def __send_ws_download(self, content: str, name: str, on_action: str) -> None:
send_back_only=True,
)
- def __send_ws_alert(self, type: str, message: str, system_notification: bool, duration: int) -> None:
+ def __send_ws_alert(
+ self, type: str,
+ ... | taipy/gui/gui.py | 26 | Python | 0.214 | suggestion | 91 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: allow_grouping=False,
)
def __send_ws_download(self, content: str, name: str, on_action: str) -> None:
self.__send_ws(
{"typ... | payload["notification_id"] = notification_id =>payload["notificationId"] = notification_id | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
on_action_name = (
_get_lambda_id(t.cast(LambdaType, on_action))
if _is_unnamed_function(on_action)
else _get_expr_var_name(t.cast(t.Callable, on_action).__name__)
)
if on_action_name:
self._bind_var_val(on_action_name, ... | generate a notification_id from uuid if not set or == "" | if _is_function(on_action):
on_action_name = (
_get_lambda_id(t.cast(LambdaType, on_action))
if _is_unnamed_function(on_action)
else _get_expr_var_name(t.cast(t.Callable, on_action).__name__)
)
if on_action_name:
... | @@ -2242,14 +2253,30 @@ def _notify(
message: str = "",
system_notification: t.Optional[bool] = None,
duration: t.Optional[int] = None,
+ notification_id: str = "",
):
self.__send_ws_alert( | taipy/gui/gui.py | 26 | Python | 0.214 | suggestion | 56 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: on_action_name = (
_get_lambda_id(t.cast(LambdaType, on_action))
if _is_unnamed_function(on_action)
else _get... | generate a notification_id from uuid if not set or == "" | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
newValue.data = addRows(rows, newValue.data as Record<string, unknown>[], start);
}
}
return {
...state,
data: {
...state.data,
[action.name]: action.payload.pagekey
... | notification_id: alertAction.notification_id or nanoid(),
for internal use (ie fileSelector) | []) as Record<string, unknown>[];
newValue.data = addRows(rows, newValue.data as Record<string, unknown>[], start);
}
}
return {
...state,
data: {
...state.data,
[a... | @@ -379,14 +384,16 @@ export const taipyReducer = (state: TaipyState, baseAction: TaipyBaseAction): Ta
message: alertAction.message,
system: alertAction.system,
duration: alertAction.duration,
+ notification_id: alertActio... | frontend/taipy-gui/src/context/taipyReducers.ts | 26 | TypeScript | 0.286 | suggestion | 93 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/context/taipyReducers.ts
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: newValue.data = addRows(rows, newValue.data as Record<string, unknown>[], start);
}
}
... | notification_id: alertAction.notification_id or nanoid(),
for internal use (ie fileSelector) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
notification_type: The notification type. This can be one of "success", "info",
"warning", or "error".<br/>
To remove the last notification, set this parameter to the empty string.
message: The text message to display.
system_notification: If True, the system will also sh... | should return state._gui._notify(....) | notification_type: The notification type. This can be one of "success", "info",
"warning", or "error".<br/>
To remove the last notification, set this parameter to the empty string.
message: The text message to display.
system_notification: If True, the system will also sh... | @@ -98,6 +98,7 @@ def notify(
"""
if state and isinstance(state._gui, Gui):
state._gui._notify(notification_type, message, system_notification, duration, notification_id)
+ return notification_id | taipy/gui/gui_actions.py | 26 | Python | 0.143 | suggestion | 38 | 51 | 51 | false | #1801 Added close a specific notification feature | 1,985 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | AdeshGhadage | Review this pull request change.
Language: Python
File: taipy/gui/gui_actions.py
PR Title: #1801 Added close a specific notification feature
BEFORE CODE: notification_type: The notification type. This can be one of "success", "info",
"warning", or "error".<br/>
To remove the last no... | should return state._gui._notify(....) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Arguments:
favicon_path: The path to the image file to use.<br/>
This can be expressed as a path name or a URL (relative or not).
state: The state to apply the change to.<br/>
If no set or set to None, all the application's clients are impacted.
""... | ```suggestion
_warn("Exception in Hook._add_event_listener(): ", e)
``` | listener: t.Union[
t.Callable[[str, t.Dict[str, t.Any]], None], t.Callable[[State, str, t.Dict[str, t.Any]], None]
],
with_state: t.Optional[bool] = False,
):
_Hooks()._add_event_listener(event_name, listener, with_state)
def _fire_event(
self, event_name: st... | @@ -2907,3 +2907,44 @@ def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State]
self._broadcast(
"taipy_favicon", url, self._get_client_id() if state else None, message_type=_WsType.FAVICON
)
+
+ @staticmethod
+ def _add_event_listener(
+ e... | taipy/gui/gui.py | 26 | Python | 0.714 | suggestion | 85 | 51 | 37 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Support event listener through Hooks
BEFORE CODE: Arguments:
favicon_path: The path to the image file to use.<br/>
This can be expressed as a path name or a URL (relative or not).
state... | ```suggestion
_warn("Exception in Hook._add_event_listener(): ", e)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_warn("Hooks: ", e)
def _fire_event(
self, event_name: str, client_id: t.Optional[str] = None, payload: t.Optional[t.Dict[str, t.Any]] = None
):
Timer(interval=0.1,
function=self.__do_fire_event,
args=(event_name, client_id, payload),
).start()
d... | ```suggestion
_warn("Exception in Hook._fire_event(): ", e)
``` | # 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... | @@ -2907,3 +2907,44 @@ def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State]
self._broadcast(
"taipy_favicon", url, self._get_client_id() if state else None, message_type=_WsType.FAVICON
)
+
+ @staticmethod
+ def _add_event_listener(
+ e... | taipy/gui/gui.py | 26 | Python | 0.714 | suggestion | 77 | 30 | 2,933 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Support event listener through Hooks
BEFORE CODE: _warn("Hooks: ", e)
def _fire_event(
self, event_name: str, client_id: t.Optional[str] = None, payload: t.Optional[t.Dict[str, t.Any]] = None
):
T... | ```suggestion
_warn("Exception in Hook._fire_event(): ", e)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
"""
if state or self.__favicon != favicon_path:
if not state:
self.__favicon = favicon_path
url = self._get_content("__taipy_favicon", favicon_path, True)
self._broadcast(
"taipy_favicon", url, self._get_client_id() if state else None, ... | Plese tell me why the delay... | _Hooks()._add_event_listener(event_name, listener, with_state)
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 t... | @@ -2907,3 +2907,44 @@ def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State]
self._broadcast(
"taipy_favicon", url, self._get_client_id() if state else None, message_type=_WsType.FAVICON
)
+
+ @staticmethod
+ def _add_event_listener(
+ e... | taipy/gui/gui.py | 26 | Python | 0.071 | suggestion | 30 | 50 | 32 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Support event listener through Hooks
BEFORE CODE: """
if state or self.__favicon != favicon_path:
if not state:
self.__favicon = favicon_path
url = self._get_content("__taipy_fa... | Plese tell me why the delay... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
def _fire_event(
self, event_name: str, client_id: t.Optional[str] = None, payload: t.Optional[t.Dict[str, t.Any]] = None
):
Timer(interval=0.1,
function=self.__do_fire_event,
args=(event_name, client_id, payload),
).start()
def __do_fire_event(
self,... | ```suggestion
if this_sid:
```
Or did I missed something? | # 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... | @@ -2907,3 +2907,44 @@ def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State]
self._broadcast(
"taipy_favicon", url, self._get_client_id() if state else None, message_type=_WsType.FAVICON
)
+
+ @staticmethod
+ def _add_event_listener(
+ e... | taipy/gui/gui.py | 26 | Python | 0.571 | question | 72 | 28 | 2,933 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Support event listener through Hooks
BEFORE CODE: def _fire_event(
self, event_name: str, client_id: t.Optional[str] = None, payload: t.Optional[t.Dict[str, t.Any]] = None
):
Timer(interval=0.1,
fu... | ```suggestion
if this_sid:
```
Or did I missed something? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | I would have called this '_is_function' to be honest.
... and... can a class be callabled? Seriously?? | # 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,31 @@
+# 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/gui/utils/callable.py | 17 | Python | 0.357 | question | 104 | 32 | 32 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/utils/callable.py
PR Title: Support event listener through Hooks
BEFORE CODE: # 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 L... | I would have called this '_is_function' to be honest.
... and... can a class be callabled? Seriously?? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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
def _get_function_name(s: t.Any) -> str:
```
or even `_function_name()` | # 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,31 @@
+# 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/gui/utils/callable.py | 21 | Python | 0.571 | suggestion | 89 | 32 | 32 | false | Support event listener through Hooks | 1,993 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/utils/callable.py
PR Title: Support event listener through Hooks
BEFORE CODE: # 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 L... | ```suggestion
def _get_function_name(s: t.Any) -> str:
```
or even `_function_name()` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
editable,
partialEditable,
onEdit,
onCellValidation,
onDelete,
onRowDeletion,
onAction,
onRowSelection,
onRowClick,
props.rowClassName,
props.nanValue,
size,
]
);
... | I don't think `index` is needed ? | editable,
partialEditable,
onEdit,
onCellValidation,
onDelete,
onRowDeletion,
onAction,
onRowSelection,
onRowClick,
props.rowClassName,
props.nanValue,
size,
]
);
... | @@ -600,11 +601,12 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
<MuiTable sx={tableSx} aria-labelledby="tableTitle" size={size} stickyHeader={true}>
<TableHead>
<TableRow ref={headerRow}>
- ... | frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx | 26 | TypeScript | 0.214 | question | 34 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx
PR Title: Add css class to columns header
BEFORE CODE: editable,
partialEditable,
onEdit,
onCellValidation,
onDelete,
onRow... | I don't think `index` is needed ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
onRowDeletion,
onAction,
onRowSelection,
onRowClick,
props.rowClassName,
props.nanValue,
size,
]
);
const boxSx = useMemo(() => ({ ...baseBoxSx, width: width }), [width]);
return (
<Box id={id} sx={boxSx} c... | - `columns[col].dfid` is enough
- No index please (it would be the responsability of the developper to handle identical class names
- use `getSuffixedClassNames(className, generateHeaderClassName(columns[col].dfid)` to get the current prefix | onRowDeletion,
onAction,
onRowSelection,
onRowClick,
props.rowClassName,
props.nanValue,
size,
]
);
const boxSx = useMemo(() => ({ ...baseBoxSx, width: width }), [width]);
return (
<Box id={id} sx={boxSx} c... | @@ -600,11 +601,12 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
<MuiTable sx={tableSx} aria-labelledby="tableTitle" size={size} stickyHeader={true}>
<TableHead>
<TableRow ref={headerRow}>
- ... | frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx | 26 | TypeScript | 0.786 | suggestion | 243 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx
PR Title: Add css class to columns header
BEFORE CODE: onRowDeletion,
onAction,
onRowSelection,
onRowClick,
props.rowClassName,
... | - `columns[col].dfid` is enough
- No index please (it would be the responsability of the developper to handle identical class names
- use `getSuffixedClassNames(className, generateHeaderClassName(columns[col].dfid)` to get the current prefix | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import ClearIcon from "@mui/icons-material/Clear";
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { BaseDateTimePickerSlotProps ... | - `\W` would work also and is easier to read
- would be nice to replace multiple `-` by 1 `-`
- make it lower case please | import ClearIcon from "@mui/icons-material/Clear";
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { BaseDateTimePickerSlotProps ... | @@ -47,6 +47,20 @@ import { TaipyActiveProps, TaipyMultiSelectProps, getSuffixedClassNames } from "
/**
* A column description as received by the backend.
*/
+
+/**
+ * Generates a unique CSS class name for a table header.
+ * @param columnName - The name of the column.
+ * @param index - The index of the column t... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 26 | TypeScript | 0.571 | suggestion | 124 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/tableUtils.tsx
PR Title: Add css class to columns header
BEFORE CODE: import ClearIcon from "@mui/icons-material/Clear";
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/De... | - `\W` would work also and is easier to read
- would be nice to replace multiple `-` by 1 `-`
- make it lower case please | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { BaseDateTimePickerSlotProps } from "@mui/x-date-pickers/DateTimePicker/shared";... | keep `taipy-table` out of the thing (see my comment about `getSuffixedClassName`) | import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { BaseDateTimePickerSlotProps } from "@mui/x-date-pickers/DateTimePicker/shared";... | @@ -47,6 +47,20 @@ import { TaipyActiveProps, TaipyMultiSelectProps, getSuffixedClassNames } from "
/**
* A column description as received by the backend.
*/
+
+/**
+ * Generates a unique CSS class name for a table header.
+ * @param columnName - The name of the column.
+ * @param index - The index of the column t... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 26 | TypeScript | 0.357 | suggestion | 81 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/tableUtils.tsx
PR Title: Add css class to columns header
BEFORE CODE: import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
import { DatePicker } from "@mui/x-date-pick... | keep `taipy-table` out of the thing (see my comment about `getSuffixedClassName`) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import Input from "@mui/material/Input";
import Switch from "@mui/material/Switch";
import TableCell, { TableCellProps } from "@mui/material/TableCell";
import TextField from "@mui/material/TextField";
import CheckIcon from "@mui/icons-material/Check";
import ClearIcon from "@mui/icons-material/Clear";
import EditIcon ... | no need for uniqueness at our level | import Input from "@mui/material/Input";
import Switch from "@mui/material/Switch";
import TableCell, { TableCellProps } from "@mui/material/TableCell";
import TextField from "@mui/material/TextField";
import CheckIcon from "@mui/icons-material/Check";
import ClearIcon from "@mui/icons-material/Clear";
import EditIcon ... | @@ -47,6 +47,20 @@ import { TaipyActiveProps, TaipyMultiSelectProps, getSuffixedClassNames } from "
/**
* A column description as received by the backend.
*/
+
+/**
+ * Generates a unique CSS class name for a table header.
+ * @param columnName - The name of the column.
+ * @param index - The index of the column t... | frontend/taipy-gui/src/components/Taipy/tableUtils.tsx | 26 | TypeScript | 0.071 | suggestion | 35 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/tableUtils.tsx
PR Title: Add css class to columns header
BEFORE CODE: import Input from "@mui/material/Input";
import Switch from "@mui/material/Switch";
import TableCell, { TableCellProps } from "@mui/material/Table... | no need for uniqueness at our level | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { generateHeaderClassName } from "./tableUtils";
describe("generateHeaderClassName", () => {
it("should generate a CSS class name with a hyphen prefix and convert to lowercase", () => {
const result = generateHeaderClassName("ColumnName");
expect(result).toBe("-columnname");
});
it(... | empty string or undefined should resolve to empty string | import { generateHeaderClassName } from "./tableUtils";
describe("generateHeaderClassName", () => {
it("should generate a CSS class name with a hyphen prefix and convert to lowercase", () => {
const result = generateHeaderClassName("ColumnName");
expect(result).toBe("-columnname");
});
it(... | @@ -0,0 +1,23 @@
+import { generateHeaderClassName } from "./tableUtils";
+
+describe("generateHeaderClassName", () => {
+ it("should generate a CSS class name with a hyphen prefix and convert to lowercase", () => {
+ const result = generateHeaderClassName("ColumnName");
+ expect(result).toBe("-columnn... | frontend/taipy-gui/src/components/Taipy/tableUtils.spec.ts | 19 | TypeScript | 0.429 | suggestion | 56 | 24 | 29 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/tableUtils.spec.ts
PR Title: Add css class to columns header
BEFORE CODE: import { generateHeaderClassName } from "./tableUtils";
describe("generateHeaderClassName", () => {
it("should generate a CSS class name ... | empty string or undefined should resolve to empty string | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Example for column name styling
from taipy.gui import Gui
import pandas as pd
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Occupation": ["Engineer", "Doctor", "Artist"]
})
# Define column properties
columns = [
{"field": "Name", "h... | with columns names showing spaces or transformed characters:
```py
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Occupation or Job": ["Engineer", "Doctor", "Artist"]
})
```
you can define style at the page level like this :
```py
page = Markdown("""4
<|table|d... | # Example for column name styling for header
import pandas as pd
from taipy.gui import Gui, Markdown
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Job or Occupation": ["Engineer", "Doctor", "Artist"]
})
# Page content with table and hea... | @@ -0,0 +1,26 @@
+# Example for column name styling
+
+from taipy.gui import Gui
+import pandas as pd
+
+# Sample data in DataFrame format
+df = pd.DataFrame({
+ "Name": ["Alice", "Bob", "Charlie"],
+ "Age": [25, 30, 35],
+ "Occupation": ["Engineer", "Doctor", "Artist"]
+})
+
+# Define column properties
+colum... | doc/gui/examples/controls/column_name_styling.py | 23 | Python | 0.786 | suggestion | 461 | 26 | 22 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/column_name_styling.py
PR Title: Add css class to columns header
BEFORE CODE: # Example for column name styling
from taipy.gui import Gui
import pandas as pd
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice"... | with columns names showing spaces or transformed characters:
```py
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Occupation or Job": ["Engineer", "Doctor", "Artist"]
})
```
you can define style at the page level like this :
```py
page = Markdown("""4
<|table|d... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Example for column name styling
from taipy.gui import Gui
import pandas as pd
from taipy.gui import Markdown
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Occupation": ["Engineer", "Doctor", "Artist"]
})
# Page content with table and h... | please change column name to be consistent with the style | # Example for column name styling for header
import pandas as pd
from taipy.gui import Gui, Markdown
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Job or Occupation": ["Engineer", "Doctor", "Artist"]
})
# Page content with table and hea... | @@ -0,0 +1,21 @@
+# Example for column name styling
+
+from taipy.gui import Gui
+import pandas as pd
+from taipy.gui import Markdown
+
+# Sample data in DataFrame format
+df = pd.DataFrame({
+ "Name": ["Alice", "Bob", "Charlie"],
+ "Age": [25, 30, 35],
+ "Occupation": ["Engineer", "Doctor", "Artist"] | doc/gui/examples/controls/column_name_styling.py | 11 | Python | 0.286 | style | 57 | 21 | 22 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/column_name_styling.py
PR Title: Add css class to columns header
BEFORE CODE: # Example for column name styling
from taipy.gui import Gui
import pandas as pd
from taipy.gui import Markdown
# Sample data in DataFrame format
df = pd.D... | please change column name to be consistent with the style | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# Example for column name styling
from taipy.gui import Gui
import pandas as pd
from taipy.gui import Markdown
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Job": ["Engineer", "Doctor", "Artist"]
})
# Page content with table and header s... | I don't get why you cannot have a column name with space in it so that we can show the classname transformation ? | # Example for column name styling for header
import pandas as pd
from taipy.gui import Gui, Markdown
# Sample data in DataFrame format
df = pd.DataFrame({
"Name": ["Alice", "Bob", "Charlie"],
"Age": [25, 30, 35],
"Job or Occupation": ["Engineer", "Doctor", "Artist"]
})
# Page content with table and hea... | @@ -0,0 +1,21 @@
+# Example for column name styling
+
+from taipy.gui import Gui
+import pandas as pd
+from taipy.gui import Markdown
+
+# Sample data in DataFrame format
+df = pd.DataFrame({
+ "Name": ["Alice", "Bob", "Charlie"],
+ "Age": [25, 30, 35],
+ "Job": ["Engineer", "Doctor", "Artist"] | doc/gui/examples/controls/column_name_styling.py | 11 | Python | 0.357 | question | 113 | 21 | 22 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/column_name_styling.py
PR Title: Add css class to columns header
BEFORE CODE: # Example for column name styling
from taipy.gui import Gui
import pandas as pd
from taipy.gui import Markdown
# Sample data in DataFrame format
df = pd.D... | I don't get why you cannot have a column name with space in it so that we can show the classname transformation ? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import AddIcon from "@mui/icons-material/Add";
import DataSaverOff from "@mui/icons-material/DataSaverOff";
import DataSaverOn from "@mui/icons-material/DataSaverOn";
import Download from "@mui/icons-material/Download";
import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton";
import Pape... | please remove those duplicated lines |
import AddIcon from "@mui/icons-material/Add";
import DataSaverOff from "@mui/icons-material/DataSaverOff";
import DataSaverOn from "@mui/icons-material/DataSaverOn";
import Download from "@mui/icons-material/Download";
import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton";
import Pape... | @@ -42,6 +42,13 @@ import Tooltip from "@mui/material/Tooltip";
import Typography from "@mui/material/Typography";
import { visuallyHidden } from "@mui/utils";
+import IconButton from "@mui/material/IconButton";
+import AddIcon from "@mui/icons-material/Add";
+import DataSaverOn from "@mui/icons-material/DataSaverO... | frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx | 26 | TypeScript | 0.143 | refactor | 36 | 51 | 51 | false | Add css class to columns header | 2,018 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | THEBOSS0369 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx
PR Title: Add css class to columns header
BEFORE CODE:
import AddIcon from "@mui/icons-material/Add";
import DataSaverOff from "@mui/icons-material/DataSaverOff";
import DataSaverOn from "@mui/ico... | please remove those duplicated lines | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 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... | we have our own formatting rules, we kindly request you to respect them | # 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... | @@ -25,6 +25,7 @@ class _DataAccessor(ABC):
_WS_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
def __init__(self, gui: "Gui") -> None:
+ | taipy/gui/data/data_accessor.py | 26 | Python | 0.214 | style | 71 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/data/data_accessor.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compl... | we have our own formatting rules, we kindly request you to respect them | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
new_row: t.Optional[t.List[t.Any]] = None,
) -> t.Optional[t.Any]:
pass
@abstractmethod
def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
pass
class _InvalidDataAccessor(_DataAccessor):
def __init__(self, gui: "Gui") -> None:
super().__init__(gui)
... | I think the callback should not be invoked here.
It should be invoked when evaluating the right `DataAccessor` for the data type.
this way, we can redirect to an existing `DataAccessor` and keep the `InvalidDataAccessor` for invalid data types. |
class _InvalidDataAccessor(_DataAccessor):
@staticmethod
def get_supported_classes() -> t.List[t.Type]:
return []
def get_data(
self, var_name: str, value: t.Any, payload: t.Dict[str, t.Any], data_format: _DataFormat
) -> t.Dict[str, t.Any]:
return {}
def get_col_types(sel... | @@ -66,34 +74,59 @@ def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
class _InvalidDataAccessor(_DataAccessor):
+
+ def __init__(self, gui: "Gui") -> None:
+ super().__init__(gui)
+
@staticmethod
def get_supported_classes() -> t.List[t.Type]:
return []
def get_d... | taipy/gui/data/data_accessor.py | 26 | Python | 0.786 | suggestion | 246 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/data/data_accessor.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: new_row: t.Optional[t.List[t.Any]] = None,
) -> t.Optional[t.Any]:
pass
@abstractm... | I think the callback should not be invoked here.
It should be invoked when evaluating the right `DataAccessor` for the data type.
this way, we can redirect to an existing `DataAccessor` and keep the `InvalidDataAccessor` for invalid data types. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
self.add_pages(pages)
if env_filename is not None:
self.__env_filename = env_filename
if libraries is not None:
for library in libraries:
Gui... | on_invalid_data should be handled the same way as on_action
- [definition](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L255)
- [assignment](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L2583) | "sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(self)
if page:
... | @@ -396,7 +396,28 @@ def __init__(
if libraries is not None:
for library in libraries:
Gui.add_library(library)
+ def set_on_invalid_data_callback(self, callback: t.Callable[[t.Any], t.Optional[t.Any]]): | taipy/gui/gui.py | 26 | Python | 0.643 | suggestion | 296 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
... | on_invalid_data should be handled the same way as on_action
- [definition](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L255)
- [assignment](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L2583) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
self.add_pages(pages)
if env_filename is not None:
self.__env_filename = env_filename
if libraries is not None:
for library in libraries:
Gui... | could use `_is_function(self.on_invalid_data)` | self.add_pages(pages)
if env_filename is not None:
self.__env_filename = env_filename
if libraries is not None:
for library in libraries:
Gui.add_library(library)
@staticmethod
def add_library(library: ElementLibrary) -> None:
"""Add a... | @@ -405,6 +412,30 @@ def __init__(
if libraries is not None:
for library in libraries:
Gui.add_library(library)
+ def set_on_invalid_data_callback(self, callback: t.Callable[[t.Any], t.Optional[t.Any]]):
+ """
+ Set the callback function to handle unsupported data... | taipy/gui/gui.py | 26 | Python | 0.286 | suggestion | 46 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
... | could use `_is_function(self.on_invalid_data)` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import inspect
import typing as t
from abc import ABC, abstractmethod
from .._warnings import _warn
from ..utils import _TaipyData
from .data_format import _DataFormat
if t.TYPE_CHECKING:
from ..gui import Gui
class _DataAccessor(ABC):
_WS_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
def __init__(self, gui: "... | please remove your formatting, it makes reading your changes complicated | import inspect
import typing as t
from abc import ABC, abstractmethod
from .._warnings import _warn
from ..utils import _TaipyData
from .data_format import _DataFormat
if t.TYPE_CHECKING:
from ..gui import Gui
class _DataAccessor(ABC):
_WS_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
def __init__(self, gui: "... | @@ -34,7 +34,11 @@ def get_supported_classes() -> t.List[t.Type]:
@abstractmethod
def get_data(
- self, var_name: str, value: t.Any, payload: t.Dict[str, t.Any], data_format: _DataFormat
+ self, | taipy/gui/data/data_accessor.py | 26 | Python | 0.286 | style | 72 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/data/data_accessor.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: import inspect
import typing as t
from abc import ABC, abstractmethod
from .._warnings import _warn
from .... | please remove your formatting, it makes reading your changes complicated | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
raise TypeError(
f"method {cls.__name__}.get_supported_classes returned an invalid value"
)
# check existence
inst: t.Optional[_DataAccessor] = None
for cl in classes:
inst = self.__access_4_type.get(cl)
if inst:
bre... | here we should check the availability of an accessor with the new type and return it.
| """Unregisters a DataAccessor type."""
if cls in self.__access_4_type:
del self.__access_4_type[cls]
def __get_instance(self, value: _TaipyData) -> _DataAccessor: # type: ignore
value = value.get() if isinstance(value, _TaipyData) else value
access = self.__access_4_typ... | @@ -132,17 +152,27 @@ def _register(self, cls: t.Type[_DataAccessor]) -> None:
for cl in classes:
self.__access_4_type[cl] = inst # type: ignore
- def __get_instance(self, value: _TaipyData) -> _DataAccessor: # type: ignore
+
+ def __get_instance(self, value: _TaipyData) ... | taipy/gui/data/data_accessor.py | 26 | Python | 0.429 | suggestion | 87 | 51 | 45 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/data/data_accessor.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: raise TypeError(
f"method {cls.__name__}.get_supported_classes returned an inva... | here we should check the availability of an accessor with the new type and return it.
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# check existence
inst: t.Optional[_DataAccessor] = None
for cl in classes:
inst = self.__access_4_type.get(cl)
if inst:
break
if inst is None:
try:
inst = cls(self.__gui)
except Exception as e:
... | no need for this line, the user will get the warning | raise TypeError(f"{cls.__name__}.get_supported_classes() returned an invalid value")
# check existence
inst: t.Optional[_DataAccessor] = None
for cl in classes:
inst = self.__access_4_type.get(cl)
if inst:
break
if inst is None:
... | @@ -137,6 +137,12 @@ def __get_instance(self, value: _TaipyData) -> _DataAccessor: # type: ignore
access = self.__access_4_type.get(type(value))
if access is None:
if value is not None:
+ transformed_value = self.__gui.handle_invalid_data(value)
+ if transfo... | taipy/gui/data/data_accessor.py | 26 | Python | 0.286 | suggestion | 52 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/data/data_accessor.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: # check existence
inst: t.Optional[_DataAccessor] = None
for cl in classes:
... | no need for this line, the user will get the warning | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
"meta",
"admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
... | make this method private by prefixing it with _ | "tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(self)
if page:
self.add_page(name=Gui.__ro... | @@ -406,6 +413,21 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def handle_invalid_data(self, value: t.Any) -> t.Optional[t.Any]: | taipy/gui/gui.py | 26 | Python | 0.071 | suggestion | 47 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: "meta",
"admonition",
"sane_lists",
"tables",
... | make this method private by prefixing it with _ | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
pass
def mock_taipy_data(value):
"""Helper to mock _TaipyData objects."""
mock_data = Mock(spec=_TaipyData)
mock_data.get.return_value = value
return mock_data
def test_custom_accessor(gui: Gui):
"""Test if get_data()... | ```suggestion
# Testing when accessor is registered
``` |
def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
pass
def mock_taipy_data(value):
"""Helper to mock _TaipyData objects."""
mock_data = Mock(spec=_TaipyData)
mock_data.get.return_value = value
return mock_data
def test_custom_accessor(gui: Gui):
"""Test if get_data()... | @@ -0,0 +1,79 @@
+import typing as t
+from unittest.mock import Mock
+
+from taipy.gui import Gui
+from taipy.gui.data.data_accessor import (
+ _DataAccessor,
+ _DataAccessors,
+ _InvalidDataAccessor,
+)
+from taipy.gui.data.data_format import _DataFormat
+from taipy.gui.utils.types import _TaipyData
+
+
+clas... | tests/gui/data/test_accessors.py | 26 | Python | 0.571 | suggestion | 61 | 34 | 34 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | Ujj1225 | Review this pull request change.
Language: Python
File: tests/gui/data/test_accessors.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE:
def to_csv(self, var_name: str, value: t.Any) -> t.Optional[str]:
pass
def mock_taipy_data(... | ```suggestion
# Testing when accessor is registered
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if w.category is not DeprecationWarning and w.category is not PendingDeprecationWarning:
keep_value = False
break
if not keep_value:
# do not send data that... | this is invoked only when the property is types as TaipyData | if w.category is not DeprecationWarning and w.category is not PendingDeprecationWarning:
keep_value = False
break
if not keep_value:
# do not send data that... | @@ -1143,6 +1143,41 @@ def __update_state_context(self, payload: dict):
for var, val in state_context.items():
self._update_var(var, val, True, forward=False)
+
+ @staticmethod
+ def set_unsupported_data_converter(converter: t.Optional[t.Callable[[t.Any], t.Any]]) -> None:
+ ... | taipy/gui/gui.py | 26 | Python | 0.357 | suggestion | 60 | 51 | 51 | false | Added a function to support data conversion if type is not supported by the taipy.gui.data module | 2,028 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Ujj1225 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Added a function to support data conversion if type is not supported by the taipy.gui.data module
BEFORE CODE: if w.category is not DeprecationWarning and w.category is not PendingDeprecationWarning:
... | this is invoked only when the property is types as TaipyData | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.