cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.common.utils Namespace Reference

Classes

class  ServerProxy

Functions

def ip_itos
 Convert ip from long-integer to standard, human-readable form.
def ip_stoi
 Convert ip from human-readable form to long-integer.
def ip_stomac
 Convert ip from string to mac address.
def json_convert
 Convert object to json format.
def password_gen
 Generates random password of given length.
def subcall
def xml2dict
 A simple function to converts XML data into native Python dictionary.

Variables

 current
 root
 stack
 text_parts

Function Documentation

def src.common.utils.ip_itos (   ip_int)

Convert ip from long-integer to standard, human-readable form.

Definition at line 114 of file utils.py.

def src.common.utils.ip_stoi (   ip)

Convert ip from human-readable form to long-integer.

Parameters
ip(string) IP address with 4 dot-separated numbers (0-255).
Returns
(long int) number representation of the given ip

Definition at line 129 of file utils.py.

def src.common.utils.ip_stomac (   ip)

Convert ip from string to mac address.

Parameters
ip(string) IP address with 4 dot-separated numbers (0-255).
Returns
(string) mac address

Definition at line 140 of file utils.py.

def src.common.utils.json_convert (   o)

Convert object to json format.

Definition at line 179 of file utils.py.

def src.common.utils.password_gen (   length,
  chars = ['letters',
  digits,
  special,
  extra_chars = None 
)

Generates random password of given length.

The password consists of symbols drawn from the set of specified character groups (chars) and (optionally) of extra characters specified in (extra_chars).

Parameters
length(int) length of the requested password
chars(list(string)) may contain letters, digits, or special.
extra_chars(list(char)) list of extra characters for password composition.
Returns
(string) password composed of length symbols picked from specified character set

Definition at line 157 of file utils.py.

def src.common.utils.subcall (   command,
  log = None,
  err_log = None,
  std_log = None,
  err_msg = None,
  err_exit = True 
)

Definition at line 221 of file utils.py.

def src.common.utils.xml2dict (   src)

A simple function to converts XML data into native Python dictionary.

Parameters
srcxml file content or stream
Adds to <b>\c data</b> dictionary key named <b>\c name</b> with value
<b>\c value</b>. If <b>\c name</b> key with single-value already exists
in <b>\c data</b> key, it's converted into list. If it's already
converted into list, yet another value is added.
@param data <i>(\c dict)</i> to which dictionary key should be added
@param name <i>(\c string)</i> name of the key
@param value <i>(\c string)</i> value of the key

Definition at line 44 of file utils.py.

Variable Documentation

src.common.utils.current

Definition at line 66 of file utils.py.

src.common.utils.root

Definition at line 65 of file utils.py.

src.common.utils.stack

Definition at line 64 of file utils.py.

src.common.utils.text_parts

Definition at line 67 of file utils.py.