# `EvaluationAttributeNameValidator`

digraph inheritance178d72fa18 { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "EvaluationAttributeNameValidator" [URL="#taurus.core.evaluation.evalvalidator.EvaluationAttributeNameValidator",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Validator for Evaluation attribute names. Apart from the standard named"]; "TaurusAttributeNameValidator" -> "EvaluationAttributeNameValidator" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusAttributeNameValidator" [URL="taurus.core.taurusvalidator-TaurusAttributeNameValidator.html#taurus.core.taurusvalidator.TaurusAttributeNameValidator",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Base class for Attribute name validators."]; }

class EvaluationAttributeNameValidator(*p, **k)

  Validator for Evaluation attribute names. Apart from the standard named groups (scheme, authority, path, query and fragment), the following named groups are created:

  - attrname: attribute name. same as concatenating _subst with _expr

  - _expr: a mathematical expression

  - _evalrefs: a list of eval refs found in the name (see `getRefs()`)

  - [_subst]: a semicolon-separated repetition of key=value (for replacing them in _expr)

  - [devname]: as in `EvaluationDeviceNameValidator`

  - [_evalname]: evaluation instance name (aka non-dotted dev name)

  - [_evaldotname]: evaluator instance dotted name (if dotted name given)

  - [_old_devname]: devname without “@”. Only in non-strict mode

  - [_dbname] and [_subst]: unused. Only if non-strict mode

  - [cfgkey] same as fragment (for bck-compat use only)

  Note: brackets on the group name indicate that this group will only contain a value if the URI contains it.

  Import from `taurus.core.evaluation.evalvalidator` as:

      from taurus.core.evaluation.evalvalidator import EvaluationAttributeNameValidator

  authority = '//localhost'
  static expandExpr(expr, substmap)

    expands expr by substituting all keys in map by their value. Note that eval references in expr (i.e. text within curly brackets) is not substituted.

    Parameters:

      - expr (str) – string that may contain symbols defined in symbolMap

      - symbolMap (dict or str) – dictionary whose keys (strings) are symbols to be substituted in expr and whose values are the corresponding replacements. Alternatively, a string containing a semi-colon separated list of symbol=value pairs can also be passed.

  fragment = '(?P<cfgkey>[^# ]*)'
  getAttrName(s)
  getDBName(s)

    returns the full data base name for the given attribute name

  getDeviceName(name)

    Obtain the fullname of the device from the attribute name

  getExpandedExpr(name)

    Returns the expanded expression from the attribute name URI

    Parameters:

      name (str) – eval attribute URI

    Returns:

      the expression (from the name )expanded with any substitution k,v pairs also defined in the name

    Return type:

      str

  getNames(fullname, factory=None, fragment=False)

    reimplemented from `TaurusDeviceNameValidator`

  static getRefs(expr, ign_quoted=True)

    Find the attribute references (strings within brackets) in an eval expression. In case of nested references, only the outermost level is returned.

    Example: val.getRefs(‘{foo}bar{zig{zag}}boom’) –> [‘foo’, ‘zig{zag}’]

    Parameters:

      - expr (str) – the expression to parse

      - ign_quoted – If True (default) ignore refs within quotes

    Returns:

      a list of refs (not including the brackets)

    Return type:

      list<str>

  getUriGroups(name, strict=None)

    reimplemented from `TaurusAttributeNameValidator` to provide backwards compatibility with old syntax

  isValid(name, matchLevel=None, strict=None)

    reimplemented from `TaurusAttributeNameValidator` to do extra check on references validity (recursive)

  property nonStrictNamePattern

    In non-strict mode support old-style eval config names

  path = '(?!//)/?((?P<devname>@((?P<_evalname>[^/?#:\\.=]+)|(?P<_evaldotname>((?P<_evalinstname>\\w+)=)?(?P<_evalmodname>(\\w+\\.)*\\w+)\\.(?P<_evalclassname>(\\w+|\\*))(?P<_evalclassparenths>\\(("[^"]*"|\\\'[^\\\']*\\\'|[^\\\'"/])*?\\))?)))/)?(?P<attrname>(?P<_subst>(((?<![\\.a-zA-Z0-9_])[a-zA-Z_][a-zA-Z0-9_]*)=([^?#=;]+);)+)?(?P<_expr>[^@?#]+))'
  query = '(?!)'
  static replaceUnquotedRef(string, substring, repl)

    Return a copy of string where first non-quoted occurrence of substring is replaced by repl

    Parameters:

      - string (str) – string to be used

      - substring (str) – substring to be replaced

      - repl (str) – replacement

    Returns:

    Return type:

      str

  scheme = 'eval'