ads.jobs.builders package

Subpackages

Submodules

ads.jobs.builders.base module

class ads.jobs.builders.base.Builder(spec: Optional[Dict] = None, **kwargs)

Bases: Serializable

Initialize the object with specifications.

User can either pass in the specification as a dictionary or through keyword arguments.

Parameters:
  • spec (dict, optional) – Object specification, by default None

  • kwargs (dict) – Specification as keyword arguments. If spec contains the same key as the one in kwargs, the value from kwargs will be used.

attribute_map = {}
classmethod from_dict(obj_dict: dict)

Initialize the object from a Python dictionary

get_spec(key: str, default: Optional[Any] = None) Any

Gets the value of a specification property

Parameters:
  • key (str) – The name of the property.

  • default (Any, optional) – The default value to be used, if the property does not exist, by default None.

Returns:

The value of the property.

Return type:

Any

property kind: str

The kind of the object as showing in YAML. Subclass should overwrite this value.

set_spec(k: str, v: Any)

Sets a specification property for the object.

Parameters:
  • k (str) – key, the name of the property.

  • v (Any) – value, the value of the property.

Returns:

This method returns self to support chaining methods.

Return type:

Builder

to_dict() dict

Converts the object to dictionary with kind, type and spec as keys.

property type: str

The type of the object as showing in YAML.

This implementation returns the class name with the first letter coverted to lower case.

Module contents