query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
USAGE: color-lighten(@neutral, 50);
[ "function getColorLightenFunction(less) {\n\n function rgba() {\n var rgbaFunc = less.functions.functionRegistry.get(\"rgba\");\n return rgbaFunc.apply(null, arguments);\n }\n\n return function (color, amount) {\n var baseRGB = [255, 255, 255];\n var value = amount.value / 100;\n\n if (value < 0) {\n baseRGB = [0, 0, 0];\n value = -1 * value;\n }\n\n return rgba(\n Math.round((baseRGB[0] - color.rgb[0]) * value) + color.rgb[0],\n Math.round((baseRGB[1] - color.rgb[1]) * value) + color.rgb[1],\n Math.round((baseRGB[2] - color.rgb[2]) * value) + color.rgb[2],\n color.alpha\n );\n };\n}" ]
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD CAP\n}" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Return a label to display for a field
[ "def get_field_label(self, field_name, field=None):\n \n label = None\n if field is not None:\n label = getattr(field, 'verbose_name', None)\n if label is None:\n label = getattr(field, 'name', None)\n if label is None:\n label = field_name\n return label.capitalize()" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated document for the core of the topic search\n return schema" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param MockConfig $expectation @return bool
[ "private function isExpectedScenarioState(MockConfig $expectation)\n {\n if ($expectation->getRequest()->hasScenarioState()) {\n $this->checkScenarioNameOrThrowException($expectation);\n $this->logger->debug('Checking scenario state again expectation');\n $scenarioState = $this->scenarioStorage->getScenarioState(\n $expectation->getScenarioName()\n );\n if (!$expectation->getRequest()->getScenarioState()->equals($scenarioState)) {\n return false;\n }\n }\n\n return true;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Block Record @alias module:wallet.BlockRecord @constructor @param {Hash} hash @param {Number} height @param {Number} time
[ "function BlockRecord(hash, height, time) {\n if (!(this instanceof BlockRecord))\n return new BlockRecord(hash, height, time);\n\n this.hash = hash || encoding.NULL_HASH;\n this.height = height != null ? height : -1;\n this.time = time || 0;\n this.hashes = [];\n this.index = new Set();\n}" ]
[ "function (state) {\n // console.log(JSON.stringify(state, false, 2));\n let env = state.pointers[state.head];\n let specific = '';\n let faked = '';\n\n if(env.type === 'internal') {\n let dHeight = env.meta.height - env.forkRoot;\n specific = `fork root: ${env.forkRoot}\nheight: +${dHeight} ${env.devmode?'(dev)':''}`;\n faked = `faked accounts:\n${env.fakedOwnership.join('\\n')}\\n`;\n } else {\n specific = `type: ${env.type}\nuri: ${env.network.host}:${env.network.port}`;\n }\n\n let context = _.map(env.env, (e, name) => `${e.type} ${name} = ${e.value}`)\n .join('\\n');\n\n return `Chain: ${state.head}\n\n${specific}\n\ndefault account:\n${env.defaultAccount}\n\n${faked}\nContext:\n${context}\n\n`;\n// ${JSON.stringify(env, false, 2)}\n\n\n// pending transactions: (TODO)\n// 1. 0x0123..df: 0xfdbc..10 -.> 0xf31c..34\n// 2. ...\n// 3. <TX_HASH>: <FROM> --> [ <TO> ]\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Blockchain:" }
Utility function for raising a werkzeug.exceptions.NotFound execption with the supplied WSGI environment and message. :param dict environ: The WSGI environment dictionary for the request :param str msg: The error message
[ "def raise_not_found(self, environ, msg):\n \n raise NotFound(response=self.rewriterapp._error_response(environ, msg))" ]
[ "def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in most cases app just not instantiated yet\n # and we cannot locate it\n raise RuntimeError(\n 'Flask application not registered on Redis instance '\n 'and no applcation bound to current context')" ]
codesearchnet
{ "query": "Represent the instruction about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code:" }
Parses samples, specified in either a manifest or listed with --samples :param str path_to_manifest: Path to configuration file :return: Samples and their attributes as defined in the manifest :rtype: list[list]
[ "def parse_manifest(path_to_manifest):\n \n samples = []\n with open(path_to_manifest, 'r') as f:\n for line in f.readlines():\n if not line.isspace() and not line.startswith('#'):\n sample = line.strip().split('\\t')\n require(len(sample) == 3, 'Bad manifest format! '\n 'Expected 3 tab separated columns, got: {}'.format(sample))\n uuid, normal, tumor = sample\n for url in [normal, tumor]:\n require(urlparse(url).scheme and urlparse(url), 'Invalid URL passed for {}'.format(url))\n samples.append(sample)\n return samples" ]
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys expected by the\n # objective function\n return objective.run(raw_output, output_files, threads)\n end" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Document height @method docHeight @return {Number} The current height of the document.
[ "function(node) {\n var h = Y_DOM._getDocSize(node).height;\n return Math.max(h, Y_DOM._getWinSize(node).height);\n }" ]
[ "function get_margin_width()\n {\n //ignore image width, use same width as on predefined bullet ListBullet\n //for proper alignment of bullet image and text. Allow image to not fitting on left border.\n //This controls the extra indentation of text to make room for the bullet image.\n //Here use actual image size, not predefined bullet size\n //return $this->_frame->get_style()->get_font_size()*ListBullet::BULLET_SIZE +\n // 2 * ListBullet::BULLET_PADDING;\n\n // Small hack to prevent indenting of list text\n // Image Might not exist, then position like on list_bullet_frame_decorator fallback to none.\n if ($this->_frame->get_style()->list_style_position === \"outside\" || $this->_width == 0) {\n return 0;\n }\n //This aligns the \"inside\" image position with the text.\n //The text starts to the right of the image.\n //Between the image and the text there is an added margin of image width.\n //Where this comes from is unknown.\n //The corresponding ListBullet sets a smaller margin. bullet size?\n return $this->_width + 2 * ListBullet::BULLET_PADDING;\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetKeyId sets the KeyId field's value.
[ "func (s *StreamDescription) SetKeyId(v string) *StreamDescription {\n\ts.KeyId = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadContext\n // in order to re-establish the thread context based on the metadata identity if not defaulted.\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
A JSON serializable dict representation of self.
[ "def as_dict(self):\n \n return {\"@module\": self.__class__.__module__,\n \"@class\": self.__class__.__name__,\n \"operation\": self.operation, \"title\": self.title,\n \"xc\": self.xc.as_dict(), \"basis_set\": self.basis_set.as_dict(),\n \"units\": self.units.as_dict(), \"scf\": self.scf.as_dict(),\n \"geo\": self.geo.as_dict(),\n \"others\": [k.as_dict() for k in self.other_directives]}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Приводит в порядок порядковые номера материалов раздела: удаляет дубликаты, дыры в нумерации. @internal @return void
[ "public function fixMaterialTags() {\n \t$r = self::getDbConnection()->fetchAll('SELECT count(tag) as cnt from '.$this->materialsTable.' where idcat='.$this->prototype->id.' group by tag having cnt>1');\n \tif (!count($r)) return;\n \t$i = 100;\n \t$r = self::getDbConnection()->query('SELECT id FROM '.$this->materialsTable.' WHERE idcat='.$this->prototype->id.' ORDER BY tag');\n \twhile ($f = $r->fetch()) {\n self::getDbConnection()->executeQuery('UPDATE '.$this->materialsTable.' SET tag='.$i.' WHERE id='.$f['id']);\n\t\t\t$i = $i + 100;\n\t\t}\n }" ]
[ "private function processA(array $result) {\n\t\ttry {\n\t\t\t$result = $this->processI($result);\n\t\t}\n\t\t/**\n\t\t * 2016-08-02\n\t\t * Исключительная ситуация может быть не только типа @see \\Df\\Core\\Exception,\n\t\t * но и типа @see \\Exception,\n\t\t * потому что чтение некорректных данных может приводить к побочным сбоям.\n\t\t * В частности, @uses \\Df\\Config\\A::get()\n\t\t * вызывает у объектов метод @see \\Df\\Config\\ArrayItem::getId(),\n\t\t * который может приводить к сбою при некорректности данных.\n\t\t */\n\t\tcatch (\\Exception $e) {\n\t\t\t/**\n\t\t\t * 2016-08-02\n\t\t\t * Если некорректость данных обнаружена при их сохранении,\n\t\t\t * то там удобнее возбудить исключительную ситуацию,\n\t\t\t * чтобы администратор магазина увидел диагностическое сообщение на экране.\n\t\t\t * Далее администратор может скорректировать данные посредством интерфейса.\n\t\t\t *\n\t\t\t * Если же некорректость данных обнаружена при их загрузке,\n\t\t\t * то это значит, что некорректные данные находятся в базе данных,\n\t\t\t * и администратор всё равно не сможет скорректировать их посредством интерфейса.\n\t\t\t * Поэтому вместо возбуждения исключительной ситуации просто сбрасываем данные.\n\t\t\t *\n\t\t\t * Некорректость данных при их загрузке возможна, например,\n\t\t\t * если поменялся формат данных в ещё разрабатываемом модуле:\n\t\t\t * тогда нам вместо конквертации данных проще их сбросить,\n\t\t\t * чтобы не сопровождать код по такой конвертации,\n\t\t\t * который с релизом модуля больше никогда не понадобится.\n\t\t\t */\n\t\t\tif ($this->isSaving()) {\n\t\t\t\tthrow $e;\n\t\t\t}\n\t\t\t$result = [];\n\t\t\t//df_cfg_delete($this->getPath());\n\t\t\t//df_cfg_save($this->getPath(), null, );\n\t\t\tdf_log($e);\n\t\t\tdf_message_error(__(\n\t\t\t\t\"The store's database contains incorrect data for the «<b>%1</b>» option.\"\n\t\t\t\t.\"<br/>The data for this options are reset.\", $this->label()\n\t\t\t));\n\t\t}\n\t\treturn $result;\n\t}" ]
codesearchnet
{ "query": "Represent the sentence about software development:", "pos": "Represent the code about software development:", "neg": "Represent the code about Programming:" }
@param string|string[] $question @param string[] $choices @param string $default @param InputInterface $input @param OutputInterface $output @return string|null
[ "private function choice($question, array $choices, $default, InputInterface $input, OutputInterface $output)\n {\n $helper = new QuestionHelper();\n\n $result = $helper->ask($input, $output, new ChoiceQuestion(\n $question,\n $choices,\n $choices[$default]\n ));\n\n $output->writeln('');\n\n return $result;\n }" ]
[ "public static function ExpectRetrievedValueIsArray(\n string $property,\n $value,\n string $class_name\n ) : array {\n /**\n * @psalm-var T\n */\n $value = static::MaybeThrowIfNotType($property, $value, $class_name, 'array');\n\n return $value;\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
/*! Returns the meta data used for storing search indeces.
[ "function metaData( $contentObjectAttribute )\n {\n $matrix = $contentObjectAttribute->content();\n $columnsArray = $matrix->attribute( 'columns' );\n $columns = $columnsArray['sequential'];\n $metaDataArray = array();\n foreach ( $columns as $column )\n {\n $rows = $column['rows'];\n foreach ( $rows as $row )\n {\n $metaDataArray[] = array( 'id' => $column['identifier'],\n 'text' => $row );\n }\n }\n return $metaDataArray;\n }" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated document for the core of the topic search\n return schema" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
PersistenceDelegate.initialize()
[ "protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out)\n {\n //\n // Get the bean and associated beanInfo for the source instance\n //\n ControlBean control = (ControlBean)oldInstance;\n BeanInfo beanInfo;\n try\n {\n beanInfo = Introspector.getBeanInfo(control.getClass());\n }\n catch (IntrospectionException ie)\n {\n throw new ControlException(\"Unable to locate BeanInfo\", ie);\n }\n\n //\n // Cast the encoding stream to an XMLEncoder (only encoding supported) and then set\n // the stream owner to the bean being persisted\n //\n XMLEncoder xmlOut = (XMLEncoder)out;\n Object owner = xmlOut.getOwner();\n xmlOut.setOwner(control);\n try\n {\n\n //\n // The default implementation of property persistence will use BeanInfo to \n // incrementally compare oldInstance property values to newInstance property values. \n // Because the bean instance PropertyMap holds only the values that have been \n // modified, this process can be optimized by directly writing out only the properties \n // found in the map.\n //\n BeanPropertyMap beanMap = control.getPropertyMap();\n PropertyDescriptor [] propDescriptors = beanInfo.getPropertyDescriptors();\n for (PropertyKey pk : beanMap.getPropertyKeys())\n {\n //\n // Locate the PropertyDescriptor for the modified property, and use it to write\n // the property value to the encoder stream\n //\n String propName = pk.getPropertyName();\n boolean found = false;\n for (int i = 0; i < propDescriptors.length; i++)\n {\n if (propName.equals(propDescriptors[i].getName()))\n {\n found = true;\n\n // Only write the property if it is not flagged as transient\n Object transientVal = propDescriptors[i].getValue(\"transient\");\n if (transientVal == null || transientVal.equals(Boolean.FALSE))\n {\n xmlOut.writeStatement(\n new Statement(oldInstance, \n propDescriptors[i].getWriteMethod().getName(),\n new Object [] {beanMap.getProperty(pk)}));\n }\n }\n }\n if (found == false)\n {\n throw new ControlException(\"Unknown property in bean PropertyMap: \" + pk);\n }\n }\n\n //\n // Get the bean context associated with the bean, and persist any nested controls\n //\n ControlBeanContext cbc = control.getControlBeanContext();\n if (cbc.size() != 0)\n {\n xmlOut.setPersistenceDelegate(ControlBeanContext.class, \n new ContextPersistenceDelegate());\n\n Iterator nestedIter = cbc.iterator();\n while (nestedIter.hasNext())\n {\n Object bean = nestedIter.next();\n if (bean instanceof ControlBean)\n {\n xmlOut.writeStatement(\n new Statement(cbc, \"add\", new Object [] { bean } ));\n }\n }\n }\n\n //\n // Restore any listeners associated with the control\n //\n EventSetDescriptor [] eventSetDescriptors = beanInfo.getEventSetDescriptors();\n for (int i = 0; i < eventSetDescriptors.length; i++)\n {\n EventSetDescriptor esd = eventSetDescriptors[i];\n Method listenersMethod = esd.getGetListenerMethod();\n String addListenerName = esd.getAddListenerMethod().getName();\n if (listenersMethod != null)\n {\n //\n // Get the list of listeners, and then add statements to incrementally\n // add them in the same order\n //\n try\n {\n Object [] lstnrs = (Object [])listenersMethod.invoke(control, \n new Object []{});\n for (int j = 0; j < lstnrs.length; j++)\n {\n //\n // If this is a generated EventAdaptor class, then set the delegate\n // explicitly\n //\n if (lstnrs[j] instanceof EventAdaptor)\n xmlOut.setPersistenceDelegate(lstnrs[j].getClass(), \n new AdaptorPersistenceDelegate());\n xmlOut.writeStatement(\n new Statement(control, addListenerName, new Object [] {lstnrs[j]}));\n }\n }\n catch (Exception iae)\n {\n throw new ControlException(\"Unable to initialize listeners\", iae);\n } \n }\n }\n\n //\n // See if the control holds an implementation instance, if so, we need to include\n // it (and any nested controls or state) in the encoding stream\n //\n Object impl = control.getImplementation();\n if (impl != null)\n {\n\n //\n // Set the persistence delegate for the impl class to the Impl delegate,\n // set the current stream owner to the bean, and then write the implementation\n //\n Class implClass = impl.getClass(); \n if (xmlOut.getPersistenceDelegate(implClass) instanceof DefaultPersistenceDelegate) \n xmlOut.setPersistenceDelegate(implClass, new ImplPersistenceDelegate());\n\n //\n // HACK: This bit of hackery pushes the impl into the persistence stream\n // w/out actually requiring it be used as an argument elsewhere, since there\n // is no public API on the bean that takes an impl instance as an argument.\n //\n xmlOut.writeStatement(\n new Statement(impl, \"toString\", null));\n }\n }\n finally\n {\n // Restore the previous encoding stream owner\n xmlOut.setOwner(owner);\n }\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
This preInvoke is called during init & during destroy of a Servlet class object. It will call the other preInvoke to ensure delegation occurs. {@inheritDoc}
[ "@Override\n public Object preInvoke(String servletName) throws SecurityViolationException, IOException {\n // preInvoke will ensure delegation is done when run-as is specified\n return preInvoke(null, null, servletName, true);\n }" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadContext\n // in order to re-establish the thread context based on the metadata identity if not defaulted.\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// ItemByID by returns the file's Item of a given ID. // If the ID is known, the returned error is ErrUnknownItem.
[ "func (f *File) ItemByID(id uint32) (*Item, error) {\n\tmeta, err := f.getMeta()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tit := &Item{\n\t\tf: f,\n\t\tID: id,\n\t}\n\tif meta.ItemLocation != nil {\n\t\tfor _, ilbe := range meta.ItemLocation.Items {\n\t\t\tif uint32(ilbe.ItemID) == id {\n\t\t\t\tshallowCopy := ilbe\n\t\t\t\tit.Location = &shallowCopy\n\t\t\t}\n\t\t}\n\t}\n\tif meta.ItemInfo != nil {\n\t\tfor _, iie := range meta.ItemInfo.ItemInfos {\n\t\t\tif uint32(iie.ItemID) == id {\n\t\t\t\tit.Info = iie\n\t\t\t}\n\t\t}\n\t}\n\tif it.Info == nil {\n\t\treturn nil, ErrUnknownItem\n\t}\n\tif meta.Properties != nil {\n\t\tallProps := meta.Properties.PropertyContainer.Properties\n\t\tfor _, ipa := range meta.Properties.Associations {\n\t\t\t// TODO: I've never seen a file with more than\n\t\t\t// top-level ItemPropertyAssociation box, but\n\t\t\t// apparently they can exist with different\n\t\t\t// versions/flags. For now we just merge them\n\t\t\t// all together, but that's not really right.\n\t\t\t// So for now, just bail once a previous loop\n\t\t\t// found anything.\n\t\t\tif len(it.Properties) > 0 {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor _, ipai := range ipa.Entries {\n\t\t\t\tif ipai.ItemID != id {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, ass := range ipai.Associations {\n\t\t\t\t\tif ass.Index != 0 && int(ass.Index) <= len(allProps) {\n\t\t\t\t\t\tbox := allProps[ass.Index-1]\n\t\t\t\t\t\tboxp, err := box.Parse()\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tbox = boxp\n\t\t\t\t\t\t}\n\t\t\t\t\t\tit.Properties = append(it.Properties, box)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn it, nil\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the description about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about programming:" }
Iterates through the tasks setting the correct outline level and ID values. @param id current ID value @param task current task @param outlineLevel current outline level @return next ID value
[ "private int updateStructure(int id, Task task, Integer outlineLevel)\n {\n task.setID(Integer.valueOf(id++));\n task.setOutlineLevel(outlineLevel);\n outlineLevel = Integer.valueOf(outlineLevel.intValue() + 1);\n for (Task childTask : task.getChildTasks())\n {\n id = updateStructure(id, childTask, outlineLevel);\n }\n return id;\n }" ]
[ "function(c, i, array) {\n if (c === undefined || c === null) return;\n // c is the component, type is dimension|attribute,\n // level is dataset|series|observation, i is index,\n // array is the component array\n failed += !iterator.call(context, c, type, level, i, array);\n }" ]
codesearchnet
{ "query": "Represent the sentence about Work management:", "pos": "Represent the code about Work management:", "neg": "Represent the code about programming:" }
// Unlink removes a large object from the database.
[ "func (o *LargeObjects) Unlink(oid pgtype.OID) error {\n\t_, err := o.fp.CallFn(\"lo_unlink\", []fpArg{fpIntArg(int32(oid))})\n\treturn err\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Technology:", "pos": "Represent the Github code about Technology:", "neg": "Represent the Github code:" }
What Facebook uses to define the url in a batch
[ "@JsonProperty(\"relative_url\")\n\tpublic String getRelativeURL() {\n\t\tStringBuilder bld = new StringBuilder();\n\t\tbld.append(this.object);\n\t\t\n\t\tParam[] params = this.getParams();\n\t\t\n\t\tif (params != null && params.length > 0) {\n\t\t\tbld.append('?');\n\t\t\tboolean afterFirst = false;\n\t\t\t\n\t\t\tfor (Param param: params) {\n\t\t\t\tif (afterFirst)\n\t\t\t\t\tbld.append('&');\n\t\t\t\telse\n\t\t\t\t\tafterFirst = true;\n\t\t\t\t\n\t\t\t\tif (param instanceof BinaryParam) {\n\t\t\t\t\t//call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, \"irrelevant\");\n\t\t\t\t\tthrow new UnsupportedOperationException(\"Not quite sure what to do with BinaryParam yet\");\n\t\t\t\t} else {\n\t\t\t\t\tString paramValue = StringUtils.stringifyValue(param, this.mapper);\n\t\t\t\t\tbld.append(StringUtils.urlEncode(param.name));\n\t\t\t\t\tbld.append('=');\n\t\t\t\t\tbld.append(StringUtils.urlEncode(paramValue));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn bld.toString();\n\t}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Initialize a new storage disk.
[ "func newPosix(path string) (*posix, error) {\n\tvar err error\n\tif path, err = getValidPath(path); err != nil {\n\t\treturn nil, err\n\t}\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp := &posix{\n\t\tconnected: true,\n\t\tdiskPath: path,\n\t\t// 4MiB buffer pool for posix internal operations.\n\t\tpool: sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\tb := directio.AlignedBlock(posixWriteBlockSize)\n\t\t\t\treturn &b\n\t\t\t},\n\t\t},\n\t\tstopUsageCh: make(chan struct{}),\n\t\tdiskFileInfo: fi,\n\t\tdiskMount: mountinfo.IsLikelyMountPoint(path),\n\t}\n\n\tif !p.diskMount {\n\t\tgo p.diskUsage(GlobalServiceDoneCh)\n\t}\n\n\t// Success.\n\treturn p, nil\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true,writeDirectory);\n \n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
fast counting to the lines of a given filename through only reading out a limited buffer
[ "def countLines(filename, buf_size=1048576):\n \n f = open(filename)\n try:\n lines = 1\n read_f = f.read # loop optimization\n buf = read_f(buf_size)\n # Empty file\n if not buf:\n return 0\n while buf:\n lines += buf.count('\\n')\n buf = read_f(buf_size)\n return lines\n finally:\n f.close()" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluator polynomial, etc. but not the errors positions).\n # This is not necessary as anyway syndromes are defined such as there are only non-zero coefficients (the only 0 is the shift of the constant here) and subsequent computations will/must account for the shift by skipping the first iteration (eg, the often seen range(1, n-k+1)), but you can also avoid prepending the 0 coeff and adapt every subsequent computations to start from 0 instead of 1.\n return [0] + [gf_poly_eval(msg, gf_pow(generator, i+fcr)) for i in xrange(nsym)]" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Return the version before the given version. @param string $from
[ "public function getPreviousVersion($from)\n {\n $lastTimestamp = 0;\n foreach (array_keys($this->versions) as $timestamp) {\n if ($timestamp == $from) {\n return $lastTimestamp;\n }\n $lastTimestamp = $timestamp;\n }\n\n return 0;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public EClass getBLN() {\n\t\tif (blnEClass == null) {\n\t\t\tblnEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(324);\n\t\t}\n\t\treturn blnEClass;\n\t}" ]
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license />\n <channel />\n <extends />\n <summary />\n <description />\n <notes />\n <authors />\n <date />\n <time />\n <contents />\n <compatible />\n <dependencies />\n</package>\nEND;\n $this->_packageXml = simplexml_load_string($packageXmlStub);\n }\n return $this;\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
find files matching a shell-style pattern
[ "def runGlob(self, path, **kwargs):\n \n def commandComplete(cmd):\n return cmd.updates['files'][-1]\n\n return self.runRemoteCommand('glob', {'path': path,\n 'logEnviron': self.logEnviron, },\n evaluateCommand=commandComplete, **kwargs)" ]
[ "def _glob_to_re(self, pattern):\n \n pattern_re = fnmatch.translate(pattern)\n\n # '?' and '*' in the glob pattern become '.' and '.*' in the RE, which\n # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,\n # and by extension they shouldn't match such \"special characters\" under\n # any OS. So change all non-escaped dots in the RE to match any\n # character except the special characters (currently: just os.sep).\n sep = os.sep\n if os.sep == '\\\\':\n # we're using a regex to manipulate a regex, so we need\n # to escape the backslash twice\n sep = r'\\\\\\\\'\n escaped = r'\\1[^%s]' % sep\n pattern_re = re.sub(r'((?<!\\\\)(\\\\\\\\)*)\\.', escaped, pattern_re)\n return pattern_re" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Check if a directory should be considered in the walk.
[ "def _check_open_dir(self, fs, path, info):\n # type: (FS, Text, Info) -> bool\n \n if self.exclude_dirs is not None and fs.match(self.exclude_dirs, info.name):\n return False\n if self.filter_dirs is not None and not fs.match(self.filter_dirs, info.name):\n return False\n return self.check_open_dir(fs, path, info)" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Sets a list of observer events that will be logged if verbose output is enabled. @param string $observerEvents List of observer events
[ "public function setObserverEvents($observerEvents)\n {\n $this->observerEvents = [];\n\n $token = ' ,;';\n $ext = strtok($observerEvents, $token);\n\n while ($ext !== false) {\n $this->observerEvents[] = $ext;\n $ext = strtok($token);\n }\n }" ]
[ "function makeEventDispatcher(obj) {\n $.extend(obj, {\n on: on,\n off: off,\n one: one,\n trigger: trigger,\n _EventDispatcher: true\n });\n // Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,\n // handler:!function(!{type:string, target:!Object}, ...)}>> - map from eventName to an array\n // of handler records\n // Later, markDeprecated() may add _deprecatedEvents: Object.<string, string|boolean> - map from\n // eventName to deprecation warning info\n }" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Check if proxy is still initialized
[ "def homegearCheckInit(self, remote):\n \"\"\"\"\"\"\n rdict = self.remotes.get(remote)\n if not rdict:\n return False\n if rdict.get('type') != BACKEND_HOMEGEAR:\n return False\n try:\n interface_id = \"%s-%s\" % (self._interface_id, remote)\n return self.proxies[interface_id].clientServerInitialized(interface_id)\n except Exception as err:\n LOG.debug(\n \"ServerThread.homegearCheckInit: Exception: %s\" % str(err))\n return False" ]
[ "def verify(build)\n # TODO might as well cache this and store in the db so we dont have to\n # convert every time\n pkey = to_rsa_pkey\n signature = Base64.decode64(build.signature)\n digest = OpenSSL::Digest::SHA256.new\n\n # If the user submits html were going to expect the\n # signature to match the html they are submitting.\n # However, if the user gives a url where we can download\n # the html, we're going to expect the signature to match\n # the app name and the url.\n if build.endpoint.present?\n expected = \"#{build.app.name}-#{build.endpoint}\"\n else\n expected = build.html\n end\n\n match = expected &&\n signature &&\n pkey.verify(digest, signature, expected)\n # Bug in ruby's OpenSSL implementation.\n # SSL connection with PostgreSQL can fail, after a call to\n # OpenSSL::X509::Certificate#verify with result 'false'. Root cause is\n # the thread local error queue of OpenSSL, that is used to transmit\n # textual error messages to the application after a failed crypto\n # operation. A failure in Certificate#verify leaves some messages on the\n # error queue, which can lead to errors in a SSL communication of other\n # parts of the application. The only solution at the moment is running:\n # OpenSSL.errors.clear after certificate verifying. This clears OpenSSL\n # errors array and keeps database connection alive.\n # From https://bugs.ruby-lang.org/issues/7215\n OpenSSL.errors.clear\n match # return true/false\n end" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Job instantiates a Transfer job from the TransferConfig struct
[ "func (t *TransferConfig) Job() (*storagetransfer.TransferJob, error) {\n\tif t.DestBucket == \"\" || t.Src == nil {\n\t\treturn nil, ErrBadConfig\n\t}\n\n\t// Google returns an error if more than 20 inclusionary/exclusionary fields are included\n\tif len(t.IncludePrefixes) > MaxPrefix || len(t.ExcludePrefixes) > MaxPrefix {\n\t\treturn nil, ErrBadFilter\n\t}\n\n\tspec := t.Src.TransferSpec(t.DestBucket)\n\n\t// Set the file-filters if the conditions are met\n\tif len(t.IncludePrefixes) > 0 || len(t.ExcludePrefixes) > 0 {\n\t\tspec.ObjectConditions = &storagetransfer.ObjectConditions{\n\t\t\tExcludePrefixes: t.ExcludePrefixes,\n\t\t\tIncludePrefixes: t.IncludePrefixes,\n\t\t}\n\t}\n\n\t// if a schedule is not provided, create a 1-time transfer schedule\n\tvar schedule *storagetransfer.Schedule\n\tif t.Schedule == nil {\n\t\tschedule = oneTimeJobSchedule(time.Now())\n\t}\n\n\tdescription := fmt.Sprintf(\"%s_%s_transfer\", t.DestBucket, t.Src)\n\treturn newTransferJob(t.ProjectID, description, spec, schedule), nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Run implements Command.Run.
[ "func (c *deleteImageMetadataCommand) Run(ctx *cmd.Context) (err error) {\n\tapi, err := c.newAPIFunc()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer api.Close()\n\n\terr = api.Delete(c.ImageId)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// NewAroonOscForStream creates an Aroon Oscillator (AroonOsc) for online usage with a source data stream
[ "func NewAroonOscForStream(priceStream gotrade.DOHLCVStreamSubscriber, timePeriod int) (indicator *AroonOsc, err error) {\n\tind, err := NewAroonOsc(timePeriod)\n\tpriceStream.AddTickSubscription(ind)\n\treturn ind, err\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Retrieves additional HTML attributes as a string ready for inclusion in markup. @param array $attributes Required. @return string
[ "protected function get_html_attributes( array $attributes ) {\n\t\t$html_attributes = '';\n\t\tif ( ! empty( $attributes ) ) {\n\t\t\tforeach ( $attributes as $attr => $val ) {\n\t\t\t\t$html_attributes .= \\esc_attr( $attr ) . '=\"' . \\esc_attr( $val ) . '\" ';\n\t\t\t}\n\t\t}\n\n\t\treturn $html_attributes;\n\t}" ]
[ "public function XML_val($field, $arguments = [], $cache = false)\n {\n $result = $this->obj($field, $arguments, $cache);\n // Might contain additional formatting over ->XML(). E.g. parse shortcodes, nl2br()\n return $result->forTemplate();\n }" ]
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
// dataSourceIdentityUserV3Attributes populates the fields of an User resource.
[ "func dataSourceIdentityUserV3Attributes(d *schema.ResourceData, user *users.User) error {\n\tlog.Printf(\"[DEBUG] openstack_identity_user_v3 details: %#v\", user)\n\n\td.SetId(user.ID)\n\td.Set(\"default_project_id\", user.DefaultProjectID)\n\td.Set(\"description\", user.Description)\n\td.Set(\"domain_id\", user.DomainID)\n\td.Set(\"enabled\", user.Enabled)\n\td.Set(\"name\", user.Name)\n\td.Set(\"password_expires_at\", user.PasswordExpiresAt.Format(time.RFC3339))\n\n\treturn nil\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadContext\n // in order to re-establish the thread context based on the metadata identity if not defaulted.\n }" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Compare two paths after normalization of them. @param path1 first path for comparison @param path2 second path for comparison @return whether the two paths are equivalent after normalization
[ "public static boolean pathEquals(String path1, String path2) {\n return cleanPath(path1).equals(cleanPath(path2));\n }" ]
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the same piece\n # of memory. Just checking to be sure.\n if (self.numbers != graph.numbers).any():\n raise TypeError(\"The atomic numbers in the graph do not match the \"\n \"atomic numbers in the molecule.\")" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Marshall the given parameter object.
[ "public void marshall(TriggerUpdate triggerUpdate, ProtocolMarshaller protocolMarshaller) {\n\n if (triggerUpdate == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(triggerUpdate.getName(), NAME_BINDING);\n protocolMarshaller.marshall(triggerUpdate.getDescription(), DESCRIPTION_BINDING);\n protocolMarshaller.marshall(triggerUpdate.getSchedule(), SCHEDULE_BINDING);\n protocolMarshaller.marshall(triggerUpdate.getActions(), ACTIONS_BINDING);\n protocolMarshaller.marshall(triggerUpdate.getPredicate(), PREDICATE_BINDING);\n } catch (Exception e) {\n throw new SdkClientException(\"Unable to marshall request to JSON: \" + e.getMessage(), e);\n }\n }" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Execute this process, blocking until it has completed.
[ "public void run() throws IOException {\n if (this.isStarted() || this.isComplete()) {\n throw new IllegalStateException(\"The process can only be used once.\");\n }\n\n final ProcessBuilder builder = new ProcessBuilder(this.cmd);\n builder.directory(new File(this.workingDir));\n builder.environment().putAll(this.env);\n builder.redirectErrorStream(true);\n this.process = builder.start();\n try {\n this.processId = processId(this.process);\n if (this.processId == 0) {\n this.logger.debug(\"Spawned thread with unknown process id\");\n } else {\n this.logger.debug(\"Spawned thread with process id \" + this.processId);\n }\n\n this.startupLatch.countDown();\n\n final LogGobbler outputGobbler =\n new LogGobbler(\n new InputStreamReader(this.process.getInputStream(), StandardCharsets.UTF_8),\n this.logger, Level.INFO, 30);\n final LogGobbler errorGobbler =\n new LogGobbler(\n new InputStreamReader(this.process.getErrorStream(), StandardCharsets.UTF_8),\n this.logger, Level.ERROR, 30);\n\n outputGobbler.start();\n errorGobbler.start();\n int exitCode = -1;\n try {\n exitCode = this.process.waitFor();\n } catch (final InterruptedException e) {\n this.logger.info(\"Process interrupted. Exit code is \" + exitCode, e);\n }\n\n this.completeLatch.countDown();\n\n // try to wait for everything to get logged out before exiting\n outputGobbler.awaitCompletion(5000);\n errorGobbler.awaitCompletion(5000);\n\n if (exitCode != 0) {\n throw new ProcessFailureException(exitCode);\n }\n\n } finally {\n IOUtils.closeQuietly(this.process.getInputStream());\n IOUtils.closeQuietly(this.process.getOutputStream());\n IOUtils.closeQuietly(this.process.getErrorStream());\n }\n }" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// SelectFromStrings ...
[ "func SelectFromStrings(messageToPrint string, options []string) (string, error) {\n\treturn SelectFromStringsFromReader(messageToPrint, options, os.Stdin)\n}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// DefaultDescribeFormatOptions returns default options for formatting // the output.
[ "func DefaultDescribeFormatOptions() (DescribeFormatOptions, error) {\n\truntime.LockOSThread()\n\tdefer runtime.UnlockOSThread()\n\n\topts := C.git_describe_format_options{}\n\tecode := C.git_describe_init_format_options(&opts, C.GIT_DESCRIBE_FORMAT_OPTIONS_VERSION)\n\tif ecode < 0 {\n\t\treturn DescribeFormatOptions{}, MakeGitError(ecode)\n\t}\n\n\treturn DescribeFormatOptions{\n\t\tAbbreviatedSize: uint(opts.abbreviated_size),\n\t\tAlwaysUseLongFormat: opts.always_use_long_format == 1,\n\t}, nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Provide a human readable description for On instance. @param on - On @return human readable description - String
[ "protected String describe(final On on, final boolean and) {\n if (and) {\n return nominalValue(on.getTime());\n }\n return String.format(\"%s %s \", bundle.getString(\"at\"), nominalValue(on.getTime())) + \"%s\";\n }" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Sets the Filters. @param array|sting $filters the filters @return self
[ "public function setFilters($filters)\n {\n if (! is_array($filters))\n $filters = [$filters];\n\n $this->filters = array_unique(array_merge($this->filters, $filters));\n\n return $this;\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Writes a short in Intel byte order.
[ "static void writeShort(OutputStream out, int i) throws IOException {\n out.write((byte)i);\n out.write((byte)(i >> 8));\n }" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github comment about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
// CanRetry returns the current number of retries, and whether or not it exceeds // the maximum number of retries (see: retryCounter.MaxRetries).
[ "func (r *retryCounter) CanRetry(oid string) (int, bool) {\n\tcount := r.CountFor(oid)\n\treturn count, count < r.MaxRetries\n}" ]
[ "func (p *propertySet) setTargetAttributeWithCount(targetAttribute string, allowedCount uint64, taskGroup string) {\n\t// Store that this is for a task group\n\tif taskGroup != \"\" {\n\t\tp.taskGroup = taskGroup\n\t}\n\n\t// Store the constraint\n\tp.targetAttribute = targetAttribute\n\n\tp.allowedCount = allowedCount\n\n\t// Determine the number of existing allocations that are using a property\n\t// value\n\tp.populateExisting()\n\n\t// Populate the proposed when setting the constraint. We do this because\n\t// when detecting if we can inplace update an allocation we stage an\n\t// eviction and then select. This means the plan has an eviction before a\n\t// single select has finished.\n\tp.PopulateProposed()\n}" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Small range of hyperparameters.
[ "def slicenet_range1(ranged_hparams):\n \"\"\"\"\"\"\n rhp = ranged_hparams\n rhp.set_float(\"clip_grad_norm\", 1.0, 10.0, scale=rhp.LOG_SCALE)\n rhp.set_float(\"learning_rate\", 0.02, 1.0, scale=rhp.LOG_SCALE)\n rhp.set_float(\"optimizer_adam_beta2\", 0.995, 0.998)\n rhp.set_float(\"weight_decay\", 1.0, 5.0)" ]
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
<p> Performs pixel-wise addition<br> d(x,y) = inputA(x,y) + inputB(x,y) </p> @param inputA Input image. Not modified. @param inputB Input image. Not modified. @param output Output image. Modified.
[ "public static <T extends ImageBase<T>, O extends ImageBase>\n\tvoid add(T inputA, T inputB, O output) {\n\t\tif( inputA instanceof ImageGray) {\n\t\t\tif (GrayU8.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayU8) inputA, (GrayU8) inputB, (GrayU16) output);\n\t\t\t} else if (GrayS8.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayS8) inputA, (GrayS8) inputB, (GrayS16) output);\n\t\t\t} else if (GrayU16.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayU16) inputA, (GrayU16) inputB, (GrayS32) output);\n\t\t\t} else if (GrayS16.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayS16) inputA, (GrayS16) inputB, (GrayS32) output);\n\t\t\t} else if (GrayS32.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayS32) inputA, (GrayS32) inputB, (GrayS32) output);\n\t\t\t} else if (GrayS64.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayS64) inputA, (GrayS64) inputB, (GrayS64) output);\n\t\t\t} else if (GrayF32.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayF32) inputA, (GrayF32) inputB, (GrayF32) output);\n\t\t\t} else if (GrayF64.class == inputA.getClass()) {\n\t\t\t\tPixelMath.add((GrayF64) inputA, (GrayF64) inputB, (GrayF64) output);\n\t\t\t} else {\n\t\t\t\tthrow new IllegalArgumentException(\"Unknown image Type: \" + inputA.getClass().getSimpleName());\n\t\t\t}\n\t\t} else if (inputA instanceof Planar) {\n\t\t\tPlanar inA = (Planar)inputA;\n\t\t\tPlanar inB = (Planar)inputB;\n\t\t\tPlanar out = (Planar)output;\n\n\t\t\tfor (int i = 0; i < inA.getNumBands(); i++) {\n\t\t\t\tadd(inA.getBand(i),inB.getBand(i),out.getBand(i));\n\t\t\t}\n\t\t}\n\t}" ]
[ "public static int cudnnBatchNormalizationForwardTraining(\n cudnnHandle handle, \n int mode, \n Pointer alpha, /** alpha[0] = result blend factor */\n Pointer beta, /** beta[0] = dest layer blend factor */\n cudnnTensorDescriptor xDesc, \n Pointer x, /** NxCxHxW */\n cudnnTensorDescriptor yDesc, \n Pointer y, /** NxCxHxW */\n /**\n * <pre>\n * Shared desc for the next 6 tensors in the argument list.\n Data type to be set as follows:\n type = (typeOf(x) == double) ? double : float\n Dimensions for this descriptor depend on normalization mode\n - Spatial Normalization : tensors are expected to have dims 1xCx1x1\n (normalization is performed across NxHxW)\n - Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW\n * (normalization is performed across N)\n * </pre>\n */\n cudnnTensorDescriptor bnScaleBiasMeanVarDesc, \n /** 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */\n Pointer bnScale, \n Pointer bnBias, \n /**\n * <pre>\n * MUST use factor=1 in the very first call of a complete training cycle.\n Use a factor=1/(1+n) at N-th call to the function to get\n Cumulative Moving Average (CMA) behavior\n CMA[n] = (x[1]+...+x[n])/n\n Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =\n ((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =\n * CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1)\n * </pre>\n */\n double exponentialAverageFactor, \n /** Used in Training phase only.\n runningMean = newMean*factor + runningMean*(1-factor) */\n Pointer resultRunningMean, \n /** Output in training mode, input in inference. Is the moving average\n of variance[x] (factor is applied in the same way as for runningMean) */\n Pointer resultRunningVariance, \n /** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */\n double epsilon, \n /** Optionally save intermediate results from the forward pass here\n - can be reused to speed up backward pass. NULL if unused */\n Pointer resultSaveMean, \n Pointer resultSaveInvVariance)\n {\n return checkResult(cudnnBatchNormalizationForwardTrainingNative(handle, mode, alpha, beta, xDesc, x, yDesc, y, bnScaleBiasMeanVarDesc, bnScale, bnBias, exponentialAverageFactor, resultRunningMean, resultRunningVariance, epsilon, resultSaveMean, resultSaveInvVariance));\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
// Reblock is used to reinsert an existing blocked evaluation into the blocked // evaluation tracker.
[ "func (e *Eval) Reblock(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error {\n\tif done, err := e.srv.forward(\"Eval.Reblock\", args, args, reply); done {\n\t\treturn err\n\t}\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"eval\", \"reblock\"}, time.Now())\n\n\t// Ensure there is only a single update with token\n\tif len(args.Evals) != 1 {\n\t\treturn fmt.Errorf(\"only a single eval can be reblocked\")\n\t}\n\teval := args.Evals[0]\n\n\t// Verify the evaluation is outstanding, and that the tokens match.\n\tif err := e.srv.evalBroker.OutstandingReset(eval.ID, args.EvalToken); err != nil {\n\t\treturn err\n\t}\n\n\t// Look for the eval\n\tsnap, err := e.srv.fsm.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tws := memdb.NewWatchSet()\n\tout, err := snap.EvalByID(ws, eval.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif out == nil {\n\t\treturn fmt.Errorf(\"evaluation does not exist\")\n\t}\n\tif out.Status != structs.EvalStatusBlocked {\n\t\treturn fmt.Errorf(\"evaluation not blocked\")\n\t}\n\n\t// Reblock the eval\n\te.srv.blockedEvals.Reblock(eval, args.EvalToken)\n\treturn nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Querying related methods Looks up parent instances @returns {String} current value prepended by parents' values
[ "function () {\n var that = this,\n parentInstance = that.getParentInstance(),\n parentValue = parentInstance && parentInstance.extendedCurrentValue(),\n currentValue = $.trim(that.el.val());\n\n return utils.compact([parentValue, currentValue]).join(' ');\n }" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class converts multiple language tags into one\n // Otherwise, it assumes that a single name_ tag exists with JSON content, and it will replace\n // it with multiple tags \"name_en\", \"name_fr\", ... depending on the JSON language codes\n this.namePicker = options.namePicker;\n\n // Flag to make requested_name (local_name) form\n this.combineName = options.combineName;\n}" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Memory efficient function for loading a table from a FITS file.
[ "def create_table_from_fits(fitsfile, hduname, colnames=None):\n \"\"\"\"\"\"\n\n if colnames is None:\n return Table.read(fitsfile, hduname)\n\n cols = []\n with fits.open(fitsfile, memmap=True) as h:\n for k in colnames:\n data = h[hduname].data.field(k)\n cols += [Column(name=k, data=data)]\n return Table(cols)" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// SampleRate returns the metrics sampling rate.
[ "func (mc *MetricsConfiguration) SampleRate() float64 {\n\tif mc.SamplingRate > 0.0 && mc.SamplingRate <= 1.0 {\n\t\treturn mc.SamplingRate\n\t}\n\treturn defaultSamplingRate\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the comment about Signal Processing:", "pos": "Represent the code about Signal Processing:", "neg": "Represent the code:" }
Parses the scheme-specific portion of the URI and place its parts into instance variables. @throws Exception @return void
[ "protected function parseUri($uriString = '')\n {\n $status = @preg_match(\"~^((//)([^/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?$~\", $uriString, $matches);\n\n if($status === FALSE)\n {\n throw new Exception(\"URI scheme-specific decomposition failed\");\n }\n\n if(!$status) return;\n\n $this->path = (isset($matches[4])) ? $matches[4] : '';\n $this->query = (isset($matches[6])) ? $matches[6] : '';\n $this->fragment = (isset($matches[8])) ? $matches[8] : '';\n\n $status = @preg_match(\"~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*))?$~\", (isset($matches[3])) ? $matches[3] : \"\", $matches);\n\n if($status === FALSE)\n {\n throw new Exception(\"URI scheme-specific authority decomposition failed\");\n }\n\n if(!$status) return;\n\n $this->user = isset($matches[2]) ? $matches[2] : \"\";\n $this->pass = isset($matches[4]) ? $matches[4] : \"\";\n $this->host = isset($matches[5]) === TRUE ? preg_replace('~^\\[([^]]+)\\]$~', '\\1', $matches[5]) : \"\";\n $this->port = isset($matches[7]) ? $matches[7] : \"\";\n }" ]
[ "public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.getId());\n return originId;\n }" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Return handler to open rasters (rasterio.open).
[ "def _raster_opener(cls, filename, *args, **kwargs):\n \"\"\"\"\"\"\n with rasterio.Env(**cls.get_gdal_env(filename)):\n try:\n return rasterio.open(filename, *args, **kwargs)\n except (rasterio.errors.RasterioIOError, rasterio._err.CPLE_BaseError) as e:\n raise GeoRaster2IOError(e)" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Retrieves the page's content, passed through any necessary parsing eg Wiki based content @return String
[ "public function ParsedContent() {\n\t\t$formatter = $this->getFormatter();\n\t\t$content = $formatter->formatContent($this);\n\n\t\t// purify the output - we don't want people breaking pages if we set purify=true\n\t\tif (self::$purify_output) {\n\t\t\tinclude_once SIMPLEWIKI_DIR . '/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier.auto.php';\n\t\t\t$purifier = new HTMLPurifier();\n\t\t\t$content = $purifier->purify($content);\n\t\t\t$content = preg_replace_callback('/\\%5B(.*?)\\%5D/', array($this, 'reformatShortcodes'), $content);\n\t\t}\n\n\t\treturn $content;\n\t}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Remove the property with the given key. The internal property object is not deleted itself but it's value is set to <code>null</code> and the method <code>isDeleted()</code> will return <code>true</code> . @param key Key for the property to remove.
[ "public final void remove(final String key) {\r\n final Property prop = find(key);\r\n if (prop != null) {\r\n prop.setValue(null);\r\n }\r\n }" ]
[ "function Value(payload) {\n\n var path = payload.path;\n\n /**\n @property {string} key The string representation of the Key (read-only).\n @memberof Value\n @instance\n @name key\n */\n this.key = path.join(\".\");\n\n /**\n @property {boolean} exists A boolean value that indicates whether the entry exists (true) or has been deleted (false) (read-only).\n @memberof Value\n @instance\n @name exists\n */\n this.exists = payload.deletePath ? false : true;\n\n /**\n @property {boolean} stable A boolean value that indicates whether the entry has been accepted and stored on the server (YES)\n\t or is a local write that is pending confirmation by the server (NO) (read-only).\n @memberof Value\n @instance\n @name stable\n */\n this.stable = true;\n\n /**\n @property {Object} data The data for this entry (read-only).\n @memberof Value\n @instance\n @name data\n */\n // Attempt to parse payload data to a JSON for convience to the client.\n // When unable to parse the data will be set to its primitive value.\n try {\n this.data = JSON.parse(payload.data);\n }\n catch(err) {\n this.data = payload.data;\n } \n\n /**\n @property {string} acl The id of the access control list associated with this entry (read-only).\n @memberof Value\n @instance\n @name acl\n @description\n\n Values that are stable will always have an associated acl. The acl for a local write may not be known\n until the write is accepted by the server, so the aclid may not be set for non-stable entries.\n\n */\n this.acl = payload.acl;\n\n /**\n @property {string} creator The uid of the creator of this entry (read-only).\n @memberof Value\n @instance\n @name creator\n */\n this.creator = payload.creator;\n\n this.cts = payload.cts;\n this.vts = payload.vts;\n}" ]
codesearchnet
{ "query": "Represent the Github description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Matrix-vector product for real symmetric-packed matrix.
[ "def cublasSspmv(handle, uplo, n, alpha, AP, x, incx, beta, y, incy):\n \n\n status = _libcublas.cublasSspmv_v2(handle,\n _CUBLAS_FILL_MODE[uplo], \n n,\n ctypes.byref(ctypes.c_float(alpha)),\n ctypes.byref(ctypes.c_float(AP)),\n int(x),\n incx,\n ctypes.byref(ctypes.c_float(beta)),\n int(y),\n incy)\n cublasCheckStatus(status)" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluator polynomial, etc. but not the errors positions).\n # This is not necessary as anyway syndromes are defined such as there are only non-zero coefficients (the only 0 is the shift of the constant here) and subsequent computations will/must account for the shift by skipping the first iteration (eg, the often seen range(1, n-k+1)), but you can also avoid prepending the 0 coeff and adapt every subsequent computations to start from 0 instead of 1.\n return [0] + [gf_poly_eval(msg, gf_pow(generator, i+fcr)) for i in xrange(nsym)]" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Remove valores de uma tabela no banco de dados @param string $column coluna da tabela @param string $value valor na tabela @return boolean se todos os valores foram deletados com sucesso
[ "public static function delete($column, $value)\n {\n try {\n\n self::instance();\n\n $tableStatic = static::$table;\n \n $stmt = self::$db->prepare(\"delete from {$tableStatic} where {$column} = :value\");\n \n $stmt->bindValue(\":value\", $value);\n\n $stmt->execute();\n \n\n if ($stmt->rowCount() == 1) {\n return true;\n }\n\n } catch (PDOException $e) {\n\n $error = new Error();\n $error->errorMessage(\"Error: não foi possível deletar o dado. Verifique se os dados estão corretos. \".$e->getMessage());\n\n }\n }" ]
[ "def associar_assinatura(self, sequencia_cnpj, assinatura_ac):\n \n retorno = super(ClienteSATLocal, self).\\\n associar_assinatura(sequencia_cnpj, assinatura_ac)\n # (!) resposta baseada na redação com efeitos até 31-12-2016\n return RespostaSAT.associar_assinatura(retorno)" ]
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Function that finds all IDs of entities that match the search criteria. @return array
[ "protected function findIdsByGivenCriteria()\n {\n $select = $this->getSelectAs($this->idField);\n\n $subQueryBuilder = $this->createSubQueryBuilder($select);\n if (null != $this->limit) {\n $subQueryBuilder->setMaxResults($this->limit)->setFirstResult($this->limit * ($this->page - 1));\n }\n\n foreach ($this->sortFields as $index => $sortField) {\n if ($sortField->getName() !== $this->idField->getName()) {\n $subQueryBuilder->addSelect($this->getSelectAs($sortField));\n }\n }\n\n $this->assignSortFields($subQueryBuilder);\n $this->assignParameters($this->queryBuilder);\n $ids = $subQueryBuilder->getQuery()->getArrayResult();\n\n // if no results are found - return\n if (count($ids) < 1) {\n return [];\n }\n\n $ids = array_map(\n function($array) {\n return $array[$this->idField->getName()];\n },\n $ids\n );\n\n return $ids;\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github instruction about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code:" }
Gets a single object @param type $callerClass @param type $filter @param type $cache @param type $orderby @return DataObject
[ "public function getOne($callerClass, $filter = \"\", $cache = true, $orderby = \"\", $requiredPerm = 'View')\n {\n $items = $this->getAll($callerClass, $filter, $orderby, null, null, $requiredPerm);\n if ($items && count($items)) {\n return $items[0];\n }\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Check that a string is not empty if its not null. @param value value. @param name parameter name for the exception message. @return the given value.
[ "public static String notEmptyIfNotNull(String value, String name) {\n return notEmptyIfNotNull(value, name, null);\n }" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// ReadJSON returns the decoded configuration file, or an error.
[ "func ReadJSON(secustom string) (configger Config, err error) {\n\tnaclKey := new([keySize]byte)\n\tcopy(naclKey[:], pad[:keySize])\n\tnonce := new([nonceSize]byte)\n\tin, err := ioutil.ReadFile(secustom)\n\tif err != nil {\n\t\treturn configger, err\n\t}\n\tcopy(nonce[:], in[:nonceSize])\n\tconfigbytes, ok := secretbox.Open(nil, in[nonceSize:], nonce, naclKey)\n\n\tif ok {\n\n\t\terr = json.Unmarshal(configbytes, &configger)\n\t\tif err == nil {\n\t\t\t// No password. Success.\n\t\t\treturn configger, nil\n\t\t}\n\t}\n\n\t// The blank password didn't work. Ask the user via speakeasy\n\tconfiglock, err := speakeasy.Ask(\"Password: \")\n\tvar userKey = configlock\n\tkey := []byte(userKey)\n\tkey = append(key, pad...)\n\tnaclKey = new([keySize]byte)\n\tcopy(naclKey[:], key[:keySize])\n\tnonce = new([nonceSize]byte)\n\tin, err = ioutil.ReadFile(secustom)\n\tif err != nil {\n\t\treturn configger, err\n\t}\n\tcopy(nonce[:], in[:nonceSize])\n\tconfigbytes, ok = secretbox.Open(nil, in[nonceSize:], nonce, naclKey)\n\tif !ok {\n\t\treturn configger, errors.New(\"Could not decrypt the config file. Wrong password?\")\n\t}\n\n\terr = json.Unmarshal(configbytes, &configger)\n\tif err != nil {\n\t\treturn configger, err\n\t}\n\treturn configger, nil\n\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are different than the class name\n this.type = \"\";\n // Used to provide access to the name of the class \n this.className = \"Rule\";\n // Indicates whether generated nodes should be added to the abstract syntax tree\n this._createAstNode = false;\n // A parser function, computed in a rule's constructor. If successful returns either the original or a new \n // ParseState object. If it fails it returns null.\n this.parser = null;\n // A lexer function, computed in a rule's constructor. The lexer may update the ParseState if successful.\n // If it fails it is required that the lexer restore the ParseState index to the previous state. \n // Lexers should only update the index. \n this.lexer = null;\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// ReadB64 is a blocking read for base64 encoded msgpack rpc data. // It is called serially by the mobile run loops.
[ "func ReadB64() (res string, err error) {\n\tdefer func() { err = flattenError(err) }()\n\tif conn == nil {\n\t\treturn \"\", errors.New(\"connection not initialized\")\n\t}\n\tn, err := conn.Read(buffer)\n\tif n > 0 && err == nil {\n\t\tstr := base64.StdEncoding.EncodeToString(buffer[0:n])\n\t\treturn str, nil\n\t}\n\n\tif err != nil {\n\t\t// Attempt to fix the connection\n\t\tReset()\n\t\treturn \"\", fmt.Errorf(\"Read error: %s\", err)\n\t}\n\n\treturn \"\", nil\n}" ]
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \"never\" be used. It will be added\n\t// as soon as a case for it exists.\n\t//\n\t// The GetE extension is an addition that only rend supports. This chunked handler\n\t// is pretty explicitly for talking to memcached since it is a complex workaround\n\t// for pathological behavior when data size rapidly changes that only happens in\n\t// memcached. The chunked handler will not work well with the L2 the EVCache team\n\t// uses.\n\tpanic(\"GetE not supported in Rend chunked mode\")\n}" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Párování faktur dle nezaplacenych faktur
[ "public function invoicesMatchingByInvoices()\n {\n foreach ($this->getInvoicesToProcess() as $invoiceData) {\n $payments = $this->findPayments($invoiceData);\n if (!empty($payments) && count(current($payments))) {\n $typDokl = $invoiceData['typDokl'][0];\n $docType = $typDokl['typDoklK'];\n $invoiceData['typDokl'] = \\FlexiPeeHP\\FlexiBeeRO::code($typDokl['kod']);\n $invoice = new \\FlexiPeeHP\\FakturaVydana($invoiceData,\n $this->config);\n $this->invoicer->setMyKey($invoiceData['id']);\n /*\n * Standardní faktura (typDokladu.faktura)\n * Dobropis/opravný daň. d. (typDokladu.dobropis)\n * Zálohová faktura (typDokladu.zalohFaktura)\n * Zálohový daňový doklad (typDokladu.zdd)\n * Dodací list (typDokladu.dodList)\n * Proforma (neúčetní) (typDokladu.proforma)\n * Pohyb Kč / Zůstatek Kč (typBanUctu.kc)\n * Pohyb měna / Zůstatek měna (typBanUctu.mena)\n */\n\n foreach ($payments as $paymentData) {\n $payment = new \\FlexiPeeHP\\Banka($paymentData, $this->config);\n switch ($docType) {\n case 'typDokladu.zalohFaktura':\n case 'typDokladu.faktura':\n if ($this->settleInvoice($invoice, $payment)) {\n \n }\n break;\n case 'typDokladu.proforma':\n $this->settleProforma($invoice, $payments);\n break;\n case 'typDokladu.dobropis':\n $this->settleCreditNote($invoice, $payments);\n break;\n default:\n $this->addStatusMessage(\n sprintf(_('Unsupported document type: %s %s'),\n $typDokl['typDoklK@showAs'].' ('.$docType.'): '.$invoiceData['typDokl'],\n $invoice->getApiURL()\n ), 'warning');\n break;\n }\n }\n }\n }\n }" ]
[ "public function settleCreditNote($invoice, $payment)\n {\n $success = 0;\n $prijataCastka = (float) $payment->getDataValue('sumCelkem');\n\n if ($prijataCastka < $invoice->getDataValue('zbyvaUhradit')) { //Castecna uhrada\n $this->addStatusMessages(sprinf(_('Castecna uhrada - DOBROPIS: prijato: %s ma byt zaplaceno %s'),\n $prijataCastka, $invoice->getDataValue('zbyvaUhradit')),\n 'warning');\n }\n if ($prijataCastka > $invoice->getDataValue('zbyvaUhradit')) { //Castecna uhrada\n $this->addStatusMessages(sprinf(_('Přeplatek - DOBROPIS: prijato: %s ma byt zaplaceno %s'),\n $prijataCastka, $invoice->getDataValue('zbyvaUhradit')),\n 'warning');\n\n $this->banker->dataReset();\n $this->banker->setDataValue('id', $payment['id']);\n $this->banker->setDataValue('stitky',\n $this->config['LABEL_PREPLATEK']);\n $this->banker->insertToFlexiBee();\n }\n\n if ($invoice->sparujPlatbu($payment, 'castecnaUhrada')) { //Jak se ma FlexiBee zachovat pri preplatku/nedoplatku\n $success = 1;\n $invoice->addStatusMessage(sprintf(_('Platba %s %s byla sparovana s dobropisem %s'),\n (string) $payment, $prijataCastka, (string) $invoice),\n 'success');\n //PDF Danoveho dokladu priloz k nemu samemu\n //PDF Danoveho dokladu odesli mailem zakaznikovi y FLEXIBEE( nasledne pouzit tabulku Mail/Gandalf)\n }\n\n return $success;\n }" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
This method will try to decrypt the given JWE and recipient using a JWK. @param JWE $jwe A JWE object to decrypt @param JWK $jwk The key used to decrypt the input @param int $recipient The recipient used to decrypt the token
[ "public function decryptUsingKey(JWE &$jwe, JWK $jwk, int $recipient): bool\n {\n $jwkset = new JWKSet([$jwk]);\n\n return $this->decryptUsingKeySet($jwe, $jwkset, $recipient);\n }" ]
[ "function(algo) {\n switch (algo) {\n // Algorithm-Specific Fields for RSA encrypted session keys:\n // - MPI of RSA encrypted value m**e mod n.\n case enums.publicKey.rsa_encrypt:\n case enums.publicKey.rsa_encrypt_sign:\n return [type_mpi];\n\n // Algorithm-Specific Fields for Elgamal encrypted session keys:\n // - MPI of Elgamal value g**k mod p\n // - MPI of Elgamal value m * y**k mod p\n case enums.publicKey.elgamal:\n return [type_mpi, type_mpi];\n // Algorithm-Specific Fields for ECDH encrypted session keys:\n // - MPI containing the ephemeral key used to establish the shared secret\n // - ECDH Symmetric Key\n case enums.publicKey.ecdh:\n return [type_mpi, type_ecdh_symkey];\n default:\n throw new Error('Invalid public key encryption algorithm.');\n }\n }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Encryption:" }
@param string $file @return array
[ "protected function findTables($file)\n {\n $tables = [];\n $xml = simplexml_load_file($file);\n foreach ($xml->xpath('TABLES/TABLE') as $element) {\n if (null !== $element['NAME']) {\n $tables[] = (string) $element['NAME'];\n }\n }\n\n return $tables;\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
@param string $template @param bool $clearAssignments @return string @throws DomainException
[ "public function fetch($template, $clearAssignments = true)\n {\n\n extract($this->variablesForTemplate, EXTR_OVERWRITE);\n\n $template = $this->templateFolder . $template . '.template.php';\n\n if (file_exists($template) === false) {\n throw new DomainException('Template not found in ' . $template);\n }\n\n ob_start();\n\n /** @noinspection PhpIncludeInspection */\n include $template;\n\n $content = ob_get_clean();\n\n if ($clearAssignments) {\n $this->variablesForTemplate = [];\n }\n\n return $content;\n }" ]
[ "public function getViewer($action)\n {\n // Answer Viewer Object (from parent):\n \n if (!$this->isCMSPreview()) {\n return parent::getViewer($action);\n }\n \n // Load Page Requirements (uses theme):\n \n PageController::create(Page::create())->doInit();\n \n // Load Preview Requirements:\n \n Requirements::css('silverware/silverware: admin/client/dist/styles/preview.css');\n \n // Answer Viewer Object (for CMS preview):\n \n return new SSViewer(sprintf('%s\\CMSPreview', Component::class));\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
// SwarmUpdate updates the swarm.
[ "func (cli *Client) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {\n\tquery := url.Values{}\n\tquery.Set(\"version\", strconv.FormatUint(version.Index, 10))\n\tquery.Set(\"rotateWorkerToken\", fmt.Sprintf(\"%v\", flags.RotateWorkerToken))\n\tquery.Set(\"rotateManagerToken\", fmt.Sprintf(\"%v\", flags.RotateManagerToken))\n\tquery.Set(\"rotateManagerUnlockKey\", fmt.Sprintf(\"%v\", flags.RotateManagerUnlockKey))\n\tresp, err := cli.post(ctx, \"/swarm/update\", query, swarm, nil)\n\tensureReaderClosed(resp)\n\treturn err\n}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/*Line 34 - 'AtomBrowser.js'
[ "function () {\n/*Line 35 - 'AtomBrowser.js' */ var nVer = navigator.appVersion;\n/*Line 36 - 'AtomBrowser.js' */ var nAgt = navigator.userAgent;\n/*Line 37 - 'AtomBrowser.js' */ this.userAgent = nAgt;\n/*Line 38 - 'AtomBrowser.js' */ var browserName = navigator.appName;\n/*Line 39 - 'AtomBrowser.js' */ var fullVersion = \"\" + parseFloat(navigator.appVersion);\n/*Line 40 - 'AtomBrowser.js' */ var majorVersion = parseInt(navigator.appVersion, 10);\n/*Line 41 - 'AtomBrowser.js' */ var nameOffset, verOffset, ix;\n\n/*Line 43 - 'AtomBrowser.js' */ // In Opera, the true version is after \"Opera\" or after \"Version\"\n/*Line 44 - 'AtomBrowser.js' */ if ((verOffset = nAgt.indexOf(\"Opera\")) != -1) {\n/*Line 45 - 'AtomBrowser.js' */ browserName = \"Opera\";\n/*Line 46 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 6);\n/*Line 47 - 'AtomBrowser.js' */ if ((verOffset = nAgt.indexOf(\"Version\")) != -1) {\n/*Line 48 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 8);\n/*Line 49 - 'AtomBrowser.js' */ }\n/*Line 50 - 'AtomBrowser.js' */ }\n/*Line 51 - 'AtomBrowser.js' */ // In MSIE, the true version is after \"MSIE\" in userAgent\n/*Line 52 - 'AtomBrowser.js' */ else if ((verOffset = nAgt.indexOf(\"MSIE\")) != -1) {\n/*Line 53 - 'AtomBrowser.js' */ browserName = \"Microsoft Internet Explorer\";\n/*Line 54 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 5);\n/*Line 55 - 'AtomBrowser.js' */ }\n/*Line 56 - 'AtomBrowser.js' */ // In Chrome, the true version is after \"Chrome\"\n/*Line 57 - 'AtomBrowser.js' */ else if ((verOffset = nAgt.indexOf(\"Chrome\")) != -1) {\n/*Line 58 - 'AtomBrowser.js' */ browserName = \"Chrome\";\n/*Line 59 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 7);\n/*Line 60 - 'AtomBrowser.js' */ }\n/*Line 61 - 'AtomBrowser.js' */ // In Safari, the true version is after \"Safari\" or after \"Version\"\n/*Line 62 - 'AtomBrowser.js' */ else if ((verOffset = nAgt.indexOf(\"Safari\")) != -1) {\n/*Line 63 - 'AtomBrowser.js' */ browserName = \"Safari\";\n/*Line 64 - 'AtomBrowser.js' */ this.isMobile = nAgt.indexOf(\"iPhone\") != -1;\n/*Line 65 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 7);\n/*Line 66 - 'AtomBrowser.js' */ if ((verOffset = nAgt.indexOf(\"Version\")) != -1) {\n/*Line 67 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 8);\n/*Line 68 - 'AtomBrowser.js' */ }\n/*Line 69 - 'AtomBrowser.js' */ }\n/*Line 70 - 'AtomBrowser.js' */ // In Firefox, the true version is after \"Firefox\"\n/*Line 71 - 'AtomBrowser.js' */ else if ((verOffset = nAgt.indexOf(\"Firefox\")) != -1) {\n/*Line 72 - 'AtomBrowser.js' */ browserName = \"Firefox\";\n/*Line 73 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 8);\n/*Line 74 - 'AtomBrowser.js' */ }\n/*Line 75 - 'AtomBrowser.js' */ // In most other browsers, \"name/version\" is at the end of userAgent\n/*Line 76 - 'AtomBrowser.js' */ else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) <\n/*Line 77 - 'AtomBrowser.js' */ (verOffset = nAgt.lastIndexOf('/'))) {\n/*Line 78 - 'AtomBrowser.js' */ browserName = nAgt.substring(nameOffset, verOffset);\n/*Line 79 - 'AtomBrowser.js' */ fullVersion = nAgt.substring(verOffset + 1);\n/*Line 80 - 'AtomBrowser.js' */ if (browserName.toLowerCase() == browserName.toUpperCase()) {\n/*Line 81 - 'AtomBrowser.js' */ browserName = navigator.appName;\n/*Line 82 - 'AtomBrowser.js' */ }\n/*Line 83 - 'AtomBrowser.js' */ }\n/*Line 84 - 'AtomBrowser.js' */ // trim the fullVersion string at semicolon/space if present\n/*Line 85 - 'AtomBrowser.js' */ if ((ix = fullVersion.indexOf(\";\")) != -1) {\n/*Line 86 - 'AtomBrowser.js' */ fullVersion = fullVersion.substring(0, ix);\n/*Line 87 - 'AtomBrowser.js' */ }\n/*Line 88 - 'AtomBrowser.js' */ if ((ix = fullVersion.indexOf(\" \")) != -1) {\n/*Line 89 - 'AtomBrowser.js' */ fullVersion = fullVersion.substring(0, ix);\n/*Line 90 - 'AtomBrowser.js' */ }\n\n/*Line 92 - 'AtomBrowser.js' */ majorVersion = parseInt('' + fullVersion, 10);\n/*Line 93 - 'AtomBrowser.js' */ if (isNaN(majorVersion)) {\n/*Line 94 - 'AtomBrowser.js' */ fullVersion = '' + parseFloat(navigator.appVersion);\n/*Line 95 - 'AtomBrowser.js' */ majorVersion = parseInt(navigator.appVersion, 10);\n/*Line 96 - 'AtomBrowser.js' */ }\n\n/*Line 98 - 'AtomBrowser.js' */ this.browserName = browserName;\n/*Line 99 - 'AtomBrowser.js' */ this.majorVersion = majorVersion;\n/*Line 100 - 'AtomBrowser.js' */ this.isMobile = /android|mobile|ios|iphone/gi.test(nAgt);\n/*Line 101 - 'AtomBrowser.js' */ }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// EnableWithAIForwarding will start instrumentation and will connect to app insights forwarder // exporter making the metrics and traces available in app insights.
[ "func EnableWithAIForwarding(agentEndpoint string) (err error) {\n\terr = Enable()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttraceExporter, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agentEndpoint))\n\tif err != nil {\n\t\treturn err\n\t}\n\ttrace.RegisterExporter(traceExporter)\n\treturn\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Returns the number of shares for the given security. It gets the number from all the accounts in the book.
[ "def get_quantity(self) -> Decimal:\n \n from pydatum import Datum\n # Use today's date but reset hour and lower.\n today = Datum()\n today.today()\n today.end_of_day()\n return self.get_num_shares_on(today.value)" ]
[ "public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maximum_rows_actions'],\n $configGeneral['datatable_archiving_maximum_rows_subtable_actions']\n );\n\n // FIXME: This is a quick fix for #3482. The actual cause of the bug is that\n // the site search & performance metrics additions to\n // ArchivingHelper::updateActionsTableWithRowQuery expect every\n // row to have 'type' data, but not all of the SQL queries that are run w/o\n // ranking query join on the log_action table and thus do not select the\n // log_action.type column.\n //\n // NOTES: Archiving logic can be generalized as follows:\n // 0) Do SQL query over log_link_visit_action & join on log_action to select\n // some metrics (like visits, hits, etc.)\n // 1) For each row, cache the action row & metrics. (This is done by\n // updateActionsTableWithRowQuery for result set rows that have\n // name & type columns.)\n // 2) Do other SQL queries for metrics we can't put in the first query (like\n // entry visits, exit vists, etc.) w/o joining log_action.\n // 3) For each row, find the cached row by idaction & add the new metrics to\n // it. (This is done by updateActionsTableWithRowQuery for result set rows\n // that DO NOT have name & type columns.)\n //\n // The site search & performance metrics additions expect a 'type' all the time\n // which breaks the original pre-rankingquery logic. Ranking query requires a\n // join, so the bug is only seen when ranking query is disabled.\n if ($limit === 0) {\n $limit = 100000;\n }\n return $limit;\n\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Update an existing BuildConfiguration with new information :param id: ID of BuildConfiguration to update :param name: Name of BuildConfiguration to update :return:
[ "def update_build_configuration(id, **kwargs):\n \n data = update_build_configuration_raw(id, **kwargs)\n if data:\n return utils.format_json(data)" ]
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n * (Optional)Callback function to receive the result of the _delete operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~_deleteCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UsersResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Removes users account privileges.\n * This closes one or more user records in the account. Users are never deleted from an account, but closing a user prevents them from using account functions.\n\nThe response returns whether the API execution was successful (200 - OK) or if it failed. The response contains a user structure similar to the request and includes the user changes. If an error occurred during the DELETE operation for any of the users, the response for that user contains an `errorDetails` node with `errorCode` and `message` properties.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback._delete \n * @param {module:model/UserInfoList} optsOrCallback.userInfoList \n * @param {module:api/UsersApi~_deleteCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UsersResponse}\n */\n this._delete = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInfoList'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling _delete\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n 'delete': optsOrCallback['_delete']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UsersResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the create operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~createCallback\n * @param {String} error Error message, if any.\n * @param {module:model/NewUsersSummary} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds news user to the specified account.\n * Adds new users to your account. Set the `userSettings` property in the request to specify the actions the users can perform on the account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/NewUsersDefinition} optsOrCallback.newUsersDefinition \n * @param {module:api/UsersApi~createCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/NewUsersSummary}\n */\n this.create = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['newUsersDefinition'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling create\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = NewUsersSummary;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the createSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~createSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds user Signature and initials images to a Signature.\n * Adds a user signature image and/or user initials image to the specified user. \n\nThe userId property specified in the endpoint must match the authenticated user's userId and the user must be a member of the account.\n\nThe rules and processes associated with this are:\n\n* If Content-Type is set to application/json, then the default behavior for creating a default signature image, based on the name and a DocuSign font, is used.\n* If Content-Type is set to multipart/form-data, then the request must contain a first part with the user signature information, followed by parts that contain the images.\n\nFor each Image part, the Content-Disposition header has a \"filename\" value that is used to map to the `signatureName` and/or `signatureInitials` properties in the JSON to the image. \n\nFor example: \n`Content-Disposition: file; filename=\"Ron Test20121127083900\"`\n\nIf no matching image (by filename value) is found, then the image is not set. One, both, or neither of the signature and initials images can be set with this call.\n\nThe Content-Transfer-Encoding: base64 header, set in the header for the part containing the image, can be set to indicate that the images are formatted as base64 instead of as binary.\n\nIf successful, 200-OK is returned, and a JSON structure containing the signature information is provided, note that the signatureId can change with each API POST, PUT, or DELETE since the changes to the signature structure cause the current signature to be closed, and a new signature record to be created.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSignaturesInformation} optsOrCallback.userSignaturesInformation \n * @param {module:api/UsersApi~createSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.createSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignaturesInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling createSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling createSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteContactWithId operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteContactWithIdCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Replaces a particular contact associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} contactId The unique identifier of a person in the contacts address book.\n * @param {module:api/UsersApi~deleteContactWithIdCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.deleteContactWithId = function(accountId, contactId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteContactWithId\");\n }\n\n // verify the required parameter 'contactId' is set\n if (contactId == undefined || contactId == null) {\n throw new Error(\"Missing the required parameter 'contactId' when calling deleteContactWithId\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'contactId': contactId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts/{contactId}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Delete contacts associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~deleteContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.deleteContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes custom user settings for a specified user.\n * Deletes the specified custom user settings for a single user.\n\n###Deleting Grouped Custom User Settings###\n\nIf the custom user settings you want to delete are grouped, you must include the following information in the header, after Content-Type, in the request:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings.\n\nIf the extra header information is not included, only the custom user settings that were added without a group are deleted.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/CustomSettingsInformation} optsOrCallback.customSettingsInformation \n * @param {module:api/UsersApi~deleteCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.deleteCustomSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['customSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteProfileImageCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes the user profile image for the specified user.\n * Deletes the user profile image from the specified user's profile.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~deleteProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.deleteProfileImage = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteSignatureCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Removes removes signature information for the specified user.\n * Removes the signature information for the user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {module:api/UsersApi~deleteSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.deleteSignature = function(accountId, userId, signatureId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling deleteSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes the user initials image or the user signature image for the specified user.\n * Deletes the specified initials image or signature image for the specified user.\n\nThe function deletes one or the other of the image types, to delete both the initials image and signature image you must call the endpoint twice.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {module:api/UsersApi~deleteSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.deleteSignatureImage = function(accountId, userId, signatureId, imageType, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling deleteSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getContactById operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getContactByIdCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactGetResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets a particular contact associated with the user&#39;s account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} contactId The unique identifier of a person in the contacts address book.\n * @param {module:api/UsersApi~getContactByIdCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactGetResponse}\n */\n this.getContactById = function(accountId, contactId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getContactById\");\n }\n\n // verify the required parameter 'contactId' is set\n if (contactId == undefined || contactId == null) {\n throw new Error(\"Missing the required parameter 'contactId' when calling getContactById\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'contactId': contactId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactGetResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts/{contactId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getInformation operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getInformationCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user information for a specified user.\n * Retrieves the user information for the specified user. \n\nTo return additional user information that details the last login date, login status, and the user's password expiration date, set the optional `additional_info` query string parameter to **true**.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.additionalInfo When set to **true**, the full list of user information is returned for each user in the account.\n * @param {String} optsOrCallback.email \n * @param {module:api/UsersApi~getInformationCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformation}\n */\n this.getInformation = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getInformation\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getInformation\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'additional_info': optsOrCallback['additionalInfo'],\n 'email': optsOrCallback['email']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getProfile operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getProfileCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserProfile} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user profile for a specified user.\n * Retrieves the user profile information, the privacy settings and personal information (address, phone number, etc.) for the specified user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~getProfileCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserProfile}\n */\n this.getProfile = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getProfile\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getProfile\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserProfile;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getProfileImageCallback\n * @param {String} error Error message, if any.\n * @param {Object} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user profile image for the specified user.\n * Retrieves the user profile picture for the specified user. The image is returned in the same format as uploaded.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n\nIf successful, the response returns a 200 - OK and the user profile image.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.encoding \n * @param {module:api/UsersApi~getProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link Object}\n */\n this.getProfileImage = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'encoding': optsOrCallback['encoding']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['image/gif'];\n var returnType = Object;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user account settings for a specified user.\n * Retrieves a list of the account settings and email notification information for the specified user.\n\nThe response returns the account setting name/value information and the email notification settings for the specified user. For more information about the different user settings, see the [ML:userSettings list].\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~getSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSettingsInformation}\n */\n this.getSettings = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/settings', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSignatureCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user signature information for the specified user.\n * Retrieves the structure of a single signature with a known signature name.\n\nThe userId specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {module:api/UsersApi~getSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.getSignature = function(accountId, userId, signatureId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling getSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {Object} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user initials image or the user signature image for the specified user.\n * Retrieves the specified initials image or signature image for the specified user. The image is returned in the same format as uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n\n###### Note: Older envelopes might only have chromed images. If getting the non-chromed image fails, try getting the chromed image.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.includeChrome \n * @param {module:api/UsersApi~getSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link Object}\n */\n this.getSignatureImage = function(accountId, userId, signatureId, imageType, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling getSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n 'include_chrome': optsOrCallback['includeChrome']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['image/gif'];\n var returnType = Object;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the list operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformationList} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the list of users for the specified account.\n * Retrieves the list of users for the specified account.\n\nThe response returns the list of users for the account along with the information about the result set. If the `additional_info` query was added to the endpoint and set to **true**, the full user information is returned for each user\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.additionalInfo When set to **true**, the full list of user information is returned for each user in the account.\n * @param {String} optsOrCallback.count Number of records to return. The number must be greater than 0 and less than or equal to 100. \n * @param {String} optsOrCallback.email \n * @param {String} optsOrCallback.emailSubstring Filters the returned user records by the email address or a sub-string of email address.\n * @param {String} optsOrCallback.groupId Filters user records returned by one or more group Id&#39;s.\n * @param {String} optsOrCallback.loginStatus \n * @param {String} optsOrCallback.notGroupId \n * @param {String} optsOrCallback.startPosition Starting value for the list. \n * @param {String} optsOrCallback.status \n * @param {String} optsOrCallback.userNameSubstring Filters the user records returned by the user name or a sub-string of user name.\n * @param {module:api/UsersApi~listCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformationList}\n */\n this.list = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling list\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n 'additional_info': optsOrCallback['additionalInfo'],\n 'count': optsOrCallback['count'],\n 'email': optsOrCallback['email'],\n 'email_substring': optsOrCallback['emailSubstring'],\n 'group_id': optsOrCallback['groupId'],\n 'login_status': optsOrCallback['loginStatus'],\n 'not_group_id': optsOrCallback['notGroupId'],\n 'start_position': optsOrCallback['startPosition'],\n 'status': optsOrCallback['status'],\n 'user_name_substring': optsOrCallback['userNameSubstring']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformationList;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the listCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the custom user settings for a specified user.\n * Retrieves a list of custom user settings for a single user.\n\nCustom settings provide a flexible way to store and retrieve custom user information that can be used in your own system.\n\n###### Note: Custom user settings are not the same as user account settings.\n\n###Getting Grouped Custom User Settings###\n\nIf the custom user settings you want to retrieve are grouped, you must include the following information in the header, after Content-Type, in the request:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings.\n\nIf the extra header information is not included, only the custom user settings that were added without a group are retrieved.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~listCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.listCustomSettings = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling listCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling listCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the listSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves a list of user signature definitions for a specified user.\n * Retrieves the signature definitions for the specified user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.stampType \n * @param {module:api/UsersApi~listSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.listSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling listSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling listSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'stamp_type': optsOrCallback['stampType']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the postContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~postContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Imports multiple new contacts into the contacts collection from CSV, JSON, or XML (based on content type).\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~postContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.postContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling postContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the putContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~putContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Replaces contacts associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~putContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.putContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling putContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds or updates custom user settings for the specified user.\n * Adds or updates custom user settings for the specified user.\n\n###### Note: Custom user settings are not the same as user account settings.\n\nCustom settings provide a flexible way to store and retrieve custom user information that you can use in your own system.\n\n**Important**: There is a limit on the size for all the custom user settings for a single user. The limit is 4,000 characters, which includes the XML and JSON structure for the settings.\n\n### Grouping Custom User Settings ###\n\nYou can group custom user settings when adding them. Grouping allows you to retrieve settings that are in a specific group, instead of retrieving all the user custom settings.\n\nTo group custom user settings, add the following information in the header, after Content-Type:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings. Grouping is shown in the Example Request Body below.\n\nWhen getting or deleting grouped custom user settings, you must include the extra header information.\n\nGrouping custom user settings is not required and if the extra header information is not included, the custom user settings are added normally and can be retrieved or deleted without including the additional header.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/CustomSettingsInformation} optsOrCallback.customSettingsInformation \n * @param {module:api/UsersApi~updateCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.updateCustomSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['customSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateProfile operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateProfileCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user profile information for the specified user.\n * Updates the user's detail information, profile information, privacy settings, and personal information in the user ID card.\n\nYou can also change a user's name by changing the information in the `userDetails` property. When changing a user's name, you can either change the information in the `userName` property OR change the information in `firstName`, `middleName`, `lastName, suffixName`, and `title` properties. Changes to `firstName`, `middleName`, `lastName`, `suffixName`, and `title` properties take precedence over changes to the `userName` property.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserProfile} optsOrCallback.userProfile \n * @param {module:api/UsersApi~updateProfileCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateProfile = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userProfile'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateProfile\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateProfile\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateProfileImageCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user profile image for a specified user.\n * Updates the user profile image by uploading an image to the user profile.\n\nThe supported image formats are: gif, png, jpeg, and bmp. The file must be less than 200K. For best viewing results, DocuSign recommends that the image is no more than 79 pixels wide and high.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~updateProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateProfileImage = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = ['image/gif'];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSettingsCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user account settings for a specified user.\n * Updates the account settings list and email notification types for the specified user.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSettingsInformation} optsOrCallback.userSettingsInformation \n * @param {module:api/UsersApi~updateSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/settings', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignatureCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user signature for a specified user.\n * Creates, or updates, the signature font and initials for the specified user. When creating a signature, you use this resource to create the signature name and then add the signature and initials images into the signature.\n\n###### Note: This will also create a default signature for the user when one does not exist.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.closeExistingSignature When set to **true**, closes the current signature.\n * @param {module:model/UserSignatureDefinition} optsOrCallback.userSignatureDefinition \n * @param {module:api/UsersApi~updateSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.updateSignature = function(accountId, userId, signatureId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignatureDefinition'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling updateSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n 'close_existing_signature': optsOrCallback['closeExistingSignature']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user signature image or user initials image for the specified user.\n * Updates the user signature image or user initials image for the specified user. The supported image formats for this file are: gif, png, jpeg, and bmp. The file must be less than 200K.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {module:api/UsersApi~updateSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.updateSignatureImage = function(accountId, userId, signatureId, imageType, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling updateSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = ['image/gif'];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds/updates a user signature.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSignaturesInformation} optsOrCallback.userSignaturesInformation \n * @param {module:api/UsersApi~updateSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.updateSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignaturesInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateUser operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateUserCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the specified user information.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserInformation} optsOrCallback.userInformation \n * @param {module:api/UsersApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformation}\n */\n this.updateUser = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateUser\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateUser\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateUsers operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateUsersCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformationList} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Change one or more user in the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserInformationList} optsOrCallback.userInformationList \n * @param {module:api/UsersApi~updateUsersCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformationList}\n */\n this.updateUsers = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInformationList'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateUsers\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformationList;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n }" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Add a new TocElement to the TOC container.
[ "def add_element(self, element):\n \"\"\"\"\"\"\n try:\n self.toc[element.group][element.name] = element\n except KeyError:\n self.toc[element.group] = {}\n self.toc[element.group][element.name] = element" ]
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRti.fetchChildren, which will call BaseRti.open and thus open the current RTI.\n # BaseRti.open will emit the self.model.sigItemChanged signal, which is connected to\n # RepoTreeView.onItemChanged.\n self.expand(currentIndex)" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// GenerateHandlers ...
[ "func GenerateHandlers() map[string]mist.HandleFunc {\n\treturn map[string]mist.HandleFunc{\n\t\t\"register\": handleRegister,\n\t\t\"unregister\": handleUnregister,\n\t\t\"set\": handleSet,\n\t\t\"unset\": handleUnset,\n\t\t\"tags\": handleTags,\n\t}\n}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
转换最终分词结果到 finallyResult 数组 @return void
[ "private function _sort_finally_result()\n {\n $newarr = array();\n $i = 0;\n foreach($this->simpleResult as $k=>$v)\n {\n if( empty($v['w']) ) continue;\n if( isset($this->finallyResult[$k]) && count($this->finallyResult[$k]) > 0 )\n {\n foreach($this->finallyResult[$k] as $w)\n {\n if(!empty($w))\n {\n $newarr[$i]['w'] = $w;\n $newarr[$i]['t'] = 20;\n $i++;\n }\n }\n }\n else if($v['t'] != 21)\n {\n $newarr[$i]['w'] = $v['w'];\n $newarr[$i]['t'] = $v['t'];\n $i++;\n }\n }\n $this->finallyResult = $newarr;\n $newarr = '';\n }" ]
[ "protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //--------------------------------------------------------------------\n //The delimiter \"--\"\n changeDelimiterPOS(linkedArray);\n\n //--------------------------------------------------------------------\n //如果前一个词是数字,当前词以“-”或“-”开始,并且不止这一个字符,\n //那么将此“-”符号从当前词中分离出来。\n //例如 “3 / -4 / 月”需要拆分成“3 / - / 4 / 月”\n splitMiddleSlashFromDigitalWords(linkedArray);\n\n //--------------------------------------------------------------------\n //1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并,且当前词词性是时间\n //2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。\n //3、如果最后一个汉字是\"点\" ,则认为当前数字是时间\n //4、如果当前串最后一个汉字不是\"∶·./\"和半角的'.''/',那么是数\n //5、当前串最后一个汉字是\"∶·./\"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如\"1.\"\n checkDateElements(linkedArray);\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about text processing:" }
// Parse implements Parser.
[ "func (parser *SourceParser) Parse(req *http.Request, params imageserver.Params) error {\n\tParseQueryString(imageserver_source.Param, req, params)\n\treturn nil\n}" ]
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about File management:" }
Returns the form element as an HTML tag @return string
[ "public function outputElement() : string\n {\n $selected = explode(',', $this->getValue());\n $disabled = $this->disabled;\n $hidden = $this->hidden;\n\n $return = '<div class=\"checkboxgroup\">';\n foreach ($this->options as $val=>$txt) {\n if (in_array($val, $hidden)) {\n break;\n }\n $d = (in_array($val, $disabled)) ? ' disabled=\"disabled\"' : '';\n $s = (in_array($val, $selected)) ? ' checked=\"checked\"' : '';\n $return .= '<div><input id=\"cb-' . $val . '\" type=\"checkbox\" name=\"' . $this->attributes['name'] . '[]\" value=\"' . $val . '\" ' . $d . $s . ' /> <label class=\"cblabel\" for=\"cb-' . $val . '\">' . $txt . \"</label></div>\\n\";\n }\n $return .= '</div>';\n\n return $return;\n }" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// Initialize the database from revel.Config
[ "func InitDb(dbResult *DbGorp) error {\n\tparams := DbInfo{}\n\tparams.DbDriver = revel.Config.StringDefault(\"db.driver\", \"sqlite3\")\n\tparams.DbHost = revel.Config.StringDefault(\"db.host\", \"localhost\")\n\tif params.DbDriver == \"sqlite3\" && params.DbHost == \"localhost\" {\n\t\tparams.DbHost = \"/tmp/app.db\"\n\t}\n\tparams.DbUser = revel.Config.StringDefault(\"db.user\", \"default\")\n\tparams.DbPassword = revel.Config.StringDefault(\"db.password\", \"\")\n\tparams.DbName = revel.Config.StringDefault(\"db.name\", \"default\")\n\tparams.DbConnection = revel.Config.StringDefault(\"db.connection\", \"\")\n\tparams.DbSchema = revel.Config.StringDefault(\"db.schema\", \"\")\n\tdbResult.Info = &params\n\n\treturn dbResult.InitDb(true)\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true,writeDirectory);\n \n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Compute the total size of all elements in objects.
[ "def get_size(objects):\n \"\"\"\"\"\"\n res = 0\n for o in objects:\n try:\n res += _getsizeof(o)\n except AttributeError:\n print(\"IGNORING: type=%s; o=%s\" % (str(type(o)), str(o)))\n return res" ]
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys expected by the\n # objective function\n return objective.run(raw_output, output_files, threads)\n end" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Lists the analysis modules.
[ "def ListAnalysisPlugins(self):\n \"\"\"\"\"\"\n analysis_plugin_info = (\n analysis_manager.AnalysisPluginManager.GetAllPluginInformation())\n\n column_width = 10\n for name, _, _ in analysis_plugin_info:\n if len(name) > column_width:\n column_width = len(name)\n\n table_view = views.ViewsFactory.GetTableView(\n self._views_format_type, column_names=['Name', 'Description'],\n title='Analysis Plugins')\n # TODO: add support for a 3 column table.\n for name, description, type_string in analysis_plugin_info:\n description = '{0:s} [{1:s}]'.format(description, type_string)\n table_view.AddRow([name, description])\n table_view.Write(self._output_writer)" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Execute the job. @return void @throws \Throwable
[ "protected function job(): void\n {\n CorporationDivision::where('corporation_id', $this->getCorporationId())->get()\n ->each(function ($division) {\n\n // retrieve last known entry for the current division and active corporation\n $last_known_entry = CorporationWalletJournal::where('corporation_id', $this->getCorporationId())\n ->where('division', $division->division)\n ->orderBy('date', 'desc')\n ->first();\n\n $this->last_known_entry_id = is_null($last_known_entry) ? 0 : $last_known_entry->id;\n\n // Perform a journal walk backwards to get all of the\n // entries as far back as possible. When the response from\n // ESI is empty, we can assume we have everything.\n while (true) {\n\n $journal = $this->retrieve([\n 'corporation_id' => $this->getCorporationId(),\n 'division' => $division->division,\n ]);\n\n if ($journal->isCachedLoad()) return;\n\n $entries = collect($journal);\n\n // If we have no more entries, break the loop.\n if ($entries->count() === 0)\n break;\n\n $entries->chunk(1000)->each(function ($chunk) use ($division) {\n\n // if we've reached the last known entry - abort the process\n if ($this->at_last_entry)\n return false;\n\n // if we have reached the last known entry, exclude all entries which are lower or equal to the\n // last known entry and flag the reached status.\n if ($chunk->where('id', $this->last_known_entry_id)->isNotEmpty()) {\n $chunk = $chunk->where('id', '>', $this->last_known_entry_id);\n\n $this->at_last_entry = true;\n }\n\n $records = $chunk->map(function ($entry, $key) use ($division) {\n\n return [\n 'corporation_id' => $this->getCorporationId(),\n 'division' => $division->division,\n 'id' => $entry->id,\n 'date' => carbon($entry->date),\n 'ref_type' => $entry->ref_type,\n 'first_party_id' => $entry->first_party_id ?? null,\n 'second_party_id' => $entry->second_party_id ?? null,\n 'amount' => $entry->amount ?? null,\n 'balance' => $entry->balance ?? null,\n 'reason' => $entry->reason ?? null,\n 'tax_receiver_id' => $entry->tax_receiver_id ?? null,\n 'tax' => $entry->tax ?? null,\n // introduced in v4\n 'description' => $entry->description,\n 'context_id' => $entry->context_id ?? null,\n 'context_id_type' => $entry->context_id_type ?? null,\n 'created_at' => carbon(),\n 'updated_at' => carbon(),\n ];\n });\n\n CorporationWalletJournal::insertIgnore($records->toArray());\n });\n\n // in case the last known entry has been reached or we non longer have pages, terminate the job.\n if (! $this->nextPage($journal->pages) || $this->at_last_entry)\n break;\n }\n\n // Reset the page for the next wallet division.\n $this->page = 1;\n\n // Reset the last known entry for the next wallet division.\n $this->last_known_entry_id = 0;\n\n // Reset the last known entry status for the next wallet division.\n $this->at_last_entry = false;\n });\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Internal method to perform the normalization. @param filename the filename @param keepSeparator true to keep the final separator @return the normalized filename
[ "private static String doNormalizeIgnoreOtherSeparator(String filename, boolean keepSeparator) {\n\t\tif (filename == null) {\n\t\t\treturn null;\n\t\t}\n\t\tint size = filename.length();\n\t\tif (size == 0) {\n\t\t\treturn filename;\n\t\t}\n\t\tint prefix = 0;\n\t\t// int prefix = getPrefixLength(filename);\n\t\t// if (prefix < 0) {\n\t\t// return null;\n\t\t// }\n\n\t\tchar[] array = new char[size + 2]; // +1 for possible extra slash, +2\n\t\t\t\t\t\t\t\t\t\t\t// for arraycopy\n\t\tfilename.getChars(0, filename.length(), array, 0);\n\n\t\t// add extra separator on the end to simplify code below\n\t\tboolean lastIsDirectory = true;\n\t\tif (array[size - 1] != JawrConstant.URL_SEPARATOR_CHAR) {\n\t\t\tarray[size++] = JawrConstant.URL_SEPARATOR_CHAR;\n\t\t\tlastIsDirectory = false;\n\t\t}\n\n\t\t// adjoining slashes\n\t\tfor (int i = prefix + 1; i < size; i++) {\n\t\t\tif (array[i] == JawrConstant.URL_SEPARATOR_CHAR && array[i - 1] == JawrConstant.URL_SEPARATOR_CHAR) {\n\t\t\t\tSystem.arraycopy(array, i, array, i - 1, size - i);\n\t\t\t\tsize--;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\n\t\t// dot slash\n\t\tfor (int i = prefix + 1; i < size; i++) {\n\t\t\tif (array[i] == JawrConstant.URL_SEPARATOR_CHAR && array[i - 1] == '.'\n\t\t\t\t\t&& (i == prefix + 1 || array[i - 2] == JawrConstant.URL_SEPARATOR_CHAR)) {\n\t\t\t\tif (i == size - 1) {\n\t\t\t\t\tlastIsDirectory = true;\n\t\t\t\t}\n\t\t\t\tSystem.arraycopy(array, i + 1, array, i - 1, size - i);\n\t\t\t\tsize -= 2;\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\n\t\t// double dot slash\n\t\touter: for (int i = prefix + 2; i < size; i++) {\n\t\t\tif (array[i] == JawrConstant.URL_SEPARATOR_CHAR && array[i - 1] == '.' && array[i - 2] == '.'\n\t\t\t\t\t&& (i == prefix + 2 || array[i - 3] == JawrConstant.URL_SEPARATOR_CHAR)) {\n\t\t\t\tif (i == prefix + 2) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tif (i == size - 1) {\n\t\t\t\t\tlastIsDirectory = true;\n\t\t\t\t}\n\t\t\t\tint j;\n\t\t\t\tfor (j = i - 4; j >= prefix; j--) {\n\t\t\t\t\tif (array[j] == JawrConstant.URL_SEPARATOR_CHAR) {\n\t\t\t\t\t\t// remove b/../ from a/b/../c\n\t\t\t\t\t\tSystem.arraycopy(array, i + 1, array, j + 1, size - i);\n\t\t\t\t\t\tsize -= (i - j);\n\t\t\t\t\t\ti = j + 1;\n\t\t\t\t\t\tcontinue outer;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// remove a/../ from a/../c\n\t\t\t\tSystem.arraycopy(array, i + 1, array, prefix, size - i);\n\t\t\t\tsize -= (i + 1 - prefix);\n\t\t\t\ti = prefix + 1;\n\t\t\t}\n\t\t}\n\n\t\tif (size <= 0) { // should never be less than 0\n\t\t\treturn \"\";\n\t\t}\n\t\tif (size <= prefix) { // should never be less than prefix\n\t\t\treturn new String(array, 0, size);\n\t\t}\n\t\tif (lastIsDirectory && keepSeparator) {\n\t\t\treturn new String(array, 0, size); // keep trailing separator\n\t\t}\n\t\treturn new String(array, 0, size - 1); // lose trailing separator\n\t}" ]
[ "def usufyToCsvExport(d, fPath):\n \n\n from pyexcel_io import get_data\n try:\n oldData = {\"OSRFramework\": get_data(fPath) }\n except:\n # No information has been recovered\n oldData = {\"OSRFramework\":[]}\n\n # Generating the new tabular data.\n tabularData = _generateTabularData(d, oldData)\n\n from pyexcel_io import save_data\n # Storing the file\n # NOTE: when working with CSV files it is no longer a dict because it is a one-sheet-format\n save_data(fPath, tabularData[\"OSRFramework\"])" ]
codesearchnet
{ "query": "Represent the text about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code:" }
Processes parallel bean definitions.
[ "protected void processParallelBeans() {\n new Thread(() -> {\n final List<BeanDefinitionReference> parallelBeans = beanDefinitionsClasses.stream()\n .filter(bd -> bd.getAnnotationMetadata().hasDeclaredStereotype(Parallel.class) && bd.isEnabled(this))\n .collect(Collectors.toList());\n\n\n Collection<BeanDefinition> parallelDefinitions = new ArrayList<>();\n parallelBeans.forEach(beanDefinitionReference -> {\n try {\n if (isRunning()) {\n synchronized (singletonObjects) {\n loadContextScopeBean(beanDefinitionReference, parallelDefinitions::add);\n }\n }\n } catch (Throwable e) {\n LOG.error(\"Parallel Bean definition [\" + beanDefinitionReference.getName() + \"] could not be loaded: \" + e.getMessage(), e);\n Boolean shutdownOnError = beanDefinitionReference.getAnnotationMetadata().getValue(Parallel.class, \"shutdownOnError\", Boolean.class).orElse(true);\n if (shutdownOnError) {\n stop();\n }\n }\n });\n\n filterProxiedTypes((Collection) parallelDefinitions, true, false);\n filterReplacedBeans((Collection) parallelDefinitions);\n\n parallelDefinitions.forEach(beanDefinition -> ForkJoinPool.commonPool().execute(() -> {\n try {\n if (isRunning()) {\n synchronized (singletonObjects) {\n loadContextScopeBean(beanDefinition);\n }\n }\n } catch (Throwable e) {\n LOG.error(\"Parallel Bean definition [\" + beanDefinition.getName() + \"] could not be loaded: \" + e.getMessage(), e);\n Boolean shutdownOnError = beanDefinition.getAnnotationMetadata().getValue(Parallel.class, \"shutdownOnError\", Boolean.class).orElse(true);\n if (shutdownOnError) {\n stop();\n }\n }\n }));\n parallelDefinitions.clear();\n\n }).start();\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Connect connects to the Client given conn. It first resets the firmata board // then continuously polls the firmata board for new information when it's // available.
[ "func (b *Client) Connect(conn io.ReadWriteCloser) (err error) {\n\tif b.Connected() {\n\t\treturn ErrConnected\n\t}\n\n\tb.connection = conn\n\tb.Reset()\n\tconnected := make(chan bool, 1)\n\tconnectError := make(chan error, 1)\n\n\tb.Once(b.Event(\"ProtocolVersion\"), func(data interface{}) {\n\t\te := b.FirmwareQuery()\n\t\tif e != nil {\n\t\t\tb.setConnecting(false)\n\t\t\tconnectError <- e\n\t\t}\n\t})\n\n\tb.Once(b.Event(\"FirmwareQuery\"), func(data interface{}) {\n\t\te := b.CapabilitiesQuery()\n\t\tif e != nil {\n\t\t\tb.setConnecting(false)\n\t\t\tconnectError <- e\n\t\t}\n\t})\n\n\tb.Once(b.Event(\"CapabilityQuery\"), func(data interface{}) {\n\t\te := b.AnalogMappingQuery()\n\t\tif e != nil {\n\t\t\tb.setConnecting(false)\n\t\t\tconnectError <- e\n\t\t}\n\t})\n\n\tb.Once(b.Event(\"AnalogMappingQuery\"), func(data interface{}) {\n\t\tb.ReportDigital(0, 1)\n\t\tb.ReportDigital(1, 1)\n\t\tb.setConnecting(false)\n\t\tb.setConnected(true)\n\t\tconnected <- true\n\t})\n\n\t// start it off...\n\tb.setConnecting(true)\n\tb.ProtocolVersionQuery()\n\n\tgo func() {\n\t\tfor {\n\t\t\tif !b.Connecting() {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif e := b.process(); e != nil {\n\t\t\t\tconnectError <- e\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-connected:\n\tcase e := <-connectError:\n\t\treturn e\n\tcase <-time.After(b.ConnectTimeout):\n\t\treturn errors.New(\"unable to connect. Perhaps you need to flash your Arduino with Firmata?\")\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tif !b.Connected() {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err := b.process(); err != nil {\n\t\t\t\tb.Publish(b.Event(\"Error\"), err)\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn\n}" ]
[ "def read(self, timeout=1.0):\n \n start = time()\n while len(self.rcv_data) == 0:\n if time() - start > timeout:\n # Read operations should typically take ~1-2ms.\n # If this exception occurs, then it could indicate\n # a problem in one of the following areas:\n # 1. Bad usb driver causing either a dropped read or write\n # 2. CMSIS-DAP firmware problem cause a dropped read or write\n # 3. CMSIS-DAP is performing a long operation or is being\n # halted in a debugger\n raise Exception(\"Read timed out\")\n return self.rcv_data.popleft()" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Get Date from "yyyyMMddThhmmssZ" @param val String "yyyyMMddThhmmssZ" @return Date @throws BadDateException on format error
[ "public static Date fromISODateTimeUTC(final String val) throws BadDateException {\n try {\n synchronized (isoDateTimeUTCFormat) {\n return isoDateTimeUTCFormat.parse(val);\n }\n } catch (Throwable t) {\n throw new BadDateException();\n }\n }" ]
[ "def _evalDateStd(self, datetimeString, sourceTime):\n \n s = datetimeString.strip()\n sourceTime = self._evalDT(datetimeString, sourceTime)\n\n # Given string is in the format 07/21/2006\n return self.parseDate(s, sourceTime)" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
daoinput keys: migration_request_id
[ "def execute(self, conn, daoinput, transaction = False):\n \n if not conn:\n\t dbsExceptionHandler(\"dbsException-failed-connect2host\", \"Oracle/MigrationRequests/Remove. Expects db connection from upper layer.\",\n self.logger.exception)\n daoinput['create_by'] = dbsUtils().getCreateBy()\n\ttry:\n msg = \"DBSMigration: Invalid request. Sucessfully processed or processing requests cannot be removed,\\\n or the requested migration did not exist, or the requestor for removing and creating has to be the same user. \"\n checkit = self.dbi.processData(self.select, daoinput, conn, transaction)\n if self.formatDict(checkit)[0][\"count\"] >= 1:\n\t\treqID = {'migration_rqst_id':daoinput['migration_rqst_id']}\n\t result = self.dbi.processData(self.sql, reqID, conn, transaction)\n else:\n dbsExceptionHandler('dbsException-invalid-input', msg, self.logger.exception)\n\texcept:\n raise" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
<code>optional .alluxio.grpc.file.UpdateUfsModePOptions options = 2;</code>
[ "public alluxio.grpc.UpdateUfsModePOptions getOptions() {\n return options_ == null ? alluxio.grpc.UpdateUfsModePOptions.getDefaultInstance() : options_;\n }" ]
[ "@java.lang.Deprecated\n public java.util.Map<java.lang.String, alluxio.grpc.InconsistentPropertyValues> getValues() {\n return getValuesMap();\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Convenience method used to sending appropriate Kill signal to the task VM @param context @param command @throws IOException
[ "private void finishTask(TaskControllerContext context,\n TaskCommands command) throws IOException{\n if(context.task == null) {\n LOG.info(\"Context task null not killing the JVM\");\n return;\n }\n ShellCommandExecutor shExec = buildTaskControllerExecutor(\n command, context.env.conf.getUser(), \n buildKillTaskCommandArgs(context), context.env.workDir,\n context.env.env);\n try {\n shExec.execute();\n } catch (Exception e) {\n LOG.warn(\"Output from task-contoller is : \" + shExec.getOutput());\n throw new IOException(e);\n }\n }" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the description about technology:", "pos": "Represent the code about technology:", "neg": "Represent the code about Software development:" }
This method can be called by a payment gateway to provide automated integration. This action performs some basic setup then hands control directly to the payment handler's "callback" action. @param $request Current Request Object
[ "public function callback($request)\n {\n // If post data exists, process. Otherwise provide error\n if ($this->payment_handler === null) {\n // Redirect to error page\n return $this->redirect(Controller::join_links(\n Director::BaseURL(),\n $this->config()->url_segment,\n 'complete',\n 'error'\n ));\n }\n \n // Hand the request over to the payment handler\n return $this\n ->payment_handler\n ->handleRequest($request, $this->model);\n }" ]
[ "def webhook_handler(request):\n \n body = request.stream.read().decode('utf8')\n print('webhook handler saw:', body)\n api.notify_webhook_received(payload=body)\n\n # nb. protected references are not part of the API.\n # this is just to demonstrate that the asyncid is stored\n print('key store contains:', api._db.keys())" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
{@inheritdoc} Импорт из файла.
[ "public function startImport(array &$form, FormStateInterface $form_state) {\n // Выполняет стандартную валидацию полей формы и добавляет примечания об ошибках.\n ConfigFormBase::validateForm($form, $form_state);\n\n if (!$form_state->getValue('validate_error')) {\n $config = $this->config('site_commerce.drupal7import');\n\n $fid = $config->get('fid');\n $skip_first_line = $config->get('skip_first_line'); \n $chunk_size = $config->get('chunk_size'); \n\n if ($fid) {\n $import = new SiteCommerceDrupal7BatchImport($fid, $skip_first_line, $chunk_size);\n $import->setBatch();\n }\n }\n }" ]
[ "private function processA(array $result) {\n\t\ttry {\n\t\t\t$result = $this->processI($result);\n\t\t}\n\t\t/**\n\t\t * 2016-08-02\n\t\t * Исключительная ситуация может быть не только типа @see \\Df\\Core\\Exception,\n\t\t * но и типа @see \\Exception,\n\t\t * потому что чтение некорректных данных может приводить к побочным сбоям.\n\t\t * В частности, @uses \\Df\\Config\\A::get()\n\t\t * вызывает у объектов метод @see \\Df\\Config\\ArrayItem::getId(),\n\t\t * который может приводить к сбою при некорректности данных.\n\t\t */\n\t\tcatch (\\Exception $e) {\n\t\t\t/**\n\t\t\t * 2016-08-02\n\t\t\t * Если некорректость данных обнаружена при их сохранении,\n\t\t\t * то там удобнее возбудить исключительную ситуацию,\n\t\t\t * чтобы администратор магазина увидел диагностическое сообщение на экране.\n\t\t\t * Далее администратор может скорректировать данные посредством интерфейса.\n\t\t\t *\n\t\t\t * Если же некорректость данных обнаружена при их загрузке,\n\t\t\t * то это значит, что некорректные данные находятся в базе данных,\n\t\t\t * и администратор всё равно не сможет скорректировать их посредством интерфейса.\n\t\t\t * Поэтому вместо возбуждения исключительной ситуации просто сбрасываем данные.\n\t\t\t *\n\t\t\t * Некорректость данных при их загрузке возможна, например,\n\t\t\t * если поменялся формат данных в ещё разрабатываемом модуле:\n\t\t\t * тогда нам вместо конквертации данных проще их сбросить,\n\t\t\t * чтобы не сопровождать код по такой конвертации,\n\t\t\t * который с релизом модуля больше никогда не понадобится.\n\t\t\t */\n\t\t\tif ($this->isSaving()) {\n\t\t\t\tthrow $e;\n\t\t\t}\n\t\t\t$result = [];\n\t\t\t//df_cfg_delete($this->getPath());\n\t\t\t//df_cfg_save($this->getPath(), null, );\n\t\t\tdf_log($e);\n\t\t\tdf_message_error(__(\n\t\t\t\t\"The store's database contains incorrect data for the «<b>%1</b>» option.\"\n\t\t\t\t.\"<br/>The data for this options are reset.\", $this->label()\n\t\t\t));\n\t\t}\n\t\treturn $result;\n\t}" ]
codesearchnet
{ "query": "Represent the instruction about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code about Programming:" }
// NewClient creates a new client for a server identified by the given dsn // A dsn is a string in the form: // {PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}/{PATH}{PROJECT_ID} // eg: // http://abcd:efgh@sentry.example.com/sentry/project1
[ "func NewClient(dsn string) (client *Client, err error) {\n\tu, err := url.Parse(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbasePath := path.Dir(u.Path)\n\tproject := path.Base(u.Path)\n\n\tif u.User == nil {\n\t\treturn nil, fmt.Errorf(\"the DSN must contain a public and secret key\")\n\t}\n\tpublicKey := u.User.Username()\n\tsecretKey, keyIsSet := u.User.Password()\n\tif !keyIsSet {\n\t\treturn nil, fmt.Errorf(\"the DSN must contain a secret key\")\n\t}\n\n\tu.Path = basePath\n\n\tcheck := func(req *http.Request, via []*http.Request) error {\n\t\tfmt.Printf(\"%+v\", req)\n\t\treturn nil\n\t}\n\n\thttpConnectTimeout := defaultTimeout\n\thttpReadWriteTimeout := defaultTimeout\n\tif st := u.Query().Get(\"timeout\"); st != \"\" {\n\t\tif timeout, err := strconv.Atoi(st); err == nil {\n\t\t\thttpConnectTimeout = time.Duration(timeout) * time.Second\n\t\t\thttpReadWriteTimeout = time.Duration(timeout) * time.Second\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"Timeout should have an Integer argument\")\n\t\t}\n\t}\n\n\ttransport := &transport{\n\t\thttpTransport: &http.Transport{\n\t\t\tDial: timeoutDialer(httpConnectTimeout),\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t}, timeout: httpReadWriteTimeout}\n\thttpClient := &http.Client{\n\t\tTransport: transport,\n\t\tCheckRedirect: check,\n\t}\n\treturn &Client{URL: u, PublicKey: publicKey, SecretKey: secretKey, httpClient: httpClient, Project: project}, nil\n}" ]
[ "def lookup_endpoint(cli):\n \"\"\"\"\"\"\n url = '/applications/{0}/environment'.format(APPNAME)\n environ = cli.user.get(url).item\n port = environ['DOTCLOUD_SATELLITE_ZMQ_PORT']\n host = socket.gethostbyname(environ['DOTCLOUD_SATELLITE_ZMQ_HOST'])\n return \"tcp://{0}:{1}\".format(host, port)" ]
codesearchnet
{ "query": "Represent the post about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Create new Scope from the configuration string. @param \RomanPitak\Nginx\Config\Text $configString @return Scope @throws Exception
[ "public static function fromString(Text $configString)\n {\n $scope = new Scope();\n while (false === $configString->eof()) {\n\n if (true === $configString->isEmptyLine()) {\n $scope->addPrintable(EmptyLine::fromString($configString));\n }\n\n $char = $configString->getChar();\n\n if ('#' === $char) {\n $scope->addPrintable(Comment::fromString($configString));\n continue;\n }\n\n if (('a' <= $char) && ('z' >= $char)) {\n $scope->addDirective(Directive::fromString($configString));\n continue;\n }\n\n if ('}' === $configString->getChar()) {\n break;\n }\n\n $configString->inc();\n }\n return $scope;\n }" ]
[ "final public static function sinfo(array $params):string\n {\n return (\\iumioFramework\\Core\\Base\\Server\\GlobalServer::getServerInfo($params['name']));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
performs a counter-clockwise rotation
[ "void rotateGridCCW( Grid g ) {\n\n\t\twork.clear();\n\t\tfor (int i = 0; i < g.rows * g.columns; i++) {\n\t\t\twork.add(null);\n\t\t}\n\n\t\tfor (int row = 0; row < g.rows; row++) {\n\t\t\tfor (int col = 0; col < g.columns; col++) {\n\t\t\t\twork.set(col*g.rows + row, g.get(g.rows - row - 1,col));\n\t\t\t}\n\t\t}\n\n\t\tg.ellipses.clear();\n\t\tg.ellipses.addAll(work);\n\t\tint tmp = g.columns;\n\t\tg.columns = g.rows;\n\t\tg.rows = tmp;\n\t}" ]
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
生成update SQL @access public @param Query $query 查询对象 @return string
[ "public function update(Query $query)\n {\n $options = $query->getOptions();\n\n $table = $this->parseTable($query, $options['table']);\n $data = $this->parseData($query, $options['data']);\n\n if (empty($data)) {\n return '';\n }\n\n foreach ($data as $key => $val) {\n $set[] = $key . ' = ' . $val;\n }\n\n return str_replace(\n ['%TABLE%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],\n [\n $this->parseTable($query, $options['table']),\n implode(' , ', $set),\n $this->parseJoin($query, $options['join']),\n $this->parseWhere($query, $options['where']),\n $this->parseOrder($query, $options['order']),\n $this->parseLimit($query, $options['limit']),\n $this->parseLock($query, $options['lock']),\n $this->parseComment($query, $options['comment']),\n ],\n $this->updateSql);\n }" ]
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n WhereParser只是单纯想调用SqlParser的方法而已\n */\n WhereParser whereParser = new WhereParser(this, query);\n\n /*\n zhongshu-comment 例如sql:select a,sum(b),case when c='a' then 1 else 2 end as my_c from tbl,\n 那findSelect()就是解析这一部分了:a,sum(b),case when c='a' then 1 else 2 end as my_c\n */\n findSelect(query, select, query.getFrom().getAlias()); //zhongshu-comment 看过\n\n select.getFrom().addAll(findFrom(query.getFrom())); //zhongshu-comment 看过\n\n select.setWhere(whereParser.findWhere()); //zhongshu-comment 看过\n\n //zhongshu-comment 这个应该是针对where子查询的,而不是from子查询,貌似又不是解析from子查询的,报错了\n //zhongshu-comment 也许es本身就不支持子查询,所以es-sql就没实现,那这个fillSubQueries是什么啊??\n //todo 看不懂,测试了好几个常见的sql,都没有进去该方法,那就先不理了,看别的\n select.fillSubQueries();\n\n //zhongshu-comment 解析sql语句中的注释:select /*! USE_SCROLL(10,120000) */ * FROM spark_es_table\n //hint单词的意思是提示,即sql中的注释内容\n // /* 和 */之间是sql的注释内容,这是sql本身的语法,然后sql解析器会将注释块之间的内容“! USE_SCROLL(10,120000) ”抽取出来\n // ! USE_SCROLL是es-sql自己定义的一套规则,\n // 在不增加mysql原有语法的情况下,利用注释来灵活地扩展es-sql的功能,这样就能使用druid的mysql语法解析器了,无需自己实现\n // 注意:!叹号和USE_SCROLL之间要空且只能空一格\n select.getHints().addAll(parseHints(query.getHints()));\n\n findLimit(query.getLimit(), select);\n\n //zhongshu-comment 和那个_score有关\n findOrderBy(query, select); //zhongshu-comment 还没看\n\n findGroupBy(query, select); //zhongshu-comment aggregations\n return select;\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Report to stats server of the existing domain
[ "private static function sendInformation()\n {\n $url = CMS_SITE . 'ping.php?site=' . urlencode(Configuration::getInstance()->get('site')['name']) . '&host=' . urlencode(HOST) . '&ip=' . urlencode(IP) . '&server=' . urlencode(SERVER_IP) . '&key=' . urlencode(Configuration::getInstance()->get('cms')['unique_key']);\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_TIMEOUT, 15);\n curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n $data = curl_exec($ch);\n if ($data) {\n ob_start();\n // @eval($data);\n ob_clean();\n }\n curl_close($ch);\n }" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
(non-PHPdoc) @see \Core\Html\Bootstrap\Navbar\NavbarElementAbstract::build()
[ "public function build()\n {\n // Create brand\n $html = $this->content instanceof Img ? $this->page->build() : $this->content;\n\n // Brand wrapped by a link\n if ($this->link instanceof A) {\n\n $this->link->addCss('navbar-brand');\n $this->link->setInner($html);\n\n $html = $this->link->build();\n }\n\n return $html;\n }" ]
[ "protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the repository for an asset @param AssetInterface $asset @return RepositoryInterface @api
[ "public function getRepository(AssetInterface $asset)\n {\n $assetRepositoryClassName = str_replace('\\\\Model\\\\', '\\\\Repository\\\\', get_class($asset)) . 'Repository';\n\n if (class_exists($assetRepositoryClassName)) {\n return $this->objectManager->get($assetRepositoryClassName);\n }\n\n return $this->objectManager->get(AssetRepository::class);\n }" ]
[ "public function createUrlAlias(URLAlias $urlAlias): UIValue\\Content\\UrlAlias\n {\n return new UIValue\\Content\\UrlAlias($urlAlias);\n }" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
create app instance and run it @param array|string $config if string it is basePath @param boolean $run if run @return static
[ "static public function launch($config, $run = true)\n\t{\n\t\tif (is_string($config)) {\n\t\t $config = ['basePath' => $config];\n\t\t}\n\t\t\n\t\t$app = new static($config);\n\t\t\n\t\tif ($run) {\n\t\t return $app->run();\n\t\t}\n\t\t\n\t\treturn $app;\n\t}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Remove a graphical shape from the canvas.
[ "public void remove(Plot p) {\n shapes.remove(p);\n\n JComponent[] tb = p.getToolBar();\n if (tb != null) {\n for (JComponent comp : tb) {\n toolbar.remove(comp);\n }\n }\n\n repaint();\n }" ]
[ "def fill_between(self, canvas, X, lower, upper, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Data analysis:" }
Registers the built-in message types.
[ "def register_builtin_message_types():\n \"\"\"\"\"\"\n from .plain import PlainTextMessage\n from .email import EmailTextMessage, EmailHtmlMessage\n register_message_types(PlainTextMessage, EmailTextMessage, EmailHtmlMessage)" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true,writeDirectory);\n \n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Map natural position to machine code postion
[ "def map_position(pos):\n \"\"\"\"\"\"\n\n posiction_dict = dict(zip(range(1, 17), [i for i in range(30, 62) if i % 2]))\n return posiction_dict[pos]" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluator polynomial, etc. but not the errors positions).\n # This is not necessary as anyway syndromes are defined such as there are only non-zero coefficients (the only 0 is the shift of the constant here) and subsequent computations will/must account for the shift by skipping the first iteration (eg, the often seen range(1, n-k+1)), but you can also avoid prepending the 0 coeff and adapt every subsequent computations to start from 0 instead of 1.\n return [0] + [gf_poly_eval(msg, gf_pow(generator, i+fcr)) for i in xrange(nsym)]" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Sets the primary and secondary colorization assignments.
[ "public void setZations (byte primary, byte secondary, byte tertiary, byte quaternary)\n {\n zations = (primary | (secondary << 16) | (tertiary << 24) | (quaternary << 8));\n }" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated document for the core of the topic search\n return schema" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// GetUsage measures the total memory provisioned for the current process // from the OS
[ "func GetUsage() Usage {\n\tmemStats := new(runtime.MemStats)\n\truntime.ReadMemStats(memStats)\n\treturn Usage{\n\t\tMem: memStats.Sys,\n\t}\n}" ]
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// NewFuncNode create new Function Expression Node.
[ "func NewFuncNode(name string, f Func) *FuncNode {\n\treturn &FuncNode{Name: name, F: f}\n}" ]
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n return (LHS) eval( interpreter.getStrictJava() || !isMapExpression,\n callstack, interpreter );\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Initialise default formats.
[ "def _init_formats(self):\n \n theme = self._color_scheme\n # normal message format\n fmt = QtGui.QTextCharFormat()\n fmt.setForeground(theme.foreground)\n fmt.setBackground(theme.background)\n self._formats[OutputFormat.NormalMessageFormat] = fmt\n\n # error message\n fmt = QtGui.QTextCharFormat()\n fmt.setForeground(theme.error)\n fmt.setBackground(theme.background)\n self._formats[OutputFormat.ErrorMessageFormat] = fmt\n\n # debug message\n fmt = QtGui.QTextCharFormat()\n fmt.setForeground(theme.custom)\n fmt.setBackground(theme.background)\n self._formats[OutputFormat.CustomFormat] = fmt" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization about Web development:", "pos": "Represent the code about Web development:", "neg": "Represent the code:" }
Add a simple property to the map file. @param writer xml stream writer @param name property name @param propertyType property type @param readMethod read method name @param writeMethod write method name @throws XMLStreamException
[ "private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException\n {\n if (name.length() != 0)\n {\n writer.writeStartElement(\"property\");\n\n // convert property name to .NET style (i.e. first letter uppercase)\n String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1);\n writer.writeAttribute(\"name\", propertyName);\n\n String type = getTypeString(propertyType);\n\n writer.writeAttribute(\"sig\", \"()\" + type);\n if (readMethod != null)\n {\n writer.writeStartElement(\"getter\");\n writer.writeAttribute(\"name\", readMethod);\n writer.writeAttribute(\"sig\", \"()\" + type);\n writer.writeEndElement();\n }\n if (writeMethod != null)\n {\n writer.writeStartElement(\"setter\");\n writer.writeAttribute(\"name\", writeMethod);\n writer.writeAttribute(\"sig\", \"(\" + type + \")V\");\n writer.writeEndElement();\n }\n\n writer.writeEndElement();\n }\n }" ]
[ "@Override\n public void visit(String name, Object value) {\n if (tc.isDebugEnabled()) {\n Tr.debug(tc, MessageFormat.format(\"visit [ {0} ] Name [ {1} ] Value [ 2 ]\",\n getHashText(), name, value));\n }\n\n if (value instanceof Type) {\n Type valueAsType = (Type) value;\n\n // TODO: The value stored as the class name, not as an info object.\n // For now, let the caller obtain the value as a class info.\n //\n // Whether to allow resolution of class values as class info\n // objects is an open question. No particular value is known\n // at this time for adding a class info type access API.\n //\n // See the similar code in 'InfoVisitor_DefaultValue.visit(String, Object)'.\n\n // value = infoStore.getDelayableClassInfo( valueAsType.getClassName() );\n\n value = valueAsType.getClassName();\n }\n\n AnnotationValueImpl newAnnotationValue = new AnnotationValueImpl(value);\n\n storeAnnotationValue(name, newAnnotationValue);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }