|
def | quit (self) |
| def del(self): """ Tell our RVP process to quit. More...
|
|
def | validate (self, stream) |
|
def | get_validation_errors (self) |
|
def | _error_found (self, line, col, msg) |
|
def | _start_tag_open (self, cur, name) |
|
def | _attribute (self, cur, name, val) |
|
def | _start_tag_close (self, cur, name) |
|
def | _end_tag (self, cur, name) |
|
def | _textonly (self, cur, text) |
|
def | _mixed (self, cur, text) |
|
def | _start (self, grammar='0') |
|
def | _send (self, s) |
|
def | _recv (self) |
|
def | _resp (self) |
|
def | _flush_text (self) |
|
def | _start_element (self, name, attrs) |
|
def | _end_element (self, name) |
|
def | _characters (self, data) |
|
def | check_repo (repo_dir='../../models/all_from_repository', model_suffix='xml', invalid_if_warnings=False, compare=True) |
| Convenience functions #. More...
|
|
def | compare_output_files (new_stream, old_filename) |
|
def | get_options (args) |
| For running as an executable #. More...
|
|
def | run () |
|
Copyright (c) 2005-2016, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University of Oxford nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
def CellMLToNektar.validator.check_repo |
( |
|
repo_dir = '../../models/all_from_repository' , |
|
|
|
model_suffix = 'xml' , |
|
|
|
invalid_if_warnings = False , |
|
|
|
compare = True |
|
) |
| |
Convenience functions #.
Validate every model in the CellML repository, and return a list
of invalid models.
If compare is False, writes errors & warnings to log files in the
same folder as the models, otherwise compares the output to log
files already present, and notes differences.
Displays total run time.
Definition at line 447 of file validator.py.
References CellMLToNektar.validator.compare_output_files().
Referenced by CellMLToNektar.validator._characters().
449 Validate every model in the CellML repository, and return a list 452 If compare is False, writes errors & warnings to log files in the 453 same folder as the models, otherwise compares the output to log 454 files already present, and notes differences. 456 Displays total run time. 458 def close_log_file(stream, filename):
461 size = os.path.getsize(filename)
466 import glob, time, gc
467 start_time = time.time()
468 v = CellMLValidator()
470 files = glob.glob(repo_dir +
'/*.' + model_suffix)
472 for filename
in files:
473 model = os.path.basename(filename)[:-4]
474 fn = os.path.splitext(filename)[0]
475 warnfn, errfn = fn +
'_warnings.log', fn +
'_errors.log' 477 warn_stream = StringIO()
478 err_stream = StringIO()
480 warn_stream = open(warnfn,
'w')
481 err_stream = open(errfn,
'w')
482 print "Checking model",model,
"at",time.strftime(
"%X %x"),
484 valid = v.validate(filename, error_stream=err_stream,
485 warning_stream=warn_stream,
486 invalid_if_warnings=invalid_if_warnings)
488 print max(1,4 - (5+len(model))//8) *
'\t',
"X" 495 close_log_file(err_stream, errfn)
496 close_log_file(warn_stream, warnfn)
498 invalid.append(model)
500 elapsed_time = time.time() - start_time
501 mins,secs = int(elapsed_time//60), int(elapsed_time%60)
502 print len(files),
"models checked in",mins,
"minutes",secs,
"seconds." 503 print len(invalid),
"invalid" def compare_output_files(new_stream, old_filename)