Skip to content

Commit

Permalink
Merge pull request Avaiga#90 from Avaiga/feature/#614-propose-prototy…
Browse files Browse the repository at this point in the history
…pe-for-removing-pipeline-config

Feature/#614 propose prototype for removing pipeline config
  • Loading branch information
toan-quach authored Jul 20, 2023
2 parents 3ae2e85 + e2e681d commit 81ccba5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/taipy/config/checker/_checkers/_config_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# specific language governing permissions and limitations under the License.

import abc
from typing import Any, List
from typing import Any, List, Optional, Set

from ..._config import _Config
from ..issue_collector import IssueCollector
Expand All @@ -37,16 +37,25 @@ def _warning(self, field: str, value: Any, message: str):
def _info(self, field: str, value: Any, message: str):
self._collector._add_info(field, value, message, self.__class__.__name__)

def _check_children(self, parent_config_class, config_id: str, config_key: str, config_value, child_config_class):
if not config_value:
def _check_children(
self,
parent_config_class,
config_id: str,
config_key: str,
config_value,
child_config_class,
can_be_empty: Optional[bool] = False,
):
if not config_value and not can_be_empty:
self._warning(
config_key,
config_value,
f"{config_key} field of {parent_config_class.__name__} `{config_id}` is empty.",
)
else:
if not (
isinstance(config_value, List) and all(map(lambda x: isinstance(x, child_config_class), config_value))
(isinstance(config_value, List) or isinstance(config_value, Set))
and all(map(lambda x: isinstance(x, child_config_class), config_value))
):
self._error(
config_key,
Expand Down

0 comments on commit 81ccba5

Please sign in to comment.