models.representations.BaseRepresentation

Note

This module contains the implemented representation classes for all property representations that may be added to KE-chain.

class BaseRepresentation(obj=None, json=None, value=None, prop=None)[source]

Base class for all Representations.

Variables:
  • jsonschema – jsonschema to validate the json of the representation

  • rtype – type of representation

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

as_json() Dict[source]

Parse the validator to a proper validator json.

validate_json() Any[source]

Validate the json representation of the validator against the validator jsonschema.

classmethod parse(obj: Any, json: Dict) BaseRepresentation[source]

Parse a json dict and return the correct subclass of BaseRepresentation.

It uses the ‘rtype’ key to determine which BaseRepresentation to instantiate.

Parameters:
  • obj – object to which the BaseRepresentation belongs.

  • json (dict) – dictionary containing the specific keys to parse into a BaseRepresentation

Type:

prop: Base

Returns:

the instantiated subclass of BaseRepresentation

Return type:

BaseRepresentation or subclass thereof

property value

Retrieve current representation value.

Returns:

value

:rtype Any

abstract validate_representation(value: Any) None[source]

Validate whether the representation value can be set.

Will fail on error, no need to return anything.

Parameters:

value (Any) – representation value to set.

:raises IllegalArgumentError :return: None

class RepresentationsComponent(parent_object, representation_options: Dict, update_method: Callable)[source]

Aggregate class to use representations on an object.

To add representations to a Pykechain class, create an instance of this class in its __init__() method.

New in version 3.7.

Extract the json with the representation options.

Parameters:
  • parent_object – Object to which this representation component is attached

  • representation_options – json with list of representations

  • update_method – method of the parent_object that is used to update the representations

get_representations() List[AnyRepresentation][source]

Get list of representation objects.

Returns:

list of Representations

:raises IllegalArgumentError if representations are set with incorrect options

set_representations(representations: List[AnyRepresentation]) None[source]

Set the representations.

class DecimalPlaces(obj=None, json=None, value=None, prop=None)[source]

Representation for floating-point value properties.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

validate_representation(value: int) None[source]

Validate whether the representation value can be set.

Parameters:

value (int) – representation value to set.

Returns:

None

class SignificantDigits(obj=None, json=None, value=None, prop=None)[source]

Representation for floating-point value properties.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

class LinkTarget(obj=None, json=None, value=None, prop=None)[source]

Representation for HTML link reference properties.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

validate_representation(value: LinkTargets) None[source]

Validate whether the representation value can be set.

Parameters:

value (LinkTargets) – representation value to set.

Returns:

None

class ButtonRepresentation(obj=None, json=None, value=None, prop=None)[source]

Representation for single-select list properties.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

validate_representation(value: SelectListRepresentations) None[source]

Validate whether the representation value can be set.

Parameters:

value (SelectListRepresentations) – representation value to set.

Returns:

None

class Autofill(obj=None, json=None, value=None, prop=None)[source]

Representation for date(time) properties.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

validate_representation(value: bool) None[source]

Validate whether the representation value can be set.

Parameters:

value (bool) – representation value to set.

Returns:

None

class CustomIconRepresentation(*args, **kwargs)[source]

Representation for scope and activities to display a custom Font Awesome icon.

Create a custom icon representation.

Display mode of the icon will be regular by default.

validate_representation(value: str)[source]

Validate whether the representation value can be set.

Parameters:

value (str) – representation value to set.

Returns:

None

property display_mode

Get the the display mode of the custom icon representation.

class GeoCoordinateRepresentation(obj=None, json=None, value=None, prop=None)[source]

Representation for Geocoordinate properties.

It should look like this in the value_options # “representations”: [ # { # “rtype”: “geoCoordinate”, # “config”: { # “geoCoordinate”: “rd_amersfoort” # can be any of GeoCoordinateConfig # } # } # ] # },

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

validate_representation(value: GeoCoordinateConfig) None[source]

Validate whether the representation value can be set.

Parameters:

value (one of GeoCoordinateConfig) – representation value to set.

Returns:

None

class UsePropertyNameRepresentation(obj=None, json=None, value=None, prop=None)[source]

Representation for the use of Property Names in a reference property.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj

class CameraScannerInputRepresentation(obj=None, json=None, value=None, prop=None)[source]

Representation for text and number inputs to be able to use the camera as scanner.

Construct a base representation.

Parameters:
  • obj (Base) – the object to which the representation is applied, such as a property.

  • json (dict) – representation json (usually part of the original object json)

  • value (Any) – value of the representation, its options vary per representation type

  • prop (Property) – deprecated keyword for obj