arjuna.tpi.magic module

Arjuna’s Magic Functions

The magic functions are single-letter functions which provide easy access to Arjuna’s following global containers:
  • Configurations

  • Localizer

  • Contextual Data References.

arjuna.tpi.magic.C(query: ConfigQuery, *, cname: str = None) → Any

Get the object for a configuration option.

Parameters
  • query – Config query representing a config option in reference or custom configuration.

  • cname – (Optional keyword arg) Configuration name. If None Arjuna assumes the reference configuration for this query.

Returns

An object of Any type depending upon the configuration option query.

arjuna.tpi.magic.L(query: L10nQuery, *, locale: Locale = None, bucket: str = None, strict: bool = None) → str

Get the localized string corresponding to Localization Query.

Parameters
  • query – Localization query representing a reference which needs to be localized.

  • locale – A Locale enum constant or corresponding string e.g. en

  • bucket – A string representing Localization bucket

  • strict – If True, exception is raised if query is not resolved, else query is returned. Default is False.

Returns

A localized string as per the bucket and locale. In non-strict mode, the query itself is returned if localized string is not found.

arjuna.tpi.magic.R(query: DataRefQuery = '', *, bucket: str = None, context: str = None, index: int = None) → Any

Get the object for a query from Contextual Data Reference.

Parameters
  • query – Data Reference Query representing a reference for which object has to be retrieved.

  • bucket – A string representing Data Reference bucket

  • context – A string representing Data Reference context

  • context – An int representing Data Reference index

Returns

An object of Any type depending upon the Data Reference query.