cocopp.toolsdivers
module documentationcocopp
Class | Infolder | Contextmanager to do some work in a folder of choice and change dir back in the end. |
Class | StringList | A microtool to join a list of strings using property as_string . |
Class | InfolderGoneWithTheWind | with InfolderGoneWithTheWind(): ... executes the block in a |
Class | StrList | A list of str with search/find functionality. |
Class | AlgorithmList | Not in use. Not necessary when the algorithm dict is an OrderedDict anyway. |
Function | print_done | prints a message with time stamp |
Function | equals_approximately | Undocumented |
Function | less | return a < b, while comparing nan results in False without warning |
Function | diff_attr | return list of [name, val1, val2] triplets for attributes with different values. |
Function | prepend_to_file | "prepend lines the tex-command filename |
Function | replace_in_file | "replace a string in the file with another string |
Function | truncate_latex_command_file | truncate file but keep in good latex shape |
Function | strip_pathname | remove ../ and ./ and leading/trailing blanks and path separators from input string name and replace any remaining path separator with '/' |
Function | strip_pathname1 | remove ../ and ./ and leading/trailing blanks and path separators from input string name, replace any remaining path separator with '/', and keep only the last part of the path |
Function | strip_pathname2 | No summary |
Function | str_to_latex | do replacements in string such that it most likely compiles with latex |
Function | number_of_digits | returns the number of non-zero digits of a number, e.g. two for 1200 or three for 2.03. |
Function | num2str | returns the shortest string representation with either significant_digits digits shown or its true value, whichever is shorter. |
Function | number_to_latex | usage as number_to_latex(num2str(1.023e-12)) == "'-1.0\times10^{-12}'" |
Function | number_to_html | usage as number_to_html(num2str(1.023e-12)) == "'-1.0 x 10<sup>-12</sup>'" |
Function | legend | Undocumented |
Function | check_output | Run command with arguments and return its output as a byte string. Backported from Python 2.7 as it's implemented as pure python on stdlib. |
Function | git | Run a git command and return its output. |
Function | get_version_label | No summary |
Function | path_in_package | return the absolute path prepended to subpath in this module. |
return list
of [name, val1, val2] triplets for
attributes with different values.
Attributes whose names start with any string from the
exclude
list are skipped. Furthermore, only attributes
present in both m1
and m2
are compared.
This function was introduced to compare the genericsettings
module with its state directly after import. It should be
applicable any other two class instances as well.
Details: to "find" the attributes, m1.__dict__
is iterated over.
returns the shortest string representation with either significant_digits digits shown or its true value, whichever is shorter.
force_rounding shows no more than the desired number of significant digits, which means, e.g., 12345 becomes 12000.
remove_trailing_zeros removes zeros, if and only if the value is exactly.
>>> from cocopp import toolsdivers as td >>> print([td.num2str(val) for val in [12345, 1234.5, 123.45, 12.345, 1.2345, .12345, .012345, .0012345]]) ['12345', '1234', '123', '12', '1.2', '0.12', '0.012', '1.2e-3']
Run command with arguments and return its output as a byte string. Backported from Python 2.7 as it's implemented as pure python on stdlib.
WARNING: This method is also defined in ../../code-experiments/tools/cocoutils.py. If you change something you have to change it in both files.
Run a git command and return its output.
All errors are deemed fatal and the system will quit.
WARNING: This method is also defined in ../../code-experiments/tools/cocoutils.py. If you change something you have to change it in both files.
bbob-biobj
setting).
If algorithmID==None, the set of different hypervolume reference values
from all algorithms, read in by the postprocessing, are returned in
the string. If more than one reference value is present in the data,
the string displays also a warning.