Functions for parsing strings into various data types, ranging from
string (a no-op) to a system of differential equations.
An "accept" function takes a string, and returns a value of
the desired type. If the conversion is impossible, it raises a
descriptive exception.
Accept functions are used to validate input in various components in
qubx.GTK and qubx.tables.
Copyright 2007-2014 Research Foundation State University of New York
This file is part of QUB Express.
QUB Express is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
QUB Express is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License,
named LICENSE.txt, in the QUB Express program directory. If not, see
<http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
acceptXorUnset(accept)
Interprets '' as UNSET_VALUE, otherwise uses provided accept
function. |
source code
|
|
|
acceptFloatOrUnset(x)
Like acceptFloat, but acceptFloatOrUnset('') returns
qubx.util_types.UNSET_VALUE. |
source code
|
|
|
formatFloatOrUnset(fmt)
Returns f(val): if val != qubx.util_types.UNSET_VALUE: return
fmt(val); else: return '' |
source code
|
|
|
acceptBool(x)
Returns False if x is in ['', 'False', 'false']; True otherwise. |
source code
|
|
|
acceptCmp(convert,
compare,
errmsg)
Returns an accept function which enforces `compare(convert(s)) ==
True. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
acceptList(acceptor,
dashrange,
description) |
source code
|
|
|
acceptIntList(acceptor=<__builtin__.function object>,
description=' integers ' ) |
source code
|
|
|
acceptFloatList(acceptor=<__builtin__.function object>,
description=' numbers ' ) |
source code
|
|
|
|
|
|
|
|
|
MissingName(msg)
Returns the symbol named in a NameError's message. |
source code
|
|
|
acceptF(static=[ ' x ' ] ,
avail=[ ] ,
custom=False,
typ=<type 'float'>,
default=' 1.0 ' ,
locals=None)
Returns an accept function which converts a Python expression into a
FuncAcceptor |
source code
|
|
|
|
|
Union(ls)
Given an iterable of subiterables, returns a list of unique elements
in the subiterables. |
source code
|
|
|
|
|
acceptODEorF(static=[ ' x ' ] ,
avail=[ ] ,
custom=False,
locals=None)
Returns an accept function which acts like acceptODEs if ' is
present, otherwise like acceptF. |
source code
|
|
|
|