Commit Graph

23 Commits

Author SHA1 Message Date
Wirawan Purwanto
fc0d97db1e * Parameters._flatten_(): Added workaround to avoid evaluating the
dict values while flattening the list.
  This is critical for avoiding evaluation of the 'active' members.
2013-04-25 16:54:36 -04:00
Wirawan Purwanto
80961ed2bd * Added test7 and test8 for param_flat module.
- test7 tests active parameters which can work OK if the search dicts are
    flatten.
  - test8 tests the _flatten_() method.
2013-04-17 17:26:48 -04:00
Wirawan Purwanto
b326937d80 * Parameters: Now correctly implements _flatten_() method and flag.
- The _flatten_() method should recursively flatten the parameter
    search space into a single dict.
  - The _flatten_ flag will flatten the input dicts and keyword-based
    parameter (in the __init__() method only) in the expected order of
    priority (where the first found keyword is the most overriding one)
    into a single search dict.
2013-04-16 14:06:26 -04:00
Wirawan Purwanto
8d32c2c067 * Parameters: if _flatten_ is enabled, must flatten in reverse order to
give the firstly mentioned dict the priority.
2013-04-16 11:55:18 -04:00
Wirawan Purwanto
254aaca622 * Added tester for active Parameters value. 2013-04-11 14:38:04 -04:00
Wirawan Purwanto
0f58bc0f03 * params_flat.py: Added ActiveReadValue magic class to enable `active',
or executable, parameter, which will be executed upon `reading' such a
  value.
2013-04-11 14:36:52 -04:00
Wirawan Purwanto
fe9fa59e76 * params_flat.py: Documentation and note updates. 2013-04-11 14:06:14 -04:00
Wirawan Purwanto
8f513ff5b4 * Added tests for Parameters._all_keys(). 2013-03-04 13:59:26 -05:00
Wirawan Purwanto
6709679af9 * Parameters: Added _all_keys_() and _flatten_() methods.
Warning: These are expensive, and not for general use.
2013-03-04 13:58:32 -05:00
Wirawan Purwanto
5a84a98b84 * Added tests for _append_() and _prepend_() methods. 2013-03-04 13:42:22 -05:00
Wirawan Purwanto
f04531a601 * Parameters: Added _append_() and _prepend_() methods. 2013-03-04 13:37:48 -05:00
Wirawan Purwanto
5666280a45 * Alias "|" operator to "+" operator. 2012-02-09 15:02:38 -05:00
wirawan
7017fdc6af * Committing all dirty work to CVS. We are migrating to GIT.
Beware: changes in this commit may or may not work properly.
2011-10-06 19:15:05 +00:00
wirawan
8ebf1e422e * Add important warning. Maybe in the future we need to use operator "|"
and append the search paths to _list_?
2011-09-19 20:06:45 +00:00
wirawan
6fb10829e0 * Added Parameters._get_() method. 2011-09-12 21:58:43 +00:00
wirawan
aad559d86b * Class Parameters: important change of behavior for more safety to avoid
potential confusion.

* Detail of the important changes:

  1) by default now the function's local variables are not included in the
     lookup chain. Use _localvars_ flag if you insist on doing that; but
     be aware of the caveat (see Parameters' documentation).

  2) the default _kwparam_ and _userparam_ names are now passed on to the
     child Parameters object instead of the override values given through
     the _create_ function argument.
     Rationale: To begin with, the default names defined during the creation
     of the parent Parameters object should be used by *all* the relevant
     functions.
     Overrides should be regarded as exceptional rather than common cases.

  3) Value overrides (_kwparam_, _userparam_, etc.) in _create_ must now
     be specified in keyword=value manner rather than as positional argument.
     Rationale: Those overrides must be made conspicuous.
     The keyword=value approach also makes the code more resilient to minor
     API changes.
     All unnamed parameters are supposed to be low-priority defaults.
2011-09-09 18:58:48 +00:00
wirawan
4aff740f55 * Parameters value lookup: use try..except EAFP rather LBYL approach.
* Add simple checks for _p, _opts_ default arguments in case they are not
  indexable/dict-like objects. This is needed to avoid bizzare error messages
  later then the Parameters object is in use.
2011-09-07 15:05:54 +00:00
wirawan
26db0806ae * Make Struct available publicly in wpylib.params namespace (with the
'struct' name).
2011-03-10 19:22:37 +00:00
wirawan
3ac8e37b35 * Using the __dict__ attribute to store user-defined values.
Dict-like behavior is exemplified by this class although it is *not*
  derived from a dict.
2011-03-10 19:21:33 +00:00
wirawan
6d043f6721 * Simple clarification on example. 2011-03-10 19:20:35 +00:00
wirawan
d8984cf032 * Introducing "Struct", the base class for all structured datatypes.
This is the original implementation as found in Ca+4H2_Hstorage_iter.py .
2011-03-10 17:17:48 +00:00
wirawan
71474e2973 * Standard python ignore. 2010-09-30 16:17:00 +00:00
wirawan
6641410d89 * Moving the fancy "Parameters" parameter lookup class to its own module.
From now on, use it as wpylib.params.flat class.
2010-09-30 16:16:38 +00:00