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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
"passé": "events",
"born": "births",
"né": "births",
"dead": "deaths",
"mort": "deaths",
}
user_agent = "https://taipy.io/demo"
# the list of messages
messages: list[tuple[str, str, str]] = [] # (Message id, message, sender)
# the users
users = [
["wikipedia", Icon("https://www.wikipedia.org/... | Can this be an inner function of *update_message_with_image()*?
Would clarify the code... | "passé": "events",
"born": "births",
"né": "births",
"dead": "deaths",
"mort": "deaths",
}
user_agent = "https://taipy.io/demo"
# The list of messages
messages: list[tuple[str, str, str]] = [] # (Message id, message, sender)
# The two users of this app
users = [
["wikipedia", Icon("https://ww... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.214 | suggestion | 90 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: "passé": "events",
"born": "births",
"né": "births",
"dead": "deaths",
"mort": "deaths",
}
user_agent = "https://taipy.io/demo"
# the list of message... | Can this be an inner function of *update_message_with_image()*?
Would clarify the 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. |
invoke_long_callback(
state=state,
user_function=update_message_with_image,
user_function_args=[
state.get_gui(),
get_state_id(state),
idx,
event.get("text", ""),
... | ```suggestion
# Append text to an existing message
``` | state=state,
user_function=update_message_with_image,
user_function_args=[
state.get_gui(),
get_state_id(state),
idx,
event.get("text", ""),
pages[0].get("thumbnail", {}) i... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 56 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: invoke_long_callback(
state=state,
user_function=update_message_with_image,
user_function_args=[
... | ```suggestion
# Append text to an existing message
``` | 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. |
],
)
# set or append a message returning its index in the list
def set_message(state: State, message: str, idx: t.Optional[int] = None):
if idx is not None and idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
else:... | ```suggestion
# Invoke the Wikipedia API. This is invoked by send_message()
``` | )
# Set a new message or append to an existing message.
# Return the message index in the list.
def set_message(state: State, message: str, idx: t.Optional[int] = None):
if idx is not None and idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], message, ... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: ],
)
# set or append a message returning its index in the list
def set_message(state: State, message: str, idx: t.Optional[int] = None):
... | ```suggestion
# Invoke the Wikipedia API. This is invoked by send_message()
``` | 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. |
msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
else:
idx = len(state.messages)
state.messages.append((f"{len(state.messages)}", message, users[0][0]))
state.refresh("messages")
return idx
# append to an existing message
def append_to_message(state... | ```suggestion
["Fetching information from Wikipedia ..."],
``` | msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
else:
idx = len(state.messages)
state.messages.append((f"{len(state.messages)}", message, users[0][0]))
state.refresh("messages")
return idx
# Append text to an existing message
def append_to_message(... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 72 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
else:
idx = len(state.messages)
state.messages.append((f"{le... | ```suggestion
["Fetching information from Wikipedia ..."],
``` | 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 request_wikipedia(gui: Gui, state_id: str, event_type: str, month: str, day: str):
# inform the user a request is posted
idx = invoke_callback(
gui,
state_id,
set_message,
["requesting Wikipedia ..."],
)
request = wiki_url.format(type=event_type, month=month, day=day)... | ```suggestion
[f"Wikipedia API call failed: {req.status_code}", idx],
``` | def request_wikipedia(gui: Gui, state_id: str, event_type: str, month: str, day: str):
# Let the user known that a query was sent
idx = invoke_callback(
gui,
state_id,
set_message,
["Fetching information from Wikipedia ..."],
)
request = wiki_url.format(type=event_type, m... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | bug | 87 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: def request_wikipedia(gui: Gui, state_id: str, event_type: str, month: str, day: str):
# inform the user a request is posted
idx = invoke_callback(
gui,
... | ```suggestion
[f"Wikipedia API call failed: {req.status_code}", idx],
``` | 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. |
request = wiki_url.format(type=event_type, month=month, day=day)
req = requests.get(request, headers={"accept": "application/json; charset=utf-8;", "User-Agent": user_agent})
# handle the response
if req.status_code == 200:
# display response
invoke_callback(
gui,
... | ```suggestion
# Display the request
``` | request = wiki_url.format(type=event_type, month=month, day=day)
req = requests.get(request, headers={"accept": "application/json; charset=utf-8;", "User-Agent": user_agent})
# Handle the response
if req.status_code == 200:
# Display the response
invoke_callback(
gui,
... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.429 | suggestion | 45 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: request = wiki_url.format(type=event_type, month=month, day=day)
req = requests.get(request, headers={"accept": "application/json; charset=utf-8;", "User-Agent": ... | ```suggestion
# Display the request
``` | 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. |
# display response
invoke_callback(
gui,
state_id,
update_message,
[req.json(), event_type, f"{day}/{month}", idx],
)
else:
# display error
invoke_callback(
gui,
state_id,
set_message,
... | ```suggestion
# Analyse request
``` | # Display the response
invoke_callback(
gui,
state_id,
update_message,
[req.json(), event_type, f"{day}/{month}", idx],
)
else:
# Display the error
invoke_callback(
gui,
state_id,
set_message,... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.429 | suggestion | 41 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: # display response
invoke_callback(
gui,
state_id,
update_message,
[req.json(), event_type, f"{day}/{month... | ```suggestion
# Analyse request
``` | 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. |
state_id,
set_message,
[f"requesting Wikipedia failed: {req.status_code}", idx],
)
# invoked by the on_action on the chat control when the user press the send button
def send_message(state: State, id: str, payload: dict):
args = payload.get("args", [])
# display re... | ```suggestion
for m in re.finditer(r"(\d+)", request):
```
Shorted and less constrained... may be not what you really want. | state_id,
set_message,
[f"Wikipedia API call failed: {req.status_code}", idx],
)
# Invoked by the 'on_action' callback of the chat control when the user presses the Send button
def send_message(state: State, id: str, payload: dict):
args = payload.get("args", [])
#... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.714 | suggestion | 130 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: state_id,
set_message,
[f"requesting Wikipedia failed: {req.status_code}", idx],
)
# invoked by the on_action on the chat co... | ```suggestion
for m in re.finditer(r"(\d+)", request):
```
Shorted and less constrained... may be not what you really want. | 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. |
state.messages.append((f"{len(state.messages)}", args[2], args[3]))
state.refresh("messages")
# analyse request
request = args[2].lower()
type_event = None
for word in event_types:
if word in request:
type_event = event_types[word]
break
type_event = type_eve... | ```suggestion
# Process the request
``` | state.messages.append((f"{len(state.messages)}", args[2], args[3]))
state.refresh("messages")
# Analyse the request
request = args[2].lower()
type_event = None
for word in event_types:
if word in request:
type_event = event_types[word]
break
type_event = type... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.429 | suggestion | 45 | 40 | 40 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: state.messages.append((f"{len(state.messages)}", args[2], args[3]))
state.refresh("messages")
# analyse request
request = args[2].lower()
type_event ... | ```suggestion
# Process the request
``` | 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. |
break
type_event = type_event if type_event else "events"
month = None
day = None
for m in re.finditer(r"(\d\d?)", request):
if month is None:
month = m.group()
elif day is None:
day = m.group()
break
if month is None:
month = ... | Do you really need this 'height'? | break
type_event = type_event if type_event else "events"
month = None
day = None
for m in re.finditer(r"(\d\d?)", request):
if month is None:
month = m.group()
elif day is None:
day = m.group()
break
if month is None:
month = ... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.071 | question | 33 | 31 | 31 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: break
type_event = type_event if type_event else "events"
month = None
day = None
for m in re.finditer(r"(\d\d?)", request):
if month... | Do you really need this 'height'? | 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. |
day = None
for m in re.finditer(r"(\d\d?)", request):
if month is None:
month = m.group()
elif day is None:
day = m.group()
break
if month is None:
month = f"{datetime.datetime.now().month}"
if day is None:
day = f"{datetime.datetime.no... | ```suggestion
Gui(page).run(title="Chat - Ask Wikipedia")
``` | day = None
for m in re.finditer(r"(\d\d?)", request):
if month is None:
month = m.group()
elif day is None:
day = m.group()
break
if month is None:
month = f"{datetime.datetime.now().month}"
if day is None:
day = f"{datetime.datetime.no... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 67 | 27 | 27 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: day = None
for m in re.finditer(r"(\d\d?)", request):
if month is None:
month = m.group()
elif day is None:
day = m.group(... | ```suggestion
Gui(page).run(title="Chat - Ask Wikipedia")
``` | 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. |
# Do not share the message list with other users
state.messages = []
# add an image if one is present in the wikipedia returned json
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.messages[idx][1]
pos = msg_content.find(text)
if pos > -1:
... | ```suggestion
# Invoked by query_wikipedia()
``` | # Messages are for this user only
state.messages = []
# Add the image if there is one in the Wikipedia returned data
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.messages[idx][1]
if (pos := msg_content.find(text)) > -1:
msg_content = ms... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: # Do not share the message list with other users
state.messages = []
# add an image if one is present in the wikipedia returned json
def add_image_to_message(st... | ```suggestion
# Invoked by query_wikipedia()
``` | 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 an image if one is present in the wikipedia returned json
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.messages[idx][1]
pos = msg_content.find(text)
if pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n... | ```suggestion
set_message(state, f"{event_type} for {for_date}:\n", idx)
``` | # Add the image if there is one in the Wikipedia returned data
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.messages[idx][1]
if (pos := msg_content.find(text)) > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + ms... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.714 | suggestion | 86 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: # add an image if one is present in the wikipedia returned json
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.... | ```suggestion
set_message(state, f"{event_type} for {for_date}:\n", idx)
``` | 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 an image if one is present in the wikipedia returned json
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state.messages[idx][1]
pos = msg_content.find(text)
if pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n:
msg_content: str = state.messages[idx][1]
if (pos := msg_content.find(text)) > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + m... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 54 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE:
# add an image if one is present in the wikipedia returned json
def add_image_to_message(state: State, idx: int, text: str, image_url: str):
msg_content: str = state... | ```suggestion
# Initial response content
``` | 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. |
pos = msg_content.find(text)
if pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
set_message(state, msg_content, idx)
# invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, messa... | ```suggestion
time.sleep(0.2) # Apply the typewriter effect
``` | if (pos := msg_content.find(text)) > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
set_message(state, msg_content, idx)
# Invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_id... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.714 | suggestion | 77 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: pos = msg_content.find(text)
if pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
... | ```suggestion
time.sleep(0.2) # Apply the typewriter effect
``` | 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 pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
set_message(state, msg_content, idx)
# invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_idx: int, text: str, image: di... | ```suggestion
# Update response text
``` | msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
set_message(state, msg_content, idx)
# Invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_idx: int, text: str, image: dict):
if src :... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 54 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: if pos > -1:
msg_content = msg_content[: pos + len(text)] + f"\n\n" + msg_content[pos + len(text) :]
set_message(state, msg_cont... | ```suggestion
# Update response text
``` | 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. |
set_message(state, msg_content, idx)
# invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_idx: int, text: str, image: dict):
if src := image.get("source"):
time.sleep(0.2) # to show the streaming effect
invoke_callback(
gui... | ```suggestion
# Invoke update_message_with_image() in a separated thread
``` |
# Invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_idx: int, text: str, image: dict):
if src := image.get("source"):
time.sleep(0.2) # Apply the typewriter effect
invoke_callback(
gui,
state_id,
add_image_... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.714 | suggestion | 90 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: set_message(state, msg_content, idx)
# invoked by update_message through a thread
def update_message_with_image(gui: Gui, state_id: str, message_idx: int, text:... | ```suggestion
# Invoke update_message_with_image() in a separated thread
``` | 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. |
# invoked by request_wikipedia
def update_message(state: State, json, event_type: str, for_date: str, idx: int):
if isinstance(json, dict):
# response initial message
set_message(state, f"{event_type} for {for_date}: \n", idx)
for event in json.get(event_type, []):
time.sleep(0... | ```suggestion
# Set a new message or append to an existing message.
# Return the message index in the list.
``` | # Invoked by query_wikipedia()
def update_message(state: State, json, event_type: str, for_date: str, idx: int):
if isinstance(json, dict):
# Initial response content
set_message(state, f"{event_type} for {for_date}:\n", idx)
for event in json.get(event_type, []):
time.sleep(0.2... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.714 | suggestion | 114 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE:
# invoked by request_wikipedia
def update_message(state: State, json, event_type: str, for_date: str, idx: int):
if isinstance(json, dict):
# response initia... | ```suggestion
# Set a new message or append to an existing message.
# Return the message index in the list.
``` | 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. |
# set or append a message returning its index in the list
def set_message(state: State, message: str, idx: t.Optional[int] = None):
if idx is not None and idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
else:
idx = len(state.messages... | ```suggestion
# Let the user known that a query was sent
``` |
# Set a new message or append to an existing message.
# Return the message index in the list.
def set_message(state: State, message: str, idx: t.Optional[int] = None):
if idx is not None and idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], message, msg[2])
els... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.643 | suggestion | 66 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE:
# set or append a message returning its index in the list
def set_message(state: State, message: str, idx: t.Optional[int] = None):
if idx is not None and idx < len... | ```suggestion
# Let the user known that a query was sent
``` | 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. |
state.messages.append((f"{len(state.messages)}", message, users[0][0]))
state.refresh("messages")
return idx
# append to an existing message
def append_to_message(state: State, message: str, idx: int):
if idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (m... | ```suggestion
# Handle the response
``` | state.messages.append((f"{len(state.messages)}", message, users[0][0]))
state.refresh("messages")
return idx
# Append text to an existing message
def append_to_message(state: State, message: str, idx: int):
if idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx]... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 45 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: state.messages.append((f"{len(state.messages)}", message, users[0][0]))
state.refresh("messages")
return idx
# append to an existing message
def append_... | ```suggestion
# Handle the response
``` | 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. |
return idx
# append to an existing message
def append_to_message(state: State, message: str, idx: int):
if idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], f"{msg[1]}{message}", msg[2])
state.refresh("messages")
return idx
# request the wikipedi... | ```suggestion
# Display the response
``` | return idx
# Append text to an existing message
def append_to_message(state: State, message: str, idx: int):
if idx < len(state.messages):
msg = state.messages[idx]
state.messages[idx] = (msg[0], f"{msg[1]}{message}", msg[2])
state.refresh("messages")
return idx
# Invoke the Wiki... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: return idx
# append to an existing message
def append_to_message(state: State, message: str, idx: int):
if idx < len(state.messages):
msg = state.messag... | ```suggestion
# Display the response
``` | 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. |
state.refresh("messages")
return idx
# request the wikipedia API, invoked by send_message
def request_wikipedia(gui: Gui, state_id: str, event_type: str, month: str, day: str):
# inform the user a request is posted
idx = invoke_callback(
gui,
state_id,
set_message,
... | ```suggestion
# Display the error
``` | state.refresh("messages")
return idx
# Invoke the Wikipedia API. This is invoked by send_message()
def request_wikipedia(gui: Gui, state_id: str, event_type: str, month: str, day: str):
# Let the user known that a query was sent
idx = invoke_callback(
gui,
state_id,
set_mes... | @@ -0,0 +1,192 @@
+# 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 ... | doc/gui/examples/controls/chat-streaming.py | 26 | Python | 0.571 | suggestion | 47 | 51 | 51 | false | chat streaming example | 2,213 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/controls/chat-streaming.py
PR Title: chat streaming example
BEFORE CODE: state.refresh("messages")
return idx
# request the wikipedia API, invoked by send_message
def request_wikipedia(gui: Gui, state_id: str, event_type: str, mo... | ```suggestion
# Display the error
``` | 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. |
freeSolo
autoSelect
disableClearable
options={colLov}
value={val || ""}
onChange={onValueAutoComp}
renderInput={(params) => (
... | Are tooltip text usually NOT capitalized? | freeSolo
autoSelect
disableClearable
options={colLov}
value={val || ""}
onChange={onValueAutoComp}
renderInput={(params) => (
... | @@ -305,14 +304,11 @@ const FilterRow = (props: FilterRowProps) => {
slotProps={{
input: {
endAdornment: (
- <Switch
- onChange={toggleMatchCase}
- ... | frontend/taipy-gui/src/components/Taipy/TableFilter.tsx | 26 | TypeScript | 0.071 | question | 41 | 51 | 51 | false | case sensitive icon in filter | 2,216 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/TableFilter.tsx
PR Title: case sensitive icon in filter
BEFORE CODE: freeSolo
autoSelect
disableClearable
options={colLo... | Are tooltip text usually NOT capitalized? | 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. |
freeSolo
autoSelect
disableClearable
options={colLov}
value={val || ""}
onChange={onValueAutoComp}
renderInput={(params) => (
... | ```suggestion
<Tooltip title={matchCase ? "Case sensitive" : "Case insensitive"}>
``` | freeSolo
autoSelect
disableClearable
options={colLov}
value={val || ""}
onChange={onValueAutoComp}
renderInput={(params) => (
... | @@ -305,14 +304,11 @@ const FilterRow = (props: FilterRowProps) => {
slotProps={{
input: {
endAdornment: (
- <Switch
- onChange={toggleMatchCase}
- ... | frontend/taipy-gui/src/components/Taipy/TableFilter.tsx | 26 | TypeScript | 0.714 | security | 123 | 51 | 51 | false | case sensitive icon in filter | 2,216 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/TableFilter.tsx
PR Title: case sensitive icon in filter
BEFORE CODE: freeSolo
autoSelect
disableClearable
options={colLo... | ```suggestion
<Tooltip title={matchCase ? "Case sensitive" : "Case insensitive"}>
``` | 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
Gui(page).run(title="Layout - Fit to content")
``` | # 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.
# ------... | @@ -0,0 +1,33 @@
+# 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/blocks/layout_fit/markdown.py | 26 | Python | 0.571 | suggestion | 70 | 27 | 27 | false | layout fit example | 2,223 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/blocks/layout_fit/markdown.py
PR Title: layout fit example
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 CONDITIONS ... | ```suggestion
Gui(page).run(title="Layout - Fit to content")
``` | 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="Layout - Fit to content")
``` | #
# 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/blocks/layout_fit/builder.py | 26 | Python | 0.571 | suggestion | 70 | 27 | 27 | false | layout fit example | 2,223 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: doc/gui/examples/blocks/layout_fit/builder.py
PR Title: layout fit example
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="Layout - Fit to content")
``` | 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 ... | a bit invasive ...
Any other way ? | * 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 ... | @@ -0,0 +1,97 @@
+/*
+ * Copyright 2021-2024 Avaiga Private Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unles... | frontend/taipy-gui/src/hooks/useLocalStorageWithEvent.ts | 26 | TypeScript | 0.071 | question | 35 | 51 | 29 | false | get localstorage support (#2190) | 2,234 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | dinhlongviolin1 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/hooks/useLocalStorageWithEvent.ts
PR Title: get localstorage support (#2190)
BEFORE CODE: * Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file e... | a bit invasive ...
Any other way ? | 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. |
callback_on_status(True, function_result=res)
except Exception as e:
callback_on_status(False, e, user_function.__name__)
def thread_status(name: str, period_s: float, count: int):
active_thread = next((t for t in threading.enumerate() if t.name == name), None)
if ac... | Line skip here.
Can this be called anytime in the app life cycle?
I suspect we should add more details on invoking this API (with the complexity of the keys type). | try:
res = user_function(*uf_args)
callback_on_status(True, function_result=res)
except Exception as e:
callback_on_status(False, e, user_function.__name__)
def thread_status(name: str, period_s: float, count: int):
active_thread = next((t for t in thread... | @@ -440,3 +440,17 @@ def thread_status(name: str, period_s: float, count: int):
thread.start()
if isinstance(period, int) and period >= 500 and callable(user_status_function):
thread_status(thread.name, period / 1000.0, 0)
+
+
+def get_local_storage(state: State, *keys: str) -> t.Optional[t.Union[str... | taipy/gui/gui_actions.py | 26 | Python | 0.571 | performance | 169 | 29 | 43 | false | get localstorage support (#2190) | 2,234 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | dinhlongviolin1 | Review this pull request change.
Language: Python
File: taipy/gui/gui_actions.py
PR Title: get localstorage support (#2190)
BEFORE CODE: callback_on_status(True, function_result=res)
except Exception as e:
callback_on_status(False, e, user_function.__name__)
def thread_status(na... | Line skip here.
Can this be called anytime in the app life cycle?
I suspect we should add more details on invoking this API (with the complexity of the keys 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... | Line skip.
Explanations are pretty weak. Let's spend some time together on this one. | callback_on_status(False, e, user_function.__name__)
def thread_status(name: str, period_s: float, count: int):
active_thread = next((t for t in threading.enumerate() if t.name == name), None)
if active_thread:
callback_on_status(count)
threading.Timer(period_s, ... | @@ -440,3 +440,17 @@ def thread_status(name: str, period_s: float, count: int):
thread.start()
if isinstance(period, int) and period >= 500 and callable(user_status_function):
thread_status(thread.name, period / 1000.0, 0)
+
+
+def get_local_storage(state: State, *keys: str) -> t.Optional[t.Union[str... | taipy/gui/gui_actions.py | 26 | Python | 0.214 | suggestion | 87 | 457 | 39 | false | get localstorage support (#2190) | 2,234 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | dinhlongviolin1 | Review this pull request change.
Language: Python
File: taipy/gui/gui_actions.py
PR Title: get localstorage support (#2190)
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.... | Line skip.
Explanations are pretty weak. Let's spend some time together on this one. | 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. |
}
try {
return {
col: columns[colId].dfid,
action: act,
value:
typeof val === "string"
? colType === "number"
? parseFloat(val)
: colType === "b... | why `fieldHeaderTooltip=""` here and not in sort ? | }
try {
return {
col: columns[colId].dfid,
action: act,
value:
typeof val === "string"
? colType === "number"
? parseFloat(val)
: colType === "b... | @@ -114,22 +118,22 @@ const getFilterDesc = (
? colType === "number"
? parseFloat(val)
: colType === "boolean"
- ? val === "1"
- : colType === "date"
- ? ge... | frontend/taipy-gui/src/components/Taipy/TableFilter.tsx | 26 | TypeScript | 0.357 | question | 50 | 51 | 51 | false | Better UI for Core selector elements | 2,237 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | FabienLelaquais | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/TableFilter.tsx
PR Title: Better UI for Core selector elements
BEFORE CODE: }
try {
return {
col: columns[colId].dfid,
action: act,
value:
... | why `fieldHeaderTooltip=""` here and not in sort ? | 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._PATH_KEY,
self._DEFAULT_PATH_KEY,
self._DEFAULT_DATA_KEY,
self._IS_GENERATED_KEY,
self._HAS_HEADER_PROPERTY,
self._EXPOSED_TYPE_PROPERTY,
self.__ENCODING_KEY,
}
)
... | ```suggestion
self.track_edit(editor_id=editor_id, timestamp=datetime.now())
``` | {
self._PATH_KEY,
self._DEFAULT_PATH_KEY,
self._DEFAULT_DATA_KEY,
self._IS_GENERATED_KEY,
self._HAS_HEADER_PROPERTY,
self._EXPOSED_TYPE_PROPERTY,
self.__ENCODING_KEY,
}
)
... | @@ -116,16 +115,17 @@ def __init__(
def storage_type(cls) -> str:
return cls.__STORAGE_TYPE
- def write_with_column_names(self, data: Any, columns: Optional[List[str]] = None, job_id: Optional[JobId] = None):
+ def write_with_column_names(self, data: Any, columns: Optional[List[str]] = None, edito... | taipy/core/data/csv.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | CLean parameters for the datanode track_edit method. | 2,240 | Avaiga/taipy | 12,680 | Python | jrobinAV | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/data/csv.py
PR Title: CLean parameters for the datanode track_edit method.
BEFORE CODE: {
self._PATH_KEY,
self._DEFAULT_PATH_KEY,
self._DEFAULT_DATA_KEY,
self._IS_GENERATED_... | ```suggestion
self.track_edit(editor_id=editor_id, timestamp=datetime.now())
``` | 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. |
editor_id: Optional[str] = None,
timestamp: Optional[datetime] = None,
comment: Optional[str] = None,
**options: Dict[str, Any]):
"""Creates and adds a new entry in the edits attribute without writing the data.
Arguments:
... | `type: ignore` should be banned :-)
at least it should give a list of errors `type: ignore[...]`
but a cast would be better ifg t is a cast issue ;-) | job_id: Optional[str] = None,
editor_id: Optional[str] = None,
timestamp: Optional[datetime] = None,
comment: Optional[str] = None,
**options: Any):
"""Creates and adds a new entry in the edits attribute without writi... | @@ -447,20 +452,35 @@ def write(self, data, job_id: Optional[JobId] = None, **kwargs: Dict[str, Any]):
self.unlock_edit()
_DataManagerFactory._build_manager()._set(self)
- def track_edit(self, **options):
+ def track_edit(self,
+ job_id: Optional[str] = None,
+ ... | taipy/core/data/data_node.py | 26 | Python | 0.714 | suggestion | 151 | 51 | 51 | false | CLean parameters for the datanode track_edit method. | 2,240 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/data/data_node.py
PR Title: CLean parameters for the datanode track_edit method.
BEFORE CODE: editor_id: Optional[str] = None,
timestamp: Optional[datetime] = None,
comment: Optional[str] = No... | `type: ignore` should be banned :-)
at least it should give a list of errors `type: ignore[...]`
but a cast would be better ifg t is a cast issue ;-) | 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. |
Returns:
The data referenced by this data node.
Raises:
NoData^: If the data has not been written yet.
"""
if not self.last_edit_date:
raise NoData(f"Data node {self.id} from config {self.config_id} has not been written yet.")
return self._re... | kwargs shouldn't be typed like this, more like `**kwargs: Any`
https://stackoverflow.com/questions/37031928/type-annotations-for-args-and-kwargs | """Read the data referenced by this data node.
Returns:
The data referenced by this data node.
Raises:
NoData^: If the data has not been written yet.
"""
if not self.last_edit_date:
raise NoData(f"Data node {self.id} from config {self.config_... | @@ -415,19 +420,19 @@ def read(self) -> Any:
)
return None
- def append(self, data, job_id: Optional[JobId] = None, **kwargs: Dict[str, Any]):
+ def append(self, data, editor_id: Optional[str] = None, **kwargs: Dict[str, Any]): | taipy/core/data/data_node.py | 26 | Python | 0.714 | bug | 145 | 51 | 51 | false | CLean parameters for the datanode track_edit method. | 2,240 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/data/data_node.py
PR Title: CLean parameters for the datanode track_edit method.
BEFORE CODE:
Returns:
The data referenced by this data node.
Raises:
NoData^: If the data has not been written yet.
""... | kwargs shouldn't be typed like this, more like `**kwargs: Any`
https://stackoverflow.com/questions/37031928/type-annotations-for-args-and-kwargs | 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. |
Returns:
The data referenced by this data node. None if the data has not been written yet.
"""
try:
return self.read_or_raise()
except NoData:
self._logger.warning(
f"Data node {self.id} from config {self.config_id} is being read but h... | will the current editor_id (set by lock_edit) be picked up automagically or is it not needed ? | """Read the data referenced by this data node.
Returns:
The data referenced by this data node. None if the data has not been written yet.
"""
try:
return self.read_or_raise()
except NoData:
self._logger.warning(
f"Data node {se... | @@ -415,19 +420,19 @@ def read(self) -> Any:
)
return None
- def append(self, data, job_id: Optional[JobId] = None, **kwargs: Dict[str, Any]):
+ def append(self, data, editor_id: Optional[str] = None, **kwargs: Dict[str, Any]):
"""Append some data to this data node.
... | taipy/core/data/data_node.py | 26 | Python | 0.214 | question | 94 | 51 | 51 | false | CLean parameters for the datanode track_edit method. | 2,240 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/data/data_node.py
PR Title: CLean parameters for the datanode track_edit method.
BEFORE CODE:
Returns:
The data referenced by this data node. None if the data has not been written yet.
"""
try:
return... | will the current editor_id (set by lock_edit) be picked up automagically or is it not 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. |
# 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... | 'create_chart()', really? What about '_identity()' or something less significant? | # 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... | tests/gui/gui_specific/test_evaluator.py | 16 | Python | 0.214 | question | 81 | 26 | 26 | false | add current scope variables when evaluating an expression | 2,250 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: tests/gui/gui_specific/test_evaluator.py
PR Title: add current scope variables when evaluating an expression
BEFORE CODE: # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file... | 'create_chart()', really? What about '_identity()' or something less significant? | 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. |
f" `{data_node_config_id}` must be populated with a List value.",
)
if data_node_config_id != DataNodeConfig._DEFAULT_KEY:
properties_to_check_at_least_one = [
DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY,
DataNod... | I know that it was already the case before, but I actually believe it is buggy.
Callables include functions, classes, and lambdas.
I am not sure lambdas are accepted as they must be serializable (JSON and TOML). Can you check with a unit test? | None,
f"DataNodeConfig `{data_node_config_id}` is missing the required "
f"property `{required_property}` for type `{storage_type}`.",
)
def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_node_c... | @@ -196,28 +196,43 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
- def _check_callable(self, data_node_config_id: str, data_node_config: DataNodeConfi... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.571 | bug | 246 | 51 | 51 | false | Feature/#521 refactor code for databricks integration | 2,284 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_data_node_config_checker.py
PR Title: Feature/#521 refactor code for databricks integration
BEFORE CODE: f" `{data_node_config_id}` must be populated with a List value.",
)
if data... | I know that it was already the case before, but I actually believe it is buggy.
Callables include functions, classes, and lambdas.
I am not sure lambdas are accepted as they must be serializable (JSON and TOML). Can you check with a unit test? | 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._error(
prop_key,
prop_value,
f"`{prop_key}` field of DataNodeConfig"
f" `{data_node_config_id}` must be populated with a List value.",
)
if data_node_config_id != DataNod... | this can be turned into a class attribute instead of a function, as we were using function, I just went with it so can quickly implement it | )
else:
self._error(
required_property,
None,
f"DataNodeConfig `{data_node_config_id}` is missing the required "
f"property `{required_property}` for type `{storage_typ... | @@ -196,28 +196,43 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
- def _check_callable(self, data_node_config_id: str, data_node_config: DataNodeConfi... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.429 | suggestion | 139 | 51 | 51 | false | Feature/#521 refactor code for databricks integration | 2,284 | Avaiga/taipy | 12,680 | Python | toan-quach | toan-quach | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_data_node_config_checker.py
PR Title: Feature/#521 refactor code for databricks integration
BEFORE CODE: self._error(
prop_key,
prop_value,
... | this can be turned into a class attribute instead of a function, as we were using function, I just went with it so can quickly implement 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. |
self._error(
", ".join(properties_to_check_at_least_one),
None,
f"Either `{DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY}` field or "
f"`{DataNodeConfig._OPTIONAL_WRITE_FUNCTION_GENERIC_PROPERTY}` field of "
... | The sentence is strange as a lambda is a Callable (can be called with the `()` operator).
```suggestion
f" populated with a serializable Callable function but not a lambda.",
``` | self._error(
", ".join(properties_to_check_at_least_one),
None,
f"Either `{DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY}` field or "
f"`{DataNodeConfig._OPTIONAL_WRITE_FUNCTION_GENERIC_PROPERTY}` field of "
... | @@ -196,28 +217,25 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
- def _check_callable(self, data_node_config_id: str, data_node_config: DataNodeConfi... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.786 | suggestion | 209 | 39 | 39 | false | Feature/#521 refactor code for databricks integration | 2,284 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_data_node_config_checker.py
PR Title: Feature/#521 refactor code for databricks integration
BEFORE CODE: self._error(
", ".join(properties_to_check_at_least_one),
None,
... | The sentence is strange as a lambda is a Callable (can be called with the `()` operator).
```suggestion
f" populated with a serializable Callable function but not a lambda.",
``` | 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._collector = IssueCollector()
Config.check()
assert len(Config._collector.errors) == 1
config._sections[DataNodeConfig.name]["new"].storage_type = "generic"
config._sections[DataNodeConfig.name]["new"].properties = {"write_fct": print, "read_fct": print}
C... | BTW, this deserves:
- an entry in the release notes as an improvement of the checkers for checking the property types.
- A new item in the list: https://docs.taipy.io/en/develop/userman/advanced_features/configuration/config-checker/
| Config._collector = IssueCollector()
Config.check()
assert len(Config._collector.errors) == 1
config._sections[DataNodeConfig.name]["new"].storage_type = "generic"
config._sections[DataNodeConfig.name]["new"].properties = {"write_fct": print, "read_fct": print}
C... | @@ -581,6 +581,22 @@ def test_check_callable_properties(self, caplog):
Config.check()
assert len(Config._collector.errors) == 0
+ config._sections[DataNodeConfig.name]["new"].storage_type = "generic"
+ config._sections[DataNodeConfig.name]["new"].properties = {"write_fct": lambda x: x,... | tests/core/config/checkers/test_data_node_config_checker.py | 26 | Python | 0.643 | suggestion | 242 | 51 | 51 | false | Feature/#521 refactor code for databricks integration | 2,284 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: tests/core/config/checkers/test_data_node_config_checker.py
PR Title: Feature/#521 refactor code for databricks integration
BEFORE CODE: Config._collector = IssueCollector()
Config.check()
assert len(Config._collector.errors) ==... | BTW, this deserves:
- an entry in the release notes as an improvement of the checkers for checking the property types.
- A new item in the list: https://docs.taipy.io/en/develop/userman/advanced_features/configuration/config-checker/
| 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 has_input and not has_output:
g.add_node(task)
return g
graph = build_dag()
dag = _DAG(graph)
pos = {node.entity: (node.x, node.y) for node in dag.nodes.values()}
labls = {node.entity: node.entity.id for node in dag.nodes.values()}
... | ```suggestion
logger.info(f"The graph image of the scenario configuration `{self.id}` is exported: {path}")
``` | if not has_input and not has_output:
g.add_node(task)
return g
graph = build_dag()
dag = _DAG(graph)
pos = {node.entity: (node.x, node.y) for node in dag.nodes.values()}
labls = {node.entity: node.entity.id for node in dag.nodes.values()}
... | @@ -373,3 +372,64 @@ def _set_default_configuration(
)
Config._register(section)
return Config.sections[ScenarioConfig.name][_Config.DEFAULT_KEY]
+
+ def draw(self, file_path: Optional[str]=None) -> None:
+ """
+ Export the scenario configuration graph as a PNG file.
+
+ ... | taipy/core/config/scenario_config.py | 26 | Python | 0.714 | suggestion | 121 | 27 | 27 | false | Implement a draw method in scenario config for debug purpose. | 2,289 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/config/scenario_config.py
PR Title: Implement a draw method in scenario config for debug purpose.
BEFORE CODE: if not has_input and not has_output:
g.add_node(task)
return g
graph = build_dag(... | ```suggestion
logger.info(f"The graph image of the scenario configuration `{self.id}` is exported: {path}")
``` | 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... | The `_VALID_STRING_EXPOSED_TYPES` is used when serialize and deserialize the `exposed_type` property.
The `_VALID_OTHER_EXPOSED_TYPES` is defined here but not used anywhere. | # 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... | @@ -26,6 +26,9 @@ class _TabularDataNodeMixin(object):
_EXPOSED_TYPE_PANDAS = "pandas"
_EXPOSED_TYPE_MODIN = "modin" # Deprecated in favor of pandas since 3.1.0
_VALID_STRING_EXPOSED_TYPES = [_EXPOSED_TYPE_PANDAS, _EXPOSED_TYPE_NUMPY]
+ _VALID_OTHER_EXPOSED_TYPES = [pd.DataFrame, np.ndarray] | taipy/core/data/_tabular_datanode_mixin.py | 26 | Python | 0.714 | suggestion | 176 | 51 | 51 | false | feature/#398-expand-exposed-type-parameter | 2,296 | Avaiga/taipy | 12,680 | Python | trgiangdo | sohamkumar05 | Review this pull request change.
Language: Python
File: taipy/core/data/_tabular_datanode_mixin.py
PR Title: feature/#398-expand-exposed-type-parameter
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 ... | The `_VALID_STRING_EXPOSED_TYPES` is used when serialize and deserialize the `exposed_type` property.
The `_VALID_OTHER_EXPOSED_TYPES` is defined here but not used anywhere. | 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. |
_STORAGE_TYPE_VALUE_JSON = "json"
_STORAGE_TYPE_VALUE_PARQUET = "parquet"
_STORAGE_TYPE_VALUE_S3_OBJECT = "s3_object"
_DEFAULT_STORAGE_TYPE = _STORAGE_TYPE_VALUE_PICKLE
_ALL_STORAGE_TYPES = [
_STORAGE_TYPE_VALUE_PICKLE,
_STORAGE_TYPE_VALUE_SQL_TABLE,
_STORAGE_TYPE_VALUE_SQL,... | The `_EXPOSED_TYPE_LIST` is defined here but is not used anywhere.
Besides, it is vague to have `List` as an exposed type, because it can be a list of anything (list of string, dataframe, ndarray, objects, etc). | _STORAGE_TYPE_VALUE_JSON = "json"
_STORAGE_TYPE_VALUE_PARQUET = "parquet"
_STORAGE_TYPE_VALUE_S3_OBJECT = "s3_object"
_DEFAULT_STORAGE_TYPE = _STORAGE_TYPE_VALUE_PICKLE
_ALL_STORAGE_TYPES = [
_STORAGE_TYPE_VALUE_PICKLE,
_STORAGE_TYPE_VALUE_SQL_TABLE,
_STORAGE_TYPE_VALUE_SQL,... | @@ -71,11 +74,17 @@ class DataNodeConfig(Section):
_EXPOSED_TYPE_PANDAS = "pandas"
_EXPOSED_TYPE_MODIN = "modin" # Deprecated in favor of pandas since 3.1.0
_EXPOSED_TYPE_NUMPY = "numpy"
+ _EXPOSED_TYPE_PANDAS_DATAFRAME = pandas.DataFrame
+ _EXPOSED_TYPE_NUMPY_NDARRAY = numpy.ndarray
+ _EXPOSED... | taipy/core/config/data_node_config.py | 26 | Python | 0.786 | suggestion | 214 | 51 | 51 | false | feature/#398-expand-exposed-type-parameter | 2,296 | Avaiga/taipy | 12,680 | Python | trgiangdo | sohamkumar05 | Review this pull request change.
Language: Python
File: taipy/core/config/data_node_config.py
PR Title: feature/#398-expand-exposed-type-parameter
BEFORE CODE: _STORAGE_TYPE_VALUE_JSON = "json"
_STORAGE_TYPE_VALUE_PARQUET = "parquet"
_STORAGE_TYPE_VALUE_S3_OBJECT = "s3_object"
_DEFAULT_STORAGE_TYP... | The `_EXPOSED_TYPE_LIST` is defined here but is not used anywhere.
Besides, it is vague to have `List` as an exposed type, because it can be a list of anything (list of string, dataframe, ndarray, objects, etc). | 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... | The best I think would be to change the path not to confuse users about what we're looking for and where.
I also rename the image file itself for simplicity.
```suggestion
logo_path = self.get_resource("icons/logo.png")
``` | # 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... | @@ -10,11 +10,17 @@
# specific language governing permissions and limitations under the License.
from taipy.gui.extension import Element, ElementLibrary, ElementProperty, PropertyType
+import base64
class ExampleLibrary(ElementLibrary):
def __init__(self) -> None:
# Initialize the set of visual e... | doc/gui/extension/example_library/example_library.py | 20 | Python | 0.857 | suggestion | 235 | 45 | 45 | false | Adding example for get_resource for taipy extension | 2,297 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/extension/example_library/example_library.py
PR Title: Adding example for get_resource for taipy extension
BEFORE CODE: # Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use thi... | The best I think would be to change the path not to confuse users about what we're looking for and where.
I also rename the image file itself for simplicity.
```suggestion
logo_path = self.get_resource("icons/logo.png")
``` | 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. |
("linear", PropertyType.boolean, False),
("show_value", PropertyType.boolean, False),
("title", PropertyType.dynamic_string),
("title_anchor", PropertyType.string, "bottom"),
("render", PropertyType.dynamic_boolean, True),
(... | I think `selected_message` sounds better | ("show_value", PropertyType.boolean, False),
("title", PropertyType.dynamic_string),
("title_anchor", PropertyType.string, "bottom"),
("render", PropertyType.dynamic_boolean, True),
("width", PropertyType.string_or_number),
]
... | @@ -507,6 +506,8 @@ class _Factory:
("label",),
("mode",),
("lov", PropertyType.lov),
+ ("selection_message", PropertyType.dynamic_string), | taipy/gui/_renderers/factory.py | 26 | Python | 0.286 | suggestion | 40 | 51 | 51 | false | selector: selection message and select all | 2,299 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/_renderers/factory.py
PR Title: selector: selection message and select all
BEFORE CODE: ("linear", PropertyType.boolean, False),
("show_value", PropertyType.boolean, False),
("title", PropertyType.dynam... | I think `selected_message` sounds 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. |
task_config = Config.configure_task("the_task", identity, input=input_config, output=output_config)
sc_config = Config.configure_scenario(
"the_scenario", task_configs=[task_config], frequency=Frequency.DAILY, sequences={"the_seq": [task_config]}
)
scenario = tp.create_scenario(sc_config)
re... | Using the `@pytest.mark.parametrize(mode, ["development", "standalone"])` here would be cleaner.
However, this seems ok as well. | input_config = Config.configure_data_node("the_input")
output_config = Config.configure_data_node("the_output")
task_config = Config.configure_task("the_task", identity, input=input_config, output=output_config)
sc_config = Config.configure_scenario(
"the_scenario", task_configs=[task_config], f... | @@ -156,6 +157,14 @@ def test_events_published_for_writing_dn():
def test_events_published_for_scenario_submission():
+ _events_published_for_scenario_submission()
+
+def test_events_published_for_scenario_submission_standalone():
+ _events_published_for_scenario_submission(standalone=True)
+
+def _events_pu... | tests/core/notification/test_events_published.py | 26 | Python | 0.5 | suggestion | 131 | 51 | 51 | false | Fix issue about not publishing data node updates | 2,316 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV | Review this pull request change.
Language: Python
File: tests/core/notification/test_events_published.py
PR Title: Fix issue about not publishing data node updates
BEFORE CODE: task_config = Config.configure_task("the_task", identity, input=input_config, output=output_config)
sc_config = Config.configure_sc... | Using the `@pytest.mark.parametrize(mode, ["development", "standalone"])` here would be cleaner.
However, this seems ok as well. | 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. |
_events_published_for_scenario_submission()
def test_events_published_for_scenario_submission_standalone():
_events_published_for_scenario_submission(standalone=True)
def _events_published_for_scenario_submission(standalone=False):
if standalone:
Config.configure_job_executions(mode="standalone", ... | why do we only start the `Orchestrator()` in standalone mode and not development mode? | @pytest.mark.parametrize("standalone", [False, True])
def test_events_published_for_scenario_submission(standalone):
if standalone:
Config.configure_job_executions(mode="standalone", max_nb_of_workers=2)
input_config = Config.configure_data_node("the_input")
output_config = Config.configure_data_nod... | @@ -176,7 +185,11 @@ def test_events_published_for_scenario_submission():
# 1 submission update event for jobs
# 3 submission update events (for status: PENDING, RUNNING and COMPLETED)
# 1 submission update event for is_completed
- scenario.submit()
+ if standalone:
+ Orchestrator().run() | tests/core/notification/test_events_published.py | 26 | Python | 0.357 | question | 86 | 51 | 51 | false | Fix issue about not publishing data node updates | 2,316 | Avaiga/taipy | 12,680 | Python | trgiangdo | jrobinAV | Review this pull request change.
Language: Python
File: tests/core/notification/test_events_published.py
PR Title: Fix issue about not publishing data node updates
BEFORE CODE: _events_published_for_scenario_submission()
def test_events_published_for_scenario_submission_standalone():
_events_published_for_... | why do we only start the `Orchestrator()` in standalone mode and not development mode? | 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
from importlib import util
import pandas
import pytest
if util.find_spec("playwright"):
from playwright._impl._page import Page
from taipy.gui import Gui
@pytest.mark.teste2e
def test_has_default_value(page: Page, gui: Gui, helpers):
percentages = [
(1852, 50.83),
(1856, 45.2... | ```suggestion
page_md = "<|{data}|chart|type=bar|x=Year|y=%|>"
``` | import inspect
from importlib import util
import pandas
import pytest
if util.find_spec("playwright"):
from playwright._impl._page import Page
from taipy.gui import Gui
@pytest.mark.teste2e
def test_has_default_value(page: Page, gui: Gui, helpers):
percentages = [
(1852, 50.83),
(1856, 45.2... | @@ -0,0 +1,39 @@
+import inspect
+from importlib import util
+
+import pandas
+import pytest
+
+if util.find_spec("playwright"):
+ from playwright._impl._page import Page
+
+from taipy.gui import Gui
+
+
+@pytest.mark.teste2e
+def test_has_default_value(page: Page, gui: Gui, helpers):
+ percentages = [
+ (... | tests/gui/e2e/test_resizing.py | 22 | Python | 0.714 | suggestion | 72 | 40 | 38 | false | Allow for adjustement of the metric control geometry | 2,327 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: tests/gui/e2e/test_resizing.py
PR Title: Allow for adjustement of the metric control geometry
BEFORE CODE: import inspect
from importlib import util
import pandas
import pytest
if util.find_spec("playwright"):
from playwright._impl._page import Page
fr... | ```suggestion
page_md = "<|{data}|chart|type=bar|x=Year|y=%|>"
``` | 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 test_has_default_value(page: Page, gui: Gui, helpers):
percentages = [
(1852, 50.83),
(1856, 45.29),
(1860, 39.65),
(1864, 55.03),
]
data = pandas.DataFrame(percentages, columns=["Year", "%"]) # noqa: F841
page_md = """
<|{data}|chart|type=bar|x=Year|y=%|>
"""
gui... | ```suggestion
assert box_after["width"] > box_before["width"]
``` | import inspect
from importlib import util
import pandas
import pytest
if util.find_spec("playwright"):
from playwright._impl._page import Page
from taipy.gui import Gui
@pytest.mark.teste2e
def test_has_default_value(page: Page, gui: Gui, helpers):
percentages = [
(1852, 50.83),
(1856, 45.2... | @@ -0,0 +1,39 @@
+import inspect
+from importlib import util
+
+import pandas
+import pytest
+
+if util.find_spec("playwright"):
+ from playwright._impl._page import Page
+
+from taipy.gui import Gui
+
+
+@pytest.mark.teste2e
+def test_has_default_value(page: Page, gui: Gui, helpers):
+ percentages = [
+ (... | tests/gui/e2e/test_resizing.py | 26 | Python | 0.571 | suggestion | 71 | 27 | 38 | false | Allow for adjustement of the metric control geometry | 2,327 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: tests/gui/e2e/test_resizing.py
PR Title: Allow for adjustement of the metric control geometry
BEFORE CODE: def test_has_default_value(page: Page, gui: Gui, helpers):
percentages = [
(1852, 50.83),
(1856, 45.29),
(1860, 39.65),
... | ```suggestion
assert box_after["width"] > box_before["width"]
``` | 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. |
negativeDeltaColor?: string;
threshold?: number;
defaultThreshold?: number;
format?: string;
deltaFormat?: string;
barColor?: string;
showValue?: boolean;
colorMap?: string;
title?: string;
layout?: string;
defaultLayout?: string;
width?: string | number;
height?: str... | May be a little comment here and next line indicating this impact viselements.json - in order to remember in the future | negativeDeltaColor?: string;
threshold?: number;
defaultThreshold?: number;
format?: string;
deltaFormat?: string;
barColor?: string;
showValue?: boolean;
colorMap?: string;
title?: string;
layout?: string;
defaultLayout?: string;
width?: string | number;
height?: str... | @@ -52,19 +52,30 @@ interface MetricProps extends TaipyBaseProps, TaipyHoverProps {
template_Light_?: string;
}
-const emptyLayout = {} as Partial<Layout>;
-const defaultStyle = { position: "relative", display: "inline-block", width: "100%" } as CSSProperties;
+const defaultLayout = { margin: { l: 50, r: 50, t:... | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.357 | suggestion | 119 | 51 | 51 | false | Allow for adjustement of the metric control geometry | 2,327 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Metric.tsx
PR Title: Allow for adjustement of the metric control geometry
BEFORE CODE: negativeDeltaColor?: string;
threshold?: number;
defaultThreshold?: number;
format?: string;
deltaFormat?: s... | May be a little comment here and next line indicating this impact viselements.json - in order to remember in the future | 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. |
f"`{prop_key}` field of DataNodeConfig"
f" `{data_node_config_id}` must be populated with a List value.",
)
if data_node_config_id != DataNodeConfig._DEFAULT_KEY:
properties_to_check_at_least_one = [
DataNodeConfig._... | `prop_type` is the value in the `_PROPERTIES_TYPES` dictionary. Today, it must be a Python type.
Can we imagine `prop_type` being either a type or a list of types? Then, we should check that the type of `prop_value ` is among the types in the `prop_type` list of types.
Does it make sense, or is it just over-engin... | f" `{data_node_config_id}` must be populated with a List value.",
)
if data_node_config_id != DataNodeConfig._DEFAULT_KEY:
properties_to_check_at_least_one = [
DataNodeConfig._OPTIONAL_READ_FUNCTION_GENERIC_PROPERTY,
DataNod... | @@ -217,25 +197,24 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
- def _check_class_type(self, data_node_config_id: str, data_node_config: DataNodeCon... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.786 | question | 327 | 51 | 51 | false | feat: add data config checker for property value types | 2,328 | Avaiga/taipy | 12,680 | Python | jrobinAV | joaoandre-avaiga | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_data_node_config_checker.py
PR Title: feat: add data config checker for property value types
BEFORE CODE: f"`{prop_key}` field of DataNodeConfig"
f" `{data_node_config_id}` must be pop... | `prop_type` is the value in the `_PROPERTIES_TYPES` dictionary. Today, it must be a Python type.
Can we imagine `prop_type` being either a type or a list of types? Then, we should check that the type of `prop_value ` is among the types in the `prop_type` list of types.
Does it make sense, or is it just over-engin... | 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. |
f"property `{required_property}` for type `{storage_type}`.",
)
else:
self._error(
required_property,
None,
f"DataNodeConfig `{data_node_config_id}` is missing the requ... | can you help propagate this change on enterprise as well? I'm quite certain it will fail on enterprise :D thanks! | if not isinstance(prop_value, list):
self._error(
prop_key,
prop_value,
f"`{prop_key}` field of DataNodeConfig"
f" `{data_node_config_id}` must be populated with a List value.",
... | @@ -217,25 +196,26 @@ def _check_generic_read_write_fct_and_args(self, data_node_config_id: str, data_
f"DataNodeConfig `{data_node_config_id}` must be populated with a Callable function.",
)
- def _check_class_type(self, data_node_config_id: str, data_node_config: DataNodeCon... | taipy/core/config/checkers/_data_node_config_checker.py | 26 | Python | 0.429 | bug | 113 | 51 | 51 | false | feat: add data config checker for property value types | 2,328 | Avaiga/taipy | 12,680 | Python | toan-quach | joaoandre-avaiga | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_data_node_config_checker.py
PR Title: feat: add data config checker for property value types
BEFORE CODE: f"property `{required_property}` for type `{storage_type}`.",
)
el... | can you help propagate this change on enterprise as well? I'm quite certain it will fail on enterprise :D thanks! | 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. |
TaskConfig, task_config_id, task_config._INPUT_KEY, task_config.input_configs, DataNodeConfig
)
def _check_outputs(self, task_config_id: str, task_config: TaskConfig):
self._check_children(
TaskConfig, task_config_id, task_config._OUTPUT_KEY, task_config.output_configs, Data... | should `self._REQUIRED_PROPERTIES` be replaced by `task_config._REQUIRED_PROPERTIES`? | def _check_outputs(self, task_config_id: str, task_config: TaskConfig):
self._check_children(
TaskConfig, task_config_id, task_config._OUTPUT_KEY, task_config.output_configs, DataNodeConfig
)
def _check_existing_function(self, task_config_id: str, task_config: TaskConfig):
i... | @@ -88,3 +92,16 @@ def _check_existing_function(self, task_config_id: str, task_config: TaskConfig)
f"{task_config._FUNCTION} field of TaskConfig `{task_config_id}` must be"
f" populated with Callable value.",
)
+
+ def _check_required_properties(self, task_config_id: s... | taipy/core/config/checkers/_task_config_checker.py | 26 | Python | 0.429 | question | 85 | 36 | 33 | false | feature/enterprise/#576 added _check_required_properties for task config checker | 2,335 | Avaiga/taipy | 12,680 | Python | jrobinAV | toan-quach | Review this pull request change.
Language: Python
File: taipy/core/config/checkers/_task_config_checker.py
PR Title: feature/enterprise/#576 added _check_required_properties for task config checker
BEFORE CODE: TaskConfig, task_config_id, task_config._INPUT_KEY, task_config.input_configs, DataNodeConfig... | should `self._REQUIRED_PROPERTIES` be replaced by `task_config._REQUIRED_PROPERTIES`? | 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 pytest.raises(SystemExit):
Config._collector = IssueCollector()
Config.check()
assert len(Config._collector.errors) == 1
assert "function field of TaskConfig `new` is empty." in caplog.text
assert len(Config._collector.warnings) == 2
config._sections... | Usually for checker tests, we also test the case where there's no error.
I would also configure a task with `"task_type": True, "required_key_1": "sth", "required_key_2": "sth_2"` to make sure it passes | with pytest.raises(SystemExit):
Config._collector = IssueCollector()
Config.check()
assert len(Config._collector.errors) == 1
assert "function field of TaskConfig `new` is empty." in caplog.text
assert len(Config._collector.warnings) == 2
config._sections... | @@ -311,3 +311,38 @@ def mock_func():
Config.check()
assert len(Config._collector.errors) == 0
assert len(Config._collector.warnings) == 2
+
+ def test_check_required_property(self, caplog): | tests/core/config/checkers/test_task_config_checker.py | 26 | Python | 0.714 | suggestion | 205 | 51 | 51 | false | feature/enterprise/#576 added _check_required_properties for task config checker | 2,335 | Avaiga/taipy | 12,680 | Python | trgiangdo | toan-quach | Review this pull request change.
Language: Python
File: tests/core/config/checkers/test_task_config_checker.py
PR Title: feature/enterprise/#576 added _check_required_properties for task config checker
BEFORE CODE: with pytest.raises(SystemExit):
Config._collector = IssueCollector()
... | Usually for checker tests, we also test the case where there's no error.
I would also configure a task with `"task_type": True, "required_key_1": "sth", "required_key_2": "sth_2"` to make sure it passes | 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 st = getComputedStyle(div);
gd.setAttribute("data-height", st.height);
gd.setAttribute("data-width", st.width);
}
const fs = gd.classList.toggle("full-screen");
(evt.currentTarget as HTMLElement).setAttribute("data-title", fs ? "E... | I think there's an issue with columns being undefined here
I fixed it locally but did not push it to develop yet | const st = getComputedStyle(div);
gd.setAttribute("data-height", st.height);
gd.setAttribute("data-width", st.width);
}
const fs = gd.classList.toggle("full-screen");
(evt.currentTarget as HTMLElement).setAttribute("data-title", fs ? "E... | @@ -279,6 +280,11 @@ const updateArrays = (sel: number[][], val: number[], idx: number) => {
return sel;
};
+const getDataKey = (columns: Record<string, ColumnDesc>, decimators?: string[]): [string[], string] => { | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.5 | suggestion | 113 | 51 | 51 | false | Backports for 4.0.2 | 2,336 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | FabienLelaquais | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Backports for 4.0.2
BEFORE CODE: const st = getComputedStyle(div);
gd.setAttribute("data-height", st.height);
gd.setAttribute("data-width", st.width... | I think there's an issue with columns being undefined here
I fixed it locally but did not push it to develop yet | 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_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]
)
._set_propagate(),
"dialog": lambda gui, control_type, attrs: _Builder(
gui=gui,
control_type=control_type,
... | ```suggestion
("anchor_id", PropertyType.dynamic_string),
```
?
Do you see a use case for dynamicity? | ("on_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]
)
._set_propagate(),
"dialog": lambda gui, control_type, attrs: _Builder(
gui=gui,
control_type=control_type,
... | @@ -215,6 +215,8 @@ class _Factory:
("width", PropertyType.string_or_number),
("height", PropertyType.string_or_number),
("hover_text", PropertyType.dynamic_string),
+ ("ref_id", PropertyType.dynamic_string), | taipy/gui/_renderers/factory.py | 26 | Python | 0.929 | question | 121 | 51 | 51 | false | popupdialog associated with an id (query selector) | 2,339 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/_renderers/factory.py
PR Title: popupdialog associated with an id (query selector)
BEFORE CODE: ("on_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]... | ```suggestion
("anchor_id", PropertyType.dynamic_string),
```
?
Do you see a use case for dynamicity? | 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_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]
)
._set_propagate(),
"dialog": lambda gui, control_type, attrs: _Builder(
gui=gui,
control_type=control_type,
... | I suspect we will want an anchor_type (??) as well: center/below/... | ("on_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]
)
._set_propagate(),
"dialog": lambda gui, control_type, attrs: _Builder(
gui=gui,
control_type=control_type,
... | @@ -215,6 +215,8 @@ class _Factory:
("width", PropertyType.string_or_number),
("height", PropertyType.string_or_number),
("hover_text", PropertyType.dynamic_string),
+ ("ref_id", PropertyType.dynamic_string), | taipy/gui/_renderers/factory.py | 26 | Python | 0.357 | suggestion | 68 | 51 | 51 | false | popupdialog associated with an id (query selector) | 2,339 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/_renderers/factory.py
PR Title: popupdialog associated with an id (query selector)
BEFORE CODE: ("on_change", PropertyType.function),
("format",),
("width", PropertyType.string_or_number),
]... | I suspect we will want an anchor_type (??) as well: center/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. |
/*
* 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 l... | This we will want to customize... | const paperProps = useMemo(() => {
if (width !== undefined || height !== undefined) {
const res = { sx: {} } as Record<string, Record<string, unknown>>;
if (width !== undefined) {
res.sx.width = width;
res.sx.maxWidth = width;
}
... | @@ -110,7 +139,22 @@ const Dialog = (props: DialogProps) => {
return {};
}, [width, height]);
- return (
+ const getAnchorEl = useCallback(() => (refId && document.querySelector(refId)) || virtualElt, [refId]);
+
+ return popup ? (
+ <Popover
+ id={id}
+ onClose={ha... | frontend/taipy-gui/src/components/Taipy/Dialog.tsx | 26 | TypeScript | 0.071 | suggestion | 33 | 148 | 51 | false | popupdialog associated with an id (query selector) | 2,339 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Dialog.tsx
PR Title: popupdialog associated with an id (query selector)
BEFORE CODE: /*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not ... | This we will want to customize... | 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 React, { useMemo } from "react";
import {
TaipyDynamicProps,
useDynamicJsonProperty,
} from "taipy-gui";
import Plot from "react-plotly.js";
import { Data, Layout } from "plotly.js";
interface DashboardProps extends TaipyDynamicProps {
data?: string;
defaultData?: string;
layout?: string;
... | A (common) header would be nice | /*
* 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 l... | @@ -0,0 +1,42 @@
+import React, { useMemo } from "react"; | doc/gui/extension/example_library/front-end/src/Dashboard.tsx | 14 | TypeScript | 0.071 | suggestion | 31 | 39 | 39 | false | Chart extension documentation | 2,341 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: doc/gui/extension/example_library/front-end/src/Dashboard.tsx
PR Title: Chart extension documentation
BEFORE CODE: import React, { useMemo } from "react";
import {
TaipyDynamicProps,
useDynamicJsonProperty,
} from "taipy-gui";
import Plot from "re... | A (common) header would be nice | 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. |
set1 = {
"x": [1, 2, 3, 4, 4, 4, 8, 9, 10],
"type": "box",
"name": "Set 1"
}
set2 = {
"x": [2, 3, 3, 3, 3, 5, 6, 6, 7],
"type": "box",
"name": "Set 2"
}
data = [set1, set2]
layout = {
"title": {
"text": "Horizontal Box Plot"
}
}
page = """
<|{data}|dashboard|layout={layout}|>... | Please remove this (useless) port setting - for exposure to users. | set1 = {
"x": [1, 2, 3, 4, 4, 4, 8, 9, 10],
"type": "box",
"name": "Set 1"
}
set2 = {
"x": [2, 3, 3, 3, 3, 5, 6, 6, 7],
"type": "box",
"name": "Set 2"
}
data = [set1, set2]
layout = {
"title": {
"text": "Horizontal Box Plot"
}
}
page = """
<|{data}|dashboard|layout={layout}|>... | @@ -37,4 +37,4 @@
"""
if __name__ == "__main__":
- Gui(page, libraries=[ExampleLibrary()]).run(title="Horizontal Box Plot")
+ Gui(page, libraries=[ExampleLibrary()]).run(title="Horizontal Box Plot", port=3010) | doc/gui/extension/dashboard.py | 26 | Python | 0.286 | refactor | 66 | 27 | 27 | false | Chart extension documentation | 2,341 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: doc/gui/extension/dashboard.py
PR Title: Chart extension documentation
BEFORE CODE: set1 = {
"x": [1, 2, 3, 4, 4, 4, 8, 9, 10],
"type": "box",
"name": "Set 1"
}
set2 = {
"x": [2, 3, 3, 3, 3, 5, 6, 6, 7],
"type": "box",
"name": "Set 2"
... | Please remove this (useless) port setting - for exposure to users. | 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. |
__UPLOAD_URL,
_EXTENSION_ROOT,
__USER_CONTENT_URL,
]
__LOCAL_TZ = str(tzlocal.get_localzone())
__extensions: t.Dict[str, t.List[ElementLibrary]] = {}
__shared_variables: t.List[str] = []
__content_providers: t.Dict[type, t.Callable[..., str]] = {}
# See set_unsupport... | t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]] | __UPLOAD_URL,
_EXTENSION_ROOT,
__USER_CONTENT_URL,
]
__LOCAL_TZ = str(tzlocal.get_localzone())
__extensions: t.Dict[str, t.List[ElementLibrary]] = {}
__shared_variables: t.List[str] = []
__content_providers: t.Dict[type, t.Callable[..., str]] = {}
# See set_unsupport... | @@ -187,6 +187,7 @@ def __init__(
env_filename: t.Optional[str] = None,
libraries: t.Optional[t.List[ElementLibrary]] = None,
flask: t.Optional[Flask] = None,
+ script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]] = None | taipy/gui/gui.py | 26 | Python | 0.214 | suggestion | 58 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: __UPLOAD_URL,
_EXTENSION_ROOT,
__USER_CONTENT_URL,
]
__LOCAL_TZ = str(tzlocal.get_localzone())
__extensions: t.Dict[str, t.List[ElementLibrary]] = {}
... | t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]] | 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
... | could be private __load_scripts | "admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(sel... | @@ -411,6 +420,33 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]): | taipy/gui/gui.py | 26 | Python | 0.143 | suggestion | 31 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: "meta",
"admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_Taip... | could be private __load_scripts | 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.__env_filename = env_filename
if libraries is not None:
for library in libraries:
Gui.add_library(library)
def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
if script_paths is None:
return
i... | check that scipt_path is Path (dev can pass anything as arguments) | if libraries is not None:
for library in libraries:
Gui.add_library(library)
def __load_scripts(self, script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]]):
if script_paths is None:
return
else:
if isinstance(script_pat... | @@ -411,6 +420,33 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
+ if script_paths is None:
+ return
+
+ if isinstance(script_paths, (str, Path)... | taipy/gui/gui.py | 26 | Python | 0.214 | suggestion | 66 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: self.__env_filename = env_filename
if libraries is not None:
for library in libraries:
Gui.add_library(library)
def _load_scripts(self, s... | check that scipt_path is Path (dev can pass anything as arguments) | 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. |
_Hooks()._init(self)
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 ... | Note that this could be a local `load_script()` declared in `_load_scripts()`, after script_paths was tested... |
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:
Gu... | @@ -411,6 +420,33 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
+ if script_paths is None:
+ return
+
+ if isinstance(script_paths, (str, Path)... | taipy/gui/gui.py | 26 | Python | 0.571 | suggestion | 111 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: _Hooks()._init(self)
if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
self.add_pages(pages)
if env_... | Note that this could be a local `load_script()` declared in `_load_scripts()`, after script_paths was tested... | 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 _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
if script_paths is None:
return
if isinstance(script_paths, (str, Path)):
script_paths = [script_paths]
for script_path in script_paths:
self._load_script(scrip... | Do we really want to break the app ? Or would a `_warn`be enough ? | def __load_scripts(self, script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]]):
if script_paths is None:
return
else:
if isinstance(script_paths, (str, Path)):
script_paths = [script_paths]
for script_path in script_paths:
... | @@ -411,6 +420,33 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
+ if script_paths is None:
+ return
+
+ if isinstance(script_paths, (str, Path)... | taipy/gui/gui.py | 26 | Python | 0.357 | question | 66 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE:
def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
if script_paths is None:
return
if isinstance(script_paths, (st... | Do we really want to break the app ? Or would a `_warn`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. |
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(self)
if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
... | ```
self._load_script(script_paths)
else:
``` | _TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(self)
if page:
self.add_page(name=Gui.__root_page_name, page=page)
if pages is not None:
self.add_pages(pag... | @@ -411,6 +420,33 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def _load_scripts(self, script_paths: t.Optional[t.Union[str, t.List[t.Union[str, Path]]]]):
+ if script_paths is None:
+ return
+
+ if isinstance(script_paths, (str, Path)... | taipy/gui/gui.py | 26 | Python | 0.429 | suggestion | 48 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: "md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Ho... | ```
self._load_script(script_paths)
else:
``` | 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. |
user_content_bp.add_url_rule(f"/{Gui.__USER_CONTENT_URL}/<path:path>", view_func=self.__serve_user_content)
self._flask_blueprint.append(user_content_bp)
# server URL for extension resources
extension_bp = Blueprint("taipy_extensions", __name__)
extension_bp.add_url_rule(f"/{Gui... | `if self.__script_files` is enough as an empty list is falsy | s if bool(urlparse(s).netloc) else f"{Gui._EXTENSION_ROOT}/{name}/{s}{lib.get_query(s)}"
for name, libs in Gui.__extensions.items()
for lib in libs
for s in (lib._do_get_relative_paths(lib.get_scripts()))
]
styles = [
s if bool(urlparse(s).netl... | @@ -2730,6 +2766,12 @@ def __register_blueprint(self):
if self.__css_file:
styles.append(f"{self.__css_file}")
+ if self.__script_files is not None: | taipy/gui/gui.py | 26 | Python | 0.357 | suggestion | 60 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: user_content_bp.add_url_rule(f"/{Gui.__USER_CONTENT_URL}/<path:path>", view_func=self.__serve_user_content)
self._flask_blueprint.append(user_content_bp)
# server UR... | `if self.__script_files` is enough as an empty list is falsy | 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. |
"admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(sel... | what's the point of inner defined function ? | "admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=self),
]
)
self.__event_manager = _EventManager()
# Init Gui Hooks
_Hooks()._init(sel... | @@ -411,6 +419,32 @@ def __init__(
for library in libraries:
Gui.add_library(library)
+ def __load_scripts(self, script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]]):
+ def load_script(path: t.Union[str, Path]): | taipy/gui/gui.py | 26 | Python | 0.071 | question | 44 | 51 | 51 | false | Allow custom Javascript files | 2,359 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files
BEFORE CODE: "admonition",
"sane_lists",
"tables",
"attr_list",
"md_in_html",
_TaipyMarkdownExtension(gui=s... | what's the point of inner defined function ? | 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 (!fromBlock) {
setStyle(
path == "/TaiPy_root_page" ? "Taipy_root_style" : "Taipy_style",
result.data.style || "",
);
Array.isArray(result.data.head) && setHead(result.d... | I don't get this. What does it bring ? | if (!fromBlock) {
setStyle(
path == "/TaiPy_root_page" ? "Taipy_root_style" : "Taipy_style",
result.data.style || "",
);
Array.isArray(result.data.head) && setHead(result.d... | @@ -117,11 +131,20 @@ const TaipyRendered = (props: TaipyRenderedProps) => {
return (
<ErrorBoundary FallbackComponent={ErrorFallback}>
- {head.length ? (
- <Helmet>
- {head.map((v, i) => React.createElement(v.tag, { key: `head${i}`, ...v.props }, v.content))... | frontend/taipy-gui/src/components/pages/TaipyRendered.tsx | 26 | TypeScript | 0.071 | question | 38 | 51 | 47 | false | Allow custom Javascript files for specific page | 2,375 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/pages/TaipyRendered.tsx
PR Title: Allow custom Javascript files for specific page
BEFORE CODE: if (!fromBlock) {
setStyle(
path == "/TaiPy_root_page" ... | I don't get this. What does it bring ? | 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. |
from __future__ import annotations
import logging
import re
import typing as t
import warnings
from pathlib import Path
from ._warnings import TaipyGuiAlwaysWarning
if t.TYPE_CHECKING:
from ._renderers import Page
from .gui import Gui
_DETECT_CLOSING_TAGS = re.compile(r"<([A-Z][-\w]*)(([^>\"]+\"[^\"]*\")*\s... | Is there a situation where a script would not be 'a path to a script' (like an inline script)?
If not I would certainly rename this to '_scripts' for clarity. | from __future__ import annotations
import logging
import re
import typing as t
import warnings
from pathlib import Path
from ._warnings import TaipyGuiAlwaysWarning
if t.TYPE_CHECKING:
from ._renderers import Page
from .gui import Gui
_DETECT_CLOSING_TAGS = re.compile(r"<([A-Z][-\w]*)(([^>\"]+\"[^\"]*\")*\s... | @@ -34,6 +35,7 @@ def __init__(self) -> None:
self._style: t.Optional[t.Union[str, t.Dict[str, t.Any]]] = None
self._route: t.Optional[str] = None
self._head: t.Optional[list] = None
+ self._script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]] = None | taipy/gui/_page.py | 26 | Python | 0.429 | suggestion | 159 | 51 | 51 | false | Allow custom Javascript files for specific page | 2,375 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/_page.py
PR Title: Allow custom Javascript files for specific page
BEFORE CODE: from __future__ import annotations
import logging
import re
import typing as t
import warnings
from pathlib import Path
from ._warnings import TaipyGuiAlwaysWarning
if... | Is there a situation where a script would not be 'a path to a script' (like an inline script)?
If not I would certainly rename this to '_scripts' for clarity. | 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 len(inspect.stack()) > 3 and inspect.stack()[2].function != "<module>":
self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
elif len(inspect.stack()) < 4:
raise RuntimeError(f"Can't resolve module. Page '{type(self).__name__}' is not registered... | ```suggestion
self.scripts(kwargs.get("scripts", None))
```
(see above) | if len(inspect.stack()) > 3 and inspect.stack()[2].function != "<module>":
self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
elif len(inspect.stack()) < 4:
raise RuntimeError(f"Can't resolve module. Page '{type(self).__name__}' is not registered... | @@ -75,6 +78,7 @@ def __init__(self, **kwargs) -> None:
self._notebook_gui: t.Optional["Gui"] = None
self._notebook_page: t.Optional["_Page"] = None
self.set_style(kwargs.get("style", None))
+ self.script_paths(kwargs.get("script_paths", None)) | taipy/gui/page.py | 26 | Python | 0.571 | suggestion | 82 | 51 | 51 | false | Allow custom Javascript files for specific page | 2,375 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/page.py
PR Title: Allow custom Javascript files for specific page
BEFORE CODE: if len(inspect.stack()) > 3 and inspect.stack()[2].function != "<module>":
self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3]... | ```suggestion
self.scripts(kwargs.get("scripts", None))
```
(see above) | 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. |
"css_property1": "css_value1",
}
"class2": {
"class3": {
"css_property2": "css_value2",
}
}
}
```
That would set the "css_property1" to "css_value1" for all elements with the "class1"
class, and "css_property... | I though we agreed that the Page constructor would have an additional 'scripts' parameter (just like 'style').
What is this API? | "css_property1": "css_value1",
}
"class2": {
"class3": {
"css_property2": "css_value2",
}
}
}
```
That would set the "css_property1" to "css_value1" for all elements with the "class1"
class, and "css_property... | @@ -180,3 +184,34 @@ def set_style(self, style: t.Dict[str, t.Dict[str, t.Any]]) -> Page:
def _get_style(self):
return self.__style
+
+ def script_paths(self, script_paths: t.Optional[t.Union[str, Path, t.List[t.Union[str, Path]]]]) -> Page: | taipy/gui/page.py | 26 | Python | 0.357 | question | 129 | 51 | 51 | false | Allow custom Javascript files for specific page | 2,375 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/page.py
PR Title: Allow custom Javascript files for specific page
BEFORE CODE: "css_property1": "css_value1",
}
"class2": {
"class3": {
"css_property2": "css_value2",
}
}... | I though we agreed that the Page constructor would have an additional 'scripts' parameter (just like 'style').
What is this API? | 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. |
# Handle custom pages
if (pr := page._renderer) is not None and isinstance(pr, CustomPage):
if self._navigate(
to=page_name,
params={
_Server._RESOURCE_HANDLER_ARG: pr._resource_handler.get_id(),
},
):
... | I though this '#' would need to be prefixed an additional space char | if not isinstance(nav_page, str):
return nav_page
page = self._get_page(nav_page)
# Try partials
if page is None:
page = self._get_partial(nav_page)
# Make sure that there is a page instance found
if page is None:
return (
... | @@ -2558,7 +2559,7 @@ def __render_page(self, page_name: str) -> t.Any:
with self._set_locals_context(context):
self._call_on_page_load(nav_page)
return self._server._render(
- page._rendered_jsx, page._style if page._style is not None else "", page._head, conte... | taipy/gui/gui.py | 26 | Python | 0.214 | suggestion | 68 | 51 | 51 | false | Allow custom Javascript files for specific page | 2,375 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Allow custom Javascript files for specific page
BEFORE CODE: # Handle custom pages
if (pr := page._renderer) is not None and isinstance(pr, CustomPage):
if self._navigate(
to=page_name,
... | I though this '#' would need to be prefixed an additional space char | 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 keys = oldKeys.filter((valId) => valId !== id);
dispatch(
createSendUpdateAction(
updateVarName,
keys,
module,
props.onChange,
... | height should be managed at the RadioGroup/FormGroup Level so that the label remains visible | (e: React.SyntheticEvent) => {
const id = e.currentTarget?.parentElement?.getAttribute("data-id");
id &&
setSelectedValue((oldKeys) => {
const keys = oldKeys.filter((valId) => valId !== id);
dispatch(
createS... | @@ -363,7 +371,7 @@ const Selector = (props: SelectorProps) => {
return (
<>
{isRadio || isCheck ? (
- <FormControl sx={controlSx} className={`${className} ${getComponentClassName(props.children)}`}>
+ <FormControl sx={{...controlSx, ...getWindowHeight(height)}} ... | frontend/taipy-gui/src/components/Taipy/Selector.tsx | 26 | TypeScript | 0.286 | suggestion | 92 | 51 | 51 | false | Fix Selector Height for Radio/Check Mode | 2,425 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Selector.tsx
PR Title: Fix Selector Height for Radio/Check Mode
BEFORE CODE: const keys = oldKeys.filter((valId) => valId !== id);
dispatch(
createSend... | height should be managed at the RadioGroup/FormGroup Level so that the label remains visible | 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. |
edge="start"
checked={selectedValue.includes(value)}
tabIndex={-1}
disableRipple
/>
</ListItemIcon>
{typeof item === "string" ? (
<ListItemText primary={item} />
) : (
<ListItemAvatar>
... | define as a useMemo inside the component | edge="start"
checked={selectedValue.includes(value)}
tabIndex={-1}
disableRipple
/>
</ListItemIcon>
{typeof item === "string" ? (
<ListItemText primary={item} />
) : (
<ListItemAvatar>
... | @@ -91,6 +91,14 @@ const getMenuProps = (height?: string | number) => ({
},
},
});
+const getWindowHeight = (height?: string | number) => { | frontend/taipy-gui/src/components/Taipy/Selector.tsx | 26 | TypeScript | 0.143 | suggestion | 40 | 51 | 51 | false | Fix Selector Height for Radio/Check Mode | 2,425 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | Satoshi-Sh | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Selector.tsx
PR Title: Fix Selector Height for Radio/Check Mode
BEFORE CODE: edge="start"
checked={selectedValue.includes(value)}
tabIndex={-1}
disable... | define as a useMemo inside the component | 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. |
# specific language governing permissions and limitations under the License.
import pickle
from datetime import datetime, timedelta
from typing import Any, List, Optional, Set
from taipy.common.config.common.scope import Scope
from .._entity._reload import _Reloader
from .._version._version_manager_factory import _V... | ```suggestion
??? warning "To use with pickle-able data only"
``` | # specific language governing permissions and limitations under the License.
import pickle
from datetime import datetime, timedelta
from typing import Any, List, Optional, Set
from taipy.common.config.common.scope import Scope
from .._entity._reload import _Reloader
from .._version._version_manager_factory import _V... | @@ -31,6 +31,19 @@ class PickleDataNode(DataNode, _FileDataNodeMixin):
data node.
- *default_data*: The default data of the data node. It is used at the data node instantiation
to write the data to the Pickle file.
+
+ ???warning "To use with pickle-able data only" | taipy/core/data/pickle.py | 26 | Python | 0.643 | suggestion | 71 | 51 | 51 | false | Add warning message on pickle usage #390 | 2,426 | Avaiga/taipy | 12,680 | Python | jrobinAV | jrobinAV | Review this pull request change.
Language: Python
File: taipy/core/data/pickle.py
PR Title: Add warning message on pickle usage #390
BEFORE CODE: # specific language governing permissions and limitations under the License.
import pickle
from datetime import datetime, timedelta
from typing import Any, List, Optiona... | ```suggestion
??? warning "To use with pickle-able data only"
``` | 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 __enter__(self):
self._gui.__enter__()
return self
def __exit__(self, exc_type, exc_value, traceback):
return self._gui.__exit__(exc_type, exc_value, traceback)
def set_favicon(self, favicon_path: t.Union[str, Path]):
"""Change the favicon for the client of this state.... | Whether ` __getitem__()` is abstract (then you don't want the default implementation),
or it is not (then you don't want the `@abstractmethod` decorator)
. |
def __enter__(self):
self._gui.__enter__()
return self
def __exit__(self, exc_type, exc_value, traceback):
return self._gui.__exit__(exc_type, exc_value, traceback)
def set_favicon(self, favicon_path: t.Union[str, Path]):
"""Change the favicon for the client of this state.... | @@ -149,6 +149,10 @@ def set_favicon(self, favicon_path: t.Union[str, Path]):
"""
self._gui.set_favicon(favicon_path, self)
+ @abstractmethod
+ def __getitem__(self, key: str):
+ return self | taipy/gui/state.py | 26 | Python | 0.5 | refactor | 157 | 51 | 51 | false | fix annoying bits | 2,439 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/state.py
PR Title: fix annoying bits
BEFORE CODE:
def __enter__(self):
self._gui.__enter__()
return self
def __exit__(self, exc_type, exc_value, traceback):
return self._gui.__exit__(exc_type, exc_value, traceback)
... | Whether ` __getitem__()` is abstract (then you don't want the default implementation),
or it is not (then you don't want the `@abstractmethod` decorator)
. | 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. |
from typing import Any, Dict, Optional
from .._config import _Config
from ..common._template_handler import _TemplateHandler
from ..common._validate_id import _validate_id
from ..exceptions.exceptions import InvalidConfigurationType, LoadingError
from ..global_app.global_app_config import GlobalAppConfig
from ..sectio... | This must be removed and dynamically added from the core package. For instance, it could be
declared in a `_SUB_TYPES ` variable implemented in the `Section` class, and updated dynamically by the `_inject_section` function (in `common/config/__init__.py`) when registering the Section. | from typing import Any, Dict, Optional
from .._config import _Config
from ..common._template_handler import _TemplateHandler
from ..common._validate_id import _validate_id
from ..exceptions.exceptions import InvalidConfigurationType, LoadingError
from ..global_app.global_app_config import GlobalAppConfig
from ..sectio... | @@ -29,6 +29,19 @@ class _BaseSerializer(object):
"""Base serializer class for taipy configuration."""
_GLOBAL_NODE_NAME = "TAIPY"
+ _SERIALIZABLE_TYPES = [
+ "bool",
+ "str",
+ "int",
+ "float",
+ "datetime",
+ "timedelta",
+ "function",
+ "class",... | taipy/common/config/_serializer/_base_serializer.py | 26 | Python | 0.786 | suggestion | 287 | 51 | 51 | false | Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list | 2,440 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo | Review this pull request change.
Language: Python
File: taipy/common/config/_serializer/_base_serializer.py
PR Title: Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list
BEFORE CODE: from typing import Any, Dict, Optional
from .._config import _Config
from ..common._template... | This must be removed and dynamically added from the core package. For instance, it could be
declared in a `_SUB_TYPES ` variable implemented in the `Section` class, and updated dynamically by the `_inject_section` function (in `common/config/__init__.py`) when registering the Section. | 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 = _Config()
config._global_config = GlobalAppConfig._from_dict(as_dict.get(cls._GLOBAL_NODE_NAME, {}))
for section_name, sect_as_dict in as_dict.items():
if section_class := cls._section_class.get(section_name, None):
if issubclass(section_class, UniqueSection)... | It does not look like it generates the same string:
What about:
```suggestion
TYPE_PATTERN = r"^(.+):(\b" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r"\b)?$"
``` | def _from_dict(cls, as_dict) -> _Config:
config = _Config()
config._global_config = GlobalAppConfig._from_dict(as_dict.get(cls._GLOBAL_NODE_NAME, {}))
for section_name, sect_as_dict in as_dict.items():
if section_class := cls._section_class.get(section_name, None):
... | @@ -119,10 +132,7 @@ def _pythonify(cls, val):
match = re.fullmatch(_TemplateHandler._PATTERN, str(val))
if not match:
if isinstance(val, str):
- TYPE_PATTERN = (
- r"^(.+):(\bbool\b|\bstr\b|\bint\b|\bfloat\b|\bdatetime\b||\btimedelta\b|"
- ... | taipy/common/config/_serializer/_base_serializer.py | 26 | Python | 0.857 | suggestion | 183 | 51 | 51 | false | Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list | 2,440 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo | Review this pull request change.
Language: Python
File: taipy/common/config/_serializer/_base_serializer.py
PR Title: Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list
BEFORE CODE: config = _Config()
config._global_config = GlobalAppConfig._from_dict(as_dict... | It does not look like it generates the same string:
What about:
```suggestion
TYPE_PATTERN = r"^(.+):(\b" + r"\b|\b".join(cls._SERIALIZABLE_TYPES) + r"\b)?$"
``` | 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 _config_doc_for_section(func):
def func_with_doc(section, attribute_name, default, configuration_methods, add_to_unconflicted_sections=False):
__write_section_to_doc(section, attribute_name)
__write_method_to_doc(configuration_methods)
return func(section, attribute_name, default, confi... | This import command is inside the method because this is an `__init__.py` file and we don't want to expose the `_BaseSerializer` | def _config_doc_for_section(func): # pragma: no cover
def func_with_doc(section, attribute_name, default, configuration_methods, add_to_unconflicted_sections=False):
__write_section_to_doc(section, attribute_name)
__write_method_to_doc(configuration_methods)
return func(section, attribute_n... | @@ -111,6 +111,8 @@ def _inject_section(
configuration_methods: List[tuple],
add_to_unconflicted_sections: bool = False,
):
+ from ._serializer._base_serializer import _BaseSerializer | taipy/common/config/__init__.py | 26 | Python | 0.571 | suggestion | 128 | 51 | 48 | false | Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list | 2,440 | Avaiga/taipy | 12,680 | Python | trgiangdo | trgiangdo | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list
BEFORE CODE:
def _config_doc_for_section(func):
def func_with_doc(section, attribute_name, default, configuration_methods... | This import command is inside the method because this is an `__init__.py` file and we don't want to expose the `_BaseSerializer` | 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. |
section_clazz,
attribute_name: str,
default: Section,
configuration_methods: List[tuple],
add_to_unconflicted_sections: bool = False,
):
from ._serializer._base_serializer import _BaseSerializer
Config._register_default(default)
if issubclass(section_clazz, UniqueSection):
seta... | IS it necessary? I believe the `Config._register_default(default)` does the job already. no? | attribute_name: str,
default: Section,
configuration_methods: List[tuple],
add_to_unconflicted_sections: bool = False,
):
from ._serializer._base_serializer import _BaseSerializer
Config._register_default(default)
if issubclass(section_clazz, UniqueSection):
setattr(Config, attribu... | @@ -126,6 +128,10 @@ def _inject_section(
for exposed_configuration_method, configuration_method in configuration_methods:
setattr(Config, exposed_configuration_method, configuration_method)
+ for type_to_register in section_clazz._types_to_register():
+ if type_to_register._type_identifier() ... | taipy/common/config/__init__.py | 26 | Python | 0.357 | question | 92 | 33 | 28 | false | Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list | 2,440 | Avaiga/taipy | 12,680 | Python | jrobinAV | trgiangdo | Review this pull request change.
Language: Python
File: taipy/common/config/__init__.py
PR Title: Refactor - Allow expanding the TYPE_PATTERN by the _BaseSerializer._SERIALIZABLE_TYPES list
BEFORE CODE: section_clazz,
attribute_name: str,
default: Section,
configuration_methods: List[tuple],
add... | IS it necessary? I believe the `Config._register_default(default)` does the job already. no? | 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. |
traces: string[][],
relayoutData?: PlotRelayoutEvent,
) => {
return decimators
? {
width: plotDiv?.clientWidth,
height: plotDiv?.clientHeight,
decimators: decimators.map((d, i) =>
d
? {
decimator: d,
... | Strange you have a 2-space indentation here and 4 later in the changes.... | modes: string[],
columns: Record<string, ColumnDesc>,
traces: string[][],
relayoutData?: PlotRelayoutEvent
) => {
return decimators
? {
width: plotDiv?.clientWidth,
height: plotDiv?.clientHeight,
decimators: decimators.map((d, i) =>
... | @@ -155,30 +169,30 @@ const getDecimatorsPayload = (
modes: string[],
columns: Record<string, ColumnDesc>,
traces: string[][],
- relayoutData?: PlotRelayoutEvent
+ relayoutData?: PlotRelayoutEvent,
) => {
return decimators
? {
- width: plotDiv?.clientWidth,
- ... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.286 | style | 74 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: traces: string[][],
relayoutData?: PlotRelayoutEvent,
) => {
return decimators
? {
width: plotDiv?.clientWidth,
height: plo... | Strange you have a 2-space indentation here and 4 later in the changes.... | 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. |
propagate,
),
);
return;
}
traces.forEach((tr, idx) => {
if (upvars[idx] && tr && tr.length) {
dispatch(createSendUpdate... | ```suggestion
const isYaxisAnimated = Object.prototype.hasOwn(animationDataValues, (trace as ScatterData).name);
```
`hasOwn()` is 'safer' than `hasOwnProperty()` and I don't understand why you need the `call()`. | dispatch(
createSendUpdateAction(
setVars.values().next().value,
traces,
module,
props.onChange,
propagate
... | @@ -788,9 +861,89 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.929 | suggestion | 227 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: propagate,
),
);
return;
}
... | ```suggestion
const isYaxisAnimated = Object.prototype.hasOwn(animationDataValues, (trace as ScatterData).name);
```
`hasOwn()` is 'safer' than `hasOwnProperty()` and I don't understand why you need the `call()`. | 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. |
traces: frames.to.traces,
layout: {},
},
{
transition: {
duration: 500,
easing: "cubic-in-out",
... | I suspect you can make this delay shorter (like 100 ms). | if (!plotRef.current || !toFrame.data?.length) {
return;
}
const plotElement = plotRef.current as unknown as PlotlyHTMLElement;
if (!plotElement?.data) {
return;
}
const timer = setTimeout(() => {
if (plotRef.current) {
... | @@ -788,9 +861,89 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.214 | suggestion | 56 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: traces: frames.to.traces,
layout: {},
},
{
... | I suspect you can make this delay shorter (like 100 ms). | 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. |
group: "",
baseframe: "from",
},
}));
}, [dataPl, animationDataValues]);
useEffect(() => {
if (!plotRef.current || !frames.to || !frames.to.data?.length) return;
const plotElement = plotRef.current as unknown as PlotlyHTMLElement;
if ... | So that would be the same as in the initialization right? | found = true;
tr[key] = animationData[key];
}
return tr;
},
{ ...trace } as Record<string, unknown>
) as unknown as ExtendedPlotData;
})
... | @@ -788,9 +861,89 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.214 | question | 57 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: group: "",
baseframe: "from",
},
}));
}, [dataPl, animationDataValues]);
useEffect(() => {
if (!pl... | So that would be the same as in the initialization right? | 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. |
lat: map ? yaxis.p2c() : undefined,
y: map ? undefined : transform(yaxis, "top")(evt?.clientY),
lon: map ? xaxis.p2c() : undefined,
x: map ? undefined : transform(xaxis, "left")(evt?.clientX),
}),
... | You may want to move this dict to some 'default' constant value.
Then we could modify it with the setting of the *animation* prop.
At least the default values don't show up in the middle of the code.
(and reuse it later) | ]
);
const clickHandler = useCallback(
(evt?: MouseEvent) => {
const map =
(evt?.currentTarget as PlotlyDiv)?._fullLayout?.map ||
(evt?.currentTarget as PlotlyDiv)?._fullLayout?.geo ||
(evt?.currentTarget as PlotlyDiv)?._fullLayout?.ma... | @@ -714,19 +762,44 @@ const Chart = (props: ChartProp) => {
y: map ? undefined : transform(yaxis, "top")(evt?.clientY),
lon: map ? xaxis.p2c() : undefined,
x: map ? undefined : transform(xaxis, "left")(evt?.clientX),
- })
- ... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.5 | refactor | 224 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: lat: map ? yaxis.p2c() : undefined,
y: map ? undefined : transform(yaxis, "top")(evt?.clientY),
... | You may want to move this dict to some 'default' constant value.
Then we could modify it with the setting of the *animation* prop.
At least the default values don't show up in the middle of the code.
(and reuse it later) | 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. |
yAxisName: config.traces[idx][1],
};
const selPoints = getArrayValue(selected, idx, []);
if (selPoints?.length) {
ret.selectedpoints = selPoints;
}
ret.orientation = getArrayValue(config.orientations, idx);
ret.line ... | I'm... not sure how this works in multi-trace, actually. | }
const baseZ = getValue(datum, trace, 2, true);
if (baseZ) {
if (axisNames.length > 2) {
ret[axisNames[2]] = baseZ;
} else {
ret.z = baseZ;
}
}
// Hack for treemap charts:... | @@ -588,6 +632,10 @@ const Chart = (props: ChartProp) => {
ret.xaxis = config.xaxis[idx];
ret.yaxis = config.yaxis[idx];
ret.hovertext = getValue(datum, config.labels, idx, true);
+ ret.meta = {
+ xAxisName: config.traces[idx][0],
+ yAxisNa... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.214 | suggestion | 56 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: yAxisName: config.traces[idx][1],
};
const selPoints = getArrayValue(selected, idx, []);
if (selPoints?.length) {
... | I'm... not sure how this works in multi-trace, actually. | 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. |
traces,
module,
props.onChange,
propagate,
),
);
return;
}
traces.forEach((t... | May be we want to clean the 'frame data' at this point?
One way not to animate any longer... | const upvars = traces.map((_, idx) => getUpdateVar(updateVars, `selected${idx}`));
const setVars = new Set(upvars.filter((v) => v));
if (traces.length > 1 && setVars.size === 1) {
dispatch(
createSendUpdateAc... | @@ -788,9 +861,89 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.214 | suggestion | 93 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: traces,
module,
props.onChange,
propaga... | May be we want to clean the 'frame data' at this point?
One way not to animate any longer... | 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. |
});
setFrames((prevFrames) => ({
from: prevFrames.to
? { ...prevFrames.to, name: "from" }
: { name: "from", data: [], traces: [], layout: {}, group: "", baseframe: "" },
to: {
name: "to",
data: toFramesData,
... | ```suggestion
const animate= async () => {
```
Isn't exactly what this thing does? | const toFramesData = dataPl
.map((trace) => {
const traceAnimationKeys = animationKeys.filter(
(key) => trace.hasOwnProperty(key) && Array.isArray(trace[key]) && Array.isArray(animationData[key])
);
if (!traceAnimationKeys.length) {... | @@ -788,9 +861,89 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.571 | question | 93 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: });
setFrames((prevFrames) => ({
from: prevFrames.to
? { ...prevFrames.to, name: "from" }
: { name: "from"... | ```suggestion
const animate= async () => {
```
Isn't exactly what this thing does? | 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. |
} from "../../context/taipyReducers";
import { lightenPayload } from "../../context/wsUtils";
import { darkThemeTemplate } from "../../themes/darkThemeTemplate";
import {
useClassNames,
useDispatch,
useDispatchRequestUpdateOnFirstRender,
useDynamicJsonProperty,
useDynamicProperty,
useModule,
} f... | default shouldn't be needed with TaipyData | useDispatchRequestUpdateOnFirstRender,
useDynamicJsonProperty,
useDynamicProperty,
useModule,
} from "../../utils/hooks";
import { ColumnDesc } from "./tableUtils";
import { getComponentClassName } from "./TaipyStyle";
import { getArrayValue, getUpdateVar, TaipyActiveProps, TaipyChangeProps } from "./ut... | @@ -60,6 +72,8 @@ interface ChartProp extends TaipyActiveProps, TaipyChangeProps {
defaultConfig: string;
config?: string;
data?: Record<string, TraceValueType>;
+ animationData?: string;
+ defaultAnimationData?: string; | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.143 | suggestion | 42 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: } from "../../context/taipyReducers";
import { lightenPayload } from "../../context/wsUtils";
import { darkThemeTemplate } from "../../themes/darkThemeTemplate";
impor... | default shouldn't be needed with 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. |
useMemo,
useRef,
useState,
} from "react";
import { useTheme } from "@mui/material";
import Box from "@mui/material/Box";
import Skeleton from "@mui/material/Skeleton";
import Tooltip from "@mui/material/Tooltip";
import merge from "lodash/merge";
import { nanoid } from "nanoid";
import {
Config,
D... | ordering the imports would nice | import Tooltip from "@mui/material/Tooltip";
import isEqual from "lodash/isEqual";
import merge from "lodash/merge";
import { nanoid } from "nanoid";
import {
AnimationOpts,
Config,
Data,
Frame,
Layout,
ModeBarButtonAny,
PlotDatum,
PlotData,
PlotlyHTMLElement,
PlotMarker,
Plo... | @@ -22,20 +30,27 @@ import { nanoid } from "nanoid";
import {
Config,
Data,
+ Frame,
Layout,
ModeBarButtonAny,
PlotDatum,
+ PlotData,
+ PlotlyHTMLElement,
PlotMarker,
PlotRelayoutEvent,
PlotSelectionEvent,
+ ScatterData,
ScatterLine,
+ AnimationOpts, | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.071 | suggestion | 31 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: useMemo,
useRef,
useState,
} from "react";
import { useTheme } from "@mui/material";
import Box from "@mui/material/Box";
import Skeleton from "@mui/mater... | ordering the imports would nice | 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. |
? getColNameFromIndexed(config.columns[0][config.traces[0][0]]?.dfid)
: undefined,
...layout.xaxis,
},
yaxis: {
title:
config.traces.length == 1 && config.traces[0].length > 1 && config.columns[0]... | There's a function for this ...
we only need the backend variable name for animationData => use `getUpdateVar(updateVars, "animationData")` from utils.ts. | baseLayout,
props.template,
props.template_Dark_,
props.template_Light_,
props.figure,
]);
useEffect(() => {
if (animationData?.__taipy_refresh) {
const animationDataVar = getUpdateVar(updateVars || "", "animationData");
animationDataVar &... | @@ -488,12 +550,52 @@ const Chart = (props: ChartProp) => {
props.figure,
]);
+ const updateDateVarsName = useMemo(() => { | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.571 | suggestion | 156 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: ? getColNameFromIndexed(config.columns[0][config.traces[0][0]]?.dfid)
: undefined,
...layout.xaxis,
... | There's a function for this ...
we only need the backend variable name for animationData => use `getUpdateVar(updateVars, "animationData")` from utils.ts. | 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. |
theme.palette.mode,
title,
config.columns,
config.traces,
baseLayout,
props.template,
props.template_Dark_,
props.template_Light_,
props.figure,
]);
const updateDateVarsName = useMemo(() => {
return updateVars
? updateV... | is it not better/easier to use `createRequestChartUpdateAction` ?
should we specify a list of columns ? |
const runAnimation = useCallback(() => {
return (
plotRef.current &&
plotlyRef.current &&
toFrame.data &&
(toFrame.traces && toFrame.traces.length > 0 ? true : null) &&
plotlyRef.current.animate(
plotRef.current as unknown as Plotl... | @@ -488,12 +550,52 @@ const Chart = (props: ChartProp) => {
props.figure,
]);
+ const updateDateVarsName = useMemo(() => {
+ return updateVars
+ ? updateVars.split(";").reduce((acc, item) => {
+ const [key, value] = item.split("=");
+ if (key && value) ... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.571 | question | 104 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: theme.palette.mode,
title,
config.columns,
config.traces,
baseLayout,
props.template,
props.template_Dark_,
... | is it not better/easier to use `createRequestChartUpdateAction` ?
should we specify a list of columns ? | 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. |
traces: dataPl.map((_, idx) => idx),
layout: {},
group: "",
baseframe: "from",
},
}));
}, [dataPl, animationData]);
useEffect(() => {
if (!plotRef.current || !frames.to || !frames.to.data?.length) {
setFrame... | bad type NodeJS.Timeout should be number in a browser | }
}, 100);
return () => {
if (timer) {
clearTimeout(timer);
}
};
}, [toFrame.data?.length, runAnimation]);
return render ? (
<Tooltip title={hover || ""}>
<Box id={props.id} className={`${className} ${getComponentC... | @@ -788,9 +897,72 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.429 | suggestion | 53 | 51 | 49 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: traces: dataPl.map((_, idx) => idx),
layout: {},
group: "",
baseframe: "from",
},
}... | bad type NodeJS.Timeout should be number in a browser | 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. |
baseframe: "from",
},
}));
}, [dataPl, animationData]);
useEffect(() => {
if (!plotRef.current || !frames.to || !frames.to.data?.length) {
setFrames((prevFrames) => {
if (prevFrames.to.data.length > 0) {
return {
... | why not `const animationTimeout` ? (ie why 2 lines ?) | return () => {
if (timer) {
clearTimeout(timer);
}
};
}, [toFrame.data?.length, runAnimation]);
return render ? (
<Tooltip title={hover || ""}>
<Box id={props.id} className={`${className} ${getComponentClassName(props.children)}`} ref=... | @@ -788,9 +897,72 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.357 | question | 53 | 51 | 46 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: baseframe: "from",
},
}));
}, [dataPl, animationData]);
useEffect(() => {
if (!plotRef.current || !frames.to || !f... | why not `const animationTimeout` ? (ie why 2 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. |
to: { name: "to", data: [], traces: [], layout: {}, group: "", baseframe: "" },
};
}
return prevFrames;
});
return;
}
const plotElement = plotRef.current as unknown as PlotlyHTMLElement;
if (!plo... | are `layout` and `frames.from` really needed here ? | {Array.isArray(props.figure) && props.figure.length && props.figure[0].data !== undefined ? (
<Plot
data={props.figure[0].data as Data[]}
layout={layout}
style={style}
... | @@ -788,9 +897,72 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.357 | question | 51 | 51 | 35 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: to: { name: "to", data: [], traces: [], layout: {}, group: "", baseframe: "" },
};
}
return... | are `layout` and `frames.from` really needed 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. |
const getData = (
data: Record<string, TraceValueType>,
additionalDatas: Array<Record<string, TraceValueType>>,
idx: number,
) => (idx === 0 ? data : idx <= additionalDatas.length ? additionalDatas[idx - 1] : undefined);
const Chart = (props: ChartProp) => {
const {
title = "",
width = ... | Would it be a good idea to split this into 2 `useState` ?
toFrame & fromFrame ? | width = "100%",
height,
updateVarName,
updateVars,
id,
data = emptyData,
onRangeChange,
propagate = true,
onClick,
animationData,
} = props;
const dispatch = useDispatch();
const [selected, setSelected] = useState<number[][]>([]... | @@ -308,26 +352,44 @@ const Chart = (props: ChartProp) => {
onRangeChange,
propagate = true,
onClick,
+ animationData,
} = props;
const dispatch = useDispatch();
const [selected, setSelected] = useState<number[][]>([]);
- const plotRef = useRef<HTMLDivElement>(null);
... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.429 | refactor | 80 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: const getData = (
data: Record<string, TraceValueType>,
additionalDatas: Array<Record<string, TraceValueType>>,
idx: number,
) => (idx === 0 ? data : idx <... | Would it be a good idea to split this into 2 `useState` ?
toFrame & fromFrame ? | 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. |
showValue,
colorMap,
]);
const layout = useMemo(() => {
const layout = {
...baseLayout,
};
let template = undefined;
try {
const tpl = props.template && JSON.parse(props.template);
const tplTheme =
theme.palette... | How did this situation happen?
| ]);
const layout = useMemo(() => {
const layout = {
...baseLayout,
};
let template = undefined;
try {
const tpl = props.template && JSON.parse(props.template);
const tplTheme =
theme.palette.mode === "dark"
... | @@ -191,8 +193,10 @@ const Metric = (props: MetricProps) => {
layout.template = template;
}
- if (props.title) {
- layout.title = props.title;
+ if (typeof props.title !== "object") { | frontend/taipy-gui/src/components/Taipy/Metric.tsx | 26 | TypeScript | 0.071 | question | 32 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Metric.tsx
PR Title: Chart animation
BEFORE CODE: showValue,
colorMap,
]);
const layout = useMemo(() => {
const layout = {
...baseLayout,
};
let template =... | How did this situation happen?
| 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-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... | most of the times, the test was passing with DIV
And if it fails because of SPAN, re-run the test and it succeed | * Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... | @@ -24,7 +24,7 @@ describe("Expandable Component", () => {
it("renders", async () => {
const { getByText } = render(<Expandable title="foo">bar</Expandable>);
const elt = getByText("foo");
- expect(elt.tagName).toBe("DIV");
+ expect(elt.tagName).toBe("SPAN"); | frontend/taipy-gui/src/components/Taipy/Expandable.spec.tsx | 26 | TypeScript | 0.429 | bug | 113 | 51 | 51 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FredLL-Avaiga | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Expandable.spec.tsx
PR Title: Chart animation
BEFORE CODE: * Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compl... | most of the times, the test was passing with DIV
And if it fails because of SPAN, re-run the test and it succeed | 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. |
layout: {},
group: "",
baseframe: "",
});
return;
}
const plotElement = plotRef.current as unknown as PlotlyHTMLElement;
if (!plotElement || !plotElement.data) return;
const timer = setTimeout(() => {
i... | So where `props.id` is not used anymore in for the generated component? | /*
* Copyright 2021-2025 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | @@ -789,12 +910,77 @@ const Chart = (props: ChartProp) => {
}
}
},
- [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
+ [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
);... | frontend/taipy-gui/src/components/Taipy/Chart.tsx | 26 | TypeScript | 0.429 | question | 71 | 51 | 973 | false | Chart animation | 2,443 | Avaiga/taipy | 12,680 | Python | FabienLelaquais | namnguyen20999 | Review this pull request change.
Language: TypeScript
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx
PR Title: Chart animation
BEFORE CODE: layout: {},
group: "",
baseframe: "",
});
return;
}
const plotElement = plotRe... | So where `props.id` is not used anymore in for the generated component? | 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_page = _Page()
new_page._route = name
new_page._renderer = page
new_page._style = style or page._get_style()
new_page._script_paths = page._get_script_paths()
# Append page to _config
self._config.pages.append(new_page)
self._config.routes.append(name)... | __locals_context should be good too | new_page = _Page()
new_page._route = name
new_page._renderer = page
new_page._style = style or page._get_style()
new_page._script_paths = page._get_script_paths()
# Append page to _config
self._config.pages.append(new_page)
self._config.routes.append(name)... | @@ -2133,17 +2133,24 @@ def add_page(
# Validate Page
_Hooks().validate_page(self, page)
# Update locals context
- self.__locals_context.add(page._get_module_name(), page._get_locals())
- # Update variable directory
- if not page._is_class_module():
- self.__va... | taipy/gui/gui.py | 26 | Python | 0.143 | suggestion | 35 | 51 | 51 | false | Manage context for pages that are not directly declared | 2,444 | Avaiga/taipy | 12,680 | Python | dinhlongviolin1 | FredLL-Avaiga | Review this pull request change.
Language: Python
File: taipy/gui/gui.py
PR Title: Manage context for pages that are not directly declared
BEFORE CODE: new_page = _Page()
new_page._route = name
new_page._renderer = page
new_page._style = style or page._get_style()
new_page._s... | __locals_context should be good too | 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.