dispaset.misc package

Submodules

dispaset.misc.colorstreamhandler module

dispaset.misc.colorstreamhandler.ColorStreamHandler

alias of _AnsiColorStreamHandler

dispaset.misc.gdx_handler module

dispaset.misc.str_handler module

dispaset.misc.str_handler.clean_strings(x, exclude_digits=False, exclude_punctuation=False)[source]

Function to convert strange unicode and remove characters punctuation

Parameters:

x – any string or list of strings

Usage:

df['DisplayName'].apply(clean_strings)
dispaset.misc.str_handler.force_str(x)[source]

Used to get a str object both in python 2 and 3 although they represent different objects (byte vs unicode) It is small hack for py2->3 compatibility of gams APIs which require a str object

dispaset.misc.str_handler.shrink_to_64(x, N=64)[source]

Function that reduces the length of the keys to be written to 64 (max admissible length for GAMS)

Parameters:
  • x – String or list of strings

  • N – Integer with the maximum string length (if different from 64)

Returns:

Shrinked string or list of strings

Module contents