Welcome    Usage    Browse    Find CID    Search     Log in

cM API Documentation

cmx Namespace Reference

Functions

def convert_relaxed_classes_to_uids
def find_and_separate_flags
def is_windows
def gen_tmp_with_json
def merge_array
def list2str
def is_uid
def cid2array
def return_flags
def error_if_no_cur_repo
def check_cm_json
def load_json_file
def merge_arrays
def array2cm
def str2cm
def access_fe_as_string
def cm_access

Variables

string cmx_error = 'cMX error: '
tuple x = return_flags(sys.argv[1:])
list argv = x['cmd']
tuple il = len(argv)
list flags = x['flags']
 globl = False
 local = False
 quiet = False
 jsn = False
string c = ''
string q = 'cm core gen_uid'
list af = argv[0]
tuple f = open(af, 'r')
tuple uid = f.readline()
list alias = af[8:]
tuple r
list web_host = r['cm_web_host']
list index_host = r['cm_index_host']
tuple r9
tuple pp = r9.get('cm_path','')
tuple m = r9.get('cm_module_uoa','')
tuple md = r9.get('cm_module_uid','')
tuple d = r9.get('cm_data_uoa','')
tuple dd = r9.get('cm_data_uid','')
tuple rp = r9.get('cm_repo_uoa','')
tuple rpd = r9.get('cm_repo_uid','')
string cid = ':'
string cv = '$#cm_'
string c1 = ''
string dn = ''
string dn1 = ''
dictionary ii
 update_data = False
list use_indexing = r['cm_data_obj']
string mode = 'delete'
int qx = 1
string key = 'key_'
string value = 'value_'
tuple qq = q.split('=')
list lc = []
string l = ''
string q1 = 'alias-u-'
tuple r1 = convert_relaxed_classes_to_uids({'cm_list':r['cm_values']})
list ww = r1['cm_list_match']
list p = r['cm_path']
tuple p1 = os.path.join('.cm','alias-a-'+dn)
tuple p2 = os.path.join('.cm','alias-u-'+uid)
 move = False
string rp1 = ''
tuple password = getpass.getpass('Enter password: ')

Function Documentation

def cmx::access_fe_as_string (   s  ) 
Front-end to single entry 'access' function as string (if someone finds it easier).

Input:  string that will be converted to array (See "access" function).
Output: See "access" function.

Definition at line 512 of file cmx.py.

def cmx::array2cm (   a  ) 
Convert list to cm array

cm_module_uoa cm_action A=B C=D ... @file1.json E=F ... -- <unparsed arguments>

if extension of @file is .tmp, it will be deleted after read!

Input:  input array

Output: {
          cm_return  - return code = 0 if successful
          cm_array   - array
          cm_console - if 'cm_console' in array, set it to the value of 'cm_console' parameter
        }

Definition at line 423 of file cmx.py.

def cmx::check_cm_json (   i  ) 
Check if 'cm_json' exist in array and decode it

Input:  {
          cm_json - array to check
        } 

Output: {...} - returned array where cm_json is decoded

Definition at line 316 of file cmx.py.

def cmx::cid2array (   i  ) 
Convert cid to array
Note that this function is different from 

Input:  {
          cid      - in format (REPO_UOA:)KEY_UOA:DATA_UOA
          (prefix) - add prefic to output variables (<prefix>_repo_uoa:...)
        }

Output: {
          prefix+'_repo_uoa'   - repo UOA
          prefix+'_module_uoa' - module UOA
          prefix+'_data_uoa'   - data UOA
        }

Definition at line 235 of file cmx.py.

def cmx::cm_access (   i  ) 
Call external cm and return json

Input:  {
          cm_run_module_uoa - module UOA
          cm_action         - action (function) from the module

          cm_unparsed       - unparsed list to add to command line ...
          
          Set of parameters depending on the called module and action (function)
        }

Output: {
          cm_return   - return code = 0 if successful
                                    > 0 if error
                                           99 - if couldn't process json from output
                                    < 0 if warning (rarely used at this moment)
          (cm_error)  - error text, if cm_return > 0
          (cm_stdout) - if no error, raw output
          (cm_stderr) - raw output of error stream

          Set of output parameters depending on the called module and action (function)
        }

Definition at line 526 of file cmx.py.

def cmx::convert_relaxed_classes_to_uids (   i  ) 
Convert relaxed classes to UIDs

Input:  {
          cm_list  - list with classes (wildcards * and ? can be used)
        }

Output: {
          cm_return     = 0 - no errors
          cm_error      -     error text if cm_return>0
          cm_list_uids  - updated list of UIDs
          cm_list_match - match of classes, i.e. {"value from cm_list":{"cm_uid","alias"}}
        }
 

Definition at line 23 of file cmx.py.

def cmx::error_if_no_cur_repo (   i  ) 
If current path does not belong to repository, while command needs it,
print error

Input:  {}

Output: {}

Definition at line 301 of file cmx.py.

def cmx::find_and_separate_flags (   i  ) 
Find flag of format flag=a(,b,c)
and return list of values [a(,b,c)]

Input:  {
          cm_list  - list with flags
          flags    - list of flags to match 
                     (to support equivalent flags like -c and --classes)
        }

Output: {
          cm_return = 0 (for compatibility with cM)
          cm_found  - False, if not found
                      True,  if found
          cm_values - List of values
        }
 

Definition at line 74 of file cmx.py.

def cmx::gen_tmp_with_json (   i  ) 
Generate tmp file and put array as json there

Input: array

Output: filename

Definition at line 134 of file cmx.py.

def cmx::is_uid (   str  ) 
Check if string is cM UID

Input: string to check

Output: True if UID, otherwise False

Definition at line 216 of file cmx.py.

def cmx::is_windows (  ) 
Is Windows?

Input: None

Output: True if Windows

Definition at line 117 of file cmx.py.

def cmx::list2str (   a  ) 
Convert list to string

Input: list

Output: string 

Definition at line 199 of file cmx.py.

def cmx::load_json_file (   i  ) 
Load json from file

Input:  {
          cm_filename - file name with json
        }

Output: {
          cm_return - return code = 0 if successful
          cm_array  - array from json file
        }

Definition at line 349 of file cmx.py.

def cmx::merge_array (   a,
  b 
)
Add params from array b (in form x=y) to array a

Input: a=original array
       b=array with params (in form x=y)

Output: 

Definition at line 153 of file cmx.py.

def cmx::merge_arrays (   i  ) 
Intelligently merge cm_array with cm_array1

Input:  {
          cm_array  - merge this array with cm_array1 (will be directly modified!)
          cm_array1 - cM array

Output: {
          cm_return - return code = 0 if successful
          cm_array  - output array
        }

Definition at line 382 of file cmx.py.

def cmx::return_flags (   i  ) 
Separate argv to flags (starting from '-' and the rest)

Input:  {
          argv
        }

Output: {
          flags - array with flags
          cmd   - "clean from flags" argv
        }

Definition at line 270 of file cmx.py.

def cmx::str2cm (   i  ) 
Convert string to cM array

Input:  string

Output: {
          cm_return - return code = 0 if successful
          cm_array  - array
        }

Definition at line 497 of file cmx.py.


Variable Documentation

list cmx::af = argv[0]

Definition at line 763 of file cmx.py.

list cmx::alias = af[8:]

Definition at line 775 of file cmx.py.

list cmx::argv = x['cmd']

Definition at line 636 of file cmx.py.

list cmx::c = ''

Definition at line 745 of file cmx.py.

Referenced by org::openme::openme::remote_access().

list cmx::c1 = ''

Definition at line 869 of file cmx.py.

tuple cmx::cid = ':'

Definition at line 821 of file cmx.py.

string cmx::cmx_error = 'cMX error: '

Definition at line 20 of file cmx.py.

string cmx::cv = '$#cm_'

Definition at line 849 of file cmx.py.

tuple cmx::d = r9.get('cm_data_uoa','')

Definition at line 810 of file cmx.py.

tuple cmx::dd = r9.get('cm_data_uid','')

Definition at line 811 of file cmx.py.

string cmx::dn = ''

Definition at line 886 of file cmx.py.

string cmx::dn1 = ''

Definition at line 940 of file cmx.py.

tuple cmx::f = open(af, 'r')

Definition at line 771 of file cmx.py.

Referenced by org::openme::openme::access(), and org::openme::openme::remote_access().

list cmx::flags = x['flags']

Definition at line 638 of file cmx.py.

cmx::globl = False

Definition at line 725 of file cmx.py.

dictionary cmx::ii
Initial value:
{'cm_run_module_uoa':'core',
                'cm_action':'rename',
                'orig_module_uoa':'repo',
                'orig_data_uoa':dn,
                'cm_console':'json'}

Definition at line 948 of file cmx.py.

tuple cmx::il = len(argv)

Definition at line 637 of file cmx.py.

Referenced by openme_create_obj().

list cmx::index_host = r['cm_index_host']

Definition at line 795 of file cmx.py.

cmx::jsn = False

Definition at line 740 of file cmx.py.

string cmx::key = 'key_'

Definition at line 1239 of file cmx.py.

tuple cmx::l = ''

Definition at line 1284 of file cmx.py.

list cmx::lc = []

Definition at line 1275 of file cmx.py.

cmx::local = False

Definition at line 729 of file cmx.py.

list cmx::m = r9.get('cm_module_uoa','')

Definition at line 808 of file cmx.py.

tuple cmx::md = r9.get('cm_module_uid','')

Definition at line 809 of file cmx.py.

string cmx::mode = 'delete'

Definition at line 1098 of file cmx.py.

cmx::move = False

Definition at line 1714 of file cmx.py.

list cmx::p = r['cm_path']

Definition at line 1585 of file cmx.py.

Referenced by openme_init(), and org::openme::openme::openme_run_program().

tuple cmx::p1 = os.path.join('.cm','alias-a-'+dn)

Definition at line 1591 of file cmx.py.

tuple cmx::p2 = os.path.join('.cm','alias-u-'+uid)

Definition at line 1598 of file cmx.py.

tuple cmx::password = getpass.getpass('Enter password: ')

Definition at line 1847 of file cmx.py.

Referenced by org::openme::openme::remote_access().

tuple cmx::pp = r9.get('cm_path','')

Definition at line 807 of file cmx.py.

string cmx::q = 'cm core gen_uid'

Definition at line 753 of file cmx.py.

string cmx::q1 = 'alias-u-'

Definition at line 1299 of file cmx.py.

tuple cmx::qq = q.split('=')

Definition at line 1243 of file cmx.py.

cmx::quiet = False

Definition at line 735 of file cmx.py.

int cmx::qx = 1

Definition at line 1237 of file cmx.py.

tuple cmx::r
Initial value:
cm_access({'cm_run_module_uoa':'core', 
                   'cm_action':'get_info_about_full_hosts',
                   'cm_console':'json'})

Definition at line 787 of file cmx.py.

tuple cmx::r1 = convert_relaxed_classes_to_uids({'cm_list':r['cm_values']})

Definition at line 1479 of file cmx.py.

tuple cmx::r9
Initial value:
cm_access({'cm_run_module_uoa':'core', 
                    'cm_action':'get_info_about_current_path',
                    'cm_get_uid':'yes',
                    'cm_console':'json'})

Definition at line 798 of file cmx.py.

tuple cmx::rp = r9.get('cm_repo_uoa','')

Definition at line 812 of file cmx.py.

string cmx::rp1 = ''

Definition at line 1747 of file cmx.py.

tuple cmx::rpd = r9.get('cm_repo_uid','')

Definition at line 813 of file cmx.py.

tuple cmx::uid = f.readline()

Definition at line 772 of file cmx.py.

Definition at line 954 of file cmx.py.

list cmx::use_indexing = r['cm_data_obj']

Definition at line 1030 of file cmx.py.

string cmx::value = 'value_'

Definition at line 1240 of file cmx.py.

list cmx::web_host = r['cm_web_host']

Definition at line 794 of file cmx.py.

list cmx::ww = r1['cm_list_match']

Definition at line 1484 of file cmx.py.


Generated on Wed May 28 02:49:03 2014 for Collective Mind Framework by DoxyGen 1.6.1
Concept, design and coordination: Grigori Fursin (C) 1993-2013