Repository: Avaiga/taipy
File: taipy/core/cycle/cycle.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 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_reload, _self_setter
from ..exceptions.exceptions import _SuspiciousFileOperation
from ..notification.event import Event, EventEntityType, EventOperation, _make_event
from .cycle_id import CycleId


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 financial reports, yearly budgeting, etc.

    For this purpose, `Cycle^` represents a single iteration of such a time pattern.
    Each _cycle_ has a start date and a duration. Examples of cycles are:

    - Monday, 2. January 2023 as a daily cycle
    - Week 01 2023, from 2. January as a weekly cycle
    - January 2023 as a monthly cycle
    - etc.

    `Cycles^` are created along with the `Scenarios^` 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`
    - `Frequency.MONTHLY`
    - `Frequency.QUARTERLY`
    - `Frequency.YEARLY`

    Attributes:
        id (str): The unique identifier of the cycle.

Review comment (suggestion):
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
```

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 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_reload, _self_setter
from ..exceptions.exceptions import _SuspiciousFileOperation
from ..notification.event import Event, EventEntityType, EventOperation, _make_event
from .cycle_id import CycleId


class Cycle(_Entity, _Labeled):
    """An iteration of a recurrent work pattern.

    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 modeling the
    corresponding periods (i.e., cycles).

    For this purpose, a `Cycle^` represents a single iteration of such a time pattern.
    Each _cycle_ has a start date and a duration. Examples of cycles are:

    - Monday, 2. January 2023 as a daily cycle
    - Week 01 2023, from 2. January as a weekly cycle
    - January 2023 as a monthly cycle
    - etc.

    `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`
    - `Frequency.MONTHLY`
    - `Frequency.QUARTERLY`
    - `Frequency.YEARLY`

    Attributes: