Convert owlsim json to SimResult object

        :param sim_resp: owlsim response from search_by_attribute_set()
        :param method: SimAlgorithm
        :return: SimResult object
192588
def _simsearch_to_simresult(self, sim_resp: Dict, method: SimAlgorithm) -> SimResult:
        

        sim_ids = get_nodes_from_ids(sim_resp['query_IRIs'])
        sim_resp['results'] = OwlSim2Api._rank_results(sim_resp['results'], method)

        # get id type map:
        ids = [result['j']['id'] for result in sim_resp['results']]
        id_type_map = get_id_type_map(ids)

        matches = []

        for result in sim_resp['results']:
            matches.append(
                SimMatch(
                    id=result['j']['id'],
                    label=result['j']['label'],
                    rank=result['rank'],
                    score=result[OwlSim2Api.method2key[method]],
                    type=id_type_map[result['j']['id']][0],
                    taxon=get_taxon(result['j']['id']),
                    significance="NaN",
                    pairwise_match=OwlSim2Api._make_pairwise_matches(result)
                )
            )

        return SimResult(
            query=SimQuery(
                ids=sim_ids,
                unresolved_ids=sim_resp['unresolved'],
                target_ids=[[]]
            ),
            matches=matches,
            metadata=SimMetadata(
                max_max_ic=self.statistics.max_max_ic
            )
        )
648019
def methodResponse(is_ret, *params)

      if is_ret
        resp = params.collect do |param|
          @writer.ele("param", conv2value(param))
        end

        resp = [@writer.ele("params", *resp)]
      else
        if params.size != 1 or params[0] === XMLRPC::FaultException
          raise ArgumentError, "no valid fault-structure given"
        end
        resp = @writer.ele("fault", conv2value(params[0].to_h))
      end


      tree = @writer.document(
               @writer.pi("xml", 'version="1.0"'),
               @writer.ele("methodResponse", resp)
             )

      @writer.document_to_str(tree) + "\n"
    end
1096084
def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None):
    
    @wraps(method)
    def wrapped(*args, **kwargs):
        ret = method(*args, **kwargs)
        if ret[0]:
            if len(ret) == 2:
                return ret[1]
            else:
                return ret[1:]
        else:
            if exc_type:
                raise exc_type(exc_str or 'call failed')
            return fail_ret
    return wrapped
150164
function (method, result) {

      // result should not be undefined
      if (result === undefined) {
        console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
        result = ''
      }

      var rpcMessage = {
        jsonrpc: '2.0',
        result: result,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
968735
def simxGetObjectChild(clientID, parentObjectHandle, childIndex, operationMode):
    '''
    
    '''
    childObjectHandle = ct.c_int()
    return c_GetObjectChild(clientID, parentObjectHandle, childIndex, ct.byref(childObjectHandle), operationMode), childObjectHandle.value
57070
function generateOptionsResponder(res, methods) {
  return function onDone(fn, err) {
    if (err || methods.length === 0) {
      return fn(err)
    }

    trySendOptionsResponse(res, methods, fn)
  }
}
336832
def simxGetDialogResult(clientID, dialogHandle, operationMode):
    '''
    
    '''
    result = ct.c_int()
    return c_GetDialogResult(clientID, dialogHandle, ct.byref(result), operationMode), result.value
1124295
def simxGetFloatingParameter(clientID, paramIdentifier, operationMode):
    '''
    
    '''

    paramValue = ct.c_float()
    return c_GetFloatingParameter(clientID, paramIdentifier, ct.byref(paramValue), operationMode), paramValue.value
1206938
function getReturn(spec_c, details, method, parent) {
  var retType = getType(getText(spec_c, 'type'), parent);
  var retDescription = (details ? getText(details, 'description') : '');
  return ((retType == 'void') ? {} : {
    type: retType,
    description: retDescription
  });
}
1321686
function(method) {
   
      // convert the method parameters into a json-schema :
      var schemaIdentifierMap = {};
      schemaIdentifierMap[method.name] = {
          id: method.name,
          type:'object',
          properties:{}
      };
      for(var i = 0 ; i < method._parameters.length ; i++) {
         var p = method._parameters[i];
         schemaIdentifierMap[method.name].properties[p.name] = p;
      }
   
      // Use the builder to build an inputEx form from the json-schema
      var builder = new inputEx.JsonSchema.Builder({
   	  'schemaIdentifierMap': schemaIdentifierMap,
   	  'defaultOptions':{
   	     'showMsg':true
   	  }
      });
   	var options = builder.schemaToInputEx(schemaIdentifierMap[method.name]);
	
   	return options;
   }
1315669
def get_class_method(cls_or_inst, method_name):
    
    cls = cls_or_inst if isinstance(cls_or_inst, type) else cls_or_inst.__class__
    meth = getattr(cls, method_name, None)
    if isinstance(meth, property):
        meth = meth.fget
    elif isinstance(meth, cached_property):
        meth = meth.func
    return meth
1353865
def simToReg(self, sim):
        """"""
        # remove initial slash if present
        res = re.sub('^/', '', sim)
        res = re.sub('/$', '', res)
        return '^/?' + re.sub('\*', '[^/]+', res) + '/?$'
564490
public GenericMetadataSupport resolveGenericReturnType(Method method) {
        Type genericReturnType = method.getGenericReturnType();
        // logger.log("Method '" + method.toGenericString() + "' has return type : " + genericReturnType.getClass().getInterfaces()[0].getSimpleName() + " : " + genericReturnType);

        int arity = 0;
        while (genericReturnType instanceof GenericArrayType) {
            arity++;
            genericReturnType = ((GenericArrayType) genericReturnType).getGenericComponentType();
        }

        GenericMetadataSupport genericMetadataSupport = resolveGenericType(genericReturnType, method);
        if (arity == 0) {
            return genericMetadataSupport;
        } else {
            return new GenericArrayReturnType(genericMetadataSupport, arity);
        }
    }
1368544
def simxCopyPasteObjects(clientID, objectHandles, operationMode):
    '''
    
    '''
    c_objectHandles  = (ct.c_int*len(objectHandles))(*objectHandles)
    c_objectHandles = ct.cast(c_objectHandles,ct.POINTER(ct.c_int)) # IronPython needs this
    newObjectCount   = ct.c_int()
    newObjectHandles = ct.POINTER(ct.c_int)()
    ret = c_CopyPasteObjects(clientID, c_objectHandles, len(objectHandles), ct.byref(newObjectHandles), ct.byref(newObjectCount), operationMode)

    newobj = []
    if ret == 0:
        for i in range(newObjectCount.value):
            newobj.append(newObjectHandles[i])

    return ret, newobj
921846
def simxGetJointMatrix(clientID, jointHandle, operationMode):
    '''
    
    '''
    matrix = (ct.c_float*12)()
    ret = c_GetJointMatrix(clientID, jointHandle, matrix, operationMode)
    arr = []
    for i in range(12):
        arr.append(matrix[i])
    return ret, arr
1035788
def _ConvertMethodType(self, methodType):
      
      if methodType:
         name = methodType.name
         wsdlName = methodType.wsdlName
         version = methodType.version
         params = self._Filter(self._ConvertParamType, methodType.paramTypeInfo)
         privId = methodType.privId
         faults = methodType.fault

         # Figure out reture info
         if methodType.returnTypeInfo:
            returnTypeInfo = methodType.returnTypeInfo
            retFlags = self._ConvertAnnotations(returnTypeInfo.annotation)
            methodRetType = returnTypeInfo.type
         else:
            retFlags = 0
            methodRetType = "void"
         if wsdlName.endswith("_Task"):
            # TODO: Need a seperate task return type for task, instead of
            #       hardcode vim.Task as return type
            retType = "vim.Task"
         else:
            retType = methodRetType
         retInfo = (retFlags, retType, methodRetType)

         method = (name, wsdlName, version, params, retInfo, privId, faults)
      else:
         method = None
      return method
830036
def simxSetModelProperty(clientID, objectHandle, prop, operationMode):
    '''
    
    '''

    return c_SetModelProperty(clientID, objectHandle, prop, operationMode)