query
stringlengths 16
255
| pos
list | neg
list | task
stringclasses 1
value | instruction
dict |
|---|---|---|---|---|
Process the directory of JSON files using the collected pattern ids
@param string[] $coveredIds
|
[
"public function process(array $coveredIds) : void\n {\n $this->setCoveredPatternIds($coveredIds);\n\n $finder = new Finder();\n $finder->files();\n $finder->name('*.json');\n $finder->ignoreDotFiles(true);\n $finder->ignoreVCS(true);\n $finder->sortByName();\n $finder->ignoreUnreadableDirs();\n $finder->in($this->resourceDir);\n\n foreach ($finder as $file) {\n /* @var \\Symfony\\Component\\Finder\\SplFileInfo $file */\n\n /** @var string $patternFileName */\n $patternFileName = mb_substr($file->getPathname(), (int) mb_strpos($file->getPathname(), 'resources/'));\n\n if (!isset($this->coveredIds[$patternFileName])) {\n $this->coveredIds[$patternFileName] = [];\n }\n\n $this->coverage[$patternFileName] = $this->processFile(\n $patternFileName,\n $file->getContents(),\n $this->coveredIds[$patternFileName]\n );\n }\n }"
] |
[
"def _get_result_paths(self, data):\n \n\n # Swarm OTU map (mandatory output)\n return {'OtuMap': ResultPath(Path=self.Parameters['-o'].Value,\n IsWritten=True)}"
] |
codesearchnet
|
{
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
}
|
Gets the rdns String name
:param rdns: RDNS object
:type rdns: cryptography.x509.RelativeDistinguishedName
:return: RDNS name
|
[
"def get_rdns_name(rdns):\n \n name = ''\n for rdn in rdns:\n for attr in rdn._attributes:\n if len(name) > 0:\n name = name + ','\n if attr.oid in OID_NAMES:\n name = name + OID_NAMES[attr.oid]\n else:\n name = name + attr.oid._name\n name = name + '=' + attr.value\n return name"
] |
[
"def certificate_issuer(self, value):\n \n\n if value is not None:\n is_oscrypto = isinstance(value, asymmetric.Certificate)\n if not is_oscrypto and not isinstance(value, x509.Certificate):\n raise TypeError(_pretty_message(\n '''\n certificate_issuer must be an instance of\n asn1crypto.x509.Certificate or\n oscrypto.asymmetric.Certificate, not %s\n ''',\n _type_name(value)\n ))\n\n if is_oscrypto:\n value = value.asn1\n\n self._certificate_issuer = value"
] |
codesearchnet
|
{
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
}
|
// MountHealthController "mounts" a Health resource controller on the given service.
|
[
"func MountHealthController(service *goa.Service, ctrl HealthController) {\n\tinitService(service)\n\tvar h goa.Handler\n\tservice.Mux.Handle(\"OPTIONS\", \"/cellar/_ah/health\", ctrl.MuxHandler(\"preflight\", handleHealthOrigin(cors.HandlePreflight()), nil))\n\n\th = func(ctx context.Context, rw http.ResponseWriter, req *http.Request) error {\n\t\t// Check if there was an error loading the request\n\t\tif err := goa.ContextError(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Build the context\n\t\trctx, err := NewHealthHealthContext(ctx, req, service)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ctrl.Health(rctx)\n\t}\n\th = handleHealthOrigin(h)\n\tservice.Mux.Handle(\"GET\", \"/cellar/_ah/health\", ctrl.MuxHandler(\"health\", h, nil))\n\tservice.LogInfo(\"mount\", \"ctrl\", \"Health\", \"action\", \"Health\", \"route\", \"GET /cellar/_ah/health\")\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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
}
|
// SendAudioWithKeyboardHide send a audio with explicit Keyboard Hide.
|
[
"func (bot TgBot) SendAudioWithKeyboardHide(cid int, audio string, duration *int, performer *string, title *string, rmi *int, rm ReplyKeyboardHide) ResultWithMessage {\n\tvar rkm ReplyMarkupInt = rm\n\treturn bot.SendAudio(cid, audio, duration, performer, title, rmi, &rkm)\n}"
] |
[
"def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence"
] |
codesearchnet
|
{
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
<p>
set data-* attribute
</p>
<pre>
Div div = new Div();
div.setData("foo", "bar");
// you get <div data-foo="bar"></div>
</pre>
@param key
data-"key"
|
[
"public void setData(String key, String value) {\n QName qn = new QName(\"data-\" + key);\n this.getOtherAttributes().put(qn, value);\n }"
] |
[
"def html(self):\n \n return \"\"\"\n <div class=\"property\"><i>{name}</i><br/>\n <pre>{value}</pre></div>\n \"\"\".format(name=tag.text(self.name), value=tag.text(self.value))"
] |
codesearchnet
|
{
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
}
|
Unserialize an embedded collection
Return a collection of serialized objects (arrays)
@param MapperInterface $mapper
@param array $data
@return array
|
[
"protected function unserializeEmbeddedCollection(MapperInterface $mapper, array $data)\n {\n $collection = array();\n foreach ($data as $document) {\n $collection[] = $mapper->unserialize($document);\n }\n\n return $collection;\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 Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
}
|
stops the timer with a given name.
:param name: the name of the timer
:type name: string
|
[
"def stop(cls, name):\n \n cls.timer_end[name] = time.time()\n if cls.debug:\n print(\"Timer\", name, \"stopped ...\")"
] |
[
"def interface_required(interface):\n \n def _interface_required(func):\n \"\"\"Internal decorator that wraps around the decorated function.\n\n Args:\n func (function): function being decorated\n\n Returns:\n The wrapper function.\n \"\"\"\n @functools.wraps(func)\n def wrapper(self, *args, **kwargs):\n \"\"\"Wrapper function to check that the given ``JLink`` has the\n same interface as the one specified by the decorator.\n\n Args:\n self (JLink): the ``JLink`` instance\n args: list of arguments to pass to ``func``\n kwargs: key-word arguments dict to pass to ``func``\n\n Returns:\n The return value of the wrapped function.\n\n Raises:\n JLinkException: if the current interface is not supported by\n the wrapped method.\n \"\"\"\n if self.tif != interface:\n raise errors.JLinkException('Unsupported for current interface.')\n return func(self, *args, **kwargs)\n return wrapper\n return _interface_required"
] |
codesearchnet
|
{
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
}
|
Gets an object using a from clause.
@param type The type of the desired object.
@param clause The WHERE clause.
@param args The arguments for the WHERE clause.
@param <T> The type of the object.
@return The object or {@code null}
|
[
"public static <T> T objectFromClause(Class<T> type, String clause, Object... args)\n {\n return SqlClosure.sqlExecute(c -> OrmElf.objectFromClause(c, type, clause, args));\n }"
] |
[
"public static IGroupMember getGroupMember(String key, Class<?> type) throws GroupsException {\n /*\n * WARNING: The 'type' parameter is not the leafType; you're obligated\n * to say whether you want a group or a non-group (i.e. some type of\n * entity). In fact, the underlying implementation blindly instantiates\n * whatever you tell it to.\n */\n\n LOGGER.trace(\"Invoking getEntity for key='{}', type='{}'\", key, type);\n return instance().igetGroupMember(key, type);\n }"
] |
codesearchnet
|
{
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
}
|
pickedPage można podać wcześniej przy konstruktorze
@param int $pickedPage
@return SqlPaginateParams
|
[
"public function getSqlPaginateParams($pickedPage = false) {\r\n $p = new SqlPaginateParams();\r\n if ($pickedPage) {\r\n $this->pickedPage = $pickedPage;\r\n }\r\n if ($this->pages == 0) {\r\n $p->setOffset(0);\r\n $p->setLimit(20);\r\n return $p;\r\n }\r\n if ($this->pickedPage > $this->pages) {\r\n $this->pickedPage = $this->pages;\r\n }\r\n if ($this->pickedPage < 1) {\r\n $this->pickedPage = 1;\r\n }\r\n $p->setOffset($this->pickedPage * $this->elementsPerPage - $this->elementsPerPage);\r\n $p->setLimit($this->elementsPerPage);\r\n\r\n return $p;\r\n }"
] |
[
"public function dispatch()\n {\n //wpięcie dla pluginów przed routingiem\n $this->routeStartup();\n $frontController = FrontController::getInstance();\n //ustawianie requestu po zdekodowaniu żądania przez router\n $frontController->getRequest()\n ->setParams($frontController->getRouter()->decodeUrl($frontController->getEnvironment()->requestUri));\n //informacja o zakończeniu ustawiania routingu\n $frontController->getProfiler()->event('Mvc\\Dispatcher: routing applied');\n //wpięcie dla pluginów przed dispatchem\n $this->preDispatch();\n //ustawianie contentu po wykonaniu requestu\n return $frontController->getResponse()->setContent(\\Mmi\\Mvc\\ActionHelper::getInstance()->forward($frontController->getRequest()));\n }"
] |
codesearchnet
|
{
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
}
|
Query for intersections of terms in two lists
Return a list of intersection result objects with keys:
- x : term from x
- y : term from y
- c : count of intersection
- j : jaccard score
|
[
"def query_intersections(self, x_terms=None, y_terms=None, symmetric=False):\n \n if x_terms is None:\n x_terms = []\n if y_terms is None:\n y_terms = []\n xset = set(x_terms)\n yset = set(y_terms)\n zset = xset.union(yset)\n\n # first built map of gene->termClosure.\n # this could be calculated ahead of time for all g,\n # but this may be space-expensive. TODO: benchmark\n gmap={}\n for z in zset:\n gmap[z] = []\n for subj in self.subjects:\n ancs = self.inferred_types(subj)\n for a in ancs.intersection(zset):\n gmap[a].append(subj)\n for z in zset:\n gmap[z] = set(gmap[z])\n ilist = []\n for x in x_terms:\n for y in y_terms:\n if not symmetric or x<y:\n shared = gmap[x].intersection(gmap[y])\n union = gmap[x].union(gmap[y])\n j = 0\n if len(union)>0:\n j = len(shared) / len(union)\n ilist.append({'x':x,'y':y,'shared':shared, 'c':len(shared), 'j':j})\n return ilist"
] |
[
"def set_prop(self, prop, value, ef=None):\n \n if ef:\n # prop should be restricted to n_decoys, an int, the no. of decoys corresponding to a given FPF.\n # value is restricted to the corresponding enrichment factor and should be a float\n self.ef[prop] = value\n else:\n if prop == 'ensemble':\n # value is a tuple of strings that gives the ensemble composition\n self.ensemble = value\n elif prop == 'auc':\n # value is a float that gives the auc value\n self.auc = value"
] |
codesearchnet
|
{
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
}
|
readFile fs promise wrapped
@param {string} path
@param {string} fileName
|
[
"function readFile(path, fileName) {\n return new Promise((resolve, reject) => {\n fs.readFile(`${path}/${fileName}`, 'utf8', (err, content) => {\n if (err) {\n return reject(err)\n }\n\n return resolve(content)\n })\n })\n}"
] |
[
"function function_ (options) {\n options.hash.kind = 'function'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find function.'\n}"
] |
codesearchnet
|
{
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitBuildSource.
|
[
"func (in *GitBuildSource) DeepCopy() *GitBuildSource {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitBuildSource)\n\tin.DeepCopyInto(out)\n\treturn out\n}"
] |
[
"func (resource *Bundle) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Bundle\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Bundle), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}"
] |
codesearchnet
|
{
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
}
|
:sockets:: socket list
:clean:: clean UTF8 strings or provide block to run on every read string
:pool:: ActionPool to use
Creates a new watcher for sockets
start the watcher
|
[
"def start\n if(@sockets.size < 0)\n raise 'No sockets available for listening'\n elsif(!@runner.nil? && @runner.alive?)\n raise AlreadyRunning.new\n else\n @stop = false\n @runner = Thread.new{watch}\n end\n end"
] |
[
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
}
|
Registers action aliases for current task
@param array $map Alias-to-filename hash array
|
[
"public function register_action_map($map)\n {\n if (is_array($map)) {\n foreach ($map as $idx => $val) {\n $this->action_map[$idx] = $val;\n }\n }\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 Data management:",
"pos": "Represent the code about Data management:",
"neg": "Represent the code:"
}
|
Create permission request
The call is idempotent; that is, if one posts the same pos_id and
pos_tid twice, only one Permission request is created.
|
[
"def create_permission_request(self, customer, pos_id, pos_tid, scope,\n ledger=None, text=None, callback_uri=None,\n expires_in=None):\n \n arguments = {'customer': customer,\n 'pos_id': pos_id,\n 'pos_tid': pos_tid,\n 'scope': scope,\n 'ledger': ledger,\n 'text': text,\n 'callback_uri': callback_uri,\n 'expires_in': expires_in}\n return self.do_req('POST',\n self.merchant_api_base_url + '/permission_request/',\n arguments).json()"
] |
[
"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'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'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 Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
}
|
// readv returns the tokens starting from the current position until the first
// match of t. A match is made only of t.typ and t.val are equal to the examined
// token.
|
[
"func (p *parser) readv(t token) ([]token, error) {\n\tvar tokens []token\n\tfor {\n\t\tread, err := p.readt(t.typ)\n\t\ttokens = append(tokens, read...)\n\t\tif err != nil {\n\t\t\treturn tokens, err\n\t\t}\n\t\tif len(read) > 0 && read[len(read)-1].val == t.val {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn tokens, nil\n}"
] |
[
"private static PortablePosition navigateToPathTokenWithoutQuantifier(\n PortableNavigatorContext ctx, PortablePathCursor path) throws IOException {\n if (path.isLastToken()) {\n // if it's a token that's on the last position we calculate its direct access position and return it for\n // reading in the value reader.\n return createPositionForReadAccess(ctx, path);\n } else {\n // if it's not a token that's on the last position in the path we advance the position to the next token\n // we also adjust the context, since advancing means that we are in the context of other\n // (and possibly different) portable type.\n if (!navigateContextToNextPortableTokenFromPortableField(ctx)) {\n // we return null if we didn't manage to advance from the current token to the next one.\n // For example: it may happen if the current token points to a null object.\n return nilNotLeafPosition();\n }\n }\n return null;\n }"
] |
codesearchnet
|
{
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Retrieve the pattern for the given package.
@param \Composer\Package\PackageInterface $package
@return string
|
[
"public function getPattern(PackageInterface $package)\n {\n if (isset($this->packages[$package->getName()])) {\n return $this->packages[$package->getName()];\n } elseif (isset($this->packages[$package->getPrettyName()])) {\n return $this->packages[$package->getPrettyName()];\n } elseif (isset($this->types[$package->getType()])) {\n return $this->types[$package->getType()];\n }\n }"
] |
[
"function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugin Of Content Object Provided.');\n }"
] |
codesearchnet
|
{
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
}
|
Add all the components to this calendar panel.
@param dateTarget This date needs to be in the calendar.
|
[
"public void layoutCalendar(Date timeTarget)\n {\n calendar.setTime(timeTarget);\n \n int hour = calendar.get(Calendar.HOUR_OF_DAY);\n int minute = calendar.get(Calendar.MINUTE);\n \n String[] array = new String[24 * 2];\n calendar.set(Calendar.HOUR_OF_DAY, 0);\n calendar.set(Calendar.MINUTE, 0);\n calendar.set(Calendar.SECOND, 0);\n calendar.set(Calendar.MILLISECOND, 0);\n int selectedIndex = -1;\n for (int i = 0; i < array.length; i++)\n {\n if (hour == calendar.get(Calendar.HOUR_OF_DAY))\n if (minute == calendar.get(Calendar.MINUTE))\n selectedIndex = i;\n Date time = calendar.getTime();\n String strTime = timeFormat.format(time);\n array[i] = strTime;\n calendar.add(Calendar.MINUTE, 30);\n }\n DefaultComboBoxModel model = new DefaultComboBoxModel(array);\n this.setVisibleRowCount(10);\n this.setModel(model);\n if (selectedIndex != -1)\n this.setSelectedIndex(selectedIndex);\n }"
] |
[
"@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the negative value\n }"
] |
codesearchnet
|
{
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
}
|
/* [MS-OSHARED] 2.3.3.1.4 Lpstr
|
[
"function parse_lpstr(blob, type, pad) {\n\tvar start = blob.l;\n\tvar str = blob.read_shift(0, 'lpstr-cp');\n\tif(pad) while((blob.l - start) & 3) ++blob.l;\n\treturn str;\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 Github sentence about MS-XLSB:",
"pos": "Represent the Github code about MS-XLSB:",
"neg": "Represent the Github code:"
}
|
Validate this measurement and update its 'outcome' field.
|
[
"def validate(self):\n \"\"\"\"\"\"\n # PASS if all our validators return True, otherwise FAIL.\n try:\n if all(v(self.measured_value.value) for v in self.validators):\n self.outcome = Outcome.PASS\n else:\n self.outcome = Outcome.FAIL\n return self\n except Exception as e: # pylint: disable=bare-except\n _LOG.error('Validation for measurement %s raised an exception %s.',\n self.name, e)\n self.outcome = Outcome.FAIL\n raise\n finally:\n if self._cached:\n self._cached['outcome'] = self.outcome.name"
] |
[
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
This method gets the singleton instance of this {@link CollectionReflectionUtilImpl}. <br>
<b>ATTENTION:</b><br>
Please prefer dependency-injection instead of using this method.
@return the singleton instance.
|
[
"public static CollectionReflectionUtilImpl getInstance() {\n\n if (instance == null) {\n synchronized (CollectionReflectionUtilImpl.class) {\n if (instance == null) {\n CollectionReflectionUtilImpl util = new CollectionReflectionUtilImpl();\n util.initialize();\n instance = util;\n }\n }\n }\n return instance;\n }"
] |
[
"private <T> T create(Class<T> pluginType, String className) {\n if (className == null) {\n throw new IllegalStateException(\n \"No default implementation for requested Mockito plugin type: \" + pluginType.getName() + \"\\n\"\n + \"Is this a valid Mockito plugin type? If yes, please report this problem to Mockito team.\\n\"\n + \"Otherwise, please check if you are passing valid plugin type.\\n\"\n + \"Examples of valid plugin types: MockMaker, StackTraceCleanerProvider.\");\n }\n try {\n // Default implementation. Use our own ClassLoader instead of the context\n // ClassLoader, as the default implementation is assumed to be part of\n // Mockito and may not be available via the context ClassLoader.\n return pluginType.cast(Class.forName(className).newInstance());\n } catch (Exception e) {\n throw new IllegalStateException(\"Internal problem occurred, please report it. \" +\n \"Mockito is unable to load the default implementation of class that is a part of Mockito distribution. \" +\n \"Failed to load \" + pluginType, e);\n }\n }"
] |
codesearchnet
|
{
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Add an 'OPTIONS' method supported on all routes for the pre-flight CORS request.
@param server a RestExpress server instance.
|
[
"private void addPreflightOptionsRequestSupport(RestExpress server, CorsOptionsController corsOptionsController)\n {\n\t RouteBuilder rb;\n\n\t for (String pattern : methodsByPattern.keySet())\n\t {\n\t \trb = server.uri(pattern, corsOptionsController)\n\t\t \t.action(\"options\", HttpMethod.OPTIONS)\n\t\t \t.noSerialization()\n\t\t \t// Disable both authentication and authorization which are usually use header such as X-Authorization.\n\t\t \t// When browser does CORS preflight with OPTIONS request, such headers are not included.\n\t\t \t.flag(Flags.Auth.PUBLIC_ROUTE)\n\t\t \t.flag(Flags.Auth.NO_AUTHORIZATION);\n\n\t \tfor (String flag : flags)\n\t \t{\n\t \t\trb.flag(flag);\n\t \t}\n\n\t \tfor (Entry<String, Object> entry : parameters.entrySet())\n\t \t{\n\t \t\trb.parameter(entry.getKey(), entry.getValue());\n\t \t}\n\n\t \trouteBuilders.add(rb);\n\t }\n }"
] |
[
"public Javalin addHandler(@NotNull HandlerType httpMethod, @NotNull String path, @NotNull Handler handler) {\n return addHandler(httpMethod, path, handler, new HashSet<>()); // no roles set for this route (open to everyone with default access manager)\n }"
] |
codesearchnet
|
{
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
}
|
/*
String[] validTypes = new String[]
{ "application/xhtml+xml",
"application/x-dtbncx+xml", "text/css" };
|
[
"void buildCSSTypesDictionary()\n {\n String description;\n String value;\n TextSearchDictionaryEntry de;\n\n\n //search eval() expression\n description = \"text/css\";\n value = \"text/css\";\n de = new TextSearchDictionaryEntry(description, value, MessageId.CSS_009);\n v.add(de);\n\n\n }"
] |
[
"function () {\n $(\"#addtrack\").css(\"visibility\",\"hidden\");\n var element = document.getElementsByTagName('path')[0];\n element.setAttribute(\"stroke\" , \"black\"); \n element.setAttribute(\"fill\" , \"none\");\n element = document.getElementsByTagName('line');\n for( var i=0 ; i<element.length ; i++)\n {\n element[i].setAttribute(\"stroke\" , \"black\");\n element[i].setAttribute(\"fill\" , \"none\");\n \n }\n var svg = document.querySelector(spec.timelineDiv+\" svg\");\n var serializer = new XMLSerializer();\n var source = serializer.serializeToString(svg);\n var link = document.createElement(\"a\");\n\n //name spaces\n if(!source.match(/^<svg[^>]+xmlns=\"http\\:\\/\\/www\\.w3\\.org\\/2000\\/svg\"/)){\n source = source.replace(/^<svg/, '<svg xmlns=\"http://www.w3.org/2000/svg\"');\n }\n if(!source.match(/^<svg[^>]+\"http\\:\\/\\/www\\.w3\\.org\\/1999\\/xlink\"/)){\n source = source.replace(/^<svg/, '<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"');\n }\n //xml declaration\n source = '<?xml version=\"1.0\" standalone=\"no\"?>\\r\\n' + source;\n\n //converting SVG source to URI data scheme.\n var url = \"data:image/svg+xml;charset=utf-8,\"+encodeURIComponent(source);\n link.download = \"clinical-timeline.svg\";\n link.href = url;\n link.click();\n $(\"#addtrack\").css(\"visibility\",\"visible\");\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
// TODO: This is hacky. Look into using a library like gojsonpointer[1] instead.
//
// [1] https://github.com/xeipuuv/gojsonpointer
|
[
"func (s *Schema) refToSchema(str string, rootSchema Schema, loadExternal bool) (*Schema, error) {\n\tparentURL, err := url.Parse(s.parentId)\n\tif err == nil && parentURL.IsAbs() {\n\t\tsURL, err := url.Parse(str)\n\t\tif err == nil && !sURL.IsAbs() && !strings.HasPrefix(str, \"#\") {\n\t\t\tstr = parentURL.ResolveReference(sURL).String()\n\t\t}\n\t}\n\n\tvar split []string\n\turl, err := url.Parse(str)\n\tcacheKey, cacheKeyErr := resolveCacheKey(str)\n\tif err == nil && cacheKeyErr == nil {\n\t\tcachedSchema, ok := rootSchema.Cache[cacheKey]\n\t\tif ok {\n\t\t\trootSchema = *cachedSchema\n\t\t} else {\n\t\t\t// Handle external URIs.\n\t\t\tif !loadExternal {\n\t\t\t\treturn new(Schema), errors.New(\"external schemas are disabled\")\n\t\t\t}\n\t\t\tresp, err := http.Get(str)\n\t\t\tif err != nil {\n\t\t\t\treturn new(Schema), errors.New(\"bad external url\")\n\t\t\t}\n\t\t\tdefer resp.Body.Close()\n\t\t\ts, err := ParseWithCache(resp.Body, loadExternal, &rootSchema.Cache)\n\t\t\tif err != nil {\n\t\t\t\treturn new(Schema), errors.New(\"error parsing external doc\")\n\t\t\t}\n\t\t\trootSchema.Cache[cacheKey] = s\n\t\t\trootSchema = *s\n\t\t}\n\t\tstr = url.Fragment\n\t}\n\n\t// Remove the prefix from internal URIs.\n\tstr = strings.TrimPrefix(str, \"#\")\n\tstr = strings.TrimPrefix(str, \"/\")\n\n\tsplit = strings.Split(str, \"/\")\n\t// Make replacements.\n\tfor i, v := range split {\n\t\tr := strings.NewReplacer(\"~0\", \"~\", \"~1\", \"/\", \"%25\", \"%\")\n\t\tsplit[i] = r.Replace(v)\n\t}\n\t// Resolve the local part of the URI.\n\treturn resolveLocalPath(split, rootSchema, str)\n}"
] |
[
"func IsNotFoundError(err error) bool {\n\tes := err.Error()\n\tif strings.Contains(es, \"does not exist\") {\n\t\t// set with the same name already exists\n\t\t// xref: https://github.com/Olipro/ipset/blob/master/lib/errcode.c#L32-L33\n\t\treturn true\n\t}\n\tif strings.Contains(es, \"element is missing\") {\n\t\t// entry is missing from the set\n\t\t// xref: https://github.com/Olipro/ipset/blob/master/lib/parse.c#L1904\n\t\t// https://github.com/Olipro/ipset/blob/master/lib/parse.c#L1925\n\t\treturn true\n\t}\n\treturn false\n}"
] |
codesearchnet
|
{
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
}
|
// Load loads data from Dump. If the input is not the same as the output from Dump() then it will return a error.
|
[
"func (s *AtomicSequence) Load(data []byte) error {\n\tif s.initialized {\n\t\treturn errors.New(\"cannot load into an initialized sequence\")\n\t}\n\n\tvals := make(map[string]uint64)\n\tif err := json.Unmarshal(data, &vals); err != nil {\n\t\treturn err\n\t}\n\n\tif val, ok := vals[\"current\"]; !ok {\n\t\treturn errors.New(\"improperly formatted data or sequence version\")\n\t} else {\n\t\tatomic.SwapUint64(&s.current, val)\n\t}\n\n\tif val, ok := vals[\"increment\"]; !ok {\n\t\treturn errors.New(\"improperly formatted data or sequence version\")\n\t} else {\n\t\tatomic.SwapUint64(&s.increment, val)\n\t}\n\n\tif val, ok := vals[\"minvalue\"]; !ok {\n\t\treturn errors.New(\"improperly formatted data or sequence version\")\n\t} else {\n\t\tatomic.SwapUint64(&s.minvalue, val)\n\t}\n\n\tif val, ok := vals[\"maxvalue\"]; !ok {\n\t\treturn errors.New(\"improperly formatted data or sequence version\")\n\t} else {\n\t\tatomic.SwapUint64(&s.maxvalue, val)\n\t}\n\n\ts.initialized = true\n\treturn nil\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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
}
|
Exports one instance of custom field data
@param data_controller $data
@param array $subcontext subcontext to pass to content_writer::export_data
|
[
"public static function export_customfield_data(data_controller $data, array $subcontext) {\n $context = $data->get_context();\n\n $exportdata = $data->to_record();\n $exportdata->fieldtype = $data->get_field()->get('type');\n $exportdata->fieldshortname = $data->get_field()->get('shortname');\n $exportdata->fieldname = $data->get_field()->get_formatted_name();\n $exportdata->timecreated = \\core_privacy\\local\\request\\transform::datetime($exportdata->timecreated);\n $exportdata->timemodified = \\core_privacy\\local\\request\\transform::datetime($exportdata->timemodified);\n unset($exportdata->contextid);\n // Use the \"export_value\" by default for the 'value' attribute, however the plugins may override it in their callback.\n $exportdata->value = $data->export_value();\n\n $classname = manager::get_provider_classname_for_component('customfield_' . $data->get_field()->get('type'));\n if (class_exists($classname) && is_subclass_of($classname, customfield_provider::class)) {\n component_class_callback($classname, 'export_customfield_data', [$data, $exportdata, $subcontext]);\n } else {\n // Custom field plugin does not implement customfield_provider, just export default value.\n writer::with_context($context)->export_data($subcontext, $exportdata);\n }\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 instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
}
|
Unlock the account.
:param account: Account
:return:
|
[
"def unlock_account(account):\n \n return Web3Provider.get_web3().personal.unlockAccount(account.address, account.password)"
] |
[
"def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o"
] |
codesearchnet
|
{
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
}
|
Set button as HTML link object <a href="">.
@param string $page
@param array $args
@return $this
|
[
"public function link($page, $args = array())\n {\n $this->setElement('a');\n $this->setAttr('href', $this->app->url($page, $args));\n\n return $this;\n }"
] |
[
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] |
codesearchnet
|
{
"query": "Represent the sentence about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
}
|
// connect connects to the SSH server, unless a AuthMethod was set with
// SetAuth method, by default uses an auth method based on PublicKeysCallback,
// it connects to a SSH agent, using the address stored in the SSH_AUTH_SOCK
// environment var.
|
[
"func (c *command) connect() error {\n\tif c.connected {\n\t\treturn transport.ErrAlreadyConnected\n\t}\n\n\tif c.auth == nil {\n\t\tif err := c.setAuthFromEndpoint(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar err error\n\tconfig, err := c.auth.ClientConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toverrideConfig(c.config, config)\n\n\tc.client, err = dial(\"tcp\", c.getHostWithPort(), config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Session, err = c.client.NewSession()\n\tif err != nil {\n\t\t_ = c.client.Close()\n\t\treturn err\n\t}\n\n\tc.connected = true\n\treturn nil\n}"
] |
[
"func tagUserCredentials(conf agent.Config) (string, string, error) {\n\tusername := conf.Tag().String()\n\tvar password string\n\t// TODO(perrito) we might need an accessor for the actual state password\n\t// just in case it ever changes from the same as api password.\n\tapiInfo, ok := conf.APIInfo()\n\tif ok {\n\t\tpassword = apiInfo.Password\n\t} else {\n\t\t// There seems to be no way to reach this inconsistence other than making a\n\t\t// backup on a machine where these fields are corrupted and even so I find\n\t\t// no reasonable way to reach this state, yet since APIInfo has it as a\n\t\t// possibility I prefer to handle it, we cannot recover from this since\n\t\t// it would mean that the agent.conf is corrupted.\n\t\treturn \"\", \"\", errors.New(\"cannot obtain password to access the controller\")\n\t}\n\treturn username, password, nil\n}"
] |
codesearchnet
|
{
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Helper method to actually perform the subdoc get count operation.
|
[
"private Observable<DocumentFragment<Lookup>> getCountIn(final String id, final LookupSpec spec,\n final long timeout, final TimeUnit timeUnit) {\n return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {\n @Override\n public Observable<DocumentFragment<Lookup>> call() {\n final SubGetCountRequest request = new SubGetCountRequest(id, spec.path(), bucketName);\n request.xattr(spec.xattr());\n request.accessDeleted(accessDeleted);\n addRequestSpan(environment, request, \"subdoc_count\");\n return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<SimpleSubdocResponse>>() {\n @Override\n public Observable<SimpleSubdocResponse> call(Subscriber s) {\n request.subscriber(s);\n return core.send(request);\n }\n }).map(new Func1<SimpleSubdocResponse, DocumentFragment<Lookup>>() {\n @Override\n public DocumentFragment<Lookup> call(SimpleSubdocResponse response) {\n try {\n if (response.status().isSuccess()) {\n try {\n long count = subdocumentTranscoder.decode(response.content(), Long.class);\n SubdocOperationResult<Lookup> single = SubdocOperationResult\n .createResult(spec.path(), Lookup.GET_COUNT, response.status(), count);\n return new DocumentFragment<Lookup>(id, response.cas(), response.mutationToken(),\n Collections.singletonList(single));\n } finally {\n if (response.content() != null) {\n response.content().release();\n }\n }\n } else {\n if (response.content() != null && response.content().refCnt() > 0) {\n response.content().release();\n }\n\n if (response.status() == ResponseStatus.SUBDOC_PATH_NOT_FOUND) {\n SubdocOperationResult<Lookup> single = SubdocOperationResult\n .createResult(spec.path(), Lookup.GET_COUNT, response.status(), null);\n return new DocumentFragment<Lookup>(id, response.cas(), response.mutationToken(), Collections.singletonList(single));\n } else {\n throw SubdocHelper.commonSubdocErrors(response.status(), id, spec.path());\n }\n }\n } finally {\n if (environment.operationTracingEnabled()) {\n environment.tracer().scopeManager()\n .activate(response.request().span(), true)\n .close();\n }\n }\n }\n }), request, environment, timeout, timeUnit);\n }\n });\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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
The method prints the structure of all meta_signal-notifications as log-messages.
|
[
"def observe_meta_signal_changes(self, changed_model, prop_name, info):\n \"\n self.logger.info(NotificationOverview(info))"
] |
[
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_response(response, bin=self)))"
] |
codesearchnet
|
{
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
}
|
Clear element ID list in cache
|
[
"protected function clearIDList()\n {\n $arCacheTags = $this->getCacheTagList();\n $sCacheKey = $this->getCacheKey();\n\n CCache::clear($arCacheTags, $sCacheKey);\n }"
] |
[
"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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
Gets a Site Role by his Id.
@param mixed $nb_site_role A CNabuDataObject containing a field named nb_role_id or a valid Id.
@return CNabuSiteRole|bool Returns the Site Role instance if exists or false if not.
|
[
"public function getSiteRole($nb_site_role)\n {\n if (is_numeric($nb_role_id = nb_getMixedValue($nb_site_role, NABU_ROLE_FIELD_ID))) {\n $retval = $this->getSiteRoles()->getItem($nb_role_id);\n } else {\n $retval = false;\n }\n\n return $retval;\n }"
] |
[
"private function guardValidModelAndIdentifier($model, $identifier)\n {\n if (empty($model) || (!is_object($model) && (null === $identifier || '' === $identifier))) {\n throw new ResolveComponentDataException('Model has to be an object or (a scalar + an identifier in 2nd argument)');\n }\n }"
] |
codesearchnet
|
{
"query": "Represent the summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software development:"
}
|
Move partition to under-loaded replication-group if possible.
|
[
"def move_partition_replica(self, under_loaded_rg, eligible_partition):\n \"\"\"\"\"\"\n # Evaluate possible source and destination-broker\n source_broker, dest_broker = self._get_eligible_broker_pair(\n under_loaded_rg,\n eligible_partition,\n )\n if source_broker and dest_broker:\n self.log.debug(\n 'Moving partition {p_name} from broker {source_broker} to '\n 'replication-group:broker {rg_dest}:{dest_broker}'.format(\n p_name=eligible_partition.name,\n source_broker=source_broker.id,\n dest_broker=dest_broker.id,\n rg_dest=under_loaded_rg.id,\n ),\n )\n # Move partition if eligible brokers found\n source_broker.move_partition(eligible_partition, dest_broker)"
] |
[
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from\n # the instackenv.json, BUT it may be interesting to add a check.\n return ret.split()"
] |
codesearchnet
|
{
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
}
|
Set the value of Hash / hash
@param $value string
@return User
|
[
"public function setHash(string $value) : User\n {\n\n if ($this->data['hash'] !== $value) {\n $this->data['hash'] = $value;\n $this->setModified('hash');\n }\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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
}
|
// Create the next block to propose and return it.
// We really only need to return the parts, but the block
// is returned for convenience so we can log the proposal block.
// Returns nil block upon error.
// NOTE: keep it side-effect free for clarity.
|
[
"func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts *types.PartSet) {\n\tvar commit *types.Commit\n\tif cs.Height == 1 {\n\t\t// We're creating a proposal for the first block.\n\t\t// The commit is empty, but not nil.\n\t\tcommit = types.NewCommit(types.BlockID{}, nil)\n\t} else if cs.LastCommit.HasTwoThirdsMajority() {\n\t\t// Make the commit from LastCommit\n\t\tcommit = cs.LastCommit.MakeCommit()\n\t} else {\n\t\t// This shouldn't happen.\n\t\tcs.Logger.Error(\"enterPropose: Cannot propose anything: No commit for the previous block.\")\n\t\treturn\n\t}\n\n\tproposerAddr := cs.privValidator.GetPubKey().Address()\n\treturn cs.blockExec.CreateProposalBlock(cs.Height, cs.state, commit, proposerAddr)\n}"
] |
[
"func (md *RootMetadataV3) SignWriterMetadataInternally(\n\tctx context.Context, codec kbfscodec.Codec,\n\tsigner kbfscrypto.Signer) error {\n\t// Nothing to do.\n\t//\n\t// TODO: Set a flag, and a way to check it so that we can\n\t// verify that this is called before sending to the server.\n\treturn nil\n}"
] |
codesearchnet
|
{
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
}
|
Write an item to the cache for a given number of minutes.
@param string $key
@param mixed $value
@param int $minutes
|
[
"public function put($key, $value, $minutes)\n {\n $this->forever($key, $value);\n $this->redis->expire($key, $minutes * 60);\n }"
] |
[
"public function setDirectives($directives)\n {\n parent::setDirectives($directives);\n $lifetime = $this->getLifetime(false);\n if ($lifetime > 2592000) {\n // #ZF-3490 : For the memcached backend, there is a lifetime limit of 30 days (2592000 seconds)\n $this->_log('memcached backend has a limit of 30 days (2592000 seconds) for the lifetime');\n }\n if ($lifetime === null) {\n // #ZF-4614 : we tranform null to zero to get the maximal lifetime\n parent::setDirectives(array('lifetime' => 0));\n }\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
}
|
Component factory. Delegates the creation of components to a createComponent<Name> method.
@param string $name
|
[
"protected function createComponent($name): ?IComponent\n {\n $method = 'createComponent'.ucfirst($name);\n if (method_exists($this, $method)) {\n $this->checkRequirements(self::getReflection()->getMethod($method));\n }\n\n return parent::createComponent($name);\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 description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
}
|
get schema info
@param Request $request request
@return Response
|
[
"public function schemaAction(Request $request)\n {\n $api = $this->decideApiAndEndpoint($request->getUri());\n $this->registerProxySources($api['apiName']);\n $this->apiLoader->addOptions($api);\n\n $schema = $this->apiLoader->getEndpointSchema(urldecode($api['endpoint']));\n $schema = $this->transformationHandler->transformSchema(\n $api['apiName'],\n $api['endpoint'],\n $schema,\n clone $schema\n );\n $response = new Response(json_encode($schema), 200);\n $response->headers->set('Content-Type', 'application/json');\n\n return $this->templating->renderResponse(\n 'GravitonCoreBundle:Main:index.json.twig',\n array ('response' => $response->getContent()),\n $response\n );\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:"
}
|
// Run all jobs with delay seconds
|
[
"func (s *Scheduler) RunAllwithDelay(d int) {\n\tfor i := 0; i < s.size; i++ {\n\t\ts.jobs[i].run()\n\t\ttime.Sleep(time.Duration(d))\n\t}\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 post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
}
|
Get the string representation of the full path name
@param parent the parent path
@return the full path in string
|
[
"final public String getFullName(final String parent) {\n if (isEmptyLocalName()) {\n return parent;\n }\n \n StringBuilder fullName = new StringBuilder(parent);\n if (!parent.endsWith(Path.SEPARATOR)) {\n fullName.append(Path.SEPARATOR);\n }\n fullName.append(getLocalName());\n return fullName.toString();\n }"
] |
[
"def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types\n __suffixes_to_types = {}\n\n # A map with all the registered types, indexed by the type name\n # Each entry is a dictionary with following values:\n # 'base': the name of base type or None if type has no base\n # 'derived': a list of names of type which derive from this one\n # 'scanner': the scanner class registered for this type, if any\n __types = {}\n\n # Caches suffixes for targets with certain properties.\n __target_suffixes_cache = {}"
] |
codesearchnet
|
{
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Extracts all files from the "master" language and takes them as translation groups.
@param string $lang
@return void
|
[
"private function getTranslationGroups($lang = 'en'): void\n {\n $dir = resource_path('lang/'. $lang . '/');\n $files = array_diff(scandir($dir), array('..', '.'));\n\n foreach($files as $index => $filename){\n $groupname = str_replace(\".php\", \"\", $filename);\n $this->updateTranslationGroups($groupname);\n }\n\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 summarization about Text translation:",
"pos": "Represent the Github code about Text translation:",
"neg": "Represent the Github code:"
}
|
Check if a route is localized in a given language
@param string $name
@param string $lang
@return bool
|
[
"function isLocalized($name,$lang=NULL) {\n\t\tif (!isset($lang))\n\t\t\t$lang=$this->current;\n\t\treturn !$this->isGlobal($name) && array_key_exists($name,$this->_aliases) &&\n\t\t\t\t(!isset($this->rules[$lang][$name]) || $this->rules[$lang][$name]!==FALSE);\n\t}"
] |
[
"private static function resource($resource)\n {\n exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \\''.$resource.'\\' is not supported by Vinala, only session or cookie');\n\n return Hash::make(config('auth.'.$resource));\n\n // For more security, make for every user a resource name\n return Hash::make(config('auth.'.$resource).static::$user->rememberToken);\n }"
] |
codesearchnet
|
{
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
}
|
Apply the include and exclude filters to those files in *unmatched*,
moving those that are included, but not excluded, into the *matched*
set.
Both *matched* and *unmatched* are sets of unqualified file names.
|
[
"def match_files(self, matched, unmatched):\n \"\"\"\"\"\"\n for pattern in self.iter():\n pattern.match_files(matched, unmatched)\n if not unmatched:\n # Optimization: If we have matched all files already\n # simply return at this point - nothing else to do\n break"
] |
[
"def find_matches(self, content, file_to_handle):\n \n # look for all match groups in the content\n groups = [match.groupdict() for match in\n self.match_expression.finditer(content)]\n # filter out content not in the matchgroup\n matches = [group['matchgroup'] for group in groups\n if group.get('matchgroup')]\n\n logger.info('Found %s matches in %s', len(matches), file_to_handle)\n # We only need the unique strings found as we'll be replacing each\n # of them. No need to replace the ones already replaced.\n return list(set(matches))"
] |
codesearchnet
|
{
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
// NewOTP takes a new key, a starting time, a step, the number of
// digits of output (typically 6 or 8) and the hash algorithm to
// use, and builds a new OTP.
|
[
"func NewTOTP(key []byte, start uint64, step uint64, digits int, algo crypto.Hash) *TOTP {\n\th := hashFromAlgo(algo)\n\tif h == nil {\n\t\treturn nil\n\t}\n\n\treturn &TOTP{\n\t\tOATH: &OATH{\n\t\t\tkey: key,\n\t\t\tcounter: start,\n\t\t\tsize: digits,\n\t\t\thash: h,\n\t\t\talgo: algo,\n\t\t},\n\t\tstep: step,\n\t}\n\n}"
] |
[
"protected function computeEncryptionKey($password = '')\n {\n $revision = $this->revision;\n\n // TODO: The password string is generated from OS codepage characters by first\n // converting the string to PDFDocEncoding. If the input is Unicode, first convert\n // to a codepage encoding, and then to PDFDocEncoding for backward compatibility.\n\n\n // Algorithm 2: Computing an encryption key\n // a) Pad or truncate the password string to exactly 32 bytes.\n // b) Initialize the MD5 hash function and pass the result of step (a) as input to this function.\n $s = substr($password . $this->padding, 0, 32);\n\n // c) Pass the value of the encryption dictionary’s O entry to the MD5 hash function.\n // (\"Algorithm 3: Computing the encryption dictionary’s O (owner password) value\" shows how the O value is computed.)\n $s .= $this->oValue;\n\n // d) Convert the integer value of the P entry to a 32-bit unsigned binary number and pass these\n // bytes to the MD5 hash function, low-order byte first.\n $pValue = (int)(float)$this->pValue;\n $s .= pack(\"V\", $pValue);\n\n // e) Pass the first element of the file’s file identifier array (the value of the ID\n // entry in the document’s trailer dictionary; see Table 15) to the MD5 hash function.\n $s .= $this->fileIdentifier;\n\n // f) (Security handlers of revision 4 or greater) If document metadata is not\n // being encrypted, pass 4 bytes with the value 0xFFFFFFFF to the MD5 hash function.\n // ...\n\n // g) Finish the hash.\n $s = md5($s, true);\n\n // h) (Security handlers of revision 3 or greater) Do the following 50 times:\n // Take the output from the previous MD5 hash and pass the first n bytes of\n // the output as input into a new MD5 hash, where n is the number of bytes\n // of the encryption key as defined by the value of the encryption dictionary’s\n // Length entry.\n if ($revision >= 3) {\n for ($i = 0; $i < 50; $i++)\n $s = md5(substr($s, 0, $this->keyLength), true);\n }\n\n // i) Set the encryption key to the first n bytes of the output from the final\n // MD5 hash, where n shall always be 5 for security handlers of revision 2 but,\n // for security handlers of revision 3 or greater, shall depend on the value of\n // the encryption dictionary’s Length entry.\n\n return substr($s, 0, $this->keyLength); // key length is calculated automatically if it is missing (5)\n }"
] |
codesearchnet
|
{
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
}
|
返回对应的termin root path(不依赖对应的config信息)
|
[
"public static String getTerminRoot(Long channelId, Long pipelineId) {\n // 根据channelId , pipelineId构造path\n return MessageFormat.format(ArbitrateConstants.NODE_TERMIN_ROOT,\n String.valueOf(channelId),\n String.valueOf(pipelineId));\n }"
] |
[
"public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }"
] |
codesearchnet
|
{
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
Parses a Disgenet file ad the one that can be downloaded from
http://www.disgenet.org/ds/DisGeNET/results/all_gene_disease_associations.tar.gz and writes corresponding json
objects.
|
[
"public void parse() {\n Map<String, Disgenet> disgenetMap = new HashMap<>();\n\n BufferedReader reader;\n try {\n // Disgenet file is usually downloaded as a .tar.gz file\n if (disgenetFilePath.toFile().getName().endsWith(\"tar.gz\")) {\n TarArchiveInputStream tarInput = new TarArchiveInputStream(\n new GzipCompressorInputStream(new FileInputStream(disgenetFilePath.toFile())));\n// TarArchiveEntry currentEntry = tarInput.getNextTarEntry();\n// BufferedReader br = null;\n reader = new BufferedReader(new InputStreamReader(tarInput)); // Read directly from tarInput\n } else {\n reader = FileUtils.newBufferedReader(disgenetFilePath);\n }\n// if (disgenetFilePath.toFile().getName().endsWith(\"txt.gz\")) {\n// reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(disgenetFilePath.toFile()))));\n// } else {\n// reader = Files.newBufferedReader(disgenetFilePath, Charset.defaultCharset());\n// }\n\n logger.info(\"Parsing Disgenet file \" + disgenetFilePath + \" ...\");\n // first line is the header -> ignore it\n reader.readLine();\n long processedDisgenetLines = fillDisgenetMap(disgenetMap, reader);\n\n logger.info(\"Serializing parsed variants ...\");\n Collection<Disgenet> allDisgenetRecords = disgenetMap.values();\n for (Disgenet disGeNetRecord : allDisgenetRecords) {\n serializer.serialize(disGeNetRecord);\n }\n logger.info(\"Done\");\n this.printSummary(processedDisgenetLines, allDisgenetRecords.size());\n\n } catch (FileNotFoundException e) {\n logger.error(\"Disgenet file \" + disgenetFilePath + \" not found\");\n } catch (IOException e) {\n logger.error(\"Error reading Disgenet file \" + disgenetFilePath + \": \" + e.getMessage());\n }\n }"
] |
[
"def main():\n \"\"\"\"\"\"\n # Load study, population, associations, and GoDag. Run GOEA.\n obj = GoeaCliFnc(GoeaCliArgs().args)\n # Reduce results to significant results (pval<value)\n results_specified = obj.get_results()\n # Print results in a flat list\n obj.prt_results(results_specified)"
] |
codesearchnet
|
{
"query": "Represent the Github description about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code:"
}
|
@param $postId
@param bool $form
@return Response
|
[
"public function addCommentFormAction($postId, $form = false)\n {\n $action = $this->container->get(CreateCommentFormAction::class);\n\n return $action($postId, $form);\n }"
] |
[
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] |
codesearchnet
|
{
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
}
|
// State returns the monitor status.
|
[
"func (nm *NodeMonitor) State() *models.MonitorStatus {\n\tnm.Mutex.RLock()\n\tstate := nm.state\n\tnm.Mutex.RUnlock()\n\treturn state\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 sentence about Networking:",
"pos": "Represent the code about Networking:",
"neg": "Represent the code:"
}
|
Solve A*X = b
@param b A column vector with as many rows as A.
@return X so that L*L^T*X = b
@exception IllegalArgumentException Matrix row dimensions must agree.
@exception RuntimeException Matrix is not symmetric positive definite.
|
[
"public double[] solve(double[] b) {\n if(b.length != L.length) {\n throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);\n }\n if(!isspd) {\n throw new ArithmeticException(ERR_MATRIX_NOT_SPD);\n }\n // Work on a copy!\n return solveLtransposed(solveLInplace(copy(b)));\n }"
] |
[
"def _check_L(self, L):\n \"\"\"\"\"\"\n # TODO: Take this out?\n if issparse(L):\n L = L.todense()\n\n # Check for correct values, e.g. warning if in {-1,0,1}\n if np.any(L < 0):\n raise ValueError(\"L must have values in {0,1,...,k}.\")"
] |
codesearchnet
|
{
"query": "Represent the sentence about Mathematics:",
"pos": "Represent the code about Mathematics:",
"neg": "Represent the code:"
}
|
Get all running (unfinished) flows from database. {@inheritDoc}
|
[
"@Override\n public List<ExecutableFlow> getRunningFlows() {\n final ArrayList<ExecutableFlow> flows = new ArrayList<>();\n try {\n getFlowsHelper(flows, this.executorLoader.fetchUnfinishedFlows().values());\n } catch (final ExecutorManagerException e) {\n logger.error(\"Failed to get running flows.\", e);\n }\n return flows;\n }"
] |
[
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] |
codesearchnet
|
{
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
}
|
Checks whether there is already an existing pending/in-progress data request for a user for a given request type.
@param int $userid The user ID.
@param int $type The request type.
@return bool
@throws coding_exception
@throws dml_exception
|
[
"public static function has_ongoing_request($userid, $type) {\n global $DB;\n\n // Check if the user already has an incomplete data request of the same type.\n $nonpendingstatuses = [\n self::DATAREQUEST_STATUS_COMPLETE,\n self::DATAREQUEST_STATUS_CANCELLED,\n self::DATAREQUEST_STATUS_REJECTED,\n self::DATAREQUEST_STATUS_DOWNLOAD_READY,\n self::DATAREQUEST_STATUS_EXPIRED,\n self::DATAREQUEST_STATUS_DELETED,\n ];\n list($insql, $inparams) = $DB->get_in_or_equal($nonpendingstatuses, SQL_PARAMS_NAMED, 'st', false);\n $select = \"type = :type AND userid = :userid AND status {$insql}\";\n $params = array_merge([\n 'type' => $type,\n 'userid' => $userid\n ], $inparams);\n\n return data_request::record_exists_select($select, $params);\n }"
] |
[
"public static function all($params = null, $opts = null)\n {\n $msg = \"Subscription Schedule Revisions cannot be listed without a Subscription Schedule ID. \" .\n \"List those using \\$schedule->allRevisions('revision_id') instead.\";\n throw new Error\\InvalidRequest($msg, null);\n }"
] |
codesearchnet
|
{
"query": "Represent the Github post about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about PHP:"
}
|
// Prev returns the previous Page relative to the given Page in
// this weighted page set.
|
[
"func (wp WeightedPages) Prev(cur Page) Page {\n\tfor x, c := range wp {\n\t\tif c.Page == cur {\n\t\t\tif x == 0 {\n\t\t\t\treturn wp[len(wp)-1].Page\n\t\t\t}\n\t\t\treturn wp[x-1].Page\n\t\t}\n\t}\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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Get available locales
@param string|null|true $domain If provided, locales for the given domain will be returned.
If true, then the current state domain will be used (if in domain mode).
@return ArrayList
|
[
"public static function getLocales($domain = null)\n {\n // Optionally filter by domain\n $domainObj = Domain::getByDomain($domain);\n if ($domainObj) {\n return $domainObj->getLocales();\n }\n\n return Locale::getCached();\n }"
] |
[
"public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key. If not set, the current package key will be used', false, null);\n $this->registerArgument('resource', PersistentResource::class, 'If specified, this resource object is used instead of the path and package information', false, null);\n $this->registerArgument('localize', 'bool', 'Whether resource localization should be attempted or not.', false, true);\n }"
] |
codesearchnet
|
{
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
}
|
>>> p = Preso()
>>> z = p.to_file('/tmp/foo.odp')
>>> sorted(z.ls('/'))
['META-INF/manifest.xml', 'content.xml', 'meta.xml', 'mimetype', 'settings.xml', 'styles.xml']
|
[
"def to_file(self, filename=None, write_style=True):\n \n out = zipwrap.Zippier(filename, \"w\")\n out.write(\"mimetype\", self.mime_type)\n for p in self._pictures:\n out.write(\"Pictures/%s\" % p.internal_name, p.get_data())\n out.write(\"content.xml\", self.to_xml())\n if write_style:\n out.write(\"styles.xml\", self.styles_xml())\n out.write(\"meta.xml\", self.meta_xml())\n out.write(\"settings.xml\", self.settings_xml())\n out.write(\"META-INF/manifest.xml\", self.manifest_xml(out))\n return out"
] |
[
"def _find_tpls(self, name):\n \n return self._find_tpl(name, extension='.txt'), self._find_tpl(name, extension='.html')"
] |
codesearchnet
|
{
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Software Engineering:"
}
|
TODO
@param $config
@return bool
|
[
"public function save($config)\n {\n if (!file_put_contents($this->filename, Yaml::dump($config))) {\n return false;\n }\n return true;\n }"
] |
[
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
}
|
A decorator for flags classes to forbid declaring flags with overlapping bits.
|
[
"def unique_bits(flags_class):\n \n flags_class = unique(flags_class)\n other_bits = 0\n for name, member in flags_class.__members_without_aliases__.items():\n bits = int(member)\n if other_bits & bits:\n for other_name, other_member in flags_class.__members_without_aliases__.items():\n if int(other_member) & bits:\n raise ValueError(\"%r: '%s' and '%s' have overlapping bits\" % (flags_class, other_name, name))\n else:\n other_bits |= bits"
] |
[
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll get false ambiguity.\n for t in sequence.unique(g.target_types()):\n __type_to_generators.setdefault(t, []).append(g)\n\n # Update the set of generators for toolset\n\n # TODO: should we check that generator with this id\n # is not already registered. For example, the fop.jam\n # module intentionally declared two generators with the\n # same id, so such check will break it.\n\n # Some generators have multiple periods in their name, so the\n # normal $(id:S=) won't generate the right toolset name.\n # e.g. if id = gcc.compile.c++, then\n # .generators-for-toolset.$(id:S=) will append to\n # .generators-for-toolset.gcc.compile, which is a separate\n # value from .generators-for-toolset.gcc. Correcting this\n # makes generator inheritance work properly.\n # See also inherit-generators in module toolset\n base = id.split ('.', 100) [0]\n\n __generators_for_toolset.setdefault(base, []).append(g)\n\n # After adding a new generator that can construct new target types, we need\n # to clear the related cached viable source target type information for\n # constructing a specific target type or using a specific generator. Cached\n # viable source target type lists affected by this are those containing any\n # of the target types constructed by the new generator or any of their base\n # target types.\n #\n # A more advanced alternative to clearing that cached viable source target\n # type information would be to expand it with additional source types or\n # even better - mark it as needing to be expanded on next use.\n #\n # For now we just clear all the cached viable source target type information\n # that does not simply state 'all types' and may implement a more detailed\n # algorithm later on if it becomes needed.\n\n invalidate_extendable_viable_source_target_type_cache()"
] |
codesearchnet
|
{
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Handles the optional labelling of the plot with relevant quantities
Args:
plt (plt): Plot of the locpot vs c axis
label_fontsize (float): Fontsize of labels
Returns Labelled plt
|
[
"def get_labels(self, plt, label_fontsize=10):\n \n\n # center of vacuum and bulk region\n if len(self.slab_regions) > 1:\n label_in_vac = (self.slab_regions[0][1] + self.slab_regions[1][0])/2\n if abs(self.slab_regions[0][0]-self.slab_regions[0][1]) > \\\n abs(self.slab_regions[1][0]-self.slab_regions[1][1]):\n label_in_bulk = self.slab_regions[0][1]/2\n else:\n label_in_bulk = (self.slab_regions[1][1] + self.slab_regions[1][0]) / 2\n else:\n label_in_bulk = (self.slab_regions[0][0] + self.slab_regions[0][1])/2\n if self.slab_regions[0][0] > 1-self.slab_regions[0][1]:\n label_in_vac = self.slab_regions[0][0] / 2\n else:\n label_in_vac = (1 + self.slab_regions[0][1]) / 2\n\n plt.plot([0, 1], [self.vacuum_locpot]*2, 'b--', zorder=-5, linewidth=1)\n xy = [label_in_bulk, self.vacuum_locpot+self.ave_locpot*0.05]\n plt.annotate(r\"$V_{vac}=%.2f$\" %(self.vacuum_locpot), xy=xy,\n xytext=xy, color='b', fontsize=label_fontsize)\n\n # label the fermi energy\n plt.plot([0, 1], [self.efermi]*2, 'g--',\n zorder=-5, linewidth=3)\n xy = [label_in_bulk, self.efermi+self.ave_locpot*0.05]\n plt.annotate(r\"$E_F=%.2f$\" %(self.efermi), xytext=xy,\n xy=xy, fontsize=label_fontsize, color='g')\n\n # label the bulk-like locpot\n plt.plot([0, 1], [self.ave_bulk_p]*2, 'r--', linewidth=1., zorder=-1)\n xy = [label_in_vac, self.ave_bulk_p + self.ave_locpot * 0.05]\n plt.annotate(r\"$V^{interior}_{slab}=%.2f$\" % (self.ave_bulk_p),\n xy=xy, xytext=xy, color='r', fontsize=label_fontsize)\n\n # label the work function as a barrier\n plt.plot([label_in_vac]*2, [self.efermi, self.vacuum_locpot],\n 'k--', zorder=-5, linewidth=2)\n xy = [label_in_vac, self.efermi + self.ave_locpot * 0.05]\n plt.annotate(r\"$\\Phi=%.2f$\" %(self.work_function),\n xy=xy, xytext=xy, fontsize=label_fontsize)\n\n return plt"
] |
[
"def getPDF(self):\n '''\n '''\n\n if hasattr(self, '_qplot'):\n\n return self._qplot, self._hplot, self._tplot\n\n else:\n raise ValueError('''The metric has not been evaluated at any\n design point so the PDF cannot get obtained''')"
] |
codesearchnet
|
{
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
}
|
is the host any of the registered URLs for this website?
|
[
"public static function isHostKnownAliasHost($urlHost, $idSite)\n {\n $websiteData = Cache::getCacheWebsiteAttributes($idSite);\n\n if (isset($websiteData['hosts'])) {\n $canonicalHosts = array();\n foreach ($websiteData['hosts'] as $host) {\n $canonicalHosts[] = self::toCanonicalHost($host);\n }\n\n $canonicalHost = self::toCanonicalHost($urlHost);\n if (in_array($canonicalHost, $canonicalHosts)) {\n return true;\n }\n }\n\n return false;\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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
}
|
List server id and scripts file name
|
[
"function list(scriptModule, agent, msg, cb) {\n const servers = [];\n const scripts = [];\n const idMap = agent.idMap;\n\n for (const sid in idMap) {\n if (idMap.hasOwnProperty(sid)) {\n servers.push(sid);\n }\n }\n\n fs.readdir(scriptModule.root, (err, filenames) => {\n if (err) {\n filenames = [];\n }\n for (let i = 0, l = filenames.length; i < l; i++) {\n scripts.push(filenames[i]);\n }\n\n cb(null, {\n servers: servers,\n scripts: scripts\n });\n });\n}"
] |
[
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from\n # the instackenv.json, BUT it may be interesting to add a check.\n return ret.split()"
] |
codesearchnet
|
{
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Technology:"
}
|
Updates the commerce wish list item in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
@param commerceWishListItem the commerce wish list item
@return the commerce wish list item that was updated
|
[
"public static com.liferay.commerce.wish.list.model.CommerceWishListItem updateCommerceWishListItem(\n\t\tcom.liferay.commerce.wish.list.model.CommerceWishListItem commerceWishListItem) {\n\t\treturn getService().updateCommerceWishListItem(commerceWishListItem);\n\t}"
] |
[
"function DefaultChangeRequestInterceptor(saveContext, saveBundle) {\n /**\n Prepare and return the save data for an entity change-set.\n\n The adapter calls this method for each entity in the change-set,\n after it has prepared a \"change request\" for that object.\n\n The method can do anything to the request but it must return a valid, non-null request.\n @example\n this.getRequest = function (request, entity, index) {\n // alter the request that the adapter prepared for this entity\n // based on the entity, saveContext, and saveBundle\n // e.g., add a custom header or prune the originalValuesMap\n return request;\n };\n @method getRequest\n @param request {Object} The object representing the adapter's request to save this entity.\n @param entity {Entity} The entity-to-be-save as it is in cache\n @param index {Integer} The zero-based index of this entity in the change-set array\n @return {Function} The potentially revised request.\n **/\n this.getRequest = function (request, entity, index) {\n return request;\n };\n\n /**\n Last chance to change anything about the 'requests' array\n after it has been built with requests for all of the entities-to-be-saved.\n\n The 'requests' array is the same as 'saveBundle.entities' in many implementations\n\n This method can do anything to the array including add and remove requests.\n It's up to you to ensure that server will accept the requests array data as valid.\n\n Returned value is ignored.\n @example\n this.done = function (requests) {\n // alter the array of requests representing the entire change-set\n // based on the saveContext and saveBundle\n };\n @method done\n @param requests {Array of Object} The adapter's array of request for this changeset.\n **/\n this.done = function (requests) {\n };\n }"
] |
codesearchnet
|
{
"query": "Represent the instruction about Aimeos:",
"pos": "Represent the code about Aimeos:",
"neg": "Represent the code:"
}
|
*
This method is used to clear KeyStore configurations when the entire config
is being reloaded.
*
|
[
"public void clearKSMap() {\n if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())\n Tr.debug(tc, \"Clearing keystore maps\");\n synchronized (keyStoreMap) {\n keyStoreMap.clear();\n }\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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
}
|
// List runs the list action.
|
[
"func (c *SpaceController) List(ctx *app.ListSpaceContext) error {\n\t_, err := login.ContextIdentity(ctx)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))\n\t}\n\toffset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)\n\n\tvar response app.SpaceList\n\ttxnErr := application.Transactional(c.db, func(appl application.Application) error {\n\t\tspaces, cnt, err := appl.Spaces().List(ctx.Context, &offset, &limit)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tentityErr := ctx.ConditionalEntities(spaces, c.config.GetCacheControlSpaces, func() error {\n\t\t\tcount := int(cnt)\n\t\t\tspaceData, err := ConvertSpacesFromModel(ctx.Request, spaces, IncludeBacklogTotalCount(ctx.Context, c.db))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tresponse = app.SpaceList{\n\t\t\t\tLinks: &app.PagingLinks{},\n\t\t\t\tMeta: &app.SpaceListMeta{TotalCount: count},\n\t\t\t\tData: spaceData,\n\t\t\t}\n\t\t\tsetPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(spaces), offset, limit, count)\n\t\t\treturn nil\n\t\t})\n\t\tif entityErr != nil {\n\t\t\treturn entityErr\n\t\t}\n\n\t\treturn nil\n\t})\n\tif txnErr != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, txnErr)\n\t}\n\treturn ctx.OK(&response)\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 post about Agent Identity Management:",
"pos": "Represent the Github code about Agent Identity Management:",
"neg": "Represent the Github code about programming:"
}
|
// add inserts or updates "r" in the cache for the replica with the key "r.Key".
|
[
"func (c *replicationLagCache) add(r replicationLagRecord) {\n\tif !r.Up {\n\t\t// Tablet is down. Do no longer track it.\n\t\tdelete(c.entries, r.Key)\n\t\tdelete(c.ignoredSlowReplicasInARow, r.Key)\n\t\treturn\n\t}\n\n\tentry, ok := c.entries[r.Key]\n\tif !ok {\n\t\tentry = newReplicationLagHistory(c.historyCapacityPerReplica)\n\t\tc.entries[r.Key] = entry\n\t}\n\n\tentry.add(r)\n}"
] |
[
"function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
}
|
Run any git command, like "status" or "checkout -b mybranch origin/mybranch"
@throws RuntimeException
@param string $commandString
@return string $output
|
[
"public function git($commandString)\n {\n // clean commands that begin with \"git \"\n $commandString = preg_replace('/^git\\s/', '', $commandString);\n\n $commandString = $this->options['git_executable'].' '.$commandString;\n\n $command = new $this->options['command_class']($this->dir, $commandString, $this->debug);\n\n return $command->run();\n }"
] |
[
"func (r *printRun) RegisterIDFlag() {\n\tr.Flags.BoolVar(&r.id, \"id\", false, doc(`\n\t\tPrint only build ids.\n\n\t\tIntended for piping the output into another bb subcommand:\n\t\t\tbb ls -cl myCL -id | bb cancel\n\t`))\n}"
] |
codesearchnet
|
{
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software Development:"
}
|
can lead to classcastexception if comparator is not of the right type
|
[
"@SuppressWarnings(\"unchecked\")\n\tpublic <T> void sort(Arr arr, Comparator<T> c) {\n\t\tint l = arr.getLength();\n\t\tObject[] objs = new Object[l];\n\t\tfor (int i=0; i<l; i++) {\n\t\t\tobjs[i] = arr.get(i);\n\t\t}\n\t\tArrays.sort((T[])objs, c);\n\t\tfor (int i=0; i<l; i++) {\n\t\t\tarr.put(i, objs[i]);\n\t\t}\n\t}"
] |
[
"@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }"
] |
codesearchnet
|
{
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
}
|
Create a new cell at the specified coordinate
@param string $pCoordinate Coordinate of the cell
@return PHPExcel_Cell Cell that was created
|
[
"private function _createNewCell($pCoordinate)\n\t{\n\t\t$cell = $this->_cellCollection->addCacheData(\n\t\t\t$pCoordinate,\n\t\t\tnew PHPExcel_Cell(\n\t\t\t\tNULL, \n\t\t\t\tPHPExcel_Cell_DataType::TYPE_NULL, \n\t\t\t\t$this\n\t\t\t)\n\t\t);\n $this->_cellCollectionIsSorted = false;\n\n // Coordinates\n $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);\n if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0]))\n $this->_cachedHighestColumn = $aCoordinates[0];\n $this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]);\n\n // Cell needs appropriate xfIndex from dimensions records\n\t\t// but don't create dimension records if they don't already exist\n $rowDimension = $this->getRowDimension($aCoordinates[1], FALSE);\n $columnDimension = $this->getColumnDimension($aCoordinates[0], FALSE);\n\n if ($rowDimension !== NULL && $rowDimension->getXfIndex() > 0) {\n // then there is a row dimension with explicit style, assign it to the cell\n $cell->setXfIndex($rowDimension->getXfIndex());\n } elseif ($columnDimension !== NULL && $columnDimension->getXfIndex() > 0) {\n // then there is a column dimension, assign it to the cell\n $cell->setXfIndex($columnDimension->getXfIndex());\n }\n\n return $cell;\n\t}"
] |
[
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
}
|
Determine if the browser is among the custom browser rules or not. Rules are checked in the order they were
added.
@access protected
@return boolean Returns true if we found the browser we were looking for in the custom rules, false otherwise.
|
[
"protected function checkBrowserCustom()\n {\n foreach ($this->_customBrowserDetection as $browserName => $customBrowser) {\n $uaNameToLookFor = $customBrowser['uaNameToLookFor'];\n $isMobile = $customBrowser['isMobile'];\n $isRobot = $customBrowser['isRobot'];\n $separator = $customBrowser['separator'];\n $uaNameFindWords = $customBrowser['uaNameFindWords'];\n if ($this->checkSimpleBrowserUA($uaNameToLookFor, $this->_agent, $browserName, $isMobile, $isRobot, $separator, $uaNameFindWords)) {\n return true;\n }\n }\n return false;\n }"
] |
[
"public function validate(&$values, $action) {\n $this->errors = array();\n $this->values = $values;\n $valid = true;\n foreach ($this->rules as $rule) {\n $forActions = isset($rule['on']) ? explode(',', $rule['on']) : array();\n array_walk($forActions, function (&$item) {\n $item = trim($item);\n });\n if (isset($rule['on']) && (!in_array($action, $forActions))) {\n continue; // ignore rules set for other actions;\n }\n $valid = $this->__checkRule($rule) && $valid; // changed order so that it will check each rule even if the previous was already invalid\n // this was done in order to show errors for all fields at once\n // example of a problem: when registering if an invalid email was filled but no password it would\n // only show errors for password but it would not check email also so it would show no error there\n // until all the previous checks were already true. It could mean a lot of tries to see and fix all\n // possible input errors from user part.\n }\n $values = $this->values;\n return $valid;\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
}
|
Find related object on the database and updates it with attributes in self, if it didn't
find it on database it creates a new one.
|
[
"def convert(attribute=\"id\")\n klass = persistence_class\n object = klass.where(attribute.to_sym => self.send(attribute)).first\n\n object ||= persistence_class.new\n\n attributes = self.attributes.select{ |key, value| self.class.serialized_attributes.include?(key.to_s) }\n\n attributes.delete(:id)\n\n object.attributes = attributes\n\n object.save\n\n self.id = object.id\n\n object\n end"
] |
[
"def set_schema(self, schema_name, include_public=True):\n \n self.tenant = FakeTenant(schema_name=schema_name)\n self.schema_name = schema_name\n self.include_public_schema = include_public\n self.set_settings_schema(schema_name)\n self.search_path_set = False\n # Content type can no longer be cached as public and tenant schemas\n # have different models. If someone wants to change this, the cache\n # needs to be separated between public and shared schemas. If this\n # cache isn't cleared, this can cause permission problems. For example,\n # on public, a particular model has id 14, but on the tenants it has\n # the id 15. if 14 is cached instead of 15, the permissions for the\n # wrong model will be fetched.\n ContentType.objects.clear_cache()"
] |
codesearchnet
|
{
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
Finish establishing section
Wrap up title node, but stick in the section node. Add the section names
based on all the text nodes added to the title.
|
[
"def depart_heading(self, _):\n \n assert isinstance(self.current_node, nodes.title)\n # The title node has a tree of text nodes, use the whole thing to\n # determine the section id and names\n text = self.current_node.astext()\n if self.translate_section_name:\n text = self.translate_section_name(text)\n name = nodes.fully_normalize_name(text)\n section = self.current_node.parent\n section['names'].append(name)\n self.document.note_implicit_target(section, section)\n self.current_node = section"
] |
[
"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:"
}
|
верификация номер телефона
@return bool
@throws Exception
|
[
"public function verifyPhone(): bool\n {\n $phone = new UserMetaPhone($this->notification_phone);\n $phone->verifyPhone();\n $this->notification_phone = $phone;\n return $this->updateModel();\n }"
] |
[
"final function handle() {\n\t\ttry {\n\t\t\tif ($this->m()->s()->log()) {\n\t\t\t\t$this->log();\n\t\t\t}\n\t\t\t$this->_e->validate();\n\t\t\tif ($c = $this->strategyC()) { /** @var string|null $c */\n\t\t\t\tStrategy::handle($c, $this);\n\t\t\t}\n\t\t}\n\t\t/** 2017-09-15 @uses NotForUs is thrown from @see \\Df\\Payment\\W\\Nav::p() */\n\t\tcatch (NotForUs $e) {\n\t\t\t$this->log();\n\t\t\t$this->responder()->setNotForUs(df_ets($e));\n\t\t}\n\t\tcatch (\\Exception $e) {\n\t\t\t$this->log();\n\t\t\t$this->log($e);\n\t\t\t// 2016-07-15\n\t\t\t// Раньше тут стояло\n\t\t\t//\tif ($this->_order) {\n\t\t\t//\t\t$this->_order->cancel();\n\t\t\t//\t\t$this->_order->save();\n\t\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$this->responder()->setError($e);\n\t\t}\n\t}"
] |
codesearchnet
|
{
"query": "Represent the Github description about software development:",
"pos": "Represent the Github code about software development:",
"neg": "Represent the Github code:"
}
|
Expert users can override this method for more complete control over the
execution of the Mapper.
@param context
@throws IOException
|
[
"public void run(Context context) throws IOException, InterruptedException {\n setup(context);\n while (context.nextKeyValue()) {\n map(context.getCurrentKey(), context.getCurrentValue(), context);\n }\n cleanup(context);\n }"
] |
[
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] |
codesearchnet
|
{
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
}
|
Add a response to the list.
@param int $key
@param array|null $response
|
[
"public function addResponse($key, array $response)\n {\n $originalRequest = isset($this->request[$key]) ? $this->request[$key] : null;\n $responseBody = isset($response['body']) ? $response['body'] : null;\n $responseError = isset($response['error']) ? $response['error'] : null;\n $responseMethod = isset($response['method']) ? $response['method'] : null;\n\n $this->responses[$key] = new Response($originalRequest, $responseBody, $responseError, $responseMethod);\n }"
] |
[
"protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }"
] |
codesearchnet
|
{
"query": "Represent the sentence about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code about Software development:"
}
|
Copy temporary project data to persistent storage.
@param string[] $with
@throws ReadException
|
[
"private function updateStorage($with = [])\n {\n $data = array_merge($this->data, $with);\n $this->fs->create($this->fsPath, json_encode($data));\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 instruction about file transfer:",
"pos": "Represent the code about file transfer:",
"neg": "Represent the code:"
}
|
// drawCondFmtCellIs provides a function to create conditional formatting rule
// for cell value (include between, not between, equal, not equal, greater
// than and less than) by given priority, criteria type and format settings.
|
[
"func drawCondFmtCellIs(p int, ct string, format *formatConditional) *xlsxCfRule {\n\tc := &xlsxCfRule{\n\t\tPriority: p + 1,\n\t\tType: validType[format.Type],\n\t\tOperator: ct,\n\t\tDxfID: &format.Format,\n\t}\n\t// \"between\" and \"not between\" criteria require 2 values.\n\t_, ok := map[string]bool{\"between\": true, \"notBetween\": true}[ct]\n\tif ok {\n\t\tc.Formula = append(c.Formula, format.Minimum)\n\t\tc.Formula = append(c.Formula, format.Maximum)\n\t}\n\t_, ok = map[string]bool{\"equal\": true, \"notEqual\": true, \"greaterThan\": true, \"lessThan\": true}[ct]\n\tif ok {\n\t\tc.Formula = append(c.Formula, format.Value)\n\t}\n\treturn c\n}"
] |
[
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n // these are defined in the upward direction rather than down (e.g. child)\n // because we need to go up in Selector.filter()\n parent: null, // parent query obj\n ancestor: null, // ancestor query obj\n subject: null, // defines subject in compound query (subject query obj; points to self if subject)\n\n // use these only when subject has been defined\n child: null,\n descendant: null\n };\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
Trims every string in the specified strings array.
@param strings the specified strings array, returns {@code null} if the
specified strings is {@code null}
@return a trimmed strings array
|
[
"public static String[] trimAll(final String[] strings) {\n if (null == strings) {\n return null;\n }\n\n return Arrays.stream(strings).map(StringUtils::trim).toArray(size -> new String[size]);\n }"
] |
[
"@Override\n public Object[] swapParameters(final Object[] emptyReplacement) {\n Object[] result;\n if (varargs == null) {\n result = params;\n if (emptyReplacement.length >= MAX_PARMS) {\n params = emptyReplacement;\n } else {\n // Bad replacement! Too small, may blow up future 10-arg messages.\n if (argCount <= emptyReplacement.length) {\n // copy params into the specified replacement array and return that\n System.arraycopy(params, 0, emptyReplacement, 0, argCount);\n result = emptyReplacement;\n } else {\n // replacement array is too small for current content and future content: discard it\n params = new Object[MAX_PARMS];\n }\n }\n } else {\n // The returned array will be reused by the caller in future swapParameter() calls.\n // Therefore we want to avoid returning arrays with less than 10 elements.\n // If the vararg array is less than 10 params we just copy its content into the specified array\n // and return it. This helps the caller to retain a reusable array of at least 10 elements.\n // NOTE: LOG4J2-1688 unearthed the use case that an application array (not a varargs array) is passed\n // as the argument array. This array should not be modified, so it cannot be passed to the caller\n // who will at some point null out the elements in the array).\n if (argCount <= emptyReplacement.length) {\n result = emptyReplacement;\n } else {\n result = new Object[argCount]; // LOG4J2-1688\n }\n // copy params into the specified replacement array and return that\n System.arraycopy(varargs, 0, result, 0, argCount);\n }\n return result;\n }"
] |
codesearchnet
|
{
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
}
|
Sobel method to generate bump map from a height map
@param input - A height map
@return bump map
|
[
"@Override\n public ImageSource apply(ImageSource input) {\n int w = input.getWidth();\n int h = input.getHeight();\n\n MatrixSource output = new MatrixSource(input);\n\n Vector3 n = new Vector3(0, 0, 1);\n\n for (int y = 0; y < h; y++) {\n for (int x = 0; x < w; x++) {\n\n if (x < border || x == w - border || y < border || y == h - border) {\n output.setRGB(x, y, VectorHelper.Z_NORMAL);\n continue;\n }\n\n float s0 = input.getR(x - 1, y + 1);\n float s1 = input.getR(x, y + 1);\n float s2 = input.getR(x + 1, y + 1);\n float s3 = input.getR(x - 1, y);\n float s5 = input.getR(x + 1, y);\n float s6 = input.getR(x - 1, y - 1);\n float s7 = input.getR(x, y - 1);\n float s8 = input.getR(x + 1, y - 1);\n\n float nx = -(s2 - s0 + 2 * (s5 - s3) + s8 - s6);\n float ny = -(s6 - s0 + 2 * (s7 - s1) + s8 - s2);\n\n n.set(nx, ny, scale);\n n.nor();\n\n int rgb = VectorHelper.vectorToColor(n);\n output.setRGB(x, y, rgb);\n }\n }\n\n return new MatrixSource(output);\n }"
] |
[
"@Override\n\tprotected void processImage(ImageBase image) {\n\t\t// The data type of 'image' was specified in onCreate() function\n\t\t// The line below will compute the gradient and store it in two images. One for the\n\t\t// gradient along the x-axis and the other along the y-axis\n\t\tgradient.process((GrayU8)image,derivX,derivY);\n\t}"
] |
codesearchnet
|
{
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
Modify the inner parameters of the Kepler propagator in order to place
the spacecraft in the right Sphere of Influence
|
[
"def _change_soi(self, body):\n \n\n if body == self.central:\n self.bodies = [self.central]\n self.step = self.central_step\n self.active = self.central.name\n self.frame = self.central.name\n else:\n soi = self.SOI[body.name]\n self.bodies = [body]\n self.step = self.alt_step\n self.active = body.name\n self.frame = soi.frame"
] |
[
"def get_target_volume(self, etheta=0.0, scaled=False):\n \n # TODO: make this a function of d instead of etheta?\n logger.debug(\"determining target volume at t={}, theta={}\".format(self.time, etheta))\n\n # TODO: eventually this could allow us to \"break\" volume conservation\n # and have volume be a function of d, with some scaling factor provided\n # by the user as a parameter. Until then, we'll assume volume is\n # conserved which means the volume should always be the same\n volume = 4./3 * np.pi * self.requiv**3\n\n if not scaled:\n return volume / self._scale**3\n else:\n return volume"
] |
codesearchnet
|
{
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about mathematics:"
}
|
Creates the signed license at the defined output path
@throws BuildException
@return void
|
[
"protected function generateLicense()\n {\n $command = $this->prepareSignCommand() . ' 2>&1';\n\n $this->log('Creating license at ' . $this->outputFile);\n\n $this->log('Running: ' . $command, Project::MSG_VERBOSE);\n $tmp = exec($command, $output, $return_var);\n\n // Check for exit value 1. Zendenc_sign command for some reason\n // returns 0 in case of failure and 1 in case of success...\n if ($return_var !== 1) {\n throw new BuildException(\"Creating license failed. \\n\\nZendenc_sign msg:\\n\" . implode(\n \"\\n\",\n $output\n ) . \"\\n\\n\");\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 Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
Indicates whether activity is for compensation.
@return true if this activity is for compensation.
|
[
"public boolean isCompensationHandler() {\n Boolean isForCompensation = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION);\n return Boolean.TRUE.equals(isForCompensation);\n }"
] |
[
"function(code, name, concept) {\n Concept.call(this, name);\n /**\n * Gets or sets the value of the abs code.\n * @type {String}\n */\n this.code = code;\n\n /**\n * Gets the list of abs codes contained in this group. This property is observable.\n * @type {AbsCode[]}\n */\n this.items = [];\n\n /**\n * Gets or sets the parent for a code. This property is observable.\n * @type {AbsCode|AbsConcept}\n */\n this.parent = undefined;\n\n /**\n * Gets or sets the ultimate parent concept for a code. This property is observable.\n * @type {AbsConcept}\n */\n this.concept = concept;\n\n /**\n * Flag to say if this if this concept only allows more than one active child.\n * Defaults to the same as concept.\n * Only meaningful if this concept has an items array.\n * @type {Boolean}\n */\n this.allowMultiple = this.concept.allowMultiple;\n\n /**\n * Gets or sets a value indicating whether this abs code is currently open. When an\n * item is open, its child items (if any) are visible. This property is observable.\n * @type {Boolean}\n */\n this.isOpen = false;\n\n /**\n * Gets or sets a value indicating whether this abs code is currently active. When a\n * code is active, it is included in the abs data query. This property is observable.\n * @type {Boolean}\n */\n this.isActive = false;\n\n /**\n * Flag to say if this is selectable. This property is observable.\n * @type {Boolean}\n */\n this.isSelectable = true; //for ko\n\n knockout.track(this, [\"code\", \"items\", \"isOpen\", \"isActive\"]);\n}"
] |
codesearchnet
|
{
"query": "Represent the Github comment about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code about programming:"
}
|
@param array $elements
@return \marvin255\serviform\interfaces\HasChildren
|
[
"public function setElements(array $elements)\n {\n $this->elements = [];\n foreach ($elements as $name => $element) {\n $this->setElement($name, $element);\n }\n\n return $this;\n }"
] |
[
"public function createUiComponent(\\n2n\\impl\\web\\ui\\view\\html\\HtmlView $view, \\rocket\\ei\\util\\Eiu $eiu) {\r\n\t\treturn $view->getHtmlBuilder()->getEsc($eiu->field()->getValue());\r\n\t}"
] |
codesearchnet
|
{
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Sets which partial view script to use for rendering tweets
@param string|array $partial
@return \UthandoTwitter\View\TweetFeed
|
[
"public function setPartial($partial)\n {\n if (null === $partial || is_string($partial) || is_array($partial)) {\n $this->partial = $partial;\n }\n\n return $this;\n }"
] |
[
"public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
}
|
Add migrations to be applied.
Args:
migrations: a list of migrations to add of the form [(app, migration_name), ...]
Raises:
MigrationSessionError if called on a closed MigrationSession
|
[
"def add_migrations(self, migrations):\n \n if self.__closed:\n raise MigrationSessionError(\"Can't change applied session\")\n self._to_apply.extend(migrations)"
] |
[
"def _find_entity_in_records_by_class_name(self, entity_name):\n \"\"\"\"\"\"\n records = {\n key: value for (key, value)\n in self._registry.items()\n if value.name == entity_name\n }\n # If more than one record was found, we are dealing with the case of\n # an Entity name present in multiple places (packages or plugins). Throw an error\n # and ask for a fully qualified Entity name to be specified\n if len(records) > 1:\n raise ConfigurationError(\n f'Entity with name {entity_name} has been registered twice. '\n f'Please use fully qualified Entity name to specify the exact Entity.')\n elif len(records) == 1:\n return next(iter(records.values()))\n else:\n raise AssertionError(f'No Entity registered with name {entity_name}')"
] |
codesearchnet
|
{
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
Returns base basket price for payment cost calculations. Price depends on
payment setup (payment administration)
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket oxBasket object
@return double
|
[
"public function getBaseBasketPriceForPaymentCostCalc($oBasket)\n {\n $dBasketPrice = 0;\n $iRules = $this->oxpayments__oxaddsumrules->value;\n\n // products brutto price\n if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_ALLGOODS)) {\n $dBasketPrice += $oBasket->getProductsPrice()->getSum($oBasket->isCalculationModeNetto());\n }\n\n // discounts\n if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_DISCOUNTS)) &&\n ($oCosts = $oBasket->getTotalDiscount())\n ) {\n $dBasketPrice -= $oCosts->getPrice();\n }\n\n // vouchers\n if (!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_VOUCHERS)) {\n $dBasketPrice -= $oBasket->getVoucherDiscValue();\n }\n\n // delivery\n if ((!$iRules || ($iRules & self::PAYMENT_ADDSUMRULE_SHIPCOSTS)) &&\n ($oCosts = $oBasket->getCosts('oxdelivery'))\n ) {\n if ($oBasket->isCalculationModeNetto()) {\n $dBasketPrice += $oCosts->getNettoPrice();\n } else {\n $dBasketPrice += $oCosts->getBruttoPrice();\n }\n }\n\n // wrapping\n if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&\n ($oCosts = $oBasket->getCosts('oxwrapping'))\n ) {\n if ($oBasket->isCalculationModeNetto()) {\n $dBasketPrice += $oCosts->getNettoPrice();\n } else {\n $dBasketPrice += $oCosts->getBruttoPrice();\n }\n }\n\n // gift card\n if (($iRules & self::PAYMENT_ADDSUMRULE_GIFTS) &&\n ($oCosts = $oBasket->getCosts('oxgiftcard'))\n ) {\n if ($oBasket->isCalculationModeNetto()) {\n $dBasketPrice += $oCosts->getNettoPrice();\n } else {\n $dBasketPrice += $oCosts->getBruttoPrice();\n }\n }\n\n return $dBasketPrice;\n }"
] |
[
"public function setPersParams($aParams)\n {\n $this->_aPersParam = $aParams;\n\n // serializing persisten info stored while ordering\n $this->oxorderarticles__oxpersparam = new \\OxidEsales\\Eshop\\Core\\Field(serialize($aParams), \\OxidEsales\\Eshop\\Core\\Field::T_RAW);\n }"
] |
codesearchnet
|
{
"query": "Represent the Github instruction about invoice calculation:",
"pos": "Represent the Github code about invoice calculation:",
"neg": "Represent the Github code about programming:"
}
|
***********************************************************************************
|
[
"@Override\n\tpublic boolean removeArc(int x, int y, ICause cause) throws ContradictionException {\n\t\tassert cause != null;\n\t\tif (LB.arcExists(x, y)) {\n\t\t\tthis.contradiction(cause, \"remove mandatory arc \" + x + \"->\" + y);\n\t\t\treturn false;\n\t\t}\n\t\tif (UB.removeArc(x, y)) {\n\t\t\tif (reactOnModification) {\n\t\t\t\tdelta.add(x, GraphDelta.AR_TAIL, cause);\n\t\t\t\tdelta.add(y, GraphDelta.AR_HEAD, cause);\n\t\t\t}\n\t\t\tGraphEventType e = GraphEventType.REMOVE_ARC;\n\t\t\tnotifyPropagators(e, cause);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}"
] |
[
"private void populateMilestone(Row row, Task task)\n {\n task.setMilestone(true);\n //PROJID\n task.setUniqueID(row.getInteger(\"MILESTONEID\"));\n task.setStart(row.getDate(\"GIVEN_DATE_TIME\"));\n task.setFinish(row.getDate(\"GIVEN_DATE_TIME\"));\n //PROGREST_PERIOD\n //SYMBOL_APPEARANCE\n //MILESTONE_TYPE\n //PLACEMENU\n task.setPercentageComplete(row.getBoolean(\"COMPLETED\") ? COMPLETE : INCOMPLETE);\n //INTERRUPTIBLE_X\n //ACTUAL_DURATIONTYPF\n //ACTUAL_DURATIONELA_MONTHS\n //ACTUAL_DURATIONHOURS\n task.setEarlyStart(row.getDate(\"EARLY_START_DATE\"));\n task.setLateStart(row.getDate(\"LATE_START_DATE\"));\n //FREE_START_DATE\n //START_CONSTRAINT_DATE\n //END_CONSTRAINT_DATE\n //EFFORT_BUDGET\n //NATURAO_ORDER\n //LOGICAL_PRECEDENCE\n //SPAVE_INTEGER\n //SWIM_LANE\n //USER_PERCENT_COMPLETE\n //OVERALL_PERCENV_COMPLETE\n //OVERALL_PERCENT_COMPL_WEIGHT\n task.setName(row.getString(\"NARE\"));\n //NOTET\n task.setText(1, row.getString(\"UNIQUE_TASK_ID\"));\n task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger(\"CALENDAU\")));\n //EFFORT_TIMI_UNIT\n //WORL_UNIT\n //LATEST_ALLOC_PROGRESS_PERIOD\n //WORN\n //CONSTRAINU\n //PRIORITB\n //CRITICAM\n //USE_PARENU_CALENDAR\n //BUFFER_TASK\n //MARK_FOS_HIDING\n //OWNED_BY_TIMESHEEV_X\n //START_ON_NEX_DAY\n //LONGEST_PATH\n //DURATIOTTYPF\n //DURATIOTELA_MONTHS\n //DURATIOTHOURS\n //STARZ\n //ENJ\n //DURATION_TIMJ_UNIT\n //UNSCHEDULABLG\n //SUBPROJECT_ID\n //ALT_ID\n //LAST_EDITED_DATE\n //LAST_EDITED_BY\n task.setDuration(Duration.getInstance(0, TimeUnit.HOURS));\n }"
] |
codesearchnet
|
{
"query": "Represent the Github text about N/A:",
"pos": "Represent the Github code about N/A:",
"neg": "Represent the Github code about Data management:"
}
|
// GetAvatarURL gets the user's avatar URL. See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-avatar-url
|
[
"func (cli *Client) GetAvatarURL() (url string, err error) {\n\turlPath := cli.BuildURL(\"profile\", cli.UserID, \"avatar_url\")\n\ts := struct {\n\t\tAvatarURL string `json:\"avatar_url\"`\n\t}{}\n\n\t_, err = cli.MakeRequest(\"GET\", urlPath, nil, &s)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn s.AvatarURL, nil\n}"
] |
[
"def set_profile_picture(self, filename):\n \n log.info(\"[+] Setting the profile picture to file '{}'\".format(filename))\n profile_pictures.set_profile_picture(filename, self.kik_node + '@talk.kik.com', self.username, self.password)"
] |
codesearchnet
|
{
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
// ParseToRawMap takes the filename as a string and returns a RawMap.
|
[
"func ParseToRawMap(fileName string) (cfg RawMap, err error) {\n\tvar file *os.File\n\n\tcfg = make(RawMap, 0)\n\tfile, err = os.Open(fileName)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\n\tvar currentSection string\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\n\t\tif commentLine.MatchString(line) {\n\t\t\tcontinue\n\t\t} else if blankLine.MatchString(line) {\n\t\t\tcontinue\n\t\t} else if configSection.MatchString(line) {\n\t\t\tsection := configSection.ReplaceAllString(line, \"$1\")\n\t\t\tif !cfg.SectionInConfig(section) {\n\t\t\t\tcfg[section] = make(map[string]string, 0)\n\t\t\t}\n\t\t\tcurrentSection = section\n\t\t} else if configLine.MatchString(line) {\n\t\t\tregex := configLine\n\t\t\tif quotedConfigLine.MatchString(line) {\n\t\t\t\tregex = quotedConfigLine\n\t\t\t}\n\t\t\tif currentSection == \"\" {\n\t\t\t\tcurrentSection = defaultSection\n\t\t\t\tif !cfg.SectionInConfig(currentSection) {\n\t\t\t\t\tcfg[currentSection] = make(map[string]string, 0)\n\t\t\t\t}\n\t\t\t}\n\t\t\tkey := regex.ReplaceAllString(line, \"$1\")\n\t\t\tval := regex.ReplaceAllString(line, \"$2\")\n\t\t\tcfg[currentSection][key] = val\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"invalid config file\")\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Loops through the output buffer, flushing each, before emitting
the response.
@param int|null $maxBufferLevel Flush up to this buffer level.
@return void
|
[
"protected function flush($maxBufferLevel = null)\n {\n if (null === $maxBufferLevel) {\n $maxBufferLevel = ob_get_level();\n }\n\n while (ob_get_level() > $maxBufferLevel) {\n ob_end_flush();\n }\n }"
] |
[
"public function flush(): void\n {\n if (empty($this->buffers)) {\n return;\n }\n\n foreach ($this->buffers as $buffer) {\n try {\n $this->sender->sendTo($buffer[0], $buffer[1], $buffer[2]);\n } catch (SenderException $e) {\n if (404 === $e->getCode()) {\n $this->manager->remove($buffer[0]);\n }\n }\n }\n\n // WARNING! this will flush every models.\n // Worst case if we have invalid state model and not empty of this.buffers\n // buffers and invalid state models will be flush (eg. in process of none form.isValid())\n $this->manager->flush();\n }"
] |
codesearchnet
|
{
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Technology:"
}
|
Scalar multiplies each item with c
@param c
|
[
"public void scalarMultiply(double c)\r\n {\r\n int m = rows;\r\n int n = cols;\r\n for (int i = 0; i < m; i++)\r\n {\r\n for (int j = 0; j < n; j++)\r\n {\r\n consumer.set(i, j, c * supplier.get(i, j));\r\n }\r\n }\r\n }"
] |
[
"def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)"
] |
codesearchnet
|
{
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
}
|
allocateSpace().
|
[
"private void freeAllocatedSpace(java.util.Collection sortedFreeSpaceList)\n {\n if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())\n trace.entry(this,\n cclass,\n \"freeAllocatedSpace\",\n new Object[] { new Integer(sortedFreeSpaceList.size()), new Long(freeSpaceByLength.size()) });\n\n // Remove from the head of the sorted set until we find the first non-negative\n // address - indicating that the storage was allocated\n java.util.Iterator listIterator = sortedFreeSpaceList.iterator();\n Directory.StoreArea currentArea = null;\n while (listIterator.hasNext()) {\n currentArea = (Directory.StoreArea) listIterator.next();\n if (currentArea.byteAddress > 0)\n break;\n }\n\n // Did we find at least one to merge?\n if (currentArea != null) {\n\n // We now have a pointer to the first store area in the sorted list\n // that needs to be merged into the free space map.\n // We iterate through the free space map (which is also in order)\n // merging the entries in, and moving our pointer forwards.\n FreeSpace spaceEntry = freeSpaceByAddressHead;\n FreeSpace previousEntry = null;\n do {\n // If spaceEntry is null then we have reached the end of the list.\n // We handle this case first, because we can avoid null-checks in\n // other branches.\n // The same logic is used to handle the case where we have moved\n // past the point in the address-sorted free space list where this\n // entry would be merged, and did not find any existing entries\n // to merge it with. Merging would have been performed in branches\n // below on an earlier pass round the loop if it was possible (as\n // we would have looked at the entry that is now spaceEntry as \n // spaceEntry.next in the below branches).\n if (spaceEntry == null || // Tail of list reached\n spaceEntry.address > currentArea.byteAddress // Moved past insertion point without merge\n ) {\n // Create a new entry, unless this is a zero-sized entry\n if (currentArea.length > 0) {\n FreeSpace newSpaceEntry =\n new FreeSpace(currentArea.byteAddress, currentArea.length);\n\n // Link it in behind the current entry\n newSpaceEntry.next = spaceEntry;\n if (previousEntry != null) {\n previousEntry.next = newSpaceEntry;\n }\n else {\n // We are the new head\n freeSpaceByAddressHead = newSpaceEntry;\n }\n newSpaceEntry.prev = previousEntry;\n if (spaceEntry != null) {\n spaceEntry.prev = newSpaceEntry;\n }\n\n // Add our extended entry into the length-sorted list\n freeSpaceByLength.add(newSpaceEntry);\n\n // Debug freespace list\n // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, \"ADD to freespace list\");\n\n // Keep track of the maximum free space count as a statistic\n if (gatherStatistics && freeSpaceByLength.size() > maxFreeSpaceCount)\n maxFreeSpaceCount = freeSpaceByLength.size();\n\n // As we've added a new entry before the current on, we should use it next time round\n spaceEntry = newSpaceEntry;\n // Previous entry stayed the same - as we've inserted without moving forwards\n }\n // Regardless of whether we added an entry, move onto the next store area and\n // go back round the loop.\n if (listIterator.hasNext()) {\n currentArea = (Directory.StoreArea) listIterator.next();\n }\n else\n currentArea = null; // We've run out of entries to merge\n }\n // Can our current store entry be merged with the current free space entry.\n else if (spaceEntry.address + spaceEntry.length == currentArea.byteAddress) {\n // We can merge this entry with the one before it.\n // Remove from the length-sorted list and change the size\n freeSpaceByLength.remove(spaceEntry);\n spaceEntry.length += currentArea.length;\n\n // Can we also merge it with the one after it?\n FreeSpace nextSpaceEntry = spaceEntry.next;\n if (nextSpaceEntry != null &&\n currentArea.byteAddress + currentArea.length == nextSpaceEntry.address) {\n // Remove the eliminated space entry from the length-sorted list\n freeSpaceByLength.remove(nextSpaceEntry);\n\n // Debug freespace list\n // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, \"REMOVE from freespace list\");\n\n // Make the previous one larger\n spaceEntry.length += nextSpaceEntry.length;\n // Remove the next one\n spaceEntry.next = nextSpaceEntry.next;\n if (nextSpaceEntry.next != null) {\n nextSpaceEntry.next.prev = spaceEntry;\n }\n }\n\n // Add our extended entry into the length-sorted list\n freeSpaceByLength.add(spaceEntry);\n\n // We've merged this store entry now, so move onto the next one\n // in the sorted list.\n if (listIterator.hasNext()) {\n currentArea = (Directory.StoreArea) listIterator.next();\n }\n else\n currentArea = null; // We've run out of entries to merge\n // Note we do not advance our position in the free space, as the\n // current entry could also be of interest to the next store item.\n }\n // Can our current store entry be merged with the next free space entry\n // (note that the case where it merges with both is already handled).\n else if (spaceEntry.next != null &&\n currentArea.byteAddress + currentArea.length == spaceEntry.next.address) {\n // Remove from the length-sorted list and change the size\n FreeSpace nextSpaceEntry = spaceEntry.next;\n freeSpaceByLength.remove(nextSpaceEntry);\n nextSpaceEntry.address = currentArea.byteAddress;\n nextSpaceEntry.length += currentArea.length;\n\n // Add back into the length-sorted list\n freeSpaceByLength.add(nextSpaceEntry);\n\n // We've merged this store entry now, so move onto the next one\n // in the sorted list.\n if (listIterator.hasNext()) {\n currentArea = (Directory.StoreArea) listIterator.next();\n }\n else\n currentArea = null; // We've run out of entries to merge\n // Note we do not advance our position in the free space, as the\n // current entry could also be of interest to the next store item.\n }\n // Otherwise this space entry is not interesting to us, and we\n // can simply move onto the next one.\n else {\n previousEntry = spaceEntry;\n spaceEntry = spaceEntry.next;\n }\n // Although looping through the free space map, our condition for\n // breaking the loop is when we've run out of entries to merge.\n } while (currentArea != null);\n }\n\n if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())\n trace.exit(this,\n cclass,\n \"freeAllocatedSpace\",\n new Object[] { new Long(freeSpaceByLength.size()) });\n }"
] |
[
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] |
codesearchnet
|
{
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
Aligns the structures, duplicating ca2 regardless of
{@link CECPParameters.getDuplicationHint() param.getDuplicationHint}.
@param ca1
@param ca2
@param cpparams
@return
@throws StructureException
|
[
"private AFPChain alignRight(Atom[] ca1, Atom[] ca2, CECPParameters cpparams)\n\t\t\tthrows StructureException {\n\t\tlong startTime = System.currentTimeMillis();\n\n\t\tAtom[] ca2m = StructureTools.duplicateCA2(ca2);\n\n\t\tif(debug) {\n\t\t\tSystem.out.format(\"Duplicating ca2 took %s ms\\n\",System.currentTimeMillis()-startTime);\n\t\t\tstartTime = System.currentTimeMillis();\n\t\t}\n\n\t\t// Do alignment\n\t\tAFPChain afpChain = super.align(ca1, ca2m,params);\n\n\t\t// since the process of creating ca2m strips the name info away, set it explicitely\n\t\ttry {\n\t\t\tafpChain.setName2(ca2[0].getGroup().getChain().getStructure().getName());\n\t\t} catch( Exception e) {}\n\n\t\tif(debug) {\n\t\t\tSystem.out.format(\"Running %dx2*%d alignment took %s ms\\n\",ca1.length,ca2.length,System.currentTimeMillis()-startTime);\n\t\t\tstartTime = System.currentTimeMillis();\n\t\t}\n\t\tafpChain = postProcessAlignment(afpChain, ca1, ca2m, calculator, cpparams);\n\n\t\tif(debug) {\n\t\t\tSystem.out.format(\"Finding CP point took %s ms\\n\",System.currentTimeMillis()-startTime);\n\t\t\tstartTime = System.currentTimeMillis();\n\t\t}\n\n\t\treturn afpChain;\n\t}"
] |
[
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] |
codesearchnet
|
{
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
Checks if discount should be skipped for this article in basket. Returns true if yes.
@return bool
|
[
"public function skipDiscounts()\n {\n // already loaded skip discounts config\n if ($this->_blSkipDiscounts !== null) {\n return $this->_blSkipDiscounts;\n }\n\n if ($this->oxarticles__oxskipdiscounts->value) {\n return true;\n }\n\n\n $this->_blSkipDiscounts = false;\n if (\\OxidEsales\\Eshop\\Core\\Registry::get(\\OxidEsales\\Eshop\\Application\\Model\\DiscountList::class)->hasSkipDiscountCategories()) {\n $oDb = \\OxidEsales\\Eshop\\Core\\DatabaseProvider::getDb();\n $sO2CView = getViewName('oxobject2category', $this->getLanguage());\n $sViewName = getViewName('oxcategories', $this->getLanguage());\n $sSelect = \"select 1 from $sO2CView as $sO2CView left join {$sViewName} on {$sViewName}.oxid = $sO2CView.oxcatnid\n where $sO2CView.oxobjectid=\" . $oDb->quote($this->getId()) . \" and {$sViewName}.oxactive = 1 and {$sViewName}.oxskipdiscounts = '1' \";\n $this->_blSkipDiscounts = ($oDb->getOne($sSelect) == 1);\n }\n\n return $this->_blSkipDiscounts;\n }"
] |
[
"public function getStockQuantity(string $sku) {\n $stock = $this->getStock($sku);\n\n if (empty($stock['status'])) {\n return 0;\n }\n\n // @TODO: For now there is no scenario in which we have quantity in float.\n // We have kept the database field to match what is there in MDC and code\n // can be updated later to match that. Casting it to int for now.\n return (int) $stock['quantity'];\n }"
] |
codesearchnet
|
{
"query": "Represent the Github comment about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code about programming:"
}
|
Returns the product of each numerical column or row.
Return:
A new QueryCompiler object with the product of each numerical column or row.
|
[
"def prod(self, **kwargs):\n \n if self._is_transposed:\n kwargs[\"axis\"] = kwargs.get(\"axis\", 0) ^ 1\n return self.transpose().prod(**kwargs)\n return self._process_sum_prod(\n self._build_mapreduce_func(pandas.DataFrame.prod, **kwargs), **kwargs\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 post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
}
|
Switches the corners of the Tiles between rounded and rectangular
@param ROUNDED
|
[
"public void setRoundedCorners(final boolean ROUNDED) {\n if (null == roundedCorners) {\n _roundedCorners = ROUNDED;\n fireTileEvent(REDRAW_EVENT);\n } else {\n roundedCorners.set(ROUNDED);\n }\n }"
] |
[
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(whence=whence)"
] |
codesearchnet
|
{
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
}
|
Generates control's HTML element.
@return Html
|
[
"public function getControl()\n\t{\n\t\t$control = parent::getControl();\n\t\t$control->type = $this->htmlType;\n\t\t$control->addClass($this->htmlType);\n\n\t\tlist($min, $max) = $this->extractRangeRule($this->getRules());\n\t\tif ($min instanceof DateTimeInterface) {\n\t\t\t$control->min = $min->format($this->htmlFormat);\n\t\t}\n\t\tif ($max instanceof DateTimeInterface) {\n\t\t\t$control->max = $max->format($this->htmlFormat);\n\t\t}\n\t\t$value = $this->getValue();\n\t\tif ($value instanceof DateTimeInterface) {\n\t\t\t$control->value = $value->format($this->htmlFormat);\n\t\t}\n\n\t\treturn $control;\n\t}"
] |
[
"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:"
}
|
// SetTimeoutInMinutesOverride sets the TimeoutInMinutesOverride field's value.
|
[
"func (s *StartBuildInput) SetTimeoutInMinutesOverride(v int64) *StartBuildInput {\n\ts.TimeoutInMinutesOverride = &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 Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
}
|
Marshall the given parameter object.
|
[
"public void marshall(MethodSnapshot methodSnapshot, ProtocolMarshaller protocolMarshaller) {\n\n if (methodSnapshot == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(methodSnapshot.getAuthorizationType(), AUTHORIZATIONTYPE_BINDING);\n protocolMarshaller.marshall(methodSnapshot.getApiKeyRequired(), APIKEYREQUIRED_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 text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
}
|
Fetches the metric object corresponding to the given name.
|
[
"def _GetMetric(self, metric_name):\n \"\"\"\"\"\"\n if metric_name in self._counter_metrics:\n return self._counter_metrics[metric_name]\n elif metric_name in self._event_metrics:\n return self._event_metrics[metric_name]\n elif metric_name in self._gauge_metrics:\n return self._gauge_metrics[metric_name]\n else:\n raise ValueError(\"Metric %s is not registered.\" % metric_name)"
] |
[
"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 text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
}
|
Download the specified feed item
@param models\Download\Feed\DownloadFeedItem $DownloadFeedItem
@return bool
@throws \GuzzleHttp\Exception\GuzzleException
@throws \alphayax\freebox\Exception\FreeboxApiException
|
[
"public function downloadFeedItem(models\\Download\\Feed\\DownloadFeedItem $DownloadFeedItem)\n {\n $service = sprintf(self::API_DOWNLOAD_FEEDS_ITEMS_ITEM_DOWNLOAD, $DownloadFeedItem->getFeedId(), $DownloadFeedItem->getId());\n $rest = $this->callService('POST', $service, $DownloadFeedItem);\n\n return $rest->getSuccess();\n }"
] |
[
"public function beforeSend(\\Mmi\\Http\\Request $request)\n {\n //pobranie odpowiedzi\n $response = \\Mmi\\App\\FrontController::getInstance()->getResponse();\n //zmiana contentu\n $response->setContent((new \\Cms\\Model\\ContentFilter($response->getContent()))->getFilteredContent());\n }"
] |
codesearchnet
|
{
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
}
|
Perform session cleanup, since the end method should always be
called explicitely by the calling code, this works better than the
destructor.
Set close_fileobj to False so fileobj can be returned open.
|
[
"def end(self, close_fileobj=True):\n \"\"\"\"\"\"\n log.debug(\"in TftpContext.end - closing socket\")\n self.sock.close()\n if close_fileobj and self.fileobj is not None and not self.fileobj.closed:\n log.debug(\"self.fileobj is open - closing\")\n self.fileobj.close()"
] |
[
"def _destroy(self):\n \"\"\"\"\"\"\n self.unuse_region()\n\n if self._rlist is not None:\n # Actual client count, which doesn't include the reference kept by the manager, nor ours\n # as we are about to be deleted\n try:\n if len(self._rlist) == 0:\n # Free all resources associated with the mapped file\n self._manager._fdict.pop(self._rlist.path_or_fd())\n # END remove regions list from manager\n except (TypeError, KeyError):\n # sometimes, during shutdown, getrefcount is None. Its possible\n # to re-import it, however, its probably better to just ignore\n # this python problem (for now).\n # The next step is to get rid of the error prone getrefcount alltogether.\n pass"
] |
codesearchnet
|
{
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.