def handle(self): # Load poetry config and display errors, if any poetry_file = Factory.locate(Path.cwd()) config = PyProjectTOML(poetry_file).poetry_config check_result = Factory.validate(config, strict=True) if not check_result["errors"] and not check_result["warnings"]: self.info("All set!") return 0 for error in check_result["errors"]: self.line("<error>Error: {}</error>".format(error)) for error in check_result["warnings"]: self.line("<warning>Warning: {}</warning>".format(error)) return 1
def _f(*args: List, **kwargs: Dict) -> None: prj_wd = Path.cwd() if cwd is None else cwd pyproject_path = Factory.locate(prj_wd) parser = KktParser(pyproject_path) try: target = cast("str", kwargs.get("target", ".")) kkt = parser.read(key=target) except KktSectionNotFound: if not is_global_command: click.echo("Kkt section is not found in pyproject.yml.", err=True) sys.exit(1) kkt = {} api = get_kaggle_api() api.authenticate() command(api, kkt, pyproject_path, *args, **kwargs)
def handle(self) -> int: from poetry.core.pyproject.toml import PyProjectTOML from poetry.factory import Factory # Load poetry config and display errors, if any poetry_file = Factory.locate(Path.cwd()) config = PyProjectTOML(poetry_file).poetry_config check_result = Factory.validate(config, strict=True) if not check_result["errors"] and not check_result["warnings"]: self.info("All set!") return 0 for error in check_result["errors"]: self.line_error(f"<error>Error: {error}</error>") for error in check_result["warnings"]: self.line_error(f"<warning>Warning: {error}</warning>") return 1