Package schrodinger :: Package application :: Package jaguar :: Module reactiq_keyword :: Class ReactiqKeyword
[hide private]
[frames] | no frames]

Class ReactiqKeyword

object --+
         |
        ReactiqKeyword

Instance Methods [hide private]
 
__init__(self, name, valid_type, default, description, choices=[], subtype=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setValue(self, value)
Set to user-defined value.
 
reset(self)
Reset user-value to NoneType.
bool
isNonDefault(self)
Return True if keyword user-value differs from default value.
 
validate(self)
Check validity of this Keyword class; different errors can raise the following Exceptions which all inherit from ReactiqKeywordException:
 
_infer_list_values_from_string(self, value)
Return list of values coerced to appropriate subtypes (if possible).
self._type
_infer_value_from_string(self, value)
Return value coerced to appropriate type (if possible).

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  name
  valid_type
  default
  description
  choices
  subtype
  value
Return user-set value.

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, valid_type, default, description, choices=[], subtype=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • name (string) - unique name for keyword
  • valid_type (python type) - keyword type e.g. bool, int
  • default (<valid_type>) - default keyword value
  • description (string) - short description of what the keyword does
  • choices (list of <valid_type>'s) - allowed values for the keyword value
  • subtype (python type) - if <valid_type> is list then this is type of list items
Overrides: object.__init__

setValue(self, value)

 

Set to user-defined value.

Parameters:
  • value (anything)

isNonDefault(self)

 

Return True if keyword user-value differs from default value. False otherwise.

Returns: bool

validate(self)

 

Check validity of this Keyword class; different errors can raise the following Exceptions which all inherit from ReactiqKeywordException:

@raise ReactiqKeywordValueTypeError if wrong type. @raise ReactiqKeywordValueError if value invalid.

_infer_list_values_from_string(self, value)

 

Return list of values coerced to appropriate subtypes (if possible).
Accepts value in the following forms:
    (1)  "[a b c]"
    (2)  "['a', 'b', 'c']"
    (3)  "1 2 3"
    (4)  "[1, 2, 3]"
    (5)  "['1', '2', '3']"
    etc

@type value: str
@type value: user-defined list of values (e.g. from input file)

@rtype: list of self._type
@return: list values coerced to appropriate subtypes

@raise ReactiqKeywordValueTypeError if conversion fails.

_infer_value_from_string(self, value)

 

Return value coerced to appropriate type (if possible).

Parameters:
  • value (str)
Returns: self._type
value coerced to appropriate types (and subtypes)

@raise ReactiqKeywordValueTypeError if conversion fails.


Property Details [hide private]

name

Get Method:
unreachable.name(self)

valid_type

Get Method:
unreachable.valid_type(self)

default

Get Method:
unreachable.default(self)

description

Get Method:
unreachable.description(self)

choices

Get Method:
unreachable.choices(self)

subtype

Get Method:
unreachable.subtype(self)

value

Return user-set value. If None, return default value.

Get Method:
unreachable.value(self) - Return user-set value.
Set Method:
unreachable.value(self, value)