Package elisa :: Package core :: Package utils :: Module misc
[hide private]
[frames] | no frames]

Module misc

source code

Miscellaneaous utilities that don't need their own module because they are reasonnably small.

Functions [hide private]
string
env_var_expand(var_name)
Expand the given environment variable content.
source code
list of strings
env_var_explode_list(var_name, default='')
Explode a list of values stored in an environment variable as a single string.
source code
string
un_camelify(camel_string)
Convert CamelCase styled strings to lower_cased style.
source code
2-tuple: (mime_type: string, file_type: string)
get_media_infos_from_mime(uri)
Retrieve mime-type and media type of the given URI, based on its extension.
source code
Variables [hide private]
  __maintainer__ = 'Philippe Normand <philippe@fluendo.com>'
Function Details [hide private]

env_var_expand(var_name)

source code 

Expand the given environment variable content. If it contains other references to environment variables, they are expanded too.

Supported platforms are win32 and linux.

Example of use:
  >>> env_var_expand('$HOME')
  >>> '/home/phil'
Parameters:
  • var_name (string) - environment variable
Returns: string
Raises:
  • ValueError - if current system's platform is not windows or linux

env_var_explode_list(var_name, default='')

source code 

Explode a list of values stored in an environment variable as a single string. On win32 the item separator is ';' and on other platforms it is ':'.

Example of use:
  >>> env_var_explode_list('$PATH')
  >>> ['/usr/bin','/bin']
Parameters:
  • var_name (string) - environment variable
  • default (string) - value to use if environment variable not found
Returns: list of strings

un_camelify(camel_string)

source code 
Convert CamelCase styled strings to lower_cased style.
Parameters:
  • camel_string (string) - CamelStyled string to convert
Returns: string

get_media_infos_from_mime(uri)

source code 
Retrieve mime-type and media type of the given URI, based on its extension.
Parameters:
Returns: 2-tuple: (mime_type: string, file_type: string)