pip_services3_commons.run.Parameters module

pip_services3_commons.run.Parameters

Parameters component implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_commons.run.Parameters.Parameters(map: Any = None)

Bases: pip_services3_commons.data.AnyValueMap.AnyValueMap

Contains map with execution parameters.

In general, this map may contain non-serializable values. And in contrast with obj maps, its getters and setters support dot notation and able to access properties in the entire object graph.

This class is often use to pass execution and notification arguments, and parameterize classes before execution.

assign_to(value: Any)

Assigns (copies over) properties from the specified args to this map.

Parameters

value – args whose properties shall be copied over.

contains_key(key: str)bool

Checks if this map contains an element with specified key.

The key can be defined using dot notation and allows to recursively access elements of elements.

Parameters

key – a key to be checked

Returns

true if this map contains the key or false otherwise.

static from_config(config: pip_services3_commons.config.ConfigParams.ConfigParams)pip_services3_commons.run.Parameters.Parameters

Creates new Parameters from ConfigMap object.

Parameters

config – a ConfigParams that contain parameters.

Returns

a new Parameters object.

static from_json(json: str)pip_services3_commons.run.Parameters.Parameters

Creates new Parameters from JSON object.

Parameters

json – a JSON string containing parameters.

Returns

a new Parameters object.

static from_tuples(*tuples: Any)pip_services3_commons.run.Parameters.Parameters

Creates a new Parameters object filled with provided key-args pairs called tuples. Tuples parameters contain a sequence of key1, value1, key2, value2, … pairs.

Parameters

tuples – the tuples to fill a new Parameters object.

Returns

a new Parameters object.

static from_value(value: Any)pip_services3_commons.run.Parameters.Parameters

Creates a new Parameters object filled with key-args pairs from specified object.

Parameters

value – an object with key-args pairs used to initialize a new Parameters.

Returns

a new Parameters object.

get(key: str) → Any

Gets a map element specified by its key.

The key can be defined using dot notation and allows to recursively access elements of elements.

Parameters

key – a key of the element to get.

Returns

the args of the map element.

get_as_nullable_parameters(key: str)pip_services3_commons.run.Parameters.Parameters

Converts map element into an Parameters or returns null if conversion is not possible.

Parameters

key – a key of element to get.

Returns

Parameters args of the element or null if conversion is not supported.

get_as_parameters(key: str)pip_services3_commons.run.Parameters.Parameters

Converts map element into an Parameters or returns empty Parameters if conversion is not possible.

Parameters

key – a key of element to get.

Returns

Parameters args of the element or empty Parameters if conversion is not supported.

get_as_parameters_with_default(key: str, default_value: pip_services3_commons.run.Parameters.Parameters)pip_services3_commons.run.Parameters.Parameters

Converts map element into an Parameters or returns default args if conversion is not possible.

Parameters
  • key – a key of element to get.

  • default_value – the default args

Returns

Parameters args of the element or default args if conversion is not supported.

static merge_params(*parameters: pip_services3_commons.run.Parameters.Parameters)pip_services3_commons.run.Parameters.Parameters

Merges two or more Parameters into one. The following Parameters override previously defined parameters.

Parameters

parameters – a list of Parameters objects to be merged.

Returns

a new Parameters object.

omit(*props: str)pip_services3_commons.run.Parameters.Parameters

Omits selected parameters from this Parameters and returns the rest as a new Parameters object.

Parameters

props – keys to be omitted from copying over to new Parameters.

Returns

a new Parameters object.

override(parameters: pip_services3_commons.run.Parameters.Parameters, recursive: bool = False)pip_services3_commons.run.Parameters.Parameters

Overrides parameters with new values from specified Parameters and returns a new Parameters object.

Parameters
  • parameters – Parameters with parameters to override the current values.

  • recursive – (optional) true to perform deep copy, and false for shallow copy. Default: false

Returns

a new Parameters object.

pick(*props: str)pip_services3_commons.run.Parameters.Parameters

Picks select parameters from this Parameters and returns them as a new Parameters object.

Parameters

props – keys to be picked and copied over to new Parameters.

Returns

a new Parameters object.

put(key: str, value: Any) → Any

Puts a new args into map element specified by its key.

The key can be defined using dot notation and allows to recursively access elements of elements.

Parameters
  • key – a key of the element to put.

  • value – a new args for map element.

set_defaults(default_values: pip_services3_commons.run.Parameters.Parameters, recursive: bool = False)pip_services3_commons.run.Parameters.Parameters

Set default values from specified Parameters and returns a new Parameters object.

Parameters
  • default_values – Parameters with default parameter values.

  • recursive – (optional) true to perform deep copy, and false for shallow copy. Default: false

Returns

a new Parameters object.

to_json()str

Converts this map to JSON object.

Returns

a JSON representation of this map.