Adds all of a module's public instance methods as Less functions
427325
def extend_js(mod)
      extend mod
      mod.public_instance_methods.each do |method_name|
        add_function(sym_to_css(method_name)) { |tree, cxt|
          send method_name.to_sym, unquote(cxt.toCSS())
        }
      end
    end
879349
function normalizeModules(modules) {
    var normalized = {};

    Object.keys(modules).forEach(function (key) {
        var module = modules[key];

        // make sure each vuex module has all keys defined
        normalized[key] = {
            actions: module.actions || {},
            getters: module.getters || {},
            modules: module.modules ? normalizeModules(module.modules) : {},
            mutations: module.mutations || {},
            namespaced: module.namespaced || false,
            state: {}
        };

        // make sure our state is a fresh object
        if (typeof module.state === 'function') {
            normalized[key].state = module.state();
        } else if (_typeof(module.state) === 'object') {
            normalized[key].state = JSON.parse(JSON.stringify(module.state));
        }
    });

    return normalized;
}
1039956
function finalizeMixinMerge(classDef) {
  const propNames = Object.keys(classDef.properties || {});
  propNames.forEach((name) => {
    if (classDef['__' + name]) {

      // NOTE: Modes are currently applied to properties, but we do not yet support OVERWRITE mode.
      const setters = Util.sortBy(classDef['__' + name].filter(def => def.set), (setter) => {
        switch (setter.mode) {
          case registerComponent.MODES.BEFORE:
            return 1;
          case registerComponent.MODES.AFTER:
            return 3;
          default:
            return 2;
        }
      });
      classDef['__set_' + name] = setters.map(setter => setter.set);
    }
  });

  const methodNames = Object.keys(classDef.methods || {});

  methodNames.forEach((methodName) => {
    const methodDef = classDef.methods[methodName];
    let methodList = [
      ...methodDef.methodsBefore,
      ...methodDef.methodsMiddle,
      ...methodDef.methodsAfter,
      ...methodDef.methodLast,
    ];
    if (methodDef.lock) methodList = [methodDef.lock, ...methodDef.methodLast];

    // For each method, either set the method to be the function, or set it to be the
    // getTheMethod function which assembles all of the conditionals and mixins into a single function.
    if (methodList.length === 1 && !methodDef.conditional.length) {
      classDef.methods[methodName] = methodList[0];
    } else {
      classDef['__method_' + methodName] = methodList;
      classDef.methods[methodName] = getTheMethod(classDef, methodDef.conditional, classDef['__method_' + methodName]);
    }
  });
}
654937
function methodsAPIObject(vueObj) {
  const methodsArr = vueObj["methods"] || []
  let methods = []
  
  // construct array of objects for public methods
  methodsArr.forEach((method) => {
    const ele = {
      "name": `${method["name"]}`,
      "parameters": `${method["params"].reduce((paramList, param) => {
          paramList += `${param["name"]}: ${param["type"]["name"]} - ${param["description"]}\n`
          return paramList
      }, '')}`,
      "description": `${method["description"] || 'MISSING DESCRIPTION'}`
    }
    methods.push(ele)
  })
  return methods.length > 0 ? {methods} : null
}
1237562
function addSourceMethods() {
        $methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
        $methods = $this->sourceClassReflection->getMethods();
        foreach ($methods as $sourceMethod) {
            
            if ($sourceMethod->getName() === '__construct') {
                continue;
            }
            
            $methodBindingToApply = null;
            foreach ($methodBindingArray as $methodBinding) {
                if ($methodBinding->matchesMethod($sourceMethod->getName()) ) {
                    $methodBindingToApply = $methodBinding;
                    break;
                }
            }

            if ($methodBindingToApply != null) {
                $decoratorMethod = $methodBindingToApply->getMethod();
                $decoratorMethodReflection = $this->decoratorReflection->getMethod($decoratorMethod);
                $this->addDecoratedMethod($sourceMethod, $decoratorMethodReflection);
            }
            else {
                $this->addPlainMethod($sourceMethod);
            }
        }
    }
237148
def method_missing(method, *args, &block)
      const_methods = @constructor.class.instance_methods(false)
      if const_methods.include? method
        return @constructor.send(method, *args, &block)
      else
        super
      end
    end
1011159
def _add_common_methods(name, element_method, opts)
      default_method = opts.delete(:default_method)
      presence_method = opts.delete(:presence_method) || :present?

      define_method(name) do
        return default_method.call(name, self) if default_method.is_a?(Proc)

        default_method.nil? ? send(element_method) : send(element_method).send(default_method)
      end

      define_method("#{name}?") do
        return presence_method.call(name, self) if presence_method.is_a?(Proc)

        send(element_method).send(presence_method)
      end
    end
537763
function() {
    var objKeys = []
    var self = this

    this.use(function() {
      // get all current property names
      objKeys = Object.keys(this)
    }, 90)

    this.on('finished', function() {
      // an now search for new ones ==> instance methods for our new model class

      Object.keys(self).forEach(function(name) {
        if (objKeys.indexOf(name) === -1) {
          self.instanceMethods[name] = self[name]
          delete self[name]
        }
      })
    })
  }
946305
function getTheMethod(classDef, conditionals, methods) {
  return function runMixinMethods(...args) {
    let result;
    for (let i = 0; i < conditionals.length; i++) {
      if (!conditionals[i].apply(this, args)) return;
    }

    methods.forEach(function runMixinMethodsIterator(method) {
      const resultTmp = method.apply(this, args);
      if (resultTmp !== undefined) result = resultTmp;
    }, this);
    return result;
  };
}
715695
def reduce(function, initval=None):
	
	if initval is None:
		return lambda s: __builtin__.reduce(function, s)
	else:
		return lambda s: __builtin__.reduce(function, s, initval)
883920
def _add_numeric_methods_add_sub_disabled(cls):
        
        cls.__add__ = make_invalid_op('__add__')
        cls.__radd__ = make_invalid_op('__radd__')
        cls.__iadd__ = make_invalid_op('__iadd__')
        cls.__sub__ = make_invalid_op('__sub__')
        cls.__rsub__ = make_invalid_op('__rsub__')
        cls.__isub__ = make_invalid_op('__isub__')
21623
function () {
            var emptyFunction = new RegExp(/(\{\s\})|(\{\})/),
                publicMethods = {};
            for (property in this.settings) {
                if (typeof this.settings[property] == 'function' &&
                    typeof this[property] == 'function') {
                    var method = this.settings[property];
                    if (emptyFunction.test(method)) {
                        publicMethods[property] = this[property];
                    } else {
                        var defaultMethodName = this.createDefaultMethodName(property);
                        publicMethods[property] = this.settings[property];
                        publicMethods[defaultMethodName] = this[property];
                    }
                }
            }

            publicMethods.stylings = this.stylings;

            return publicMethods;
        }
869546
def add_functions(spec_dict: Mapping[str, Any]) -> Mapping[str, Any]:
    

    # Class 'Mapping' does not define '__setitem__', so the '[]' operator cannot be used on its instances
    spec_dict["functions"]["list"] = []
    spec_dict["functions"]["list_long"] = []
    spec_dict["functions"]["list_short"] = []

    spec_dict["functions"]["primary"] = {}
    spec_dict["functions"]["primary"]["list_long"] = []
    spec_dict["functions"]["primary"]["list_short"] = []

    spec_dict["functions"]["modifier"] = {}
    spec_dict["functions"]["modifier"]["list_long"] = []
    spec_dict["functions"]["modifier"]["list_short"] = []

    spec_dict["functions"]["to_short"] = {}
    spec_dict["functions"]["to_long"] = {}

    for func_name in spec_dict["functions"]["info"]:

        abbreviated_name = spec_dict["functions"]["info"][func_name]["abbreviation"]

        spec_dict["functions"]["list"].extend((func_name, abbreviated_name))

        spec_dict["functions"]["list_long"].append(func_name)
        spec_dict["functions"]["list_short"].append(abbreviated_name)

        if spec_dict["functions"]["info"][func_name]["type"] == "primary":
            spec_dict["functions"]["primary"]["list_long"].append(func_name)
            spec_dict["functions"]["primary"]["list_short"].append(abbreviated_name)
        else:
            spec_dict["functions"]["modifier"]["list_long"].append(func_name)
            spec_dict["functions"]["modifier"]["list_short"].append(abbreviated_name)

        spec_dict["functions"]["to_short"][abbreviated_name] = abbreviated_name
        spec_dict["functions"]["to_short"][func_name] = abbreviated_name

        spec_dict["functions"]["to_long"][abbreviated_name] = func_name
        spec_dict["functions"]["to_long"][func_name] = func_name

    return spec_dict
1136661
def _add_public_adder(self):
        
        def add_child(obj):
            private_add_method = getattr(obj, self._add_method_name)
            child = private_add_method()
            return child

        add_child.__doc__ = (
            'Add a new ``<%s>`` child element unconditionally, inserted in t'
            'he correct sequence.' % self._nsptagname
        )
        self._add_to_class(self._public_add_method_name, add_child)
1263396
def _convert(cls, name, module, filter, source=None):
    
    # convert all constants from source (or module) that pass filter() to
    # a new Enum called name, and export the enum and its members back to
    # module;
    # also, replace the __reduce_ex__ method so unpickling works in
    # previous Python versions
    module_globals = vars(_sys.modules[module])
    if source:
        source = vars(source)
    else:
        source = module_globals
    members = dict((name, value) for name, value in source.items() if filter(name))
    cls = cls(name, members, module=module)
    cls.__reduce_ex__ = _reduce_ex_by_name
    module_globals.update(cls.__members__)
    module_globals[name] = cls
    return cls
111049
function makeModuleKeys(moduleIdentifier) {
  // Allocate a public/private key pair.
  function privateKey(fun) {
    const previous = hidden;

    hidden = privateKey;
    try {
      return fun();
    } finally {
      hidden = previous;
    }
  }
  function publicKey() {
    return hidden === privateKey;
  }
  publicKeys.add(publicKey);

  // Allow a private key to be used in lieu of the pair.
  defineProperty(
    privateKey, 'publicKey', { value: publicKey, enumerable: true });

  // We attach a module identifier to the public key to enable
  // whitelisting based on strings in a configuration without having
  // to load modules before storing their public key in a set.
  defineProperties(
    publicKey,
    {
      moduleIdentifier: { value: `${ moduleIdentifier }`, enumerable: true },
      call: { value: fCall, enumerable: true },
      apply: { value: fApply, enumerable: true },
    });

  /**
   * Wraps a value in a box so that only an approved
   * opener may unbox it.
   *
   * @param {*} value the value that will be given to
   *    an approved unboxer.
   * @param {!function(function():boolean):boolean} mayOpen
   *    receives the public key of the opener.
   *    Should return `true` to allow.
   *    This will be called in the context of the opener's
   *    private key, so the public key should also return true
   *    called with no arguments.
   * @return {!Box} a box that is opaque to any receivers that cannot
   *    unbox it.
   */
  function box(value, mayOpen) {
    if (typeof mayOpen !== 'function') {
      throw new TypeError(`Expected function not ${ mayOpen }`);
    }
    // Allocate an opaque token
    const newBox = new Box();
    boxes.set(
      newBox,
      freeze({ boxerPriv: privateKey, boxerPub: publicKey, value, mayOpen }));
    return newBox;
  }

  /**
   * Tries to open a box.
   *
   * @param {*} box the box to unbox.
   * @param {?function(function():boolean):boolean} ifFrom
   *    if the box may be opened by this unboxer's owner,
   *    then ifFrom receives the publicKey of the box creator.
   *    It should return true to allow unboxing to proceed.
   * @param {*} fallback a value to substitute if unboxing failed.
   *    Defaults to undefined.
   * @return {*} the value if unboxing is allowed or fallback otherwise.
   */
  function unbox(box, ifFrom, fallback) { // eslint-disable-line no-shadow
    if (ifFrom == null) { // eslint-disable-line
      ifFrom = () => true;
    }
    if (typeof ifFrom !== 'function') {
      throw new TypeError(`Expected function not ${ ifFrom }`);
    }
    const boxData = boxes.get(box);
    if (!boxData) {
      return fallback;
    }
    const { boxerPriv, boxerPub, value, mayOpen } = boxData;
    // Require mutual consent
    // TODO: Is this the object identity equivalent of an
    // out-of-order verify/decrypt fault?
    // http://world.std.com/~dtd/sign_encrypt/sign_encrypt7.html
    return (privateKey(() => mayOpen(publicKey)) === true &&
            boxerPriv(() => ifFrom(boxerPub)) === true) ?
      value :
      fallback;
  }

  const neverBoxed = {};
  /**
   * Like unbox but raises an exception if unboxing fails.
   * @param {*} box the box to unbox.
   * @param {?function(function():boolean):boolean} ifFrom
   *    if the box may be opened by this unboxer's owner,
   *    then ifFrom receives the publicKey of the box creator.
   *    It should return true to allow unboxing to proceed.
   * @return {*} the value if unboxing is allowed or fallback otherwise.
   */
  function unboxStrict(box, ifFrom) { // eslint-disable-line no-shadow
    const result = unbox(box, ifFrom, neverBoxed);
    if (result === neverBoxed) {
      throw new Error('Could not unbox');
    }
    return result;
  }

  return defineProperties(
    create(null),
    {
      // These close over private keys, so do not leak them.
      box: { value: box, enumerable: true },
      unbox: { value: unbox, enumerable: true },
      unboxStrict: { value: unboxStrict, enumerable: true },
      privateKey: { value: privateKey, enumerable: true },
      isPublicKey: { value: isPublicKey, enumerable: true },

      // Modules may allow access to this, perhaps via module object.
      // See cjs/index.js.
      publicKey: { value: publicKey, enumerable: true },
      [publicKeySymbol]: { value: publicKey, enumerable: true },
    });
}
1273266
def _make_methods():
    ""
    for k, v in PokeAPI().get_endpoints().items():
        string = "\t@BaseAPI._memoize\n"
        string += ("\tdef get_{0}(self, id_or_name='', limit=None,"
                   .format(k.replace('-', '_')) + ' offset=None):\n')
        string += ("\t\tparams = self._parse_params(locals().copy(), " +
                   "['id_or_name'])\n")
        string += "\t\tquery_string = '{0}/'\n".format(v.split('/')[-2])
        string += "\t\tquery_string += str(id_or_name) + '?'\n"
        string += '\t\tquery_string += params\n'
        string += '\t\treturn self._get(query_string)\n'
        print(string)