parameters: ()
return_statement: return True
docstring: Load CLIENT ENCODES and CLIENT DECODES OPCODES into memory
  
      The CLIENT LIST should be clean of any invalid entries by the time this
      function is called. Client translator load failures are only commented
      upon in output streams and do not trigger a removal of the client.
docstring_summary: Load CLIENT ENCODES and CLIENT DECODES OPCODES into memory
docstring_tokens: Load CLIENT ENCODES and CLIENT DECODES OPCODES into memory
function: def loadclienttranslators():
      """
      Load CLIENT ENCODES and CLIENT DECODES OPCODES into memory
  
      The CLIENT LIST should be clean of any invalid entries by the time this
      function is called. Client translator load failures are only commented
      upon in output streams and do not trigger a removal of the client.
  
      """
  
      if VERBOSE:
          dprint('entering \'loadclienttranslators()\'\n')
  
      bad_clients = []
  
      for client in client_list:
          try:
              short_name = '/{0}_ops.h'.format(client).lower()
  
              file_name = '{0}/common/patches{1}'.format(
                  base_path,
                  short_name
              )
              
              vprint(file_name)
  
              with open(file_name, 'r') as data_file:
                  if VERBOSE:
                      dprint('->open: \'{0}\' in \'r\' mode\n'.format(file_name))
  
                  client_encodes[client] = []
                  client_decodes[client] = []
                  line_no = 0
  
                  for data_line in data_file:
                      line_no += 1
                      val_begin = data_line.find('OP_', 2)
                      val_end = data_line.find(')', val_begin)
  
                      if val_begin < 0 or val_end < 0:
                          continue
                      
                      if data_line[:1] == 'E':
                          client_encodes[client].append(data_line[val_begin:val_end])
  
                          if VERBOSE:
                              dprint('..{0}({1}:{2}) \'ENCODE\' [{3}] = {4}\n'.format(
                                  short_name,
                                  line_no,
                                  val_begin,
                                  client,
                                  data_line[val_begin:val_end]
                              ))
                      elif data_line[:1] == 'D':
                          client_decodes[client].append(data_line[val_begin:val_end])
                          
                          if VERBOSE:
                              dprint('..{0}({1}:{2}) \'DECODE\' [{3}] = {4}\n'.format(
                                  short_name,
                                  line_no,
                                  val_begin,
                                  client,
                                  data_line[val_begin:val_end]
                              ))
  
              data_file.close()
  
              if VERBOSE:
                  dprint('->close: \'{0}\'\n'.format(file_name))
          except:
              print('(Exception Error: {0}) loadclienttranslators() [{1}]'.format(
                  sys.exc_info()[0],
                  client
              ))
  
              dprint('<-except: \'{0} [{1}]\'\n'.format(
                  sys.exc_info()[0],
                  client
              ))
  
              bad_clients.append(client)
  
      for bad_client in bad_clients:
          if bad_client in client_encodes or bad_client in client_decodes:
              vprint('Deleting stale entries for \'{0}\' client...'.format(bad_client))
  
              if bad_client in client_encodes:
                  del client_encodes[bad_client]
  
                  dprint('->delete: \'{0}\' client encode entries\n'.format(bad_client))
  
              if bad_client in client_decodes:
                  del client_decodes[bad_client]
  
                  dprint('->delete: \'{0}\' client decode entries\n'.format(bad_client))
  
      if not len(client_encodes) > 0 and not len(client_decodes) > 0:
          dprint('leaving \'loadclienttranslators(): NO CLIENT ENCODES OR DECODES FOUND\'\n\n')
  
          return False
  
      if VERBOSE:
          dprint('leaving \'loadclienttranslators()\'\n\n')
  
      return True
function_tokens: def loadclienttranslators ( ) : if VERBOSE : dprint ( 'entering \'loadclienttranslators()\'\n' ) bad_clients = [ ] for client in client_list : try : short_name = '/{0}_ops.h' . format ( client ) . lower ( ) file_name = '{0}/common/patches{1}' . format ( base_path , short_name ) vprint ( file_name ) with open ( file_name , 'r' ) as data_file : if VERBOSE : dprint ( '->open: \'{0}\' in \'r\' mode\n' . format ( file_name ) ) client_encodes [ client ] = [ ] client_decodes [ client ] = [ ] line_no = 0 for data_line in data_file : line_no += 1 val_begin = data_line . find ( 'OP_' , 2 ) val_end = data_line . find ( ')' , val_begin ) if val_begin < 0 or val_end < 0 : continue if data_line [ : 1 ] == 'E' : client_encodes [ client ] . append ( data_line [ val_begin : val_end ] ) if VERBOSE : dprint ( '..{0}({1}:{2}) \'ENCODE\' [{3}] = {4}\n' . format ( short_name , line_no , val_begin , client , data_line [ val_begin : val_end ] ) ) elif data_line [ : 1 ] == 'D' : client_decodes [ client ] . append ( data_line [ val_begin : val_end ] ) if VERBOSE : dprint ( '..{0}({1}:{2}) \'DECODE\' [{3}] = {4}\n' . format ( short_name , line_no , val_begin , client , data_line [ val_begin : val_end ] ) ) data_file . close ( ) if VERBOSE : dprint ( '->close: \'{0}\'\n' . format ( file_name ) ) except : print ( '(Exception Error: {0}) loadclienttranslators() [{1}]' . format ( sys . exc_info ( ) [ 0 ] , client ) ) dprint ( '<-except: \'{0} [{1}]\'\n' . format ( sys . exc_info ( ) [ 0 ] , client ) ) bad_clients . append ( client ) for bad_client in bad_clients : if bad_client in client_encodes or bad_client in client_decodes : vprint ( 'Deleting stale entries for \'{0}\' client...' . format ( bad_client ) ) if bad_client in client_encodes : del client_encodes [ bad_client ] dprint ( '->delete: \'{0}\' client encode entries\n' . format ( bad_client ) ) if bad_client in client_decodes : del client_decodes [ bad_client ] dprint ( '->delete: \'{0}\' client decode entries\n' . format ( bad_client ) ) if not len ( client_encodes ) > 0 and not len ( client_decodes ) > 0 : dprint ( 'leaving \'loadclienttranslators(): NO CLIENT ENCODES OR DECODES FOUND\'\n\n' ) return False if VERBOSE : dprint ( 'leaving \'loadclienttranslators()\'\n\n' ) return True