Repository: Avaiga/taipy
File: taipy/core/task/task.py (Python)

Code before:
#        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 permissions and limitations under the License.

import uuid
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Union

from taipy.common.config.common._validate_id import _validate_id
from taipy.common.config.common.scope import Scope

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 .._version._version_manager_factory import _VersionManagerFactory
from ..data.data_node import DataNode
from ..exceptions import AttributeKeyAlreadyExisted
from ..notification.event import Event, EventEntityType, EventOperation, _make_event
from ..submission.submission import Submission
from .task_id import TaskId


class Task(_Entity, _Labeled):
    """Hold a user function that will be executed, its arguments and the results.

    A `Task` brings together the user code as function, the inputs and the outputs
    as data nodes (instances of the `DataNode^` class).

    !!! note
        It is not recommended to instantiate a `Task` directly. Instead, it should be
        created with the `create_scenario()^` function. When creating a `Scenario^`,
        the related data nodes and tasks are created automatically. Please refer to
        the `Scenario^` class for more information.

    A task's attributes (the input data nodes, the output data nodes, the Python
    function) are populated based on its task configuration `TaskConfig^`.

    ??? Example

        ```python
        import taipy as tp
        from taipy import Config

        def by_two(x: int):
            return x * 2

        if __name__ == "__main__":
            # Configure data nodes, tasks and scenarios
            input_cfg = Config.configure_data_node("my_input", default_data=2)

Review comment (suggestion):
```suggestion
    """Hold a user function that will be executed, its parameters, and the results.
```

Code after:
#        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 permissions and limitations under the License.

import uuid
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Union

from taipy.common.config.common._validate_id import _validate_id
from taipy.common.config.common.scope import Scope

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 .._version._version_manager_factory import _VersionManagerFactory
from ..data.data_node import DataNode
from ..exceptions import AttributeKeyAlreadyExisted
from ..notification.event import Event, EventEntityType, EventOperation, _make_event
from ..submission.submission import Submission
from .task_id import TaskId


class Task(_Entity, _Labeled):
    """Hold a user function that will be executed, its parameters, and the results.

    A `Task` brings together the user code as function, the inputs and the outputs
    as data nodes (instances of the `DataNode^` class).

    !!! note
        It is not recommended to instantiate a `Task` directly. Instead, it should be
        created with the `create_scenario()^` function. When creating a `Scenario^`,
        the related data nodes and tasks are created automatically. Please refer to
        the `Scenario^` class for more information.

    A task's attributes (the input data nodes, the output data nodes, the Python
    function) are populated based on its task configuration `TaskConfig^`.

    ??? Example

        ```python
        import taipy as tp
        from taipy import Config

        def by_two(x: int):
            return x * 2

        if __name__ == "__main__":
            # Configure data nodes, tasks and scenarios
            input_cfg = Config.configure_data_node("my_input", default_data=2)