-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Messages, logging, and exception #24
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Andrew Johnson <1drew.e.johnson@gmail.com>
Signed-off-by: Andrew Johnson <1drew.e.johnson@gmail.com>
Signed-off-by: Andrew Johnson <1drew.e.johnson@gmail.com>
Signed-off-by: Andrew Johnson <1drew.e.johnson@gmail.com>
DanKotlyar
approved these changes
Oct 6, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Drew. This is great.
But, in the future we do need to fix the '_' issue in material definition.
Reopened to squash and merge |
drewejohnson
added a commit
that referenced
this pull request
Dec 13, 2017
* Updated gitignore to exclude pycharm project settings * Skeleton files for each reader class; Basic directory setup * Depletion reader and project settings (#1) * Quick: DepletedMaterial returns time vector if not given as input (#2) * Quick fix: DepletedMaterial getXY only returns time if no time is given as input * Fixes #3; Cleaned up reader subclasses (#4) * Fixes #3; Cleaned up reader subclasses * Added versioneer (#18) * Fix get xy (#21) * Fixes #19: Material doesn't return days if given as input * Fixed unit tests * Versioneer (#23) * Messages, logging, and exception (#24) * Expand variable groups; XSReader base; Temporary settings (#27) * Branching testing; Temporary settings modification * Initial documentation - sphinx (#28) * Added variables.yaml to data_files in setup (#32) * Added depreciation and future warning decorators; More debug statements (#34) * Depletion reader now correctly adds data from TOT; Updated defaults (#39) * Better support (#40) * Added python 2.7 support (#41) * Homogenized Universe (#35) * Read depmtx (#44) * Return A matrix from depmtx as csc matrix not csr (#46) * Remove settings package; Cleaned up messages file (#47) * Implemented a module level read function (#48) * Examples (#49) * depmtx reader now parses using regular expressions (#52) * Updated documentation - developer guide, api, and examples (#59) * Updated setup.py to begrudgingly support distutils (#61) * Use warnings.catch_warnings to record warnings in test_settings (#55) * Native drewtils (#62) * Branching Reader (#65) * Release 0.1.0
drewejohnson
added a commit
that referenced
this pull request
Dec 13, 2017
* Release 0.1.0 (#66) * Updated gitignore to exclude pycharm project settings * Skeleton files for each reader class; Basic directory setup * Depletion reader and project settings (#1) * Quick: DepletedMaterial returns time vector if not given as input (#2) * Quick fix: DepletedMaterial getXY only returns time if no time is given as input * Fixes #3; Cleaned up reader subclasses (#4) * Fixes #3; Cleaned up reader subclasses * Added versioneer (#18) * Fix get xy (#21) * Fixes #19: Material doesn't return days if given as input * Fixed unit tests * Versioneer (#23) * Messages, logging, and exception (#24) * Expand variable groups; XSReader base; Temporary settings (#27) * Branching testing; Temporary settings modification * Initial documentation - sphinx (#28) * Added variables.yaml to data_files in setup (#32) * Added depreciation and future warning decorators; More debug statements (#34) * Depletion reader now correctly adds data from TOT; Updated defaults (#39) * Better support (#40) * Added python 2.7 support (#41) * Homogenized Universe (#35) * Read depmtx (#44) * Return A matrix from depmtx as csc matrix not csr (#46) * Remove settings package; Cleaned up messages file (#47) * Implemented a module level read function (#48) * Examples (#49) * depmtx reader now parses using regular expressions (#52) * Updated documentation - developer guide, api, and examples (#59) * Updated setup.py to begrudgingly support distutils (#61) * Use warnings.catch_warnings to record warnings in test_settings (#55) * Native drewtils (#62) * Branching Reader (#65) * Release 0.1.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #16
Added a
messages
module that contains functions for various status updates.A custom
Logger
is created, and all updates, warnings, and debug statements pass through this object.This is hidden with double underscores,
__logger__
, as to be super private.All the updates are passed to one of four functions:
messages.debug
,messages.info
,messages.warnings
, andmessages.error
.If we decide to change the underlying error reporting, by adding some file logs, or something totally crazy, as long as every other program just uses these functions, nothing should break.
Usage Examples
In the project
From the depletion reader:
Currently, the depletion reader does not play well with materials that contain underscores, because of variables like
ING_TOX
.A warning is printed to inform the user of this fact:
Any time a setting is changed, a debug statement is printed
messages.debug('Updated setting {} to {}'.format(name, value))
The
error
function has an additional setting:fatal
.If this value is true, a critical message is created, but also a
SerpentToolsException
is raised with the same message.This may be redundant, but the exception can be caught and suppressed, while the message should still be raised.
If
fatal
is false, then an error message is posted.Outward facing
To the user, the notices look as follows:
Exception
As mentioned above, a custom
SerpentToolsException
was created.This is for any exception that is unique to this project and not covered by the base exceptions.
This can be subclassed for unique exceptions, e.g.