added parseData and test
This commit is contained in:
@@ -143,6 +143,7 @@ py::list get_groups( const Schedule& sch ) {
|
||||
}
|
||||
|
||||
EclipseState (*parse)( const std::string&, const ParseContext& ) = &Parser::parse;
|
||||
EclipseState (*parseData) (const std::string &data, const ParseContext& context) = &Parser::parseData;
|
||||
void (ParseContext::*ctx_update)(const std::string&, InputError::Action) = &ParseContext::update;
|
||||
|
||||
}
|
||||
@@ -161,6 +162,7 @@ py::to_python_converter< const boost::posix_time::ptime,
|
||||
py::register_exception_translator< key_error >( &key_error::translate );
|
||||
|
||||
py::def( "parse", parse );
|
||||
py::def( "parseData", parseData );
|
||||
|
||||
py::class_< EclipseState >( "EclipseState", py::no_init )
|
||||
.add_property( "title", &EclipseState::getTitle )
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from os.path import isfile
|
||||
import libsunbeam as lib
|
||||
|
||||
class _delegate(object):
|
||||
@@ -163,5 +164,8 @@ def _parse_context(actions):
|
||||
|
||||
return ctx
|
||||
|
||||
def parse(path, actions = None):
|
||||
return EclipseState(lib.parse(path, _parse_context(actions)))
|
||||
def parse(deck, actions = None):
|
||||
"""deck may be a deck string, or a file path"""
|
||||
if isfile(deck):
|
||||
return EclipseState(lib.parse(deck, _parse_context(actions)))
|
||||
return EclipseState(lib.parseData(deck, _parse_context(actions)))
|
||||
|
||||
Reference in New Issue
Block a user