Wrapper for FFI::Library.callback() that converts Win32/shortcut argument types into FFI-compliant types.
 This method overrides FFI::Library.callback
488109
def callback(name, params, returns)
      params, returns = generate_signature(params, returns)
      super name.to_sym, params, returns
    end
591097
def perform_command(self):
        
        if len(self.actual_arguments) < 1:
            return self.print_help()
        audio_file_path = self.actual_arguments[0]

        if not self.check_input_file(audio_file_path):
            return self.ERROR_EXIT_CODE

        try:
            prober = FFPROBEWrapper(rconf=self.rconf, logger=self.logger)
            dictionary = prober.read_properties(audio_file_path)
            for key in sorted(dictionary.keys()):
                self.print_generic(u"%s %s" % (key, dictionary[key]))
            return self.NO_ERROR_EXIT_CODE
        except FFPROBEPathError:
            self.print_error(u"Unable to call the ffprobe executable '%s'" % (self.rconf[RuntimeConfiguration.FFPROBE_PATH]))
            self.print_error(u"Make sure the path to ffprobe is correct")
        except (FFPROBEUnsupportedFormatError, FFPROBEParsingError):
            self.print_error(u"Cannot read properties of file '%s'" % (audio_file_path))
            self.print_error(u"Make sure the input file has a format supported by ffprobe")

        return self.ERROR_EXIT_CODE
1243309
def command(func_or_args=None):
    
    def decorator(f):
        f.__args__ = args
        return f
    if type(func_or_args) == type(decorator):
        args = {}
        return decorator(func_or_args)
    args = func_or_args
    return decorator
1295835
def find_callback(args, kw=None):
    ''
    if args and callable(args[-1]):
        return args[-1], args[:-1]
    try:
        return kw['callback'], args
    except (KeyError, TypeError):
        return None, args
594492
def _callback_internal(self, kwargs):
    """"""
    logging.debug('Callback %s(*%s, **%s)#%s with params: %r',
                  self._class_path, _short_repr(self.args),
                  _short_repr(self.kwargs), self._pipeline_key.name(), kwargs)
    return self.callback(**kwargs)
472791
function invalidArgs(src, dest, options, cb) {
  // get the callback so we can give the correct errors
  // when src or dest is missing
  if (typeof dest === 'function') cb = dest;
  if (typeof src === 'function') cb = src;
  if (typeof cb !== 'function') {
    throw new TypeError('expected callback to be a function');
  }
  if (typeof src !== 'string') {
    return cb(new TypeError('expected "src" to be a string'));
  }
  if (typeof dest !== 'string') {
    return cb(new TypeError('expected "dest" to be a string'));
  }
}
374869
def _py_ex_argtype(executable):
    
    result = []
    for p in executable.ordered_parameters:
        atypes = p.argtypes
        if atypes is not None:
            result.extend(p.argtypes)
        else:
            print(("No argtypes for: {}".format(p.definition())))

    if type(executable).__name__ == "Function":
        result.extend(executable.argtypes)        
            
    return result
150437
def set_window_pos_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _window_pos_callback_repository:
        previous_callback = _window_pos_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWwindowposfun(cbfun)
    _window_pos_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetWindowPosCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
879820
def set_cursor_enter_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _cursor_enter_callback_repository:
        previous_callback = _cursor_enter_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWcursorenterfun(cbfun)
    _cursor_enter_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetCursorEnterCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
639543
function Function (retType, argTypes, abi) {
  if (!(this instanceof Function)) {
    return new Function(retType, argTypes, abi);
  }

  debug('creating new FunctionType');

  // check args
  assert(!!retType, 'expected a return "type" object as the first argument');
  assert(Array.isArray(argTypes), 'expected Array of arg "type" objects as the second argument');

  // normalize the "types" (they could be strings, so turn into real type
  // instances)
  this.retType = ref.coerceType(retType);
  this.argTypes = argTypes.map(ref.coerceType);
  this.abi = null == abi ? bindings.FFI_DEFAULT_ABI : abi;
}
1272174
def _create_callback(self, function, wrap_result):
    
    if not isinstance(function, Callable):
        return None
    def command_callback():
        # command result callback expects response from MPD as iterable lines,
        # thus read available lines from socket
        res = function(self, self._read_lines())
        # wrap result in iterator helper if desired
        if wrap_result:
            res = self._wrap_iterator(res)
        return res
    return command_callback
1195193
def callback(self, callback, *args, **kwds):
        
        return self << _CloseDummy(callback, args, kwds)
665049
def _extern_decl(return_type, arg_types):
  
  def wrapper(func):
    signature = _ExternSignature(
      return_type=str(return_type),
      method_name=str(func.__name__),
      arg_types=tuple(arg_types))
    func.extern_signature = signature
    return func
  return wrapper
8750
def execstr_funckw(func):
    
    import utool as ut
    funckw = ut.get_func_kwargs(func)
    return ut.execstr_dict(funckw, explicit=True)
754649
def mouse_button_callback(self, window, button, action, mods):
        
        # Offset button index by 1 to make it match the other libraries
        button += 1
        # Support left and right mouse button for now
        if button not in [1, 2]:
            return

        xpos, ypos = glfw.get_cursor_pos(self.window)

        if action == glfw.PRESS:
            self.example.mouse_press_event(xpos, ypos, button)
        else:
            self.example.mouse_release_event(xpos, ypos, button)
1246032
function serializeCallback(args) {
  var callback;

  debug('Transforming callback in ', args);

  return args.map(function(arg) {
    if (typeof arg !== 'function') return arg;

    // It shouldn't be an argument after the callback function
    invariant(!callback, 'Only one callback function is allowed.');

    callback = arg;

    return '__clientCallback__';
  });
}
1053363
def cli(filename, direct, language):
    # TODO: Flesh this description out
    
    file_extension = filename.split(".")[-1]
    if file_extension not in extensions.keys():
        error = "{} is not currently supported in Pyterp.\n Pyterp currently only supports" \
                "the following types: {}".format(file_extension, extensions.items())
        raise RuntimeError(error)

    if direct is not None and language is None:
        raise click.BadOptionUsage('--language',
                                   "When running a program directly from string, you must specify the langauge "
                                   "with the --language option: Valid options include [bf]")
    """
    TODO: Figure out how to best load each interpreter based on extension. Maybe a factory?
    """
    interpreter = pyterp.Brainfuck(filename=filename, direct_input=direct)
    interpreter.run()