Creates a new method from `name` and `descriptor`. If `code` is not
        ``None``, add a `Code` attribute to this method.
188284
def create(self, name: str, descriptor: str,
               code: CodeAttribute=None) -> Method:
        
        method = Method(self._cf)
        name = self._cf.constants.create_utf8(name)
        descriptor = self._cf.constants.create_utf8(descriptor)
        method._name_index = name.index
        method._descriptor_index = descriptor.index
        method.access_flags.acc_public = True

        if code is not None:
            method.attributes.create(CodeAttribute)

        self.append(method)
        return method
193289
def add_single_feature_methods(cls):
    
    # Sanity check: This only makes sense if we are building the GAPIC
    # subclass and have enums already attached.
    if not hasattr(cls, "enums"):
        return cls

    # Add each single-feature method to the class.
    for feature in cls.enums.Feature.Type:
        # Sanity check: Do not make a method for the falsy feature.
        if feature.name == "TYPE_UNSPECIFIED":
            continue

        # Assign the appropriate metadata to the function.
        detect = _create_single_feature_method(feature)

        # Assign a qualified name to the function, and perform module
        # replacement on the docstring.
        detect.__qualname__ = "{cls}.{name}".format(
            cls=cls.__name__, name=detect.__name__
        )
        detect.__doc__ = detect.__doc__.format(module=cls.__module__)

        # Place the function on the class being created.
        setattr(cls, detect.__name__, detect)

    # Done; return the class.
    return cls
1163437
def _create_api_method(cls, name, api_method):
    
    def _api_method(self, **kwargs):
        # lookup the command
        command = api_method['name']
        if kwargs:
            return self._make_request(command, kwargs)
        else:
            kwargs = {}
            return self._make_request(command, kwargs)
    _api_method.__doc__ = api_method['description']
    _api_method.__doc__ += _add_params_docstring(api_method['params'])
    _api_method.__name__ = str(name)
    setattr(cls, _api_method.__name__, _api_method)
357640
def create_method(self):
        
        n_indents = 1 if self.target_language in ['java', 'js',
                                                  'php', 'ruby'] else 0
        return self.temp('separated.method', n_indents=n_indents,
                         skipping=True).format(**self.__dict__)
764691
function _createMethod(definition, method){
        var slice = Array.prototype.slice;
        
        return function(){
            var l = arguments.length, callback, message = {
                method: method
            };
            
            if (l > 0 && typeof arguments[l - 1] === "function") {
                //with callback, procedure
                if (l > 1 && typeof arguments[l - 2] === "function") {
                    // two callbacks, success and error
                    callback = {
                        success: arguments[l - 2],
                        error: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 2);
                }
                else {
                    // single callback, success
                    callback = {
                        success: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 1);
                }
                _callbacks["" + (++_callbackCounter)] = callback;
                message.id = _callbackCounter;
            }
            else {
                // no callbacks, a notification
                message.params = slice.call(arguments, 0);
            }
            if (definition.namedParams && message.params.length === 1) {
                message.params = message.params[0];
            }
            // Send the method request
            _send(message);
        };
    }
86084
def __generate_method(name):
        
        try:
            func = getattr(DataFrame, name)
        except AttributeError as e:
            # PySpark version is too old
            def func(self, *args, **kwargs):
                raise e
            return func
        wraps = getattr(functools, "wraps", lambda _: lambda f: f)  # py3.4+

        @wraps(func)
        def _wrapper(self, *args, **kwargs):
            dataframe = func(self, *args, **kwargs)
            if self.__class__ != SourcedDataFrame \
                    and isinstance(self, SourcedDataFrame) \
                    and isinstance(dataframe, DataFrame):
                return self.__class__(dataframe._jdf, self._session, self._implicits)
            return dataframe

        return _wrapper
42285
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new MethodDescriptorProto();
			case 1:
				return new MethodDescriptorProto(func_get_arg(0));
			case 2:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1));
			case 3:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new MethodDescriptorProto(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
432682
def _CreateMethod(self, method_name):
    
    soap_service_method = self.zeep_client.service[method_name]

    def MakeSoapRequest(*args):
      AddToUtilityRegistry('zeep')
      soap_headers = self._GetZeepFormattedSOAPHeaders()
      packed_args = self._PackArguments(method_name, args)
      try:
        return soap_service_method(
            *packed_args, _soapheaders=soap_headers)['body']['rval']
      except zeep.exceptions.Fault as e:
        error_list = ()
        if e.detail is not None:
          underlying_exception = e.detail.find(
              '{%s}ApiExceptionFault' % self._GetBindingNamespace())
          fault_type = self.zeep_client.get_element(
              '{%s}ApiExceptionFault' % self._GetBindingNamespace())
          fault = fault_type.parse(
              underlying_exception, self.zeep_client.wsdl.types)
          error_list = fault.errors or error_list
        raise googleads.errors.GoogleAdsServerFault(
            e.detail, errors=error_list, message=e.message)
    return MakeSoapRequest
826798
public static MethodAnnotation fromMethodDescriptor(MethodDescriptor methodDescriptor) {
        return fromForeignMethod(methodDescriptor.getSlashedClassName(), methodDescriptor.getName(),
                methodDescriptor.getSignature(), methodDescriptor.isStatic());
    }
1339388
def create_casting_method(op, klass):
    
    # This function will become the actual method.

    def new_method(self, op=op):
        if not check_special_methods():
            raise NotImplementedError(
                'Special method %s called on %s, but special methods have been disabled. Set pymc.special_methods_available to True to enable them.' %
                (op_name, str(self)))
        return op(self.value)
    # Make the function into a method for klass.
    new_method.__name__ = '__' + op.__name__ + '__'
    setattr(
        klass,
        new_method.__name__,
        UnboundMethodType(
            new_method,
            None,
            klass))
804118
def _get_a_code_object_from( thing ) :
    '''
    
    '''
    # If we were passed a Method wrapper, get its function
    if isinstance( thing, types.MethodType ) :
        thing = thing.__func__
    # If we were passed a property object, get its getter function
    # (no direct support for the fdel or fset functions)
    if hasattr( thing, 'fget' ) :
        thing = thing.fget
    # If we were passed, or now have, a function, get its code object.
    if isinstance( thing, types.FunctionType ) :
        thing = thing.__code__
    # We should now have a code object, or will never have it.
    return thing
353182
def from_code(cls, code: int) -> 'ColorCode':
        
        c = cls()
        c._init_code(code)
        return c
723006
function NextTick(method) {
      return function (target, key, descriptor) {
          var original = descriptor.value;
          descriptor.value = function emitter() {
              var args = [];
              for (var _i = 0; _i < arguments.length; _i++) {
                  args[_i] = arguments[_i];
              }
              if (original.apply(this, args) !== false)
                  if (typeof this[method] === 'function') {
                      this.$nextTick(this[method]);
                  }
                  else {
                      throw new TypeError('must be a method name');
                  }
          };
      };
  }
1299139
function createMethod(name, fn) {
        return function () {
          var self = this, tmp = self._super, ret;

          self._super = _super[name];
          ret = fn.apply(self, arguments);
          self._super = tmp;

          return ret;
        };
      }
67293
def attribute(name, type)
      new_attribute = Attribute.new(name, type)

      attributes << new_attribute

      define_method(name) do
        self.class.attributes.find(name).value(self)
      end
      alias_method "#{name}?", name if type == Boolean

      new_attribute
    end
1328722
def add_method(self, m, **kwargs):
        
        if isinstance(m, types.FunctionType):
            self['function', id(m)] = m
        else:
            f, obj = get_method_vars(m)
            wrkey = (f, id(obj))
            self[wrkey] = obj
1122395
def add_properties(self, names, methods):
        
        cls = type(self)
        cls = type(cls.__name__, (cls,), dict(cls.__dict__))
        if isinstance(names, string_types):
            names = [names]
            methods = [methods]
        for name,method in zip(names, methods):
            setattr(cls, name, property(method))
        return self.view(type=cls)