Package schrodinger :: Package application :: Package jaguar :: Module reactiq_validation
[hide private]
[frames] | no frames]

Module reactiq_validation

Reactiq keywords input validation and specialized Exceptions

Classes [hide private]
  ReactiqKeywordException
Base exception class for all custom Reactiq keyword validation errors
  ReactiqKeywordError
Exception class raised when nonexistant Reactiq keyword is requested
  ReactiqKeywordValueTypeError
Exception class raised when Reactiq keyword value has wrong type
  ReactiqKeywordValueError
Exception class raised when Reactiq keyword value is invalid
  ReactiqKeywordConflictError
Exception class raised when Reactiq keywords have conflicting values
  ReactiqKeywordFormatError
Exception class raised when a string not in the keyword=value format is found
Functions [hide private]
 
check_type(name, value, type_, subtype_=None)
Check type of <value> against <type_> or list of values against <subtype_>
 
check_numbers_in_string(name, value)
Raise Exception for strings that look like numbers (probably user error)
 
check_values_in_choices(name, value, choices)
Raise Exception if value, or values in a list, are not one of the allowed values specified by <choices>.
 
check_conflicts(kwd, all_keywords)
Raise Exception if keyword value is inconsistent with the other keywords.
Variables [hide private]
  __package__ = 'schrodinger.application.jaguar'
Function Details [hide private]

check_type(name, value, type_, subtype_=None)

 

Check type of <value> against <type_> or list of values against <subtype_>

Parameters:
  • value (anytype) - some value
  • type_ (python type) - e.g. bool, int
  • subtype_ (python type) - for lists, type of list items, e.g. bool, int

    @raise ReactiqKeywordValueTypeError if any values have wrong types.

check_numbers_in_string(name, value)

 

Raise Exception for strings that look like numbers (probably user error)

Parameters:
  • name (string) - name of keyword value being tested (for error message)
  • value (string) - some value

    @raise ReactiqKeywordValueTypeError if any values look like numbers

check_values_in_choices(name, value, choices)

 

Raise Exception if value, or values in a list, are not one of the allowed values specified by <choices>.

Parameters:
  • name (string) - name of keyword value being tested (for error message)
  • value (anytype or list) - single value or list of values

    @raise ReactiqKeywordValueError if any value is invalid.

check_conflicts(kwd, all_keywords)

 

Raise Exception if keyword value is inconsistent with the other keywords. This is done in an adhoc case-by-case way.

Parameters:
  • kwd (ReactiqKeyword) - reference Reactiq keyword
  • all_keywords (dict of ReactiqKeyword instances indexed by name) - all the other Reactiq keywords set

    @raise ReactiqKeywordConflictError if conflicting values found.