grai_cli
utilities
utilities

load_yaml

def load_yaml(file: Union[str, TextIOBase]) -> Dict

Arguments:

file (Union[str, TextIOBase]):

Returns:

load_all_yaml

def load_all_yaml(file: Union[str, TextIOBase]) -> Iterable[Dict]

Arguments:

file (Union[str, TextIOBase]):

Returns:

prep_data

@multimethod
def prep_data(data: Any) -> Any

Arguments:

data (Any):

Returns:

_

@prep_data.register
def _(data: Dict) -> Dict

Arguments:

data (Dict):

Returns:

_

@prep_data.register
def _(data: UUID) -> str

Arguments:

data (UUID):

Returns:

_

@prep_data.register
def _(data: BaseModel) -> Dict

Arguments:

data (BaseModel):

Returns:

_

@prep_data.register
def _(data: List) -> List[Dict]

Arguments:

data (List):

Returns:

dump_yaml

@multimethod
def dump_yaml()

dump_individual_yaml

@dump_yaml.register
def dump_individual_yaml(item: Dict, stream: TextIOBase)

Arguments:

item (Dict): stream (TextIOBase):

Returns:

dump_model_yaml

@dump_yaml.register
def dump_model_yaml(item: BaseModel, stream: TextIOBase)

Arguments:

item (BaseModel): stream (TextIOBase):

Returns:

dump_multiple_yaml

@dump_yaml.register
def dump_multiple_yaml(items: Sequence[Dict], stream: TextIOBase)

Arguments:

items (Sequence[Dict]): stream (TextIOBase):

Returns:

dump_multiple_yaml

@dump_yaml.register
def dump_multiple_yaml(items: Sequence[BaseModel], stream: TextIOBase)

Arguments:

items (Sequence[BaseModel]): stream (TextIOBase):

Returns:

write_yaml

def write_yaml(data: Union[Sequence, Dict, BaseModel],
               path: Union[str, Path, TextIOBase],
               mode: str = "w")

Arguments:

data (Union[Sequence, Dict, BaseModel]): path (Union[str, Path, TextIOBase]):

  • mode str, optional - (Default value = "w")

Returns: