name,version,typ='module',fatal=False) |
name,version,external=False) |
name is either a module or an external program whose availability has been registered. Default is to treat name as a module. Add external=True for a program.
Return value is -1, 0 or 1, depending on a version found that is <, == or > than the requested values. This should normally understand version numbers in the format 2.10.1
name) |
The version string is returned, empty if the module could not be loaded. The (name,version) pair is also inserted into the the_version dict.
name,check=False) |
Returns a nonzero (version) string if the module is available, or an empty string if it is not.
By default, the module is only checked on the first call. The result is remembered in the the_version dict. The optional argument check==True forces a new detection.
name=None,command=None,answer=None) |
name is the generic command name, command is the command as it will be executed to check its operation, answer is a regular expression to match positive answers from the command. answer should contain at least one group. In case of a match, the contents of the match will be stored in the the_external dict with name as the key. If the result does not match the specified answer, an empty value is inserted.
Usually, command will contain an option to display the version, and the answer re contains a group to select the version string from the result.
As a convenience, we provide a list of predeclared external commands, that can be checked by their name alone. If no name is given, all commands in that list are checked, and no value is returned.
name) |
Returns a nonzero string if the command is available, or an empty string if it is not.
The external command is only checked on the first call. The result is remembered in the the_external dict.
) |
path,top=True) |
) |
Some local settings change the LC_NUMERIC setting, so that floating point values are read or written with a comma instead of a the decimal point. Of course this makes your files completely incompatible. You will often not be able to process these files any further and create a lot of troubels for yourself and other people if you do so. The idiots that thought changing the LC_NUMERIC locale was a good thing should be hung.
Anyway, here's a function to set it back to a sane value. It is always called when pyFormex starts.
) |
type) |
The description of known types are listed in a dict file_description. If the type is unknown, the returned string has the form 'TYPE files (*.type)'
name) |
If no icon file is found, returns the question mark icon.
fn) |
The project name is the basename f the file without the extension.
s) |
s1,s2) |
fn) |
fn) |
cmd,RaiseError=True,quiet=False) |
cmd) |
fn,ext) |
The extension is the minimal trailing part of the filename starting with a '.'. If the filename has no '.', the extension will be appended. If the given extension does not start with a dot, one is prepended.
fn) |
Bash, the most used command shell in Linux, expands a ' ' in arguments to the users home direction. This function can be used to do the same for strings that did not receive the bash tilde expansion, such as strings in the configuration file.
filename) |
A script is considered to be a pyFormex script if its first line starts with '#!' and contains the substring 'pyformex' A file is considered to be a pyFormex script if its name ends in '.py' and the first line of the file contains the substring 'pyformex'. Typically, a pyFormex script starts with a line: #!/usr/bin/env pyformex
s) |
A string like 'abc-0123' will be split in 'abc-' and '0123'. Any of both can be empty.
x,xval,yval,exp=2.5) |
xval and yval should be lists of 3 values: [xmin,x0,xmax], [ymin,y0,ymax]. Together with the exponent exp, they define the response curve as function of x. With an exponent > 0, the variation will be slow in the neighbourhood of (x0,y0). For values x < xmin or x > xmax, the limit value ymin or ymax is returned.
item) |
message) |
replacement) |
replacement,text=None) |
replacement) |