before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
the custom logic for handling incoming events. Example usage: ```python class MyEventConsumer(CoreEventConsumerBase): def process_event(self, event: Event): # Custom event processing logic here print(f"Received event created at : {event.creation_date}") pass...
This line should be placed before the example.
the custom logic for handling incoming events. Subclasses should implement the `process_event` method to define their specific event handling behavior. Example usage: ```python class MyEventConsumer(CoreEventConsumerBase): def process_event(self, event: Event): # Custom event ...
@@ -32,10 +32,18 @@ def process_event(self, event: Event): print(f"Received event created at : {event.creation_date}") pass - consumer = MyEventConsumer("consumer_1", event_queue) + registration_id, registered_queue = Notifier.unregister( + entity_type=EventEntityType.CYCLE, + ...
taipy/core/notification/core_event_consumer.py
26
Python
0.143
suggestion
46
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
from queue import Empty, SimpleQueue from .event import Event class CoreEventConsumerBase(threading.Thread): """Abstract base class for implementing a Core event consumer. This class provides a framework for consuming events from a queue in a separate thread. It should be subclassed, and the `process_ev...
This topic will never generate an event. We are registering to "the creation of a cycle whose id is CYCLE_cycle_1". Either the cycle already exists, and the event won't be produced, or it will not, and the randomly generated unique ID won't be the one provided. I would use a more common use case. Why not registering...
from queue import Empty, SimpleQueue from .event import Event class CoreEventConsumerBase(threading.Thread): """Abstract base class for implementing a Core event consumer. This class provides a framework for consuming events from a queue in a separate thread. It should be subclassed, and the `process_ev...
@@ -32,10 +32,18 @@ def process_event(self, event: Event): print(f"Received event created at : {event.creation_date}") pass - consumer = MyEventConsumer("consumer_1", event_queue) + registration_id, registered_queue = Notifier.unregister( + entity_type=EventEntityType.CYCLE, + ...
taipy/core/notification/core_event_consumer.py
26
Python
0.5
question
353
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
from .event import Event class CoreEventConsumerBase(threading.Thread): """Abstract base class for implementing a Core event consumer. This class provides a framework for consuming events from a queue in a separate thread. It should be subclassed, and the `process_event` method should be implemented to d...
```suggestion consumer = MyEventConsumer(registration_id, registered_queue) ```
from .event import Event class CoreEventConsumerBase(threading.Thread): """Abstract base class for implementing a Core event consumer. This class provides a framework for consuming events from a queue in a separate thread. It should be subclassed, and the `process_event` method should be implemented to d...
@@ -32,10 +32,18 @@ def process_event(self, event: Event): print(f"Received event created at : {event.creation_date}") pass - consumer = MyEventConsumer("consumer_1", event_queue) + registration_id, registered_queue = Notifier.unregister( + entity_type=EventEntityType.CYCLE, + ...
taipy/core/notification/core_event_consumer.py
26
Python
0.571
suggestion
85
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
cls._topics_registrations_list[registration.topic] = {registration} return registration.registration_id, registration.queue @classmethod def unregister(cls, registration_id: str): """Unregister a listener. Example usage: ```python registration_id, register...
This is not correct. we only provide the registration_id to unregister.
A tuple containing the registration id and the event queue. """ registration = _Registration(entity_type, entity_id, operation, attribute_name) if registrations := cls._topics_registrations_list.get(registration.topic, None): registrations.add(registration) else:...
@@ -118,6 +128,18 @@ def register( def unregister(cls, registration_id: str): """Unregister a listener. + Example usage: + + ```python + registration_id, registered_queue = Notifier.unregister( + entity_type=EventEntityType.CYCLE, + entity_id="CYCLE_cycle_1", +...
taipy/core/notification/notifier.py
26
Python
0.214
suggestion
71
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
the custom logic for handling incoming events. Example usage: ```python class MyEventConsumer(CoreEventConsumerBase): def process_event(self, event: Event): # Custom event processing logic here print(f"Received event created at : {event.creation_date}") pass...
After the example I would add a short paragraph to explain the code, and particularly what are the events we are registering. We can also briefly explain the principle of the topic registration and redirect readers to the register function refman page to make it easier to understand how to build the topic.
the custom logic for handling incoming events. Subclasses should implement the `process_event` method to define their specific event handling behavior. Example usage: ```python class MyEventConsumer(CoreEventConsumerBase): def process_event(self, event: Event): # Custom event ...
@@ -32,10 +32,18 @@ def process_event(self, event: Event): print(f"Received event created at : {event.creation_date}") pass - consumer = MyEventConsumer("consumer_1", event_queue) + registration_id, registered_queue = Notifier.unregister( + entity_type=EventEntityType.CYCLE, + ...
taipy/core/notification/core_event_consumer.py
26
Python
0.429
suggestion
308
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
entity_type=entity_type, operation=operation, attribute_name=attribute_name, attribute_value=attribute_value, metadata=kwargs, ) Notifier.publish(event) class Notifier: """A class for managing event registrations and publishing `Core^` service events.""" _topic...
```suggestion The topic is defined by the combination of an optional entity type, an optional entity id, an optional operation, and an optional attribute name. The purpose is to be as flexible as possible. For example, we can register to: - All scenario creations ...
entity_type=entity_type, operation=operation, attribute_name=attribute_name, attribute_value=attribute_value, metadata=kwargs, ) Notifier.publish(event) class Notifier: """A class for managing event registrations and publishing `Core^` service events.""" _topic...
@@ -68,6 +68,16 @@ def register( The topic is defined by the combination of the entity type, the entity id, the operation and the attribute name.
taipy/core/notification/notifier.py
26
Python
0.929
bug
442
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
entity_type: Optional[EventEntityType] = None, entity_id: Optional[str] = None, operation: Optional[EventOperation] = None, attribute_name: Optional[str] = None, ) -> Tuple[str, SimpleQueue]: """Register a listener for a specific event topic. The topic is defined by ...
I would use a more realistic use case.
entity_type: Optional[EventEntityType] = None, entity_id: Optional[str] = None, operation: Optional[EventOperation] = None, attribute_name: Optional[str] = None, ) -> Tuple[str, SimpleQueue]: """Register a listener for a specific event topic. The topic is defined by ...
@@ -68,6 +68,16 @@ def register( The topic is defined by the combination of the entity type, the entity id, the operation and the attribute name. + Example usage: + + ```python + registration_id, registered_queue = Notifier.register( + entity_type=EventEntityType.CYCL...
taipy/core/notification/notifier.py
26
Python
0.143
suggestion
38
51
51
false
Feature/#405 exposing notification mechanism to user
1,304
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
">": "after", }, } as Record<string, Record<string, string>>; const gridSx = { p: "0.5em", minWidth: "36rem" }; const autocompleteSx = { "& .MuiInputBase-root": { padding: "0" } }; const getActionsByType = (colType?: string) => (colType && colType in actionsByType && actionsByType[colType]) || (co...
No '===' on val? String is secured?
">": "after", }, } as Record<string, Record<string, string>>; const gridSx = { p: "0.5em", minWidth: "36rem" }; const autocompleteSx = { "& .MuiInputBase-root": { padding: "0" } }; const badgeSx = { "& .MuiBadge-badge": { height: "10px", minWidth: "10px", width: "10px", ...
@@ -94,18 +97,17 @@ const getFilterDesc = (columns: Record<string, ColumnDesc>, colId?: string, act? return; } try { - const typedVal = - colType == "number" - ? parseFloat(val) - : colType == "boolean" - ?...
frontend/taipy-gui/src/components/Taipy/TableFilter.tsx
26
TypeScript
0.071
question
35
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Not too happy with this symbol name... compared to the others. `_GuiCoreNoUpdate`?
# 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...
@@ -12,18 +12,27 @@ import typing as t from datetime import datetime +from taipy.core import Cycle, DataNode, Job, Scenario, Sequence, Task from taipy.gui import Gui from taipy.gui.extension import Element, ElementLibrary, ElementProperty, PropertyType from ..version import _get_version from ._adapters import...
taipy/gui_core/_GuiCoreLib.py
21
Python
0.357
question
83
46
46
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
showSequences?: boolean; showProperties?: boolean; showSubmit?: boolean; showSubmitSequences?: boolean; showTags?: boolean; libClassName?: string; className?: string; dynamicClassName?: string; onSubmissionChange?: string; updateScVar?: string; } interface SequencesRowProps { ...
What would be the use of the Boolean case, beside a value like null or ""?
showSequences?: boolean; showProperties?: boolean; showSubmit?: boolean; showSubmitSequences?: boolean; showTags?: boolean; libClassName?: string; className?: string; dynamicClassName?: string; onSubmissionChange?: string; updateScVar?: string; } interface SequencesRowProps { ...
@@ -104,7 +104,7 @@ interface SequencesRowProps { onFocus: (e: MouseEvent<HTMLElement>) => void; focusName: string; setFocusName: (name: string) => void; - submittable: boolean; + submittable: boolean | string;
frontend/taipy/src/ScenarioViewer.tsx
26
TypeScript
0.429
question
74
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language govern...
What would be the use of the Boolean case, beside a value like null or ""?
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language govern...
@@ -29,7 +29,7 @@ export type ScenarioFull = [ string[], // authorized_tags boolean, // deletable boolean, // promotable - boolean, // submittable + boolean | string, // submittable
frontend/taipy/src/utils.ts
26
TypeScript
0.429
question
74
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
import json import math import typing as t from datetime import date, datetime from enum import Enum from numbers import Number from operator import attrgetter, contains, eq, ge, gt, le, lt, ne import pandas as pd from taipy.core import ( Cycle, DataNode, Scenario, is_deletable, is_editable, i...
`_is_boolean_true` sounds weird. Compared to `_is_true` for example.
import json import math import typing as t from datetime import date, datetime from enum import Enum from numbers import Number from operator import attrgetter, contains, eq, ge, gt, le, lt, ne import pandas as pd from taipy.core import ( Cycle, DataNode, Scenario, is_deletable, is_editable, i...
@@ -22,21 +22,19 @@ from taipy.core import ( Cycle, DataNode, - Job, Scenario, - Sequence, - Task, is_deletable, is_editable, is_promotable, is_readable, is_submittable, ) from taipy.core import get as core_get +from taipy.core.config import Config from taipy.core.da...
taipy/gui_core/_adapters.py
26
Python
0.357
suggestion
68
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
if op := _operators.get(action): cur_val = attrgetter(col)(ent) return op(cur_val.isoformat() if isinstance(cur_val, (datetime, date)) else cur_val, val) except Exception as e: _warn(f"Error filtering with {col} {action} {val} on {ent}.", e) return True def _get_datanod...
I guess you meant `__SC_LABELS` And shouldn't these be capitalized?
if op := _operators.get(action): cur_val = attrgetter(col)(ent) return op(cur_val.isoformat() if isinstance(cur_val, (datetime, date)) else cur_val, val) except Exception as e: _warn(f"Error filtering with {col} {action} {val} on {ent}.", e) return True def _get_datanod...
@@ -260,37 +242,94 @@ def _attr_type(attr: str): } -def _invoke_action(ent: t.Any, col: str, action: str, val: t.Any) -> bool: +def _invoke_action(ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any) -> bool: try: + if col_type == "any": + # when a property is not found...
taipy/gui_core/_adapters.py
26
Python
0.429
question
68
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
error_var, f"Sequence {name} is not available in Scenario {entity_id}.", ) return _GuiCoreContext.__assign_var(state, error_var, "") except Exception as e: ...
```suggestion f"{'Sequence' if sequence else 'Scenario'} {sequence or scenario_id} is not submittable: " ```
error_var, f"Sequence {name} is not available in Scenario {entity_id}.", ) return _GuiCoreContext.__assign_var(state, error_var, "") except Exception as e: ...
@@ -515,11 +527,12 @@ def submit_entity(self, state: State, id: str, payload: t.Dict[str, str]): if sequence := data.get("sequence"): entity = entity.sequences.get(sequence) - if not is_submittable(entity): + if not (reason := is_submittable(entity)): ...
taipy/gui_core/_context.py
26
Python
0.714
suggestion
130
51
51
false
Filter scenarios
1,307
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
return _sequences @classmethod def _create( cls, sequence_name: str, tasks: Union[List[Task], List[TaskId]], subscribers: Optional[List[_Subscriber]] = None, properties: Optional[Dict] = None, scenario_id: Optional[ScenarioId] = None, version: Op...
```suggestion raise InvalidSequence(sequence_id) ```
Notifier.publish(_make_event(sequence, EventOperation.CREATION)) return _sequences @classmethod def _create( cls, sequence_name: str, tasks: Union[List[Task], List[TaskId]], subscribers: Optional[List[_Subscriber]] = None, properties: Optional[Dict] ...
@@ -171,10 +175,52 @@ def _create( subscribers=subscribers, version=version, ) + + @classmethod + def _bulk_create_from_scenario(cls, scenario: Scenario) -> Dict[str, Sequence]: + _sequences: Dict[str, Sequence] = {} + + for sequence_name, sequence_data in scenario...
taipy/core/sequence/_sequence_manager.py
26
Python
0.571
suggestion
66
51
51
false
Enterprise/bug/#389 fix insufficient permissions on enterprise
1,329
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
from .._entity._entity import _Entity from .._entity._labeled import _Labeled from .._entity._properties import _Properties from .._entity._reload import _Reloader, _self_reload, _self_setter from ..exceptions.exceptions import _SuspiciousFileOperation from ..notification.event import Event, EventEntityType, EventOper...
I'm not sure if the hyperlink works or not ```suggestion `Cycle^`s are created along with the `Scenario^`s that are attached to them. ```
from .._entity._entity import _Entity from .._entity._labeled import _Labeled from .._entity._properties import _Properties from .._entity._reload import _Reloader, _self_reload, _self_setter from ..exceptions.exceptions import _SuspiciousFileOperation from ..notification.event import Event, EventEntityType, EventOper...
@@ -28,6 +28,30 @@ class Cycle(_Entity, _Labeled): """An iteration of a recurrent work pattern. + Data applications are often used to solve business problems that operate periodically + (i.e. in time cycles) such as weekly predictions of sales data, monthly master planning + of supply chains, quarterly...
taipy/core/cycle/cycle.py
26
Python
0.714
suggestion
146
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
trgiangdo
jrobinAV
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
The thing that "operate periodically" from the sentence can be the "business problems", which is not correct. ```suggestion Business problems often require data applications that operate periodically ```
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
@@ -28,6 +28,30 @@ class Cycle(_Entity, _Labeled): """An iteration of a recurrent work pattern. + Data applications are often used to solve business problems that operate periodically
taipy/core/cycle/cycle.py
26
Python
0.786
suggestion
212
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
trgiangdo
jrobinAV
At its creation, a new scenario is attached to a single cycle, the one that matches its optional _frequency_ and its _creation_date_. The possible frequencies are: - `Frequency.DAILY` - `Frequency.WEEKLY` - `Frequency.MONTHLY` - `Frequency.QUARTERLY` - `Frequency.YEARLY` Attribute...
```suggestion month. During each month (the cycle), he/she will be interested in experimenting with ```
`Cycle^`s are created along with the `Scenario^`s that are attached to them. At its creation, a new scenario is attached to a single cycle, the one that matches its optional _frequency_ and its _creation_date_. The possible frequencies are: - `Frequency.DAILY` - `Frequency.WEEKLY` - `Frequ...
@@ -36,6 +60,42 @@ class Cycle(_Entity, _Labeled): end_date (datetime): The date and time of the end of this cycle. name (str): The name of this cycle. properties (dict[str, Any]): A dictionary of additional properties. + + !!! example "Example for January cycle" + + ![cycles](../re...
taipy/core/cycle/cycle.py
26
Python
0.714
suggestion
113
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
trgiangdo
jrobinAV
production plan to be published. Each month is modeled as a cycle, and each cycle can contain one or more scenarios. The picture on the left shows the tree of entities: Cycles, Scenarios, and their associated Sequence(s). There is an existing past cycle for December and a current ...
We're already in a Note block ```suggestion For a scenario, cycles are optional. If a scenario has no Frequency, it will not be ```
different scenarios until only one of those scenarios is selected as the official production plan to be published. Each month is modeled as a cycle, and each cycle can contain one or more scenarios. The picture on the left shows the tree of entities: Cycles, Scenarios, and their ...
@@ -36,6 +60,42 @@ class Cycle(_Entity, _Labeled): end_date (datetime): The date and time of the end of this cycle. name (str): The name of this cycle. properties (dict[str, Any]): A dictionary of additional properties. + + !!! example "Example for January cycle" + + ![cycles](../re...
taipy/core/cycle/cycle.py
26
Python
0.714
suggestion
144
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
trgiangdo
jrobinAV
from ..notification.event import Event, EventEntityType, EventOperation, _make_event from .job_id import JobId from .status import Status if TYPE_CHECKING: from ..task.task import Task def _run_callbacks(fn): def __run_callbacks(job): fn(job) _TaipyLogger._get_logger().debug(f"{job.id} status...
I believe we want to use * for italic text ```suggestion Every time a task is submitted for execution, a new *Job* is created. A job represents a ```
from ..notification.event import Event, EventEntityType, EventOperation, _make_event from .job_id import JobId from .status import Status if TYPE_CHECKING: from ..task.task import Task def _run_callbacks(fn): def __run_callbacks(job): fn(job) _TaipyLogger._get_logger().debug(f"{job.id} status...
@@ -42,8 +42,16 @@ def __run_callbacks(job): class Job(_Entity, _Labeled): """Execution of a `Task^`. - A job handles the status of the execution, contains the stacktrace of exceptions that were - raised during the execution, and notifies subscribers on status change. + Tasks, Sequences, and Scenarios ...
taipy/core/job/job.py
26
Python
0.786
suggestion
158
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
trgiangdo
jrobinAV
import re import uuid from datetime import datetime from typing import Any, Dict, Optional from taipy.config.common.frequency import Frequency from .._entity._entity import _Entity from .._entity._labeled import _Labeled from .._entity._properties import _Properties from .._entity._reload import _Reloader, _self_rel...
What do you think about the following? ```suggestion Many business operations are periodic, such as weekly predictions of sales data, monthly master planning of supply chains, quarterly financial reports, yearly budgeting, etc. The data applications to solve these business problems often require model...
import re import uuid from datetime import datetime from typing import Any, Dict, Optional from taipy.config.common.frequency import Frequency from .._entity._entity import _Entity from .._entity._labeled import _Labeled from .._entity._properties import _Properties from .._entity._reload import _Reloader, _self_rel...
@@ -28,6 +28,30 @@ class Cycle(_Entity, _Labeled): """An iteration of a recurrent work pattern. + Data applications are often used to solve business problems that operate periodically + (i.e. in time cycles) such as weekly predictions of sales data, monthly master planning + of supply chains, quarterly...
taipy/core/cycle/cycle.py
26
Python
0.786
question
540
51
51
false
#709 userman update
1,333
Avaiga/taipy
12,680
Python
jrobinAV
jrobinAV
self._server._ws.emit( "message", payload, to=self.__get_ws_receiver(), ) time.sleep(0.001) except Exception as e: # pragma: no cover _warn(f"Exception raised in WebSocket communicati...
@dinhlongviolin1 I'd like your input on this ...
self._server._ws.emit( "message", payload, to=self.__get_ws_receiver(send_back_only), ) time.sleep(0.001) except Exception as e: # pragma: no cover _warn(f"Exception raised in WebSock...
@@ -1193,7 +1193,11 @@ def __broadcast_ws(self, payload: dict, client_id: t.Optional[str] = None): def __send_ack(self, ack_id: t.Optional[str]) -> None: if ack_id: try: - self._server._ws.emit("message", {"type": _WsType.ACKNOWLEDGEMENT.value, "id": ack_id}) + s...
taipy/gui/gui.py
26
Python
0.071
suggestion
48
51
51
false
navigate and download only for the browser window that requests it
1,336
Avaiga/taipy
12,680
Python
FredLL-Avaiga
FredLL-Avaiga
hasher = hashlib.sha256() with open(file_path, "rb") as f: buf = f.read() hasher.update(buf) return hasher.hexdigest() def hash_files_in_frontend_folder(frontend_folder): combined_hasher = hashlib.sha256() file_hashes = {} lookup_fe_folder = [f"{frontend_folder}{os.sep}taipy", ...
What is the purpose of these two conditions? If these conditions are met, the `continue` is applied to the first `for` and not to both. Consequently, they do nothing. Do you agree?
hasher = hashlib.sha256() with open(file_path, "rb") as f: buf = f.read() hasher.update(buf) return hasher.hexdigest() def hash_files_in_frontend_folder(frontend_folder): combined_hasher = hashlib.sha256() file_hashes = {} lookup_fe_folder = [f"{frontend_folder}{os.sep}taipy", ...
@@ -0,0 +1,77 @@ +# 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...
tools/frontend/hash_source.py
26
Python
0.5
question
180
45
43
false
Cache dependencies on github actions (#1296)
1,337
Avaiga/taipy
12,680
Python
florian-vuillemot
dinhlongviolin1
_to_camel_case(var_name), _get_client_var_name(hash_name), ) if with_update: self.__set_update_var_name(hash_name) if with_default: if native_type: val = self.__attributes.get(var_name) ...
I would have wriitten this: ```suggestion if isinstance(value, (datetime, date, time)): value = _date_to_string(value) self.set_attribute(_to_camel_case(var_name), value) ``` That to me is more readable.
_to_camel_case(var_name), _get_client_var_name(hash_name), ) if with_update: self.__set_update_var_name(hash_name) if with_default: if native_type: val = self.__attributes.get(var_name) ...
@@ -827,7 +827,10 @@ def set_value_and_default( value = float(value) if isinstance(value, (int, float)): return self.__set_react_attribute(_to_camel_case(var_name), value) - self.set_attribute(_to_camel_case(var_name), value) + ...
taipy/gui/_renderers/builder.py
26
Python
0.786
suggestion
261
51
51
false
support filter on selector dropdown
1,338
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
); } else { onAction && dispatch(createSendActionNameAction(id, module, onAction, name, url)); } } }, [active, render, auto, name, url, dispatch, id, onAction, module]); const clickHandler = useCallback(() => { if (aRef.current) { ...
I'm afraid that moving `className` to the button will cause breaking change for the current users of Taipy. The point of having the `className` at the top-level of the component tree of a Taipy element is to facilitate the style customization of any of the component in the element's tree.
); } else { onAction && dispatch(createSendActionNameAction(id, module, onAction, name, url)); } } }, [active, render, auto, name, url, dispatch, id, onAction, module]); const clickHandler = useCallback(() => { if (aRef.current) { ...
@@ -93,11 +93,11 @@ const FileDownload = (props: FileDownloadProps) => { const aProps = useMemo(() => (bypassPreview ? {} : { target: "_blank", rel: "noreferrer" }), [bypassPreview]); return render ? ( - <label htmlFor={linkId} className={className}>
frontend/taipy-gui/src/components/Taipy/FileDownload.tsx
26
TypeScript
0.643
style
290
40
40
false
Implement fullwidth styling to FileSelector and FileDownload
1,345
Avaiga/taipy
12,680
Python
FredLL-Avaiga
Satoshi-Sh
markers: [], selectedMarkers: [], orientations: [], names: [], lines: [], texts: [], textAnchors: [], options: [], axisNames: [], addIndex: [], } as ChartConfig; const emptyLayout = {} as Partial<Layout>; const emptyData = {} as Record<string, TraceValueType>; const TaipyPlotly...
This could be easier to read if moved to line 230, before you change it.
markers: [], selectedMarkers: [], orientations: [], names: [], lines: [], texts: [], textAnchors: [], options: [], axisNames: [], addIndex: [], } as ChartConfig; const emptyLayout = {} as Partial<Layout>; const emptyData = {} as Record<string, TraceValueType>; const TaipyPlotly...
@@ -227,15 +218,23 @@ const TaipyPlotlyButtons: ModeBarButtonAny[] = [ path: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z", }, click: function (gd: HTMLElement, evt: Event) { - const title = gd.classList.toggle("full-screen") ? "Exit Full scre...
frontend/taipy-gui/src/components/Taipy/Chart.tsx
26
TypeScript
0.286
suggestion
72
51
51
false
chart disappears on refresh
1,346
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
suffix = "" complete = True part = 0 if "total" in request.form: total = int(request.form["total"]) if total > 1 and "part" in request.form: part = int(request.form["part"]) suffix = f".part.{part}" complete = part =...
Why not use the same error message in _warn as well? I would use an HTTP code 500 instead of 404...
suffix = "" complete = True part = 0 if "total" in request.form: total = int(request.form["total"]) if total > 1 and "part" in request.form: part = int(request.form["part"]) suffix = f".part.{part}" complete = part =...
@@ -963,7 +963,7 @@ def __upload_files(self): part_file_path.unlink() except EnvironmentError as ee: # pragma: no cover _warn("Cannot group file after chunk upload", ee) - return + return (f"Can...
taipy/gui/gui.py
26
Python
0.571
question
100
51
51
false
chart disappears on refresh
1,346
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
const isOnClick = (types: string[]) => (types?.length ? types.every((t) => t === "pie") : false); interface WithpointNumbers { pointNumbers: number[]; } const getPlotIndex = (pt: PlotDatum) => pt.pointIndex === undefined ? pt.pointNumber === undefined ? (pt as unknown as WithpointNumbers).p...
Why need to changed it from `Record<string, Record<string, unknown>>` to `Partial<Layout>` though 🤔
? (pt as unknown as WithpointNumbers).pointNumbers[0] : 0 : pt.pointNumber : pt.pointIndex; const defaultConfig = { columns: {} as Record<string, ColumnDesc>, labels: [], modes: [], types: [], traces: [], xaxis: [], yaxis: [], markers:...
@@ -214,7 +205,7 @@ const defaultConfig = { addIndex: [], } as ChartConfig; -const emptyLayout = {} as Record<string, Record<string, unknown>>; +const emptyLayout = {} as Partial<Layout>;
frontend/taipy-gui/src/components/Taipy/Chart.tsx
26
TypeScript
0.429
suggestion
99
51
51
false
chart disappears on refresh
1,346
Avaiga/taipy
12,680
Python
namnguyen20999
FredLL-Avaiga
return ("No selected file", 400) suffix = "" complete = True part = 0 if "total" in request.form: total = int(request.form["total"]) if total > 1 and "part" in request.form: part = int(request.form["part"]) suffix = f".p...
Why not store the computed string in a reusable variable instead of duplicating the code?
return ("No selected file", 400) suffix = "" complete = True part = 0 if "total" in request.form: total = int(request.form["total"]) if total > 1 and "part" in request.form: part = int(request.form["part"]) suffix = f".p...
@@ -962,8 +962,8 @@ def __upload_files(self): # remove file_path after it is merged part_file_path.unlink() except EnvironmentError as ee: # pragma: no cover - _warn("Cannot group file after chunk upload", ee)...
taipy/gui/gui.py
26
Python
0.286
refactor
89
51
51
false
chart disappears on refresh
1,346
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
height: 24, width: 24, path: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z", }, click: function (gd: HTMLElement, evt: Event) { const div = gd.querySelector("div.svg-container") as HTMLDivElement; if (!div) { ...
Please add // Shallow copy That concat() syntax is really misleading.
height: 24, width: 24, path: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z", }, click: function (gd: HTMLElement, evt: Event) { const div = gd.querySelector("div.svg-container") as HTMLDivElement; if (!div) { ...
@@ -236,6 +236,14 @@ const TaipyPlotlyButtons: ModeBarButtonAny[] = [ }, ]; +const updateArrays = (sel: number[][], val: number[], idx: number) => { + if (idx >= sel.length || val.length !== sel[idx].length || val.some((v, i) => sel[idx][i] != v)) { + sel = sel.concat();
frontend/taipy-gui/src/components/Taipy/Chart.tsx
26
TypeScript
0.214
suggestion
70
51
51
false
manage multi trace selection when on selected variable is binded
1,354
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
No need for Show_value= true (default)
# 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,29 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required b...
doc/gui/examples/controls/metric-simple.py
24
Python
0.071
suggestion
38
30
28
false
[DOCS] Metric component examples
1,356
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
# 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...
Can use width and height directly Can you show a differentiating use case
# 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,30 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required b...
doc/gui/examples/controls/metric-layout.py
26
Python
0.286
suggestion
73
31
44
false
[DOCS] Metric component examples
1,356
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
```suggestion layout = { ```
# 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,30 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required b...
doc/gui/examples/controls/metric-layout.py
20
Python
0.429
suggestion
30
31
44
false
[DOCS] Metric component examples
1,356
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
```suggestion <|90|metric|delta={delta_value}|format=%d km/h|delta_format=%d km/h|> ```
# 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,29 @@ +# Copyright 2021-2024 Avaiga Private Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required b...
doc/gui/examples/controls/metric-value-format.py
24
Python
0.571
suggestion
89
30
31
false
[DOCS] Metric component examples
1,356
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
} def _invoke_action(ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any) -> bool: try: if col_type == "any": # when a property is not found, return True only if action is not equals entity = getattr(ent, col.split(".")[0]) if is_dn else ent if not...
Now that I think again about this, I think it makes far more sense to have a single dict: ``` _SC_PROPS: t.Dict[str, t.Dict[str, t.Union[str, bool]]] = { "Config id": {"attr": "config_id", "type": "string"}, "Label": {"attr": "name", "type": "string"}, "Creation date": {"attr": "creation_date", "type":...
} def _invoke_action(ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any) -> bool: try: if col_type == "any": # when a property is not found, return True only if action is not equals entity = getattr(ent, col.split(".")[0]) if is_dn else ent if not...
@@ -257,17 +257,17 @@ def _get_datanode_property(attr: str): class _GuiCoreScenarioProperties(_TaipyBase): - _SC_TYPES = { - "Config id": "string", - "Label": "string", - "Creation date": "date", - "Cycle label": "string", - "Cycle start": "date", - "Cycle end": "date",...
taipy/gui_core/_adapters.py
26
Python
1
suggestion
568
51
51
false
When no cycle are used in the scenario configs ...
1,360
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
"Primary": {"type": "boolean", "cycle": True}, "Tags": {"type": "string"}, } __SC_LABELS: t.Dict[str, str] = { "Config id": "config_id", "Creation date": "creation_date", "Label": "name", "Cycle label": "cycle.name", "Cycle start": "cycle.start", "...
That reads really strange: if 'attr' is unknown, you carry on anyway? With my renaming I would propose `_SC_PROPS.get(attr).get("type", "any")`
"Primary": {"attr": "is_primary", "type": "boolean", "for_cycle": True}, "Tags": {"attr": "tags", "type": "string"}, } __DN_PROPS = { "Up to date": {"attr": "is_up_to_date", "type": "boolean"}, "Valid": {"attr": "is_valid", "type": "boolean"}, "Last edit date": {"attr": "...
@@ -289,7 +289,7 @@ def get_hash(): def get_type(attr: str): if prop := _get_datanode_property(attr): return _GuiCoreScenarioProperties.__DN_TYPES.get(prop, "any") - return _GuiCoreScenarioProperties._SC_TYPES.get(attr, "any") + return _GuiCoreScenarioProperties._SC_TYPES.get(at...
taipy/gui_core/_adapters.py
26
Python
0.643
style
144
51
51
false
When no cycle are used in the scenario configs ...
1,360
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
for f in data: if f == "*": flist.extend(self.get_default_list()) else: flist.append(f) if _GuiCoreScenarioProperties.__ENUMS is None and self.full_desc(): _GuiCoreScenarioProperties.__ENUMS = { ...
```suggestion p[0] for p in filter(lambda prop: not prop[1].get("for_cycle", False), _GuiCoreScenarioProperties._SC_TYPES.items()) ```
flist.append(f) if _GuiCoreScenarioProperties.__ENUMS is None and self.full_desc(): _GuiCoreScenarioProperties.__ENUMS = { "Config id": [c for c in Config.scenarios.keys() if c != "default"], "Tags": list( {t...
@@ -342,6 +342,9 @@ def get(self): class _GuiCoreScenarioFilter(_GuiCoreScenarioProperties): DEFAULT = list(_GuiCoreScenarioProperties._SC_TYPES.keys()) + DEFAULT_NO_CYCLE = [ + p[0] for p in filter(lambda prop: not prop[1].get("cycle", False), _GuiCoreScenarioProperties._SC_TYPES.items())
taipy/gui_core/_adapters.py
26
Python
0.857
suggestion
144
51
51
false
When no cycle are used in the scenario configs ...
1,360
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
} this._onNotify = handler; } get onReload() { return this._onReload; } set onReload(handler: onReloadHandler | undefined) { if (handler !== undefined && handler?.length !== 2) { throw new Error("_onReload() requires two parameters"); } this._...
Can we not send one INIT message instead of 3 ?
set onNotify(handler: OnNotifyHandler | undefined) { if (handler !== undefined && handler.length !== 3) { throw new Error("onNotify() requires three parameters"); } this._onNotify = handler; } get onReload() { return this._onReload; } set onReload(handler...
@@ -89,9 +92,11 @@ export class TaipyApp { this.clientId = ""; this.context = ""; this.appId = ""; + this.routes = undefined; const id = getLocalStorageValue(TAIPY_CLIENT_ID, ""); sendWsMessage(this.socket, "ID", TAIPY_CLIENT_ID, id, id, undefined, false); se...
frontend/taipy-gui/base/src/app.ts
26
TypeScript
0.143
question
47
51
51
false
Get Routes with type frontend decouple
1,370
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1
# # 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 def _build_wrong_config_type_reason(config_id: str) -> str: ```
# # 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...
@@ -22,3 +22,11 @@ def _build_data_node_is_not_written(dn_id: DataNodeId) -> str: def _build_not_submittable_entity_reason(entity_id: str) -> str: return f"Entity {entity_id} is not a submittable entity" + + +def _build_config_can_not_create_reason(config_id: str) -> str:
taipy/core/reason/_reason_factory.py
26
Python
0.714
bug
79
32
37
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
# 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. from .....
```suggestion return f'Object "{config_id}" is not a valid config.' ```
# 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. from ty...
@@ -22,3 +22,11 @@ def _build_data_node_is_not_written(dn_id: DataNodeId) -> str: def _build_not_submittable_entity_reason(entity_id: str) -> str: return f"Entity {entity_id} is not a submittable entity" + + +def _build_config_can_not_create_reason(config_id: str) -> str: + return f'Object "{config_id}" is n...
taipy/core/reason/_reason_factory.py
26
Python
0.571
suggestion
77
26
31
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
```suggestion def _build_not_global_scope_reason(config_id: str) -> str: ```
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
@@ -22,3 +22,11 @@ def _build_data_node_is_not_written(dn_id: DataNodeId) -> str: def _build_not_submittable_entity_reason(entity_id: str) -> str: return f"Entity {entity_id} is not a submittable entity" + + +def _build_config_can_not_create_reason(config_id: str) -> str: + return f'Object "{config_id}" is n...
taipy/core/reason/_reason_factory.py
26
Python
0.571
suggestion
78
28
33
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
Returns: The latest submission created from _scenario_, _sequence_ and _task_, or None if no submission has been created from _scenario_, _sequence_ and _task_. """ return _SubmissionManagerFactory._build_manager()._get_latest(entity) def get_data_nodes() -> List[DataNode]: """Return a...
Is it possible to make the config optional? If no config is passed, we just return True (an empty Reason). The false part will be implemented with the role management in Enterprise Edition. So the API can be used for a specific config, or globally. What do you think?
Returns: The latest submission created from _scenario_, _sequence_ and _task_, or None if no submission has been created from _scenario_, _sequence_ and _task_. """ return _SubmissionManagerFactory._build_manager()._get_latest(entity) def get_data_nodes() -> List[DataNode]: """Return a...
@@ -873,6 +873,23 @@ def get_cycles() -> List[Cycle]: return _CycleManagerFactory._build_manager()._get_all() +def can_create(config: Union[ScenarioConfig, DataNodeConfig]) -> Reasons:
taipy/core/taipy.py
26
Python
0.5
question
274
51
51
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
from taipy.core.data.in_memory import InMemoryDataNode from taipy.core.data.pickle import PickleDataNode from taipy.core.exceptions.exceptions import InvalidDataNodeType, ModelNotFound from tests.core.utils.named_temporary_file import NamedTemporaryFile def file_exists(file_path: str) -> bool: return os.path.exis...
```suggestion dn_config = Config.configure_data_node("dn", 10, scope=Scope.SCENARIO) ```
from taipy.core.data.in_memory import InMemoryDataNode from taipy.core.data.pickle import PickleDataNode from taipy.core.exceptions.exceptions import InvalidDataNodeType, ModelNotFound from tests.core.utils.named_temporary_file import NamedTemporaryFile def file_exists(file_path: str) -> bool: return os.path.exis...
@@ -45,6 +45,24 @@ def test_create_data_node_and_modify_properties_does_not_modify_config(self): assert dn.properties.get("foo") == "bar" assert dn.properties.get("baz") == "qux" + def test_can_create(self): + dn_config = Config.configure_in_memory_data_node("dn", 10, scope=Scope.SCENARIO)
tests/core/data/test_data_manager.py
26
Python
0.571
suggestion
98
51
51
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
class TestDataManager: def test_create_data_node_and_modify_properties_does_not_modify_config(self): dn_config = Config.configure_data_node(id="name", foo="bar") dn = _DataManager._create_and_set(dn_config, None, None) assert dn_config.properties.get("foo") == "bar" assert dn_config....
Do we really need to cast the Reasons object? What would the following do? ``` assert reasons is True ``` Does it work as well?
class TestDataManager: def test_create_data_node_and_modify_properties_does_not_modify_config(self): dn_config = Config.configure_data_node(id="name", foo="bar") dn = _DataManager._create_and_set(dn_config, None, None) assert dn_config.properties.get("foo") == "bar" assert dn_config....
@@ -45,6 +45,24 @@ def test_create_data_node_and_modify_properties_does_not_modify_config(self): assert dn.properties.get("foo") == "bar" assert dn.properties.get("baz") == "qux" + def test_can_create(self): + dn_config = Config.configure_in_memory_data_node("dn", 10, scope=Scope.SCENARIO)...
tests/core/data/test_data_manager.py
26
Python
0.857
question
131
51
51
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
) -> Dict[DataNodeConfig, DataNode]: data_node_configs = [Config.data_nodes[dnc.id] for dnc in data_node_configs] dn_configs_and_owner_id = [] for dn_config in data_node_configs: scope = dn_config.scope owner_id: Union[Optional[SequenceId], Optional[ScenarioId], Optio...
I don't understand the way of getting the config id from a config.
) -> Dict[DataNodeConfig, DataNode]: data_node_configs = [Config.data_nodes[dnc.id] for dnc in data_node_configs] dn_configs_and_owner_id = [] for dn_config in data_node_configs: scope = dn_config.scope owner_id: Union[Optional[SequenceId], Optional[ScenarioId], Optio...
@@ -68,6 +70,18 @@ def _bulk_get_or_create( for dn_config, owner_id in dn_configs_and_owner_id } + @classmethod + def _can_create(cls, config: DataNodeConfig) -> Reasons: + config_id = getattr(config, "id", None) or str(config)
taipy/core/data/_data_manager.py
26
Python
0.214
suggestion
66
51
51
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
def get_cycles() -> List[Cycle]: """Return the list of all existing cycles. Returns: The list of all cycles. """ return _CycleManagerFactory._build_manager()._get_all() def can_create(config: Union[ScenarioConfig, DataNodeConfig]) -> Reasons: """Indicate if a config can be created. ...
If it is not a `ScenarioConfig` or a `DataNodeConfig`, the reason to return is that `config` has an incorrect type. There is no need to look for a `config_id`. No? ```suggestion return Reasons(str(config))._add_reason(str(config), _build_config_can_not_create_reason(config_id)) ``` What do you think?
def get_cycles() -> List[Cycle]: """Return the list of all existing cycles. Returns: The list of all cycles. """ return _CycleManagerFactory._build_manager()._get_all() def can_create(config: Optional[Union[ScenarioConfig, DataNodeConfig]] = None) -> Reasons: """Indicate if a config can...
@@ -873,6 +873,23 @@ def get_cycles() -> List[Cycle]: return _CycleManagerFactory._build_manager()._get_all() +def can_create(config: Union[ScenarioConfig, DataNodeConfig]) -> Reasons: + """Indicate if a config can be created. + + This function checks if the given scenario or data node config can be crea...
taipy/core/taipy.py
26
Python
0.929
bug
317
51
51
false
Feature/enterprise#362 - Add can_create() api
1,390
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
return [ { domain: {x: [0, 1], y: [0, 1]}, value: value, type: "indicator", mode: "gauge" + (showValue ? "+number" : "") + (delta !== undefined ? "+delta" : ""), number: { prefix: extractPrefix(props....
Better surround with try catch
const colorMap = useMemo(() => { try { const obj = props.colorMap ? JSON.parse(props.colorMap) : null; if (obj && typeof obj === 'object') { const keys = Object.keys(obj); return keys.sort((a, b) => Number(a) - Number(b)).map((key, index) => { ...
@@ -91,6 +92,14 @@ const Metric = (props: MetricProps) => { props.max || 100 ] }, + steps: props.colorMap ? (() => { + const obj = JSON.parse(props.colorMap);
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.143
suggestion
30
51
51
false
adding color-map property to Metric
1,407
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
return [ { domain: {x: [0, 1], y: [0, 1]}, value: value, type: "indicator", mode: "gauge" + (showValue ? "+number" : "") + (delta !== undefined ? "+delta" : ""), number: { prefix: extractPrefix(props....
For simplicity, this whole function Block calculating steps could be put in another useMemo
const colorMap = useMemo(() => { try { const obj = props.colorMap ? JSON.parse(props.colorMap) : null; if (obj && typeof obj === 'object') { const keys = Object.keys(obj); return keys.sort((a, b) => Number(a) - Number(b)).map((key, index) => { ...
@@ -91,6 +92,14 @@ const Metric = (props: MetricProps) => { props.max || 100 ] }, + steps: props.colorMap ? (() => { + const obj = JSON.parse(props.colorMap);
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.286
suggestion
91
51
51
false
adding color-map property to Metric
1,407
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
Ooh I would love to see the comments for that map here.
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing p...
@@ -0,0 +1,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/controls/metric-color-map.py
26
Python
0.214
suggestion
57
29
39
false
adding color-map property to Metric
1,407
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value, props.defaultValue, 0) const threshold = useDynamicProperty(props.threshold, props.defaultThreshold, undefined) const delta = use...
```suggestion console.info(`Error parsing color_map value (metric).\n${(e as Error).message || e}`); ```
const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value, props.defaultValue, 0) const threshold = useDynamicProperty(props.threshold, props.defaultThreshold, undefined) const delta = us...
@@ -66,6 +67,22 @@ const Metric = (props: MetricProps) => { const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined); const theme = useTheme(); + const colorMap = useMemo(() => { + try { + const obj = props.colorMap && JSON.parse(props.colorMap); + ...
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.857
suggestion
118
51
51
false
adding color-map property to Metric
1,407
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
const emptyLayout = {} as Record<string, Record<string, unknown>>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value...
is it a problem when the max (100) is specified as the last key ?
} const emptyLayout = {} as Partial<Layout>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value, props.defaultValue, ...
@@ -66,6 +67,22 @@ const Metric = (props: MetricProps) => { const hover = useDynamicProperty(props.hoverText, props.defaultHoverText, undefined); const theme = useTheme(); + const colorMap = useMemo(() => { + try { + const obj = props.colorMap ? JSON.parse(props.colorMap) : null; + ...
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.214
question
65
51
51
false
adding color-map property to Metric
1,407
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
const zoomToFit = useCallback(() => engine.zoomToFit(), [engine]); const onClick = useCallback((id: string) => onAction && dispatch(createSendActionNameAction(props.id, module, onSelect, id, onAction)), [props.id, onAction, onSelect, module, dispatch]); useEffect(() => { const model = new TaipyDia...
No issue with initial value for pv? If this works, I guess not.
} setDisplayModel((oldDm) => (deepEqual(oldDm, dm) ? oldDm : dm)); }, [props.scenario, props.defaultScenario, taskStatuses]); const relayout = useCallback(() => relayoutDiagram(engine, dagreEngine), [engine, dagreEngine]); const zoomToFit = useCallback(() => engine.zoomToFit(), [engine]); ...
@@ -133,14 +142,23 @@ const ScenarioDag = (props: ScenarioDagProps) => { if (displayModel) { setScenarioId(displayModel[0]); // populate model - doLayout = populateModel(displayModel, model); + doLayout = populateModel(addStatusToDisplayModel(displayModel, taskSt...
frontend/taipy/src/ScenarioDag.tsx
26
TypeScript
0.214
suggestion
64
35
51
false
Support for pandas TimeStamp
1,412
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
import React, { useCallback, useEffect, useMemo, useState } from "react"; import { CanvasWidget } from "@projectstorm/react-canvas-core"; import Box from "@mui/material/Box"; import AppBar from "@mui/material/AppBar"; import IconButton from "@mui/material/IconButton"; import Paper from "@mui/material/Paper"; import Too...
500ms is usually pretty slow for a user interaction. Can this be smaller?
[props.id, onAction, onSelect, module, dispatch] ); useEffect(() => { const model = new TaipyDiagramModel(onClick); initDiagram(engine); let doLayout = false; if (displayModel) { setScenarioId(displayModel[0]); // populate model doLayo...
@@ -133,14 +142,23 @@ const ScenarioDag = (props: ScenarioDagProps) => { if (displayModel) { setScenarioId(displayModel[0]); // populate model - doLayout = populateModel(displayModel, model); + doLayout = populateModel(addStatusToDisplayModel(displayModel, taskSt...
frontend/taipy/src/ScenarioDag.tsx
26
TypeScript
0.286
performance
74
159
43
false
Support for pandas TimeStamp
1,412
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
} const emptyLayout = {} as Record<string, Record<string, unknown>>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.val...
I would have thought that title was part of the layout?
} const emptyLayout = {} as Partial<Layout>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value, props.defaultValue, ...
@@ -72,6 +73,9 @@ const Metric = (props: MetricProps) => { (delta !== undefined) && mode.push("delta"); return [ { + title: {
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.214
question
55
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
const emptyLayout = {} as Record<string, Record<string, unknown>>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value...
What if there's no title? See implementation in Chart.tsx - although this is based on the layout prop...
const emptyLayout = {} as Partial<Layout>; const defaultStyle = {position: "relative", display: "inline-block"}; const Metric = (props: MetricProps) => { const { width = "100%", height, showValue = true } = props; const value = useDynamicProperty(props.value, props.defaultValue, 0)...
@@ -72,6 +73,9 @@ const Metric = (props: MetricProps) => { (delta !== undefined) && mode.push("delta"); return [ { + title: { + text: props.title
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.357
question
104
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
}, [] as number[][]); if (traces.length) { const upvars = traces.map((_, idx) => getUpdateVar(updateVars, `selected${idx}`)); if (traces.length > 1 && new Set(upvars).size === 1) { dispatch(createSendUpdateAction(upvars[0], ...
Just move the tooltip around the parent `Box`
}, [] as number[][]); if (traces.length) { const upvars = traces.map((_, idx) => getUpdateVar(updateVars, `selected${idx}`)); if (traces.length > 1 && new Set(upvars).size === 1) { dispatch(createSendUpdateAction(upvars[0], ...
@@ -616,34 +617,36 @@ const Chart = (props: ChartProp) => { return render ? ( <Box id={id} data-testid={props.testId} className={className} ref={plotRef}> <Tooltip title={hover || ""}>
frontend/taipy-gui/src/components/Taipy/Chart.tsx
26
TypeScript
0.286
suggestion
45
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
: ({...defaultStyle, width: width, height: height} as CSSProperties), [height, width] ); const skelStyle = useMemo(() => ({...style, minHeight: "7em"}), [style]); const layout = useMemo(() => { const layout = {...baseLayout}; let template = undefined; try { ...
no need to expand layout here I propose ``` if (props.title) { layout.title = props.title; } ```
: ({...defaultStyle, width: width, height: height} as CSSProperties), [height, width] ); const skelStyle = useMemo(() => ({...style, minHeight: "7em"}), [style]); const layout = useMemo(() => { const layout = {...baseLayout}; let template = undefined; try { ...
@@ -144,34 +145,40 @@ const Metric = (props: MetricProps) => { layout.template = template; } - return layout + return {
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.714
suggestion
105
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
: darkTemplate : props.template_Light_ && JSON.parse(props.template_Light_); template = tpl ? (tplTheme ? {...tpl, ...tplTheme} : tpl) : tplTheme ? tplTheme : undefined; } catch (e) { console.info(`Error while parsing Metric.template\n${(e as E...
Move the `Tooltip` around the parent `Box`
: darkTemplate : props.template_Light_ && JSON.parse(props.template_Light_); template = tpl ? (tplTheme ? {...tpl, ...tplTheme} : tpl) : tplTheme ? tplTheme : undefined; } catch (e) { console.info(`Error while parsing Metric.template\n${(e as E...
@@ -144,34 +145,40 @@ const Metric = (props: MetricProps) => { layout.template = template; } - return layout + return { + title: props.title || layout.title, + ...layout + } as Partial<Layout> }, [ + props.title, props.template, ...
frontend/taipy-gui/src/components/Taipy/Metric.tsx
26
TypeScript
0.286
suggestion
42
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
const baseY = addIndex ? xs : ys; const axisNames = config.axisNames.length > idx ? config.axisNames[idx] : ([] as string[]); if (baseX.length) { if (axisNames.length > 0) { ret[axisNames[0]] = baseX; ...
So that's a strange indentation...
const baseX = addIndex ? Array.from(Array(xs.length).keys()) : xs; const baseY = addIndex ? xs : ys; const axisNames = config.axisNames.length > idx ? config.axisNames[idx] : ([] as string[]); if (baseX.length) { if (axisNames.length > ...
@@ -417,83 +418,83 @@ const Chart = (props: ChartProp) => { const datum = data[dataKey]; lastDataPl.current = datum ? config.traces.map((trace, idx) => { - const ret = { - ...getArrayValue(config.options, idx, {}), - type: config....
frontend/taipy-gui/src/components/Taipy/Chart.tsx
26
TypeScript
0.071
style
34
51
51
false
Add title for Metric.tsx
1,424
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
return null; } try { return tz && tz !== "Etc/Unknown" && withTime ? toZonedTime(value, tz) : new Date(value); } catch (e) { return null; } }; export const getDateTimeString = ( value: string, datetimeformat: string | undefined, formatConf: FormatConfig, tz?: str...
An easy thing that you could do first is simply to check if the format string (datetimeformat or formatConf.dateTime) contains a "D" or not. No need for fancy regexp here. Add the useAdditionalDayOfYearTokens settings if yes, and we're all good. What do you think?
return null; } try { return tz && tz !== "Etc/Unknown" && withTime ? toZonedTime(value, tz) : new Date(value); } catch (e) { return null; } }; export const getDateTimeString = ( value: string, datetimeformat: string | undefined, formatConf: FormatConfig, tz?: str...
@@ -105,14 +105,20 @@ export const getDateTimeString = ( tz?: string, withTime: boolean = true ): string => { - if (withTime) { - return formatInTimeZone( - getDateTime(value) || "", - formatConf.forceTZ || !tz ? formatConf.timeZone : tz, - datetimeformat || formatC...
frontend/taipy-gui/src/utils/index.ts
26
TypeScript
0.5
question
266
51
51
false
Submission status update
1,434
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
except Exception as e: # pragma: no cover _warn( f"Exception raised in '{lib_name}.get_data({lib_name}, payload, {user_var_name}, value)'", # noqa: E501 e, ) if n...
```suggestion if page_path in ["/", ""]: ``` More efficient don't you think?
except Exception as e: # pragma: no cover _warn( f"Exception raised in '{lib_name}.get_data({lib_name}, payload, {user_var_name}, value)'", # noqa: E501 e, ) if n...
@@ -1111,10 +1111,13 @@ def __request_var_update(self, payload: t.Any): def __handle_ws_get_module_context(self, payload: t.Any): if isinstance(payload, dict): + page_path = str(payload.get("path")) + if page_path in {"/", ""}:
taipy/gui/gui.py
26
Python
0.571
performance
91
51
51
false
root page decouple
1,443
Avaiga/taipy
12,680
Python
FabienLelaquais
dinhlongviolin1
export class TaipyWsAdapter extends WsAdapter { supportedMessageTypes: string[]; initWsMessageTypes: string[]; constructor() { super(); this.supportedMessageTypes = ["MU", "ID", "GMC", "GDT", "AID", "GR", "AL"]; this.initWsMessageTypes = ["ID", "AID", "GMC"]; } handleWsMessag...
is a surrounding try/catch worth it ?
export class TaipyWsAdapter extends WsAdapter { supportedMessageTypes: string[]; initWsMessageTypes: string[]; constructor() { super(); this.supportedMessageTypes = ["MU", "ID", "GMC", "GDT", "AID", "GR", "AL"]; this.initWsMessageTypes = ["ID", "AID", "GMC"]; } handleWsMessag...
@@ -43,9 +43,9 @@ export class TaipyWsAdapter extends WsAdapter { taipyApp.clientId = id; taipyApp.updateContext(taipyApp.path); } else if (message.type === "GMC") { - const mc = (message.payload as Record<string, unknown>).data as string; - w...
frontend/taipy-gui/base/src/wsAdapter.ts
26
TypeScript
0.071
question
37
51
51
false
fix decouple metadata
1,446
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1
if payload.get("refresh", False): # refresh vars for _var in t.cast(list, payload.get("names")): val = _getscopeattr_drill(self, _var) self._refresh_expr( val.get_name() if isinstance(val, _TaipyBase) else _var, ...
"metadata": json.dumps(metadata, cls=_TaipyJsonEncoder)} if metadata else None
if payload.get("refresh", False): # refresh vars for _var in t.cast(list, payload.get("names")): val = _getscopeattr_drill(self, _var) self._refresh_expr( val.get_name() if isinstance(val, _TaipyBase) else _var, ...
@@ -1116,10 +1116,15 @@ def __handle_ws_get_module_context(self, payload: t.Any): self._bind_custom_page_variables( self._get_page(str(payload.get("path")))._renderer, self._get_client_id() ) + # get metadata if there is one + metadata...
taipy/gui/gui.py
26
Python
0.214
suggestion
79
51
51
false
fix decouple metadata
1,446
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1
self.__adapter_for_type: t.Dict[str, t.Callable] = {} self.__type_for_variable: t.Dict[str, str] = {} self.__warning_by_type: t.Set[str] = set() def _get_adapted_lov(self, lov: t.Any, var_type: str) -> _AdaptedLov: return _AdaptedLov(lov, var_type) def _add_for_type(self, type_...
this 2 lines could go into the _AdaptedLov.get method
self.__warning_by_type: t.Set[str] = set() def _get_adapted_lov(self, lov: t.Any, var_type: str) -> _AdaptedLov: if not isinstance(lov, list) and hasattr(lov, "tolist"): try: lov = lov.tolist() # type: ignore[union-attr] except Exception as e: ...
@@ -60,6 +62,8 @@ def _get_unique_type(self, type_name: str) -> str: def run(self, var_name: str, value: t.Any, id_only=False) -> t.Any: lov = _AdaptedLov.get_lov(value) + if isinstance(lov, pd.Series):
taipy/gui/utils/_adapter.py
26
Python
0.286
suggestion
53
51
51
false
Accept Pandas Series in lov property
1,447
Avaiga/taipy
12,680
Python
FredLL-Avaiga
Satoshi-Sh
with tgb.Page(frame=None) as page: tgb.selector( # type: ignore[attr-defined] value="{selected_obj}", lov="{scenario_list}", adapter="{lambda elt: (elt['id'], elt['name'])}", propagate=False, ) expected_list = [ "<Selector", 'defau...
need to add `# type: ignore[attr-defined]` to avoid the linter error
with tgb.Page(frame=None) as page: tgb.selector( # type: ignore[attr-defined] value="{selected_obj}", lov="{scenario_list}", adapter="{lambda elt: (elt['id'], elt['name'])}", propagate=False, ) expected_list = [ "<Selector", 'defau...
@@ -69,3 +71,19 @@ def test_selector_builder_3(gui: Gui, test_client, helpers): "value={_TpLv_tpec_TpExPr_selected_obj_TPMDL_0}", ] helpers.test_control_builder(gui, page, expected_list) + + +def test_selector_builder_4(gui: Gui, test_client, helpers): + pd_series = pd.Series(["l1", "l2", "l3"]) +...
tests/gui/builder/control/test_selector.py
26
Python
0.571
style
68
35
35
false
Accept Pandas Series in lov property
1,447
Avaiga/taipy
12,680
Python
FredLL-Avaiga
Satoshi-Sh
gui._bind_var_val( "scenario_list", [{"id": "1", "name": "scenario 1"}, {"id": "3", "name": "scenario 3"}, {"id": "2", "name": "scenario 2"}], ) gui._bind_var_val("selected_obj", {"id": "1", "name": "scenario 1"}) with tgb.Page(frame=None) as page: tgb.selector( # type: ignore[a...
I would have renamed this test to `test_selector_pandas_series`, which really is the point of it.
gui._bind_var_val( "scenario_list", [{"id": "1", "name": "scenario 1"}, {"id": "3", "name": "scenario 3"}, {"id": "2", "name": "scenario 2"}], ) gui._bind_var_val("selected_obj", {"id": "1", "name": "scenario 1"}) with tgb.Page(frame=None) as page: tgb.selector( # type: ignore[a...
@@ -69,3 +71,19 @@ def test_selector_builder_3(gui: Gui, test_client, helpers): "value={_TpLv_tpec_TpExPr_selected_obj_TPMDL_0}", ] helpers.test_control_builder(gui, page, expected_list) + + +def test_selector_builder_4(gui: Gui, test_client, helpers):
tests/gui/builder/control/test_selector.py
26
Python
0.429
suggestion
97
40
40
false
Accept Pandas Series in lov property
1,447
Avaiga/taipy
12,680
Python
FabienLelaquais
Satoshi-Sh
from taipy import Gui ``` """ __root_page_name = "TaiPy_root_page" __env_filename = "taipy.gui.env" __UI_BLOCK_NAME = "TaipyUiBlockVar" __MESSAGE_GROUPING_NAME = "TaipyMessageGrouping" __ON_INIT_NAME = "TaipyOnInit" __ARG_CLIENT_ID = "client_id" __INIT_URL = "taipy-init"...
I... guess I would rename this variable to '__DEFAULT_FAVICON_URL'? Makes it really long, I know...
from taipy import Gui ``` """ __root_page_name = "TaiPy_root_page" __env_filename = "taipy.gui.env" __UI_BLOCK_NAME = "TaipyUiBlockVar" __MESSAGE_GROUPING_NAME = "TaipyMessageGrouping" __ON_INIT_NAME = "TaipyOnInit" __ARG_CLIENT_ID = "client_id" __INIT_URL = "taipy-init"...
@@ -223,6 +223,7 @@ class Gui: __ROBOTO_FONT = "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" __DOWNLOAD_ACTION = "__Taipy__download_csv" __DOWNLOAD_DELETE_ACTION = "__Taipy__download_delete_csv" + __FAVICON_URL = "https://raw.githubusercontent.com/Avaiga/taipy-assets/de...
taipy/gui/gui.py
26
Python
0.286
suggestion
99
51
51
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
`(Gui.)run^` method was set to True, or you are running in an IPython notebook context. """ if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server._is_running: self._server.stop_thread() self.run(**self.__run_kwargs, _reload=True) ...
Same line, please. Just like the others -> `"""Change the favicon for all clients.`
""" if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server._is_running: self._server.stop_thread() self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """S...
@@ -2621,3 +2637,16 @@ def stop(self): def _get_autorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False): return contextlib.nullcontext() + + def set_favicon(self, favicon_path: t.Union[str, Path]): + """
taipy/gui/gui.py
26
Python
0.429
suggestion
86
37
38
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server._is_running: self._server.stop_thread() self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """ Stop...
```suggestion This function dynamically changes the favicon of Taipy GUI pages for all connected client. ```
self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """Stop the web server. This function stops the underlying web server only in the situation where it was run in a separated thread: the *run_...
@@ -2621,3 +2637,16 @@ def stop(self): def _get_autorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False): return contextlib.nullcontext() + + def set_favicon(self, favicon_path: t.Union[str, Path]): + """ + Change the favicon for all clients. + + Th...
taipy/gui/gui.py
26
Python
0.786
suggestion
118
34
35
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """ Stop the web server. This function stops the underlying web server only in the situation where it was run in a separated thread: ...
```suggestion The *favicon* parameter to `(Gui.)run()^` can also be used to change the favicon when the application starts. ```
def stop(self): """Stop the web server. This function stops the underlying web server only in the situation where it was run in a separated thread: the *run_in_thread* parameter to the `(Gui.)run()^` method was set to True, or you are running in an IPython notebook context....
@@ -2621,3 +2637,16 @@ def stop(self): def _get_autorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False): return contextlib.nullcontext() + + def set_favicon(self, favicon_path: t.Union[str, Path]): + """ + Change the favicon for all clients. + + Th...
taipy/gui/gui.py
26
Python
0.786
suggestion
137
32
33
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
_attrsetter(self, name, val) def broadcast(self, name: str, value: t.Any): """Update a variable on all clients. All connected clients will receive an update of the variable called *name* with the provided value, even if it is not shared. Arguments: name (str): ...
```suggestion """Change the favicon for the client of this state. ```
_attrsetter(self, name, val) def broadcast(self, name: str, value: t.Any): """Update a variable on all clients. All connected clients will receive an update of the variable called *name* with the provided value, even if it is not shared. Arguments: name (str): ...
@@ -243,3 +245,12 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, traceback): return super().__getattribute__(State.__attrs[0]).__exit__(exc_type, exc_value, traceback) + + def set_favicon(self, favicon_path: t.Union[str, Path]): + """Change the favicon for a specific client.
taipy/gui/state.py
26
Python
0.643
suggestion
79
33
34
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
def broadcast(self, name: str, value: t.Any): """Update a variable on all clients. All connected clients will receive an update of the variable called *name* with the provided value, even if it is not shared. Arguments: name (str): The variable name to update. ...
```suggestion This function dynamically changes the favicon of Taipy GUI pages for this client. ```
def broadcast(self, name: str, value: t.Any): """Update a variable on all clients. All connected clients will receive an update of the variable called *name* with the provided value, even if it is not shared. Arguments: name (str): The variable name to update. ...
@@ -243,3 +245,12 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, traceback): return super().__getattribute__(State.__attrs[0]).__exit__(exc_type, exc_value, traceback) + + def set_favicon(self, favicon_path: t.Union[str, Path]): + """Change the favicon for a specific client. +...
taipy/gui/state.py
26
Python
0.786
suggestion
109
31
32
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server._is_running: self._server.stop_thread() self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """Stop the web ...
```suggestion TODO The *favicon_url* parameter to `(Gui.)run()^` can also be used to change the favicon when the application starts. ``` (doc is kind of incomplete - but will do in the future)
if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server._is_running: self._server.stop_thread() self.run(**self.__run_kwargs, _reload=True) _TaipyLogger._get_logger().info("Gui server has been reloaded.") def stop(self): """Stop the web ...
@@ -2635,14 +2635,15 @@ def stop(self): def _get_autorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False): return contextlib.nullcontext() - def set_favicon(self, favicon_path: t.Union[str, Path]): + def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Op...
taipy/gui/gui.py
26
Python
0.857
suggestion
203
33
37
false
use taipy-assets favicon
1,453
Avaiga/taipy
12,680
Python
FabienLelaquais
FredLL-Avaiga
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
```suggestion reason (str): The English representation of the reason why the action cannot be performed. ```
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
20
Python
0.714
suggestion
118
45
45
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
which prevents specific actions from being performed. Attributes: datanode_id (str): The identifier of the `DataNode^`. """ def __init__(self, datanode_id: str): Reason.__init__(self, f"DataNode {datanode_id} is not written") _DataNodeReasonMixin.__init__(self, datanode_id) c...
```suggestion A config id is not a valid expected config, which prevents specific actions from being performed. ```
class DataNodeIsNotWritten(Reason, _DataNodeReasonMixin): """ A `DataNode^` has never been written, which prevents specific actions from being performed. Attributes: datanode_id (str): The identifier of the `DataNode^`. """ def __init__(self, datanode_id: str): Reason.__init__(se...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.714
suggestion
121
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
def __repr__(self) -> str: return self._reason def __hash__(self) -> int: return hash(self._reason) def __eq__(self, value: Any) -> bool: return isinstance(value, Reason) and value._reason == self._reason class _DataNodeReasonMixin: def __init__(self, datanode_id: str): ...
```suggestion A `DataNode^` is being edited, which prevents specific actions from being performed. ```
def __init__(self, reason: str): self._reason = reason def __str__(self) -> str: return self._reason def __repr__(self) -> str: return self._reason def __hash__(self) -> int: return hash(self._reason) def __eq__(self, value: Any) -> bool: return isinstanc...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.714
suggestion
108
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
@property def datanode(self): from ..data._data_manager_factory import _DataManagerFactory return _DataManagerFactory._build_manager()._get(self.datanode_id) class DataNodeEditInProgress(Reason, _DataNodeReasonMixin): """ DataNodeEditInProgress holds the reason a `DataNode^` is being...
```suggestion A `DataNode^` has never been written, which prevents specific actions from being performed. ```
return isinstance(value, Reason) and value._reason == self._reason class _DataNodeReasonMixin: def __init__(self, datanode_id: str): self.datanode_id = datanode_id @property def datanode(self): from ..data._data_manager_factory import _DataManagerFactory return _DataManag...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.714
suggestion
115
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
Attributes: datanode_id (str): The identifier of the `DataNode^`. """ def __init__(self, datanode_id: str): Reason.__init__(self, f"DataNode {datanode_id} is being edited") _DataNodeReasonMixin.__init__(self, datanode_id) class DataNodeIsNotWritten(Reason, _DataNodeReasonMixin): ...
```suggestion An entity is not a submittable entity, which prevents specific actions from being performed. ```
class DataNodeEditInProgress(Reason, _DataNodeReasonMixin): """ A `DataNode^` is being edited, which prevents specific actions from being performed. Attributes: datanode_id (str): The identifier of the `DataNode^`. """ def __init__(self, datanode_id: str): Reason.__init__(self, f"...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.714
suggestion
116
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
def __init__(self, entity_id: str): Reason.__init__(self, f"Entity {entity_id} is not a submittable entity") class WrongConfigType(Reason): """ WrongConfigType holds the reason the provided config is not the valid config expected. Attributes: config_id (str): The identifier of the con...
```suggestion A data node config does not have a GLOBAL scope, which prevents specific actions from being performed. ```
Attributes: entity_id (str): The identifier of the `Entity^`. """ def __init__(self, entity_id: str): Reason.__init__(self, f"Entity {entity_id} is not a submittable entity") class WrongConfigType(Reason): """ A config id is not a valid expected config, which prevents specific act...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.714
suggestion
126
34
37
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
```suggestion A reason explains why a specific action cannot be performed. This is a parent class aiming at being implemented by specific sub-classes. Because Taipy applications are natively multiuser, asynchronous, and dynamic, some functions might not be called in some specific contex...
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
17
Python
0.857
suggestion
679
42
42
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the...
Can't we remove this property? We already have the string representation.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under the...
@@ -9,33 +9,114 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from typing import Dict, Set +from typing import Any, Optional -class Reasons: - def __init__(s...
taipy/core/reason/reason.py
26
Python
0.286
refactor
73
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
owner_id: Union[Optional[SequenceId], Optional[ScenarioId], Optional[CycleId]] if scope == Scope.SCENARIO: owner_id = scenario_id elif scope == Scope.CYCLE: owner_id = cycle_id else: owner_id = None dn_configs_an...
Since the name difference between `Reasons` and `Reason` classes is only singular or plural, I would love it if the variables to match the class name to avoid future confusion. ```suggestion reasons._add_reason(config_id, WrongConfigType(config_id, DataNodeConfig.__name__)) ```
owner_id: Union[Optional[SequenceId], Optional[ScenarioId], Optional[CycleId]] if scope == Scope.SCENARIO: owner_id = scenario_id elif scope == Scope.CYCLE: owner_id = cycle_id else: owner_id = None dn_configs_an...
@@ -75,9 +74,9 @@ def _can_create(cls, config: Optional[DataNodeConfig] = None) -> Reasons: if config is not None: if not isinstance(config, DataNodeConfig): - reason._add_reason(config_id, _build_wrong_config_type_reason(config_id, "DataNodeConfig")) + reason._add_...
taipy/core/data/_data_manager.py
26
Python
1
bug
299
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
trgiangdo
toan-quach
def __get_outputs(self, dag: nx.DiGraph) -> set[DataNode]: return {node for node, degree in dict(dag.out_degree).items() if degree == 0 and isinstance(node, DataNode)} def get_intermediate(self) -> Set[DataNode]: """Return the set of intermediate data nodes of the submittable entity. ...
Since the name difference between Reasons and Reason classes is only singular or plural, I would love it if the variables to match the class name to avoid future confusion. ```suggestion reasons._add_reason(node.id, DataNodeEditInProgress(node.id)) ```
def __get_outputs(self, dag: nx.DiGraph) -> set[DataNode]: return {node for node, degree in dict(dag.out_degree).items() if degree == 0 and isinstance(node, DataNode)} def get_intermediate(self) -> Set[DataNode]: """Return the set of intermediate data nodes of the submittable entity. ...
@@ -94,9 +93,9 @@ def is_ready_to_run(self) -> Reasons: for node in self.get_inputs(): if node._edit_in_progress: - reason._add_reason(node.id, _build_data_node_is_being_edited_reason(node.id)) + reason._add_reason(node.id, DataNodeEditInProgress(node.id))
taipy/core/_entity/submittable.py
26
Python
0.857
suggestion
273
51
51
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
trgiangdo
toan-quach
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Why do we need to expose this `_DataNodeReasonMixin` class?
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
@@ -9,4 +9,13 @@ # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. -from .reason import Reasons +from .reason import ( + DataNodeEditInProgress, + DataNodeIsNotWritte...
taipy/core/reason/__init__.py
19
Python
0.357
question
59
22
21
false
Reason class refactoring
1,459
Avaiga/taipy
12,680
Python
jrobinAV
toan-quach
const stepMultiplier = useDynamicProperty(props.stepMultiplier, props.defaultStepMultiplier, 10); const handleInput = useCallback( (e: React.ChangeEvent<HTMLInputElement>) => { const val = e.target.value; setValue(val); if (changeDelay === 0) { dispat...
Start with an `if (evt.shiftKey)` that isolates the two cases. Easier to read, and avoid the test on `!evt.shiftKey` afterwards.
if (changeDelay > 0) { if (delayCall.current > 0) { clearTimeout(delayCall.current); } delayCall.current = window.setTimeout(() => { delayCall.current = -1; dispatch(createSendUpdateAction(updateVarNa...
@@ -74,11 +91,29 @@ const Input = (props: TaipyInputProps) => { }, changeDelay); } }, - [updateVarName, dispatch, propagate, onChange, changeDelay, module] + [updateVarName, dispatch, propagate, onChange, changeDelay, module], ); const handleAction = useC...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.571
suggestion
129
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
(event: React.MouseEvent<HTMLButtonElement>) => { handleStepperMouseDown(event, false); }, [handleStepperMouseDown], ); useEffect(() => { if (props.value !== undefined) { setValue(props.value); } }, [props.value]); return ( <Toolt...
Do we really need that? The 'normal' spinner of the number MUI TextField is not enough??
useEffect(() => { if (props.value !== undefined) { setValue(props.value); } }, [props.value]); return ( <Tooltip title={hover || ""}> <TextField sx={{ "& input[type=number]::-webkit-outer-spin-button, & input[type=number]:...
@@ -103,13 +201,28 @@ const Input = (props: TaipyInputProps) => { return ( <Tooltip title={hover || ""}> - <TextField + <StyledTextField margin="dense" hiddenLabel value={value ?? ""} className={className} ...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.214
question
89
48
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
), "navbar": lambda gui, control_type, attrs: _Builder( gui=gui, control_type=control_type, element_name="NavBar", attributes=attrs, default_value=None ).set_attributes( [ ("active", PropertyType.dynamic_boolean, True), ("hover_text", Prope...
Wondering if these should be dynamic...
), "navbar": lambda gui, control_type, attrs: _Builder( gui=gui, control_type=control_type, element_name="NavBar", attributes=attrs, default_value=None ).set_attributes( [ ("active", PropertyType.dynamic_boolean, True), ("hover_text", Prope...
@@ -386,6 +386,10 @@ class _Factory: .set_attributes( [ ("active", PropertyType.dynamic_boolean, True), + ("step", PropertyType.dynamic_number, 1), + ("step_multiplier", PropertyType.dynamic_number, 10), + ("min", PropertyType.number),
taipy/gui/_renderers/factory.py
26
Python
0.143
suggestion
39
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
const handleInput = useCallback( (e: React.ChangeEvent<HTMLInputElement>) => { const val = e.target.value; setValue(val); if (changeDelay === 0) { dispatch(createSendUpdateAction(updateVarName, val, module, onChange, propagate)); return; ...
What if we're *not* in a number text field?
clearTimeout(delayCall.current); } delayCall.current = window.setTimeout(() => { delayCall.current = -1; dispatch(createSendUpdateAction(updateVarName, val, module, onChange, propagate)); }, changeDelay); ...
@@ -74,12 +91,30 @@ const Input = (props: TaipyInputProps) => { }, changeDelay); } }, - [updateVarName, dispatch, propagate, onChange, changeDelay, module] + [updateVarName, dispatch, propagate, onChange, changeDelay, module], ); const handleAction = useC...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.071
question
43
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
} if (changeDelay > 0) { if (delayCall.current > 0) { clearTimeout(delayCall.current); } delayCall.current = window.setTimeout(() => { delayCall.current = -1; dispatch(createSendUpdateActi...
no need for evt.preventDefault() ?
}, [updateVarName, dispatch, propagate, onChange, changeDelay, module], ); const handleAction = useCallback( (evt: KeyboardEvent<HTMLDivElement>) => { if (evt.shiftKey && type === "number") { if (evt.key === "ArrowUp") { let val = ...
@@ -74,12 +91,32 @@ const Input = (props: TaipyInputProps) => { }, changeDelay); } }, - [updateVarName, dispatch, propagate, onChange, changeDelay, module] + [updateVarName, dispatch, propagate, onChange, changeDelay, module], ); const handleAction = useC...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.071
question
34
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
clearTimeout(delayCall.current); delayCall.current = -1; dispatch(createSendUpdateAction(updateVarName, val, module, onChange, propagate)); } else if (changeDelay === -1) { dispatch(createSendUpdateAction(updateVarName, val,...
Why is this not a useCallback ?
[ type, actionKeys, step, stepMultiplier, max, min, changeDelay, onAction, dispatch, id, module, updateVarName, onChange, propagate, ], ...
@@ -92,7 +129,73 @@ const Input = (props: TaipyInputProps) => { evt.preventDefault(); } }, - [actionKeys, updateVarName, onAction, id, dispatch, onChange, changeDelay, propagate, module] + [ + type, + actionKeys, + step, + ...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.143
question
31
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
} }, [props.value]); return ( <Tooltip title={hover || ""}> <StyledTextField margin="dense" hiddenLabel value={value ?? ""} className={className} type={type} id={id} input...
I suppose these are displayed side by side ? If so, can you display them one over the other ?
}, "& input[type=number]": { MozAppearance: "textfield", }, }} margin="dense" hiddenLabel value={value ?? ""} className={className} type...
@@ -103,13 +206,38 @@ const Input = (props: TaipyInputProps) => { return ( <Tooltip title={hover || ""}> - <TextField + <StyledTextField margin="dense" hiddenLabel value={value ?? ""} className={className} ...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.214
question
94
49
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
* * 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 ...
this could be done in the sx prop of TextField (as it is not re-used)
* * 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 ...
@@ -11,16 +11,29 @@ * specific language governing permissions and limitations under the License. */ -import React, { useState, useEffect, useCallback, useRef, KeyboardEvent } from "react"; +import React, { useState, useEffect, useCallback, useRef, KeyboardEvent, useMemo } from "react"; import TextField from "@mu...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.286
suggestion
69
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
const [actionKeys] = useState(() => getActionKeys(props.actionKeys)); const module = useModule(); const changeDelay = typeof props.changeDelay === "number" ? (props.changeDelay >= 0 ? props.changeDelay : -1) : 300; const className = useClassNames(props.libClassName, props.dynamicClassName, props.classN...
this should be tested in Input.spec.tsx
const max = useDynamicProperty(props.max, props.defaultMax, undefined); const handleInput = useCallback( (e: React.ChangeEvent<HTMLInputElement>) => { const val = e.target.value; setValue(val); if (changeDelay === 0) { dispatch(createSendUpdateAction(...
@@ -74,12 +91,32 @@ const Input = (props: TaipyInputProps) => { }, changeDelay); } }, - [updateVarName, dispatch, propagate, onChange, changeDelay, module] + [updateVarName, dispatch, propagate, onChange, changeDelay, module], ); const handleAction = useC...
frontend/taipy-gui/src/components/Taipy/Input.tsx
26
TypeScript
0.143
suggestion
39
51
51
false
Feature/#1429 number step attribute
1,469
Avaiga/taipy
12,680
Python
FredLL-Avaiga
namnguyen20999
throw new Error("onNotify() requires three parameters"); } this._onNotify = handler; } get onReload() { return this._onReload; } set onReload(handler: OnReloadHandler | undefined) { if (handler !== undefined && handler?.length !== 2) { throw new E...
```suggestion throw new Error("onWsStatusUpdate() requires two parameters"); ```
return this._onNotify; } set onNotify(handler: OnNotifyHandler | undefined) { if (handler !== undefined && handler.length !== 3) { throw new Error("onNotify() requires three parameters"); } this._onNotify = handler; } get onReload() { return this._on...
@@ -96,22 +101,43 @@ export class TaipyApp { this._onReload = handler; } + get onWsStatusUpdate() { + return this._onWsStatusUpdate; + } + set onWsStatusUpdate(handler: OnWsStatusUpdate | undefined) { + if (handler !== undefined && handler?.length !== 2) { + throw new E...
frontend/taipy-gui/base/src/app.ts
26
TypeScript
0.714
suggestion
94
51
51
false
Decouple Acknowledgement
1,477
Avaiga/taipy
12,680
Python
FabienLelaquais
dinhlongviolin1
return entity_ids @classmethod def _get_by_config_id(cls, config_id: str, version_number: Optional[str] = None) -> List[Scenario]: """ Get all scenarios by its config id. """ filters = cls._build_filters_with_version(version_number) if not filters: f...
I would call them `from` and `to`.
if scenario.cycle and len(cls._get_all_by_cycle(scenario.cycle)) == 1: _CycleManagerFactory._build_manager()._delete(scenario.cycle.id) super()._delete(scenario.id) @classmethod def _get_children_entity_ids(cls, scenario: Scenario) -> _EntityIds: entity_ids = _En...
@@ -468,3 +468,25 @@ def _get_by_config_id(cls, config_id: str, version_number: Optional[str] = None) for fil in filters: fil.update({"config_id": config_id}) return cls._repository._load_all(filters) + + @classmethod + def _get_by_creation_time( + cls, start_time: datetime, ...
taipy/core/scenario/_scenario_manager.py
26
Python
0.214
suggestion
34
37
42
false
Feature/#393 - Creation time filtering for scenario getters
1,480
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
fil.update({"cycle": cycle.id}) return cls._get_all_by(filters) @classmethod def _get_primary_scenarios(cls) -> List[Scenario]: return [scenario for scenario in cls._get_all() if scenario.is_primary] @classmethod def _sort_scenarios( cls, scenarios: List[Sce...
This can be static. cls is never used. Right?
fil.update({"cycle": cycle.id}) return cls._get_all_by(filters) @classmethod def _get_primary_scenarios(cls) -> List[Scenario]: return [scenario for scenario in cls._get_all() if scenario.is_primary] @staticmethod def _sort_scenarios( scenarios: List[Scenario], ...
@@ -306,6 +306,35 @@ def _sort_scenarios( scenarios.sort(key=lambda x: (x.name, x.id), reverse=descending) return scenarios + @classmethod
taipy/core/scenario/_scenario_manager.py
26
Python
0.143
question
45
51
51
false
Feature/#393 - Creation time filtering for scenario getters
1,480
Avaiga/taipy
12,680
Python
jrobinAV
trgiangdo
This is used when creating custom visual elements, where you have to indicate the type of each property. Some types are 'dynamic', meaning that if the property value is modified, it is automatically handled by Taipy and propagated to the entire application. See `ElementProperty^` for more details...
The proper wording should be: "The property is dynamic and holds a date." Can you please change the surrounding property types as well?
This is used when creating custom visual elements, where you have to indicate the type of each property. Some types are 'dynamic', meaning that if the property value is modified, it is automatically handled by Taipy and propagated to the entire application. See `ElementProperty^` for more details...
@@ -82,6 +82,10 @@ class PropertyType(Enum): """ The property holds a dictionary. """ + dynamic_date = "dynamicdate" + """ + The property holds a dynamic date.
taipy/gui/types.py
26
Python
0.571
question
137
51
51
false
Feature/#848 adding min max picker for date selector
1,485
Avaiga/taipy
12,680
Python
FabienLelaquais
namnguyen20999
throw new Error("onWsMessage() requires three parameters"); } this._onWsMessage = handler; } get onWsStatusUpdate() { return this._onWsStatusUpdate; } set onWsStatusUpdate(handler: OnWsStatusUpdate | undefined) { if (handler !== undefined && handler?.length !...
I wonder if you should `bind` the function so that this will be defined and you don't have to pass taipyApp as first parameter ?
onNotifyEvent(type: string, message: string) { this.onNotify && this.onNotify(this, type, message); } get onReload() { return this._onReload; } set onReload(handler: OnReloadHandler | undefined) { if (handler !== undefined && handler?.length !== 2) { throw new Er...
@@ -101,6 +103,16 @@ export class TaipyApp { this._onReload = handler; } + get onWsMessage() { + return this._onWsMessage; + } + set onWsMessage(handler: OnWsMessage | undefined) { + if (handler !== undefined && handler?.length !== 3) { + throw new Error("onWsMessage() ...
frontend/taipy-gui/base/src/app.ts
26
TypeScript
0.571
question
128
51
51
false
Expose websocket decouple frontend
1,501
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1
this._onReload = handler; } get onWsMessage() { return this._onWsMessage; } set onWsMessage(handler: OnWsMessage | undefined) { if (handler !== undefined && handler?.length !== 3) { throw new Error("onWsMessage() requires three parameters"); } this._o...
I thought you would only defined the setter and let the on&lt;whatever> (ie onWsMessage here) be a real method with parameter that would check the existence of this._onWsMessage and call it ie ``` onWsMessage = (event, payload) => { this._onWsMessage && this._onWsMessage(event, payload); } ``` I think we're...
set onNotify(handler: OnNotifyHandler | undefined) { if (handler !== undefined && handler.length !== 3) { throw new Error("onNotify() requires three parameters"); } this._onNotify = handler; } onNotifyEvent(type: string, message: string) { this.onNotify && this.o...
@@ -101,6 +104,16 @@ export class TaipyApp { this._onReload = handler; } + get onWsMessage() {
frontend/taipy-gui/base/src/app.ts
26
TypeScript
0.857
suggestion
370
51
51
false
Expose websocket decouple frontend
1,501
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1
} this._onInit = handler; } get onChange() { return this._onChange; } set onChange(handler: OnChangeHandler | undefined) { if (handler !== undefined && handler.length !== 3) { throw new Error("onChange() requires three parameters"); } this._o...
this._onChange = handler.bind(this)
// Getter and setter get onInit() { return this._onInit; } set onInit(handler: OnInitHandler | undefined) { if (handler !== undefined && handler.length !== 1) { throw new Error("onInit() requires one parameter"); } this._onInit = handler; } onInitEv...
@@ -80,6 +93,10 @@ export class TaipyApp { this._onChange = handler;
frontend/taipy-gui/base/src/app.ts
26
TypeScript
0.286
suggestion
35
51
51
false
Expose websocket decouple frontend
1,501
Avaiga/taipy
12,680
Python
FredLL-Avaiga
dinhlongviolin1