sot/pyger — pull request #8 by matthewdahmer (2013-08-17 00:43:44+00:00)
Title: Modify pyger to streamline code; add cooldown functionality.

Modify pyger to streamline code; add cooldown functionality.

- Move `ConstraintModel` class to base.py:
The `ConstraintModel` base class code was moved out of the main pyger.py file. Now the pyger.py file is where the custom model classes and other core pyger functions are defined. Splitting up this code into two files makes it easier to maintain, reducing the code one has to scroll through to jump between different parts of the code base. The `ConstraintModel` base class code will likely double once the "cooldown" functionality is added.

- Move code out of individual model classes, into ConstraintModel base class:
- In an effort to streamline the pyger code, some functionality that seemed to be repeated in each custom model class was moved out of these custom class defintions and into the `ConstraintModel` base class (e.g. `calc_model`).
- The `state_only` keyword was removed from `calc_model` since this didn't seem to be used anywhere.

- Separate duration calculation from `calc_dwells1` function:
- The allowed duration calculation was separated from `calc_dwells1` to simplify the goal of each function, as well as allow these durations to be recalculated using different limits without rerunning the models from scratch. In re-writing the allowed duration calculation routine, this routine was refined to linearly interpolate the precise time allowed instead of selecting the last "good" point.
- Underscores were added to the function names intended to be used by internal class functions.
- Minor PEP8 changes were made (mostly whitespace issues).

Note: At the time this pull request was submitted, the cooldown functionality has not yet been added. It is expected that this functionality will be added in further commits to this pull request.

Thank you for reviewing these changes!