Miscellaneous routines including logging, pretty printers, and enhanced functionality wrappers for some standard library type functions.
More...
|
class | Error |
| Base error object for the asppybinding library. More...
|
|
class | Unimplemented |
| An exception that indicates functionality is not ready. More...
|
|
class | TODO |
| An exception that indicates there is more work to be done here. More...
|
|
|
def | ArdVersion |
|
def | yesNo2Bool |
| Convert a string to a boolean. More...
|
|
def | duration2ms |
| Converts a string describing a time interval in a number of milliseconds. More...
|
|
def | List2Str |
| Helper function that converts a list to a comma separated string. More...
|
|
def | Sort |
| Helper function that does a inplace sort inline (i.e. More...
|
|
def | Tenglish |
| Default english internationalization substitution function (there's nothing to do) More...
|
|
def | setT |
| Set the default translation function. More...
|
|
def | T |
| Call this function to do a translation. More...
|
|
def | Implements |
| Returns True if the object implements (is or is derived from) a class. More...
|
|
def | systemDetailed |
| Similar to the os.system call, except that a lot more information is returned. More...
|
|
def | system |
| Similar to the os.system call, except that the return value, signal status and core will cause an exception to be raised. More...
|
|
def | thisLine |
| Return line number of the nth caller (caller's caller, etc) based on the back argument. More...
|
|
def | thisFile |
| Return file of the nth caller (caller's caller, etc) based on the back argument. More...
|
|
def | flatten |
| Turn a list of list of lists,etc into just 1 list. More...
|
|
def | Tagify |
| Turn a string into something that can be used as an XML attribute. More...
|
|
def | ziprepeat |
| Does a python "zip" but repeats ylst over again if it is too short. More...
|
|
Miscellaneous routines including logging, pretty printers, and enhanced functionality wrappers for some standard library type functions.
def misc.duration2ms |
( |
|
t | ) |
|
Converts a string describing a time interval in a number of milliseconds.
The string can have the format '# unit'. (ex: 5 sec). If no unit is specified, milliseconds is assumed Acceptable units are all case or plural variations of week day hour hr min sec ms millisec
- Parameters
-
t | A time interval Can be an integer, float or string. |
def misc.flatten |
( |
|
listOflists | ) |
|
Turn a list of list of lists,etc into just 1 list.
flatten([1,2,[3,4],[5,[6],7,[]]]) -> [1, 2, 3, 4, 5, 6, 7]
def misc.Implements |
( |
|
obj, |
|
|
|
typ |
|
) |
| |
Returns True if the object implements (is or is derived from) a class.
- Parameters
-
obj | The object in question |
typ | The class type in question |
- Returns
- boolean
Helper function that converts a list to a comma separated string.
Set the default translation function.
- Parameters
-
fn | The translation function to be used. Here is a template:
2 return Template(str(s)).substitute(**kw)
|
Helper function that does a inplace sort inline (i.e.
x is returned). This is convenient for use in web template files. Note that a copy is NOT made. This function modifies its parameter!
- Parameters
-
- Returns
- x
Similar to the os.system call, except that the return value, signal status and core will cause an exception to be raised.
def misc.systemDetailed |
( |
|
cmd | ) |
|
Similar to the os.system call, except that a lot more information is returned.
- Parameters
-
cmd | A string containing the command you want to run |
- Returns
- (retval, output, signal, core) retval The program return code output The program's stdout signal Did any signal cause it to die? core Was a core file generated?
Call this function to do a translation.
- Parameters
-
Turn a string into something that can be used as an XML attribute.
def misc.Tenglish |
( |
|
s, |
|
|
|
kw |
|
) |
| |
Default english internationalization substitution function (there's nothing to do)
def misc.thisFile |
( |
|
back = 0 | ) |
|
Return file of the nth caller (caller's caller, etc) based on the back argument.
- Parameters
-
back | How far to unwind the stack. 0 means the caller, 1 is the caller's caller, etc. |
def misc.thisLine |
( |
|
back = 0 | ) |
|
Return line number of the nth caller (caller's caller, etc) based on the back argument.
- Parameters
-
back | How far to unwind the stack. 0 means the caller, 1 is the caller's caller, etc. |
def misc.yesNo2Bool |
( |
|
yn | ) |
|
Convert a string to a boolean.
If yn is a string, this routine will attempt to convert all case variations of "true", "yes", "y" or "1" to True and all variations of "false", "no" "n" or "0" to False. If yn is not a string, it will be cast to a boolean and returned.
- Parameters
-
def misc.ziprepeat |
( |
|
xlst, |
|
|
|
ylst |
|
) |
| |
Does a python "zip" but repeats ylst over again if it is too short.
misc.ContextErrno = "errno" |
The exception code is an errno (see errno.h system header file)
misc.ContextProgramReturnCode = "program return code" |
The exception code is a program's return code.
misc.ContextSignal = "signal" |
The exception code is a signal (see signal.h system header file.
misc.ContextUndefined = None |
tuple misc.lcl = threading.local() |