mxcubecore.utils.conversion#
General data and functions, that can be shared between different HardwareObjects
Functions
|
|
|
Return argument list for command line option |
|
Convert input string to int, float, or string (in order of priority) |
|
Coerce chars to six.text_type. For Python 2: - unicode -> unicode - str -> unicode For Python 3: - str -> str - bytes -> decoded to str. |
|
Return argument list for command line invocation setting java property |
|
Generate string with pretty-printed table |
|
Return quoted value of a (single-line) string |
- mxcubecore.utils.conversion.command_option(keyword, value, prefix='-', quote_value=False)[source]#
Return argument list for command line option
- mxcubecore.utils.conversion.convert_string_value(text)[source]#
Convert input string to int, float, or string (in order of priority)
- mxcubecore.utils.conversion.ensure_text(chars, encoding='utf-8', errors='strict')[source]#
Coerce chars to six.text_type. For Python 2:
unicode -> unicode
str -> unicode
- For Python 3:
str -> str
bytes -> decoded to str
- mxcubecore.utils.conversion.java_property(keyword, value, quote_value=False)[source]#
Return argument list for command line invocation setting java property
keyword, value are stringtypes
- mxcubecore.utils.conversion.make_table(column_names, rows)[source]#
Generate string with pretty-printed table
- Parameters:
Returns:
- mxcubecore.utils.conversion.quoted_string(text)[source]#
Return quoted value of a (single-line) string
Intended for command line arguments. Will work for Python 2 str or unicode, OR Python 3 str and (some) bytes). Somewhat fragile, will definitely break for multiline strings or strings containing both single and double quotes