Repository: Avaiga/taipy
File: taipy/rest/rest.py (Python)

Code before:
# 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 flask import Flask

from taipy.common.config import Config

from .app import create_app as _create_app


class Rest:
    """
    Runnable Rest application serving REST APIs on top of Taipy Core functionalities.
    """

    def __init__(self) -> None:
        """
        Initialize a REST API server.

        A Flask application is instantiated and configured using three arguments from the global
        config.
            - Config.global_config.testing (bool): Run the application on testing mode.
            - Config.global_config.env (Optional[str]): The application environment.
            - Config.global_config.secret_key (Optional[str]): Application server secret key.

        However, editing these arguments is only recommended for advanced users. Indeed, the default behavior of the
        REST server without any required configuration satisfies all the standard and basic needs.
        """
        self._app: Flask = _create_app(
            Config.global_config.testing or False, Config.global_config.env, Config.global_config.secret_key
        )

    def run(self, **kwargs):
        """
        Start a REST API server. This method is blocking.

        Arguments:
            **kwargs : Options to provide to the application server.
        """
        self._app.run(**kwargs)


Review comment (suggestion):
```suggestion
        However, editing these parameters is only recommended for advanced users. Indeed, the default behavior of the
```

Code after:
# 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 flask import Flask

from taipy.common.config import Config

from .app import create_app as _create_app


class Rest:
    """
    Runnable Rest application serving REST APIs on top of Taipy Core functionalities.
    """

    def __init__(self) -> None:
        """
        Initialize a REST API server.

        A Flask application is instantiated and configured using three parameters from the global
        config.
            - Config.global_config.testing (bool): Run the application on testing mode.
            - Config.global_config.env (Optional[str]): The application environment.
            - Config.global_config.secret_key (Optional[str]): Application server secret key.

        However, editing these parameters is only recommended for advanced users. Indeed, the default behavior of the
        REST server without any required configuration satisfies all the standard and basic needs.
        """
        self._app: Flask = _create_app(
            Config.global_config.testing or False, Config.global_config.env, Config.global_config.secret_key
        )

    def run(self, **kwargs):
        """
        Start a REST API server. This method is blocking.

        Arguments:
            **kwargs : Options to provide to the application server.
        """
        self._app.run(**kwargs)