Apply pointcut on input target and returns final interception.

        The poincut respects all meta properties such as:
        - function signature,
        - module path,
        - file path,
        - __dict__ reference.
967615
def apply_pointcut(self, target, function=None, ctx=None):
        

        try:
            __file__ = getfile(target)
        except TypeError:
            __file__ = '<string>'

        if function is None:
            function = _get_function(target)

        # flag which indicates that the function is not a pure python function
        # and has to be wrapped
        wrap_function = not hasattr(function, '__code__')

        try:
            # get params from target
            args, varargs, kwargs, _ = getargspec(function)
        except TypeError:
            # in case of error, wrap the function
            wrap_function = True

        if wrap_function:
            # if function is not pure python, create a generic one
            # with assignments
            assigned = []
            for wrapper_assignment in WRAPPER_ASSIGNMENTS:
                if hasattr(function, wrapper_assignment):
                    assigned.append(wrapper_assignment)
            # and updates
            updated = []
            for wrapper_update in WRAPPER_UPDATES:
                if hasattr(function, wrapper_update):
                    updated.append(wrapper_update)

            @wraps(function, assigned=assigned, updated=updated)
            def wrapper(*args, **kwargs):
                """Default wrapper."""

            function = wrapper

            # get params from target wrapper
            args, varargs, kwargs, _ = getargspec(function)

        # get params from target
        name = function.__name__

        # if target has not name, use 'function'
        if name == Joinpoint.__LAMBDA_NAME__:
            name = Joinpoint.__INTERCEPTION__

        # get join method for reducing concatenation time execution
        join = "".join

        # default indentation
        indent = '    '

        newcodestr = "def {0}(".format(name)
        if args:
            newcodestr = join((newcodestr, "{0}".format(args[0])))
        for arg in args[1:]:
            newcodestr = join((newcodestr, ", {0}".format(arg)))

        if varargs is not None:
            if args:
                newcodestr = join((newcodestr, ", "))
            newcodestr = join((newcodestr, "*{0}".format(varargs)))

        if kwargs is not None:
            if args or varargs is not None:
                newcodestr = join((newcodestr, ", "))
            newcodestr = join((newcodestr, "**{0}".format(kwargs)))

        newcodestr = join((newcodestr, "):\n"))

        # unique id which will be used for advicesexecutor and kwargs
        generated_id = repr(time()).replace('.', '_')

        # if kwargs is None
        if kwargs is None and args:
            kwargs = "kwargs_{0}".format(generated_id)  # generate a name
            # initialize a new dict with args
            newcodestr = join(
                (newcodestr, "{0}{1} = {{\n".format(indent, kwargs)))
            for arg in args:
                newcodestr = join(
                    (newcodestr, "{0}{0}'{1}': {1},\n".format(indent, arg))
                )
            newcodestr = join((newcodestr, "{0}}}\n".format(indent)))

        else:
            # fill args in kwargs
            for arg in args:
                newcodestr = join(
                    (newcodestr, "{0}{1}['{2}'] = {2}\n".format(
                        indent, kwargs, arg))
                )

        # advicesexecutor name
        joinpoint = "joinpoint_{0}".format(generated_id)

        if varargs:
            newcodestr = join(
                (newcodestr, "{0}{1}.args = {2}\n".format(
                    indent, joinpoint, varargs))
            )

        # set kwargs in advicesexecutor
        if kwargs is not None:
            newcodestr = join(
                (newcodestr, "{0}{1}.kwargs = {2}\n".format(
                    indent, joinpoint, kwargs))
            )

        # return advicesexecutor proceed result
        start = "start_{0}".format(generated_id)
        newcodestr = join(
            (newcodestr, "{0}return {1}()\n".format(indent, start))
        )
        # compile newcodestr
        code = compile(newcodestr, __file__, 'single')

        _globals = {}

        # define the code with the new function
        exec(code, _globals)

        # get new code
        newco = _globals[name].__code__

        # get new consts list
        newconsts = list(newco.co_consts)

        if PY3:
            newcode = list(newco.co_code)
        else:
            newcode = map(ord, newco.co_code)

        consts_values = {joinpoint: self, start: self.start}

        # change LOAD_GLOBAL to LOAD_CONST
        index = 0
        newcodelen = len(newcode)
        while index < newcodelen:
            if newcode[index] == LOAD_GLOBAL:
                oparg = newcode[index + 1] + (newcode[index + 2] << 8)
                name = newco.co_names[oparg]
                if name in consts_values:
                    const_value = consts_values[name]
                    if const_value in newconsts:
                        pos = newconsts.index(const_value)
                    else:
                        pos = len(newconsts)
                        newconsts.append(consts_values[name])
                    newcode[index] = LOAD_CONST
                    newcode[index + 1] = pos & 0xFF
                    newcode[index + 2] = pos >> 8
                    if name == start:
                        break  # stop when start is encountered
            index += 1

        # get code string
        codestr = bytes(newcode) if PY3 else join(map(chr, newcode))

        # get vargs
        vargs = [
            newco.co_argcount, newco.co_nlocals, newco.co_stacksize,
            newco.co_flags, codestr, tuple(newconsts), newco.co_names,
            newco.co_varnames, newco.co_filename, newco.co_name,
            newco.co_firstlineno, newco.co_lnotab,
            getattr(function.__code__, 'co_freevars', ()),
            newco.co_cellvars
        ]
        if PY3:
            vargs.insert(1, newco.co_kwonlyargcount)

        # instanciate a new code object
        codeobj = type(newco)(*vargs)
        # instanciate a new function
        if function is None or isbuiltin(function):
            interception_fn = FunctionType(codeobj, {})

        else:
            interception_fn = type(function)(
                codeobj,
                {} if function.__globals__ is None else function.__globals__,
                function.__name__,
                function.__defaults__,
                function.__closure__
            )

        # set wrapping assignments
        for wrapper_assignment in WRAPPER_ASSIGNMENTS:
            try:
                value = getattr(function, wrapper_assignment)
            except AttributeError:
                pass
            else:
                setattr(interception_fn, wrapper_assignment, value)
        # update wrapping updating
        for wrapper_update in WRAPPER_UPDATES:
            try:
                value = getattr(function, wrapper_update)
            except AttributeError:
                pass
            else:
                getattr(interception_fn, wrapper_update).update(value)

        # set interception, target function and ctx
        self._interception, self.target, self.ctx = _apply_interception(
            target=target, interception_fn=interception_fn, ctx=ctx
        )

        return self._interception
815350
def order_target(self) -> Optional[Union[int, Point2]]:
        
        if self.orders:
            if isinstance(self.orders[0].target, int):
                return self.orders[0].target
            else:
                return Point2.from_proto(self.orders[0].target)
        return None
683330
function applyToPoint(matrix, point) {
    return {
        x: matrix.a * point.x + matrix.c * point.y + matrix.e,
        y: matrix.b * point.x + matrix.d * point.y + matrix.f
    };
}
1020414
def _interception(self, joinpoint):
        

        if self.pre_cond is not None:
            self.pre_cond(joinpoint)

        result = joinpoint.proceed()

        if self.post_cond is not None:
            joinpoint.exec_ctx[Condition.RESULT] = result
            self.post_cond(joinpoint)

        return result
780732
function parse(op, target) {
  if (OPERATORS.indexOf(op.op) !== -1) {
    op = clone(op);
    if (op.from != null) {
      op.from = parsePointer(op.from);
    }
    if (op.path != null) {
      op.path = parsePointer(op.path);
    } else {
      throw new error.InvalidOperationError(op.op, 'Operation object must have a "path" member');
    }
    validatePath(op.from || op.path, target);
    return op;
  }
  throw new error.InvalidOperationError('Operation object "op" member must be one of ' + OPERATORS.join(', ') + ' ' + ('but got "' + op.op + '"'));
}
401252
function () {

		Point.prototype.init.apply(this, arguments);

		var point = this,
			toggleSlice;

		// Disallow negative values (#1530)
		if (point.y < 0) {
			point.y = null;
		}

		//visible: options.visible !== false,
		extend(point, {
			visible: point.visible !== false,
			name: pick(point.name, 'Slice')
		});

		// add event listener for select
		toggleSlice = function (e) {
			point.slice(e.type === 'select');
		};
		addEvent(point, 'select', toggleSlice);
		addEvent(point, 'unselect', toggleSlice);

		return point;
	}
150090
function _pointMouseUp(e) {
        var self = e.target;

        self.focus();

        if (self.bezierEditor.dragElement) {
            self.bezierEditor.dragElement = null;
            self.bezierEditor._commitTimingFunction();
            self.bezierEditor._updateCanvas();
        }
    }
60347
function shallowCopyTargetProperty(target, source) {
  let properties = Object.keys(target);

  for (let i = 0; i < properties.length; ++i) {
    if (source.hasOwnProperty(properties[i])) {
      target[properties[i]] = source[properties[i]];
    }
  }
}
24758
def fetch_fence_point(self ,i):
        ''''''
        self.master.mav.fence_fetch_point_send(self.target_system,
                                                    self.target_component, i)
        tstart = time.time()
        p = None
        while time.time() - tstart < 3:
            p = self.master.recv_match(type='FENCE_POINT', blocking=False)
            if p is not None:
                break
            time.sleep(0.1)
            continue
        if p is None:
            self.console.error("Failed to fetch point %u" % i)
            return None
        return p
47130
def _hijack_target(self):
        """"""

        if self._target.is_class_or_module():
            setattr(self._target.obj, self._method_name, self)
        elif self._attr.kind == 'property':
            proxy_property = ProxyProperty(
                double_name(self._method_name),
                self._original_method,
            )
            setattr(self._target.obj.__class__, self._method_name, proxy_property)
            self._target.obj.__dict__[double_name(self._method_name)] = self
        else:
            self._target.obj.__dict__[self._method_name] = self

        if self._method_name in ['__call__', '__enter__', '__exit__']:
            self._target.hijack_attr(self._method_name)
826173
boolean haveAppropriateParams(Pointcut thePointcut, HookParams theParams) {
		Validate.isTrue(theParams.getParamsForType().values().size() == thePointcut.getParameterTypes().size(), "Wrong number of params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), theParams.getParamsForType().values().stream().map(t -> t != null ? t.getClass().getSimpleName() : "null").sorted().collect(Collectors.toList()));

		List<String> wantedTypes = new ArrayList<>(thePointcut.getParameterTypes());

		ListMultimap<Class<?>, Object> givenTypes = theParams.getParamsForType();
		for (Class<?> nextTypeClass : givenTypes.keySet()) {
			String nextTypeName = nextTypeClass.getName();
			for (Object nextParamValue : givenTypes.get(nextTypeClass)) {
				Validate.isTrue(nextParamValue == null || nextTypeClass.isAssignableFrom(nextParamValue.getClass()), "Invalid params for pointcut %s - %s is not of type %s", thePointcut.name(), nextParamValue != null ? nextParamValue.getClass() : "null", nextTypeClass);
				Validate.isTrue(wantedTypes.remove(nextTypeName), "Invalid params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), nextTypeName);
			}
		}

		return true;
	}
776775
function () {

		Point.prototype.init.apply(this, arguments);

		var point = this,
			toggleSlice;

		//visible: options.visible !== false,
		extend(point, {
			visible: point.visible !== false,
			name: pick(point.name, 'Slice')
		});

		// add event listener for select
		toggleSlice = function () {
			point.slice();
		};
		addEvent(point, 'select', toggleSlice);
		addEvent(point, 'unselect', toggleSlice);

		return point;
	}
321361
def get_target(cls, scheme, path, fragment, username,
                   password, hostname, port, query, **kwargs):
        
        raise NotImplementedError("get_target must be overridden")
344675
private function getPointcut(): Pointcut
    {
        if (!$this->pointcut) {
            $this->pointcut = $this->container->getPointcut($this->pointcutId);
        }

        return $this->pointcut;
    }
996379
def _coerce_target(self, target):
        
        if not target or isinstance(target, six.string_types):
            return target
        if not hasattr(target, 'instance'):
            return None

        if getattr(target.instance, '_deferred', False):
            model = target.instance._meta.proxy_for_model
        else:
            model = target.instance.__class__

        return '%s.%s.%s' % (
            model._meta.app_label,
            model.__name__,
            target.field.name,
        )
708506
def _format_entrypoint_target(ep):
    '''
    
    '''
    s = ep.module_name
    if ep.attrs:
        s += ':' + '.'.join(ep.attrs)
    return s
649082
function methodPromify(target, method, arg0, arg1) {
  var chopLength = 2
    , argCount = arguments.length - chopLength;
  if (argCount > 2) {
    var args = slice.call(arguments, chopLength);
    return new MyPromise(function(resolve, reject) {
      args.push(function(err, result) {
        if (err) { reject(err); }
        else { resolve(result); }
      });
      target[method].apply(target, args);
    });
  } else {
    return new MyPromise(function(resolve, reject) {
      var cb = function(err, result) {
        if (err) { reject(err); }
        else { resolve(result); }
      };
      if (argCount === 2) {
        target[method].call(target, arg0, arg1, cb);
      } else if (argCount === 1) {
        target[method].call(target, arg0, cb);
      } else if (argCount === 0) {
        target[method].call(target, cb);
      }
    });
  }
}