ai_core_sdk.content.content_package
index
/home/jenkins/agent/workspace/AI-Foundation_ai-core-sdk_master/ai_core_sdk/content/content_package.py

 
Modules
       
importlib
inspect
os
pathlib
pkgutil
uuid
warnings
yaml

 
Classes
       
builtins.object
ContentPackage

 
class ContentPackage(builtins.object)
    ContentPackage(name: str, workflows: Optional[Dict[str, Any]], workflows_base_path: Union[str, pathlib.Path], examples: Union[str, pathlib.Path, NoneType] = None, license: Optional[str] = None, description: Optional[str] = None, version: Optional[str] = None)
 
The ContentPackage object defines a content packages
:param name: Name of the package
:type name: str
:param workflows: Dict of workflows see class:`ai_core_sdk.content.workflow.Workflow` for details
:type workflows: Union[Dict[str, Any], None]
:param workflows_base_path: Base path for all relative paths in the workflow definition
:type workflows_base_path: Union[str, pathlib.Path]
:param examples: Paths to a folder containing examples
:type examples: Union[str, pathlib.Path, None], optional
:param license: Name of the content package's license
:type license: Union[str, None], optional
:param description: Description text
:type description: Union[str, None], optional
:param version: Version str
:type version: Union[str, None], optional
 
  Methods defined here:
__getitem__(self, name: str) -> ai_core_sdk.content.workflow.Workflow
Get Workflow by its name.
:raises: class:`ai_core_sdk.content.workflow.WorkflowNotFound`
:return: Workflow
:rtype: class:`ai_core_sdk.content.workflow.Workflow`
__init__(self, name: str, workflows: Optional[Dict[str, Any]], workflows_base_path: Union[str, pathlib.Path], examples: Union[str, pathlib.Path, NoneType] = None, license: Optional[str] = None, description: Optional[str] = None, version: Optional[str] = None)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self) -> str
Return repr(self).
__str__(self) -> str
Return str(self).
validate(self) -> None
Run validationfor the content package definition and its workflows.
:raises: ValueError when validations fails

Class methods defined here:
from_yaml(yaml_path: Union[pathlib.Path, str]) -> 'ContentPackage' from builtins.type
Initialize a content package from a yaml file.
:param yaml_path: Path to the yaml file
:type yaml_path: Union[pathlib.Path, str]
:raises: class:`FileNotFoundError`, class:`ValueError`
:return: ContentPackage
:rtype: class:`ai_core_sdk.content.content_package.ContentPackage`

Static methods defined here:
check_path(path: Union[pathlib.Path, str], validate_is_dir: bool = False, validate_is_file: bool = False) -> Optional[str]
Funciton to check the existence of a path.
:param path: Path, which is transformed into an absolute path by the function prior to validation
:type path: Union[str, pathlib.Path]
:param validate_is_file: Bool specifying whether to check if the file is a folder
:type path: bool, optional
:param validate_is_dir: Bool specifying whether to check if the path is a folder
:type path: bool, optional
:return: str in case of a valid path and None in case of an invalid path
:rtype: Union[None, str]

Readonly properties defined here:
workflows
Return dict of workflows from the ContentPackage.
:return: Dict of workflows from the ContentPackage
:rtype: Dict[str, Workflow]

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
get_content_packages(manual_paths: Optional[List[Union[str, pathlib.Path]]] = None, raise_errors: bool = True) -> Dict[str, ai_core_sdk.content.content_package.ContentPackage]
Retrieve all content packages available.
If raising errors is turned off, then warnings are sent instead.
:param manual_paths: Additional paths to content package definitions
:type manual_paths: Union[None, List[Union[str, pathlib.Path]]], optional
:param raise_errors: Raise errors instead of warnings
:type raise_errors: bool, optional
:raises: class:`ValueError`
:return: Dictionary of class:`ai_core_sdk.content.content_package.ContentPackage`
:rtype: List[ContentPackage]
get_content_packages_from_module(module: Union[str, module], content_spec_py: str = 'ai_core_content_spec.py') -> List[ai_core_sdk.content.content_package.ContentPackage]
Search for content package definition within a module.
:param module: Name of a module as str or imported module
:type module: Union[str, ModuleType]
:param content_spec_py: file name to search for in the module
:type content_spec_py: str, optional
:return: List of content packages class:`ai_core_sdk.content.content_package.ContentPackage`
:rtype: List[ContentPackage]
get_content_packages_from_py_file(py_file: Union[str, pathlib.Path]) -> List[ai_core_sdk.content.content_package.ContentPackage]
Load content pacakges from a python file.
If raising errors is turned off, then warnings are sent instead.
:raises: class:`ValueError`, class:`FileNotFoundError`
:return: List of class:`ai_core_sdk.content.content_package.ContentPackage`
:rtype: List[ContentPackage]

 
Data
        __all__ = ['ContentPackage', 'get_content_packages', 'get_content_packages_from_module', 'get_content_packages_from_py_file']