query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// addLocalAddress adds an address that this node is listening on to the
// address manager so that it may be relayed to peers. | [
"func addLocalAddress(addrMgr *addrmgr.AddrManager, addr string, services wire.ServiceFlag) error {\n\thost, portStr, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tport, err := strconv.ParseUint(portStr, 10, 16)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ip := net.ParseIP(host); ip ... | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \... | codesearchnet | {
"query": "Represent the Github post about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Software development:"
} |
Page::setFile
@param $filePath
@return static | [
"public function setFile($filePath)\n {\n if (is_file($filePath)) {\n $this->file = new SplFileInfo($filePath);\n\n if (file_exists(\n $propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(\n '.phtml',\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 Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Returns a reference for this managed connection factory.
@return a reference for this managed connection factory | [
"Reference getReference() {\n\n if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {\n SibTr.entry(this, TRACE, \"getReference\");\n }\n\n // Create a reference object describing this class\n final Reference reference = new Reference(getConnectionType(),\n ... | [
"private boolean isInternalUnprotectedMethod(EJBMethodMetaData methodMetaData) {\n EJBMethodInterface interfaceType = methodMetaData.getEJBMethodInterface();\n /***\n * For TIMED_OBJECT, the code references EJB 2.1 spec section 22.2.2 and matches a\n * method signature, which is necess... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Returns the global cookie as set in setCookie().
@return String The cookie's value or null if not set.
@see setCookie() | [
"public function getCookie($key) {\n return (!empty($this->globalCookies[$key])) ? $this->globalCookies[$key] : null;\n }"
] | [
"function destroy()\n {\n /*\n * Cookies must be deleted with the same parameters as they were set with.\n * If the value argument is an empty string, or FALSE, and all other\n * arguments match a previous call to setcookie, then the cookie with the\n * specified name will ... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Database management:"
} |
Obtain the dictionary for the key.
Returns:
[DictionaryInterface, remainder]
@param string $key The key.
@return array | [
"protected function splitDictionaryRemainderAndPrefix(string $key): array\n {\n [$remainder, $prefix] = $this->splitRemainderAndPrefix($key);\n\n return [$this->dictionaries[$prefix], $remainder, $prefix];\n }"
] | [
"public List<Symbol> getSymbolList(final String param) {\n return get(param, new StringToSymbolList(\",\"),\n new AlwaysValid<List<Symbol>>(),\n \"comma-separated list of strings\");\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Documentation:"
} |
Generate output file path.
@param path the path
@return the string | [
"@Deprecated\n\tpublic static String generateOutputFilePath(String path) {\n\t\tString tempPath = separatorsToSystem(path);\n\t\ttempPath = tempPath + File.separatorChar + generateAuditFileName();\n\t\treturn tempPath;\n\t}"
] | [
"def append_line(self, new_line):\n \"\"\"\"\"\"\n # TODO: The user still has to write the raw line, this is error prone.\n self._write(('PGM', [Integer, String]), self.idx, new_line)"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Returns ``(entity, input_entity)`` for the given entity ID. | [
"def _get_entity_pair(self, entity_id):\n \n entity = self._entities.get(entity_id)\n try:\n input_entity = utils.get_input_peer(entity)\n except TypeError:\n try:\n input_entity = self._client._entity_cache[entity_id]\n except KeyError:\n ... | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// SetRenderedTemplate sets the RenderedTemplate field's value. | [
"func (s *TestRenderTemplateOutput) SetRenderedTemplate(v string) *TestRenderTemplateOutput {\n\ts.RenderedTemplate = &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.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Loop through all params of a method/constructor to resolve, and attempt to resolve them.
@since 1.1.0
@throws ContainerException
@param $params List of params to loop through.
@param $args Arguments passed to the parent resolve method. | [
"private function resolveParams($params, $args)\n {\n foreach ($params as $param) {\n $class = $param->getClass();\n\n // if the param is not a class, check $args for the value\n if (\\is_null($class)) {\n $this->resolveParam($args, $param);\n ... | [
"@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 Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
// Validate inspects the fields of the type to determine if they are valid. | [
"func (s *PatchRule) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"PatchRule\"}\n\tif s.ApproveAfterDays == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ApproveAfterDays\"))\n\t}\n\tif s.PatchFilterGroup == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"PatchFi... | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Enable or disable https certificate verification
// Disable this at your own risk. | [
"func (ya *YubiAuth) HttpsVerifyCertificate(verifyCertificate bool) {\n\t// Lock\n\tya.use.Lock()\n\tdefer ya.use.Unlock()\n\n\t// save setting\n\tya.verifyCertificate = verifyCertificate\n\n\t// rebuild workers (client has to be changed)\n\tya.buildWorkers()\n}"
] | [
"function() {\n var test = \"chat-bubble-storage-test\"\n try {\n localStorage.setItem(test, test)\n localStorage.removeItem(test)\n return true\n } catch (error) {\n console.error(\n \"Your server does not allow storing data locally. Most likely it's because you've opened this p... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Copy between different filesystem
@param string $from
@param string $to
@return bool
@access protected | [
"protected function diffFilesystemCopy(\n /*# string */ $from,\n /*# string */ $to\n )/*# : bool */ {\n $content = $this->get($from);\n\n if (is_null($content)) {\n return false;\n } elseif (is_array($content)) {\n return $this->copyDir($content, $to);\n ... | [
"private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope... | codesearchnet | {
"query": "Represent the Github sentence about file transfer:",
"pos": "Represent the Github code about file transfer:",
"neg": "Represent the Github code about programming:"
} |
Builds and installs the frontend | [
"def install_frontend(instance='default', forcereload=False, forcerebuild=False,\n forcecopy=True, install=True, development=False, build_type='dist'):\n \"\"\"\"\"\"\n\n hfoslog(\"Updating frontend components\", emitter='BUILDER')\n components = {}\n loadable_components = {}\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 # CAR... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
/* Functions to work with processes | [
"function execProcess(command, options, onClose) {\n const procStart = process.hrtime(),\n cmd = command.join(' '),\n opts = options || {};\n\n childProcess.exec(cmd, opts, (error, stdout, stderr) => {\n const procEnd = process.hrtime(procStart),\n end = (procEnd[0] + pro... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// AddUserToSAR adds the requisite user information to a SubjectAccessReview.
// It returns the modified SubjectAccessReview. | [
"func AddUserToSAR(user user.Info, sar *authorizationv1.SubjectAccessReview) *authorizationv1.SubjectAccessReview {\n\tsar.Spec.User = user.GetName()\n\t// reminiscent of the bad old days of C. Copies copy the min number of elements of both source and dest\n\tsar.Spec.Groups = make([]string, len(user.GetGroups()))... | [
"func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Adds a service instance or service descriptor (if it is already
not added)
@param mixed $service
@throws Apache_Solr_InvalidArgumentException If service descriptor is not valid | [
"public function addReadService($service)\n\t{\n\t\tif ($service instanceof Apache_Solr_Service)\n\t\t{\n\t\t\t$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());\n\n\t\t\t$this->_readableServices[$id] = $service;\n\t\t}\n\t\telse if (is_array($service))\n\t\t{\n\t\t\tif (isse... | [
"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 Plugi... | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
initializes table.
@param roles list of user | [
"private void init(List<CmsRole> roles) {\n\n CmsRole.applySystemRoleOrder(roles);\n m_menu = new CmsContextMenu();\n m_menu.setAsTableContextMenu(this);\n\n m_container = new IndexedContainer();\n\n for (TableProperty prop : TableProperty.values()) {\n m_container.addC... | [
"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 summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Serialize all object scalar properties to string
@return string | [
"public function serialize()\n {\n return serialize(array($this->message, $this->code, $this->file, $this->line));\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Returns array of categories, each of them contains a list of fields definitions.
@return category_controller[] | [
"public function get_categories_with_fields() : array {\n if ($this->categories === null) {\n $this->categories = api::get_categories_with_fields($this->get_component(), $this->get_area(), $this->get_itemid());\n }\n $handler = $this;\n array_walk($this->categories, function(c... | [
"def getSampleTypeTitles(self):\n \n sample_types = self.getSampleTypes()\n sample_type_titles = map(lambda obj: obj.Title(), sample_types)\n\n # N.B. This is used only for search purpose, because the catalog does\n # not add an entry to the Keywordindex for an empty list.\n ... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Build a logical line from tokens. | [
"def build_tokens_line(self):\n \"\"\"\"\"\"\n logical = []\n comments = []\n length = 0\n prev_row = prev_col = mapping = None\n for token_type, text, start, end, line in self.tokens:\n if token_type in SKIP_TOKENS:\n continue\n if not ... | [
"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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Detach a Listener from one or multiple events
@param mixed $event either an Event object or a string
@param Callable $callback | [
"public function detach($event, $callback){\n $events = is_array($event) ? $event : array($event);\n $listeners = $this->getOption(self::OPTION_LISTENERS);\n foreach ($events as $event) {\n $eventObject = is_object($event) ? $event : new GenericEvent($event);\n $listeners ... | [
"public function listen($uri, EventHandler $handler, $overRideYamlKey) {\n //CP-2 added this while working on calling listeners during core/components/render call\n //no need to add handlers that will never match our request\n //CP-265 - $overRideYamlKey - render component is the main __YML_KEY... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Decrement existing value
@param $id
@return mixed | [
"public function decr($id) {\n $params = [':id' => $id];\n $statement = 'UPDATE kv_store SET kv_value = kv_value - 1 WHERE kv_id = :id';\n return $this->sqlPeristence->exec($statement, $params);\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 Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Tries to remove a lock on an ancestor of a given path owned by the current user.<p>
@param cms the CMS context
@param folderPath the path for which the lock should be removed
@throws CmsException if something goes wrong | [
"protected void tryToUnlock(CmsObject cms, String folderPath) throws CmsException {\n\n // Get path of first ancestor that actually exists\n while (!cms.existsResource(folderPath)) {\n folderPath = CmsResource.getParentFolder(folderPath);\n }\n CmsResource resource = cms.readR... | [
"public RepositoryFile getRepositoryFile() throws ResourceException {\n if (_fileRef == null || _fileRef.get() == null) {\n throw new ResourceException(this, \"RepositoryFile '\" + _qualifiedPath\n + \"' is not available since it was not serializable. The RepositoryFileResource ... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
@param \Psr\Http\Message\RequestInterface $request
@param \Psr\Http\Message\ResponseInterface $response
@return \Psr\Http\Message\RequestInterface
@throws \Exception | [
"protected function modifyRequest(RequestInterface $request, ResponseInterface $response)\n {\n sleep(8);\n\n return modify_request(\n $request,\n [\n 'uri' => UriResolver::resolve(\n $request->getUri(),\n $this->get... | [
"public function run()\n {\n $this->loadMiddleware();\n\n //~ Default response\n $response = new HttpMessage\\Response();\n //$response->getBody()->write('-- static --');\n\n //~ Get response\n $stack = new HttpMiddleware\\Stack($response, $this->middleware);\n ... | codesearchnet | {
"query": "Represent the Github instruction about PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code:"
} |
Function for adding partial pattern to the value
:param part: string or compiled pattern | [
"def add_part(self, part):\n \n if isinstance(part, RE_TYPE):\n part = part.pattern\n\n # Allow U / spmething syntax\n if self == '^$':\n return URLPattern(part, self.separator)\n else:\n # Erase dup separator inbetween\n sep = self.sepa... | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Create an instance of `QuestionsStore` with the given `options`.
```js
var QuestionsStore = new QuestionsStore(options);
```
@param {Object} `options` question store options
@api public | [
"function QuestionsStore(options) {\n debug('initializing from <%s>', __filename);\n Cache.call(this, options);\n this.createStores(this, this.options);\n this.listen(this);\n}"
] | [
"function initCreate (args) {\n // method name is moduleNameCreate\n var methodName = `${this.name}Create`\n // method signature is moduleName.methodname\n var methodSignature = `${this.moduleName}.${methodName}`\n // capture model to pass to function\n var model = this\n // add create method t... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
// SetRestApiId sets the RestApiId field's value. | [
"func (s *GetAuthorizerInput) SetRestApiId(v string) *GetAuthorizerInput {\n\ts.RestApiId = &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.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Generates the query for the prepared statement with all parameter placeholders
replaced with the actual parameter values
@return the SQL | [
"@Override\n public String getSqlWithValues() {\n final StringBuilder sb = new StringBuilder();\n final String statementQuery = getStatementQuery();\n\n // iterate over the characters in the query replacing the parameter placeholders\n // with the actual values\n int currentParameter = 0;\n for( ... | [
"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 co... | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
The optimizer object that was used in this phase | [
"def optimizer(self) -> non_linear.NonLinearOptimizer:\n \n if self.__optimizer is None:\n with open(os.path.join(self.directory, \".optimizer.pickle\"), \"r+b\") as f:\n self.__optimizer = pickle.loads(f.read())\n return self.__optimizer"
] | [
"def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度
@param v1 被除数
@param v2 除数
@param scale 精确度,如果为负值,取绝对值
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 两个参数的商
@since 3.1.0 | [
"public static BigDecimal div(Number v1, Number v2, int scale, RoundingMode roundingMode) {\r\n\t\treturn div(v1.toString(), v2.toString(), scale, roundingMode);\r\n\t}"
] | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about text processing:"
} |
add queue
@param string $path 対象のパス
@return bool 真偽 | [
"private function add_queue( $path ){\r\n\t\t$path_type = $this->px->get_path_type( $path );\r\n\t\tif($path_type != 'normal'){\r\n\t\t\t// `normal` ではないもの(`data`, `javascript`, `anchor`, `full_url` など)は、\r\n\t\t\t// 物理ファイルを出力するものではないので、キューに送らない。\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$path = $this->px->fs()->n... | [
"func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
==================================================== | [
"public function get_tree_node(&$itms){\n\t\tif(DEBUG_MODE){\n\t\t\tBLog::addToLog('[SoftModules]: get_tree_node()');\n\t\t\t}\n\t\tforeach($itms as &$itm){\n\t\t\tif($itm->active){\n\t\t\t\t$group=$this->get_group_byalias($itm->alias);\n\t\t\t\tif(empty($group)&&(!empty($itm->alias))){\n\t\t\t\t\t$group=new BSoftM... | [
"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... | codesearchnet | {
"query": "Represent the Github summarization about Language and Writing:",
"pos": "Represent the Github code about Language and Writing:",
"neg": "Represent the Github code:"
} |
@param string $key
@param DOMElement $element
@param mixed $storage
@codeCoverageIgnore | [
"protected function addNodeWithKey($key, DOMElement $element, $storage): void\n {\n if ($key === '@attributes') {\n $this->addAttributes($element, $storage);\n return;\n }\n\n if ($key === '@value') {\n\n if (\\is_string($storage)) {\n $element... | [
"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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Generates an HTML table to display the users being affected by the bulk change.
@param array $users
@param array $statusoptions
@return string | [
"protected function get_users_table(array $users, array $statusoptions) {\n $table = new html_table();\n $table->head = array(\n get_string('name'),\n get_string('participationstatus', 'enrol'),\n get_string('enroltimestart', 'enrol'),\n get_string('enroltim... | [
"public function Upgrade182to183()\n {\n $this->_batch->addTask('Db_CreateNewTables');\n $this->_batch->addTask('Db_AddPatches', 61);\n\n // Use AddTask task to execute after patches\n $this->_batch->addTask('AddTask', 'Echo', $this->_('Make sure to read the changelog as it contains i... | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Decode bytes to a kafka.structs.ConsumerMetadataResponse
Arguments:
data: bytes to decode | [
"def decode_consumer_metadata_response(cls, data):\n \n ((correlation_id, error, nodeId), cur) = relative_unpack('>ihi', data, 0)\n (host, cur) = read_short_string(data, cur)\n ((port,), cur) = relative_unpack('>i', data, cur)\n\n return kafka.structs.ConsumerMetadataResponse(erro... | [
"def _make_read_lob_request(self, readoffset, readlength):\n \n self._connection._check_closed()\n\n request = RequestMessage.new(\n self._connection,\n RequestSegment(\n message_types.READLOB,\n (ReadLobRequest(self._lob_header.locator_id, re... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about software development:"
} |
Transform node to type.
@param \GraphQL\Language\AST\TypeDefinitionNode $definition
@return \GraphQL\Type\Definition\Type | [
"public function handle(TypeDefinitionNode $definition): Type\n {\n $nodeValue = new NodeValue($definition);\n\n return $this->pipeline\n ->send($nodeValue)\n ->through(\n $this->directiveFactory->createNodeMiddleware($definition)\n )\n ->v... | [
"public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD... | codesearchnet | {
"query": "Represent the sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Get page data via path (permalink).
@param {array} pages
@param {string} path
@returns {object} | [
"function findPageForPath (pages, path) {\n for (let i = 0; i < pages.length; i++) {\n const page = pages[i]\n if (page.path.toLowerCase() === path.toLowerCase()) {\n return page\n }\n }\n return {\n path: '',\n frontmatter: {}\n }\n}"
] | [
"function () {\n /**\n * Get a valid file path for a template file from a set of directories\n * @param {Object} opts Configurable options (see periodicjs.core.protocols for more details)\n * @param {string} [opts.extname] Periodic extension that may contain view file\n * @param {string} opts.viewna... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Makes sure the config file exists.
:raises: :class:`epab.core.new_config.exc.ConfigFileNotFoundError` | [
"def _ensure_config_file_exists():\n \n config_file = Path(ELIBConfig.config_file_path).absolute()\n if not config_file.exists():\n raise ConfigFileNotFoundError(ELIBConfig.config_file_path)"
] | [
"def get_object_record(self, pid):\n \n try:\n return self._cache['records'][pid]\n except KeyError:\n raise d1_onedrive.impl.onedrive_exceptions.ONEDriveException('Unknown PID')"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Computer Science:"
} |
Builds the value to hash based on the data being encrypted and the salt
being used to seed the encryption algorithm | [
"def build(data, salt)\n if builder.is_a?(Proc)\n builder.call(data, salt)\n else\n builder.send(:build, data, salt)\n end\n end"
] | [
"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 encodi... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
// CommitEntry sends the signed Entry Hash and the Entry Credit public key to
// the factom network. Once the payment is verified and the network is commited
// to publishing the Entry it may be published with a call to RevealEntry. | [
"func CommitEntry(e *Entry, ec *ECAddress) (string, error) {\n\ttype commitResponse struct {\n\t\tMessage string `json:\"message\"`\n\t\tTxID string `json:\"txid\"`\n\t}\n\n\treq, err := ComposeEntryCommit(e, ec)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresp, err := factomdRequest(req)\n\tif err != nil... | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Saves the current model found by the SAT solver.
@param currentModel the model found by the solver | [
"public void saveModel(final LNGBooleanVector currentModel) {\n assert nbInitialVariables != 0;\n assert currentModel.size() != 0;\n this.model.clear();\n for (int i = 0; i < nbInitialVariables; i++)\n this.model.push(currentModel.get(i));\n }"
] | [
"def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Convenience method for converting a VDM AST into a list of nodes.
@param ast
The VDM AST.
@return The VDM AST as a list of nodes. | [
"public static List<INode> getNodes(List<? extends INode> ast)\n\t{\n\t\tList<INode> nodes = new LinkedList<>();\n\n\t\tnodes.addAll(ast);\n\n\t\treturn nodes;\n\t}"
] | [
"@Override\n protected PyExpr visitPrimitiveNode(PrimitiveNode node) {\n // Note: ExprNode.toSourceString() technically returns a Soy expression. In the case of\n // primitives, the result is usually also the correct Python expression.\n return new PyExpr(node.toSourceString(), Integer.MAX_VALUE);\n }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
----------------------------------------------------------------------------- | [
"void buildStateTable() {\n //\n // Add a dummy state 0 - the stop state. Not from Aho.\n int lastInputSymbol = fRB.fSetBuilder.getNumCharCategories() - 1;\n RBBIStateDescriptor failState = new RBBIStateDescriptor(lastInputSymbol);\n fDStates.add(failState);\n... | [
"protected static function showVersion()\n {\n \\cli\\line();\n \\cli\\line(\\cli\\Colors::colorize('%y+----------------------------------------------------------------------+%N'));\n \\cli\\line(\\cli\\Colors::colorize('%y| Welcome to Doozr\\'s Demo project installer. ... | codesearchnet | {
"query": "Represent the sentence about language and writing:",
"pos": "Represent the code about language and writing:",
"neg": "Represent the code:"
} |
Constructs a residual version of layers, summing input to layers output. | [
"def Residual(*layers, **kwargs):\n \"\"\"\"\"\"\n shortcut = kwargs.get('shortcut', Identity()) # pylint: disable=no-value-for-parameter\n if len(layers) > 1:\n return Serial(\n Branch(), # pylint: disable=no-value-for-parameter\n Parallel(Serial(*layers), shortcut),\n SumBranches() #... | [
"def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato... | codesearchnet | {
"query": "Represent the post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Natural Language Processing:"
} |
Find user by his id and return user model. | [
"def get_by_id(self, id):\n \"\"\"\"\"\"\n return self.user_cls(id=id, password='secret' + str(id))"
] | [
"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... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Technology:"
} |
Authorize an action and return true or false.
@param string $action The action name
@param array $config An array of options to pass to the authorizers
@return bool | [
"public function authorize($action, $config = array())\n {\n if (is_string($config)) {\n $config = array($action => $config);\n }\n\n $config = AnConfig::unbox($config);\n\n $context = $this->_mixer->getRepository()->getCommandContext();\n\n $context->append($config)... | [
"public static function current()\n {\n if (static::$_current === null) {\n if ($token = AuthToken::current()) {\n //\n // TODO: (known bug)\n // When accessing $token->auth inside an observer other than `auth`,\n // the table name of ... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
// ServiceWithSecret adds the secret reference to the service | [
"func ServiceWithSecret(secretRef *swarmtypes.SecretReference) ServiceSpecOpt {\n\treturn func(spec *swarmtypes.ServiceSpec) {\n\t\tensureContainerSpec(spec)\n\t\tspec.TaskTemplate.ContainerSpec.Secrets = append(spec.TaskTemplate.ContainerSpec.Secrets, secretRef)\n\t}\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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
/*
@see IScriptBreakpoint#getHitCount(IDbgpSession) | [
"public int getHitCount(IDbgpSession session) throws CoreException\n\t{\n\t\tfinal PerSessionInfo info;\n\t\tsynchronized (sessions)\n\t\t{\n\t\t\tinfo = (PerSessionInfo) sessions.get(session);\n\t\t}\n\t\treturn info != null ? info.hitCount : -1;\n\t}"
] | [
"public static ChainableStatement change(JsScope jsScope)\n\t{\n\t\treturn new DefaultChainableStatement(StateEvent.CHANGE.getEventLabel(), jsScope.render());\n\t}"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Returns the directory parts.
@since 1.0.0
@return string[] The directory parts. | [
"public function getDirectoryParts(): array\n {\n return $this->myAboveBaseLevel === 0 ? $this->myDirectoryParts : array_merge(array_fill(0, $this->myAboveBaseLevel, '..'), $this->myDirectoryParts);\n }"
] | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Checks whether PHP has been compiled with the given flag.
@param string $flag The name of the flag to check. The two initial hyphens can be omitted.
@return bool True when PHP has been compiled with the given flag, false otherwise. | [
"public static function hasFlag(string $flag) : bool\n {\n // Standardize the flag name - remove starting hyphens.\n $flag = ltrim($flag, '-');\n\n // Return the check right away if it's already cached.\n if (isset(static::$flags[$flag])) {\n return static::$flags[$flag];\n... | [
"public function getPassword() : IHashedPassword\n {\n return new class implements IHashedPassword\n {\n /**\n * Gets the hashed password string.\n *\n * @return string\n */\n public function getHash() : string\n {\n ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// GetETagData returns the field values to use to generate the ETag | [
"func (m Identity) GetETagData() []interface{} {\n\t// using the 'ID' and 'UpdatedAt' (converted to number of seconds since epoch) fields\n\treturn []interface{}{m.ID, strconv.FormatInt(m.UpdatedAt.Unix(), 10)}\n}"
] | [
"public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
calculate and append ecc code, and if necessary interleave | [
"function rs(&$binary, $bytes, $datablock, $rsblock) {\n $blocks = floor(($bytes + 2) / $datablock);\n $rs = new ReedSolomon($rsblock);\n\n for ($b = 0; $b < $blocks; $b++) {\n $buf = array();\n $p = 0;\n for ($n = $b; $n < $bytes; $n += $blocks)\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(wh... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Initializes the StaticServer domain with its commands.
@param {DomainManager} domainManager The DomainManager for the server | [
"function init(domainManager) {\n _domainManager = domainManager;\n\n if (!domainManager.hasDomain(\"staticServer\")) {\n domainManager.registerDomain(\"staticServer\", {major: 0, minor: 1});\n }\n _domainManager.registerCommand(\n \"staticServer\",\n \"_setRequestFilterTimeout\",\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... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Adds all routes to the System | [
"private function buildRoutes(): void{\n require_once 'System.php';\n System::reflectionRoutes($this, $this->app);\n foreach ($this->types as $type) {\n /* @var $type Type */\n $type->applyRoutes($this, $this->app);\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 Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// UnmarshalJSON handles deserialization of a CreditNote.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded. | [
"func (i *CreditNote) UnmarshalJSON(data []byte) error {\n\tif id, ok := ParseID(data); ok {\n\t\ti.ID = id\n\t\treturn nil\n\t}\n\n\ttype note CreditNote\n\tvar v note\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn err\n\t}\n\n\t*i = CreditNote(v)\n\treturn nil\n}"
] | [
"func ExternalCAsEqualStable(a, b []*api.ExternalCA) bool {\n\t// because DeepEqual will treat an empty list and a nil list differently, we want to manually check this first\n\tif len(a) == 0 && len(b) == 0 {\n\t\treturn true\n\t}\n\t// The assumption is that each individual api.ExternalCA within both lists are cre... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Checks that the correct number of elements are in ``value`` and that
each element validates agains the associated Field class | [
"def validate_wrap(self, value):\n ''' \n '''\n if not isinstance(value, list) and not isinstance(value, tuple):\n self._fail_validation_type(value, tuple, list)\n\n for field, value in izip(self.types, list(value)):\n field.validate_wrap(value)"
] | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Get the enum value with the passed ID
@param <KEYTYPE>
The ID type
@param <ENUMTYPE>
The enum type
@param aClass
The enum class
@param aID
The ID to search
@return <code>null</code> if no enum item with the given ID is present. | [
"@Nullable\n public static <KEYTYPE, ENUMTYPE extends Enum <ENUMTYPE> & IHasID <KEYTYPE>> ENUMTYPE getFromIDOrNull (@Nonnull final Class <ENUMTYPE> aClass,\n @Nullable final KEYTYPE aID)\n {\n return getFrom... | [
"public T mapObject(final Map<String, String> values) throws Exception {\n\n T result = createInstance();\n\n // for each field\n for (Map.Entry<String, String> entry : values.entrySet()) {\n\n String field = entry.getKey();\n //get field raw value\n String valu... | codesearchnet | {
"query": "Represent the summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Build the context menu. | [
"def _build_menu(self, context_menu: QMenu):\n \"\"\"\"\"\"\n logger.debug(\"Show tray icon enabled in settings: {}\".format(cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON]))\n # Items selected for display are shown on top\n self._fill_context_menu_with_model_item_actions(context_menu)\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... | codesearchnet | {
"query": "Represent the Github sentence about User Interface Design:",
"pos": "Represent the Github code about User Interface Design:",
"neg": "Represent the Github code about programming:"
} |
Set a custom value. C{key} might have the form "key=value" when value is C{None}. | [
"def set_custom(self, key, value=None):\n \n # Split combined key/value\n if value is None:\n try:\n key, value = key.split('=', 1)\n except (ValueError, TypeError) as exc:\n raise error.UserError(\"Bad custom field assignment %r, probably mis... | [
"def uncomment(key, value, tree)\n # Try to find if it is commented out, so we can replace line\n matcher = Matcher.new(\n collection: \"#comment\",\n # FIXME: this assumes a specific \"=\" syntax, bypassing the lens\n # FIXME: this will match also \"# If you set FOO=bar then...\"\... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Computer Science:"
} |
// SetFlags implements Command.SetFlags. | [
"func (c *listCommand) SetFlags(f *gnuflag.FlagSet) {\n\tc.ModelCommandBase.SetFlags(f)\n\tf.BoolVar(&c.all, \"all\", false, \"Lists for all models (administrative users only)\")\n\tc.out.AddFlags(f, \"tabular\", map[string]cmd.Formatter{\n\t\t\"yaml\": cmd.FormatYaml,\n\t\t\"json\": cmd.FormatJson,\n\t\t\"ta... | [
"public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about File management:"
} |
Returns the pagination links.
@return the pagination links | [
"@XmlElementWrapper(name = \"links\")\n @XmlElement(name = \"link\")\n @JsonProperty(value = \"links\")\n @ApiModelProperty(value = \"The pagination links.\", position = 3)\n public List<PageRequestLinkDto> getLinks() {\n return links;\n }"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Update color preview. | [
"def _update_preview(self):\n \"\"\"\"\"\"\n color = self.hexa.get()\n if self.alpha_channel:\n prev = overlay(self._transparent_bg, hexa_to_rgb(color))\n self._im_color = ImageTk.PhotoImage(prev, master=self)\n self.color_preview.configure(image=self._im_color)... | [
"protected function parentId()\n\t{\n\t\tswitch ( $this->position )\n\t\t{\n\t\t\tcase 'root':\n\t\t\t\treturn null;\n\n\t\t\tcase 'child':\n\t\t\t\treturn $this->target->getKey();\n\n\t\t\tdefault:\n\t\t\t\treturn $this->target->getParentId();\n\t\t}\n\t}"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Computer Science:"
} |
// Error can be either of the following types:
//
// - InvalidObjectFault
// - RuntimeFault | [
"func (service *VboxPortType) IBIOSSettingssetIOAPICEnabled(request *IBIOSSettingssetIOAPICEnabled) (*IBIOSSettingssetIOAPICEnabledResponse, error) {\n\tresponse := new(IBIOSSettingssetIOAPICEnabledResponse)\n\terr := service.client.Call(\"\", request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret... | [
"@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 text about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Create service with name
@param ServiceLocatorInterface $serviceLocator
@param $name
@param $requestedName
@return StorageInterface
@throws ServiceNotCreatedException | [
"public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)\n {\n $config = $this->getConfig($serviceLocator)[$requestedName];\n $service = new $this->serviceName();\n\n // Storage\n /** @var $storage StorageInterface */\n $storage = $... | [
"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 iAuthenticator)\n throw new exContainerInvalidServiceType('Invalid Plugin... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Takes a script element and bakes it in only if it contains a remote resource | [
"def _bake_script(script):\n \n if \"src\" in script.attrs:\n if re.match(\"https?://\", script[\"src\"]):\n script_data = _load_url(script[\"src\"]).read()\n else:\n script_data = _load_file(script[\"src\"]).read()\n script.clear()\n if USING_PYTHON2:\n ... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Open the collapse element in the active panel Closes all related collapse items first | [
"function(node) {\n var $activeTab = $(node);\n var data = $($activeTab).data('cfw.tab');\n if (data) {\n var $activePane = data.$target;\n var $paneContainer = $activePane.closest('.tab-content');\n $paneContainer.find('[data-cfw=\"colla... | [
"function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Connect to the server using the supplied transport and target
An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222'
@param string $remote Remote
@throws Zend_Mail_Protocol_Exception
@return boolean | [
"protected function _connect($remote)\n {\n $errorNum = 0;\n $errorStr = '';\n\n // open connection\n $this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);\n\n if ($this->_socket === false) {\n if ($errorNum == 0) {\n ... | [
"private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Whether this tour is the last tour.
@param int $tourcount The pre-fetched count of tours
@return boolean | [
"public function is_last_tour($tourcount = null) {\n if ($tourcount === null) {\n $tourcount = helper::count_tours();\n }\n return ($this->get_sortorder() === ($tourcount - 1));\n }"
] | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the sentence about NLP:",
"pos": "Represent the code about NLP:",
"neg": "Represent the code about programming:"
} |
We cannot match a PHP array to a JSON array!
The keys in a PHP array are ordered. The key in a JSON array are not ordered!
Therefore, we will be sending the arrays as JSON arrays of key/values to preserve order.
@param array $phpArray | [
"private static function arrayToJson(array $phpArray) {\n\t\t$serializableValue = array();\n\t\tforeach ($phpArray as $key=>$val) {\n\t\t\tif ($val instanceof MoufInstanceDescriptor) {\n\t\t\t\t$value = $val->getIdentifierName();\n\t\t\t} else if (is_array($val)) {\n\t\t\t\t$value = self::arrayToJson($val);\n\t\t\t... | [
"function _parseVertex(line) {\n var vertex = JSON.parse(line);\n assert.ok(_smellsLikeAnElement(vertex));\n // A vertex is an object, i.e. a key,value map.\n // We don't sort the keys of the object, leaving that to jsonStableStringify below.\n // But a vertex values contain `prop... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
Tries to give focus to an element (even if its tabIndex is -1). | [
"function Utilities_tryFocusOnAnyElement(element, useSetActive, scroller) {\n var previousActiveElement = _Global.document.activeElement;\n\n if (element === previousActiveElement) {\n return true;\n }\n\n if (useSetActive) {\n exports._setAc... | [
"function getTargetInstForInputEventPolyfill(topLevelType, targetInst, nativeEvent) {\n if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {\n // On the selectionchange event, the target is just document which isn't\n // helpful for us so just check act... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
parse simple array. | [
"function parseBasicArrayField(field, key, array) {\n var basic_array;\n\n if (typeof array === \"string\") {\n basic_array = array.split(arraySeparator);\n } else {\n basic_array = [];\n basic_array.push(array);\n };\n\n var result = [];\n if (isNumberArray(basic_array)) {\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description about Data parsing:",
"pos": "Represent the Github code about Data parsing:",
"neg": "Represent the Github code:"
} |
Get the scheme for a raw URL.
@param bool|null $secure
@return string | [
"protected function getScheme($secure)\n {\n if (is_null($secure)) {\n return $this->forceSchema ?: $this->plugin->make('request')->getScheme().'://';\n }\n\n return $secure ? 'https://' : 'http://';\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 Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
@param mixed $val1
@param mixed|null $val2
@param string|null $operator
@param bool|null $bind
@param string|null $join
@return $this | [
"public function where($val1, $val2 = null, string $operator = null, bool $bind = null, string $join = null){\n\t\t$operator = $operator !== null ? strtoupper(trim($operator)) : '=';\n\t\t$bind = $bind ?? true;\n\n\t\t$join = strtoupper(trim($join));\n\t\t$join = in_array($join, $this->joinArgs, true) ? $join :... | [
"public function exists(string $statement, ...$params): bool\n {\n /**\n * @var string|int|float|bool|null $result\n */\n $result = $this->single($statement, $params);\n return !empty($result);\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
// excludeHelpFunc filters commands we don't want to show from the list of
// commands displayed in packer's help text. | [
"func excludeHelpFunc(commands map[string]cli.CommandFactory, exclude []string) cli.HelpFunc {\n\t// Make search slice into a map so we can use use the `if found` idiom\n\t// instead of a nested loop.\n\tvar excludes = make(map[string]interface{}, len(exclude))\n\tfor _, item := range exclude {\n\t\texcludes[item] ... | [
"function Cli(opts) {\n _.extend(this, {\n logger: require('./logger'),\n Interview: require('./interview'),\n service: Service,\n rimraf: require('rimraf'),\n yargs: require('yargs'), // overridable parsed arguments.\n takenFlags: [],\n commands: {\n 'install': \"ask user about environme... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Sits in tight loop collecting data received from peer and
processing it. | [
"def _recv_loop(self):\n \n required_len = BGP_MIN_MSG_LEN\n conn_lost_reason = \"Connection lost as protocol is no longer active\"\n try:\n while True:\n next_bytes = self._socket.recv(required_len)\n if len(next_bytes) == 0:\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 # CAR... | codesearchnet | {
"query": "Represent the Github comment about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code about programming:"
} |
add urls to fetch
@param requests requests | [
"public void addTargetRequests(List<String> requests) {\n for (String s : requests) {\n if (StringUtils.isBlank(s) || s.equals(\"#\") || s.startsWith(\"javascript:\")) {\n continue;\n }\n s = UrlUtils.canonicalizeUrl(s, url.toString());\n targetReque... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
helper functions to support the binding and template engine (whole lib is wrapped in an IIFE) | [
"function(node) {\n var el = ko.virtualElements.firstChild(node);\n\n while (el) {\n if (el.nodeType === 1 || el.nodeType === 8) {\n return true;\n }\n\n el = ko.virtualElements.nextSibling(el);\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 # CAR... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Default Logger
@param string $message
@param int $level | [
"private function log($message, $level = BlockCypherLoggingLevel::INFO)\n {\n if ($this->isLoggingEnabled) {\n $config = BlockCypherConfigManager::getInstance()->getConfigHashmap();\n\n if (isset($config['mode'])) {\n $configMode = $config['mode'];\n } else ... | [
"public function antiLight(array $req): void\n {\n $this->isConfigDebug ? print('anti light') : null;\n $this->log(configDefault('anti/light', 'log', 'anti', 'light'), $req);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// String returns the string representation of the call. | [
"func (c *Call) String() string {\n\tvar buf bytes.Buffer\n\n\t// Write name.\n\tif c.Name != \"\" {\n\t\tbuf.WriteString(c.Name)\n\t} else {\n\t\tbuf.WriteString(\"!UNNAMED\")\n\t}\n\n\t// Write opening.\n\tbuf.WriteByte('(')\n\n\t// Write child list.\n\tfor i, child := range c.Children {\n\t\tif i > 0 {\n\t\t\tbu... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the summarization about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
} |
Extract the chromosome value from the given Wig header line.
@param headerLine Header line where to look for the chromosome
@return Chromosome value | [
"public static String getChromosome(String headerLine) throws InvalidObjectException {\n String chromosome = getHeaderInfo(\"chrom\", headerLine);\n if (chromosome == null) {\n throw new InvalidObjectException(\"WigFile format, it could not find 'chrom' in the header line\");\n }\n ... | [
"def _unpack_list(example):\n \n try:\n x = example[0]\n y = example[1]\n meta = None\n return x, y, meta\n except IndexError:\n raise IndicoError(\n \"Invalid input data. Please ensure input data is \"\n \"formatted as a list of `[data, target]` pa... | codesearchnet | {
"query": "Represent the Github summarization about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Sets the log entry's context property.
@param string $context
@return void | [
"protected function setContext($context = null)\n {\n if ($context) {\n $this->context = new LogContext($this->parser, $context);\n }\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Copy files from a source to a target
under a _default sub directory.
@param source The source dir
@param target The target dir
@param options Potential options
@throws IOException If copying does not work | [
"public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException {\n if (Files.notExists(target)) {\n Files.createDirectory(target);\n }\n\n logger.debug(\" --> Copying resources from [{}]\", source);\n if (Files.notExists(source)) {\n ... | [
"function(files, options) {\n verbose.writeln('Using srcPrefix: ' + options.srcPrefix)\n verbose.writeln('Using destPrefix: ' + options.destPrefix)\n\n // Build the file list\n files = convert(files)\n\n // Copy files\n if (!copy(files, options)) {\n fail.warn('Nothing was copied for the \"' ... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns an options parser object initialized with the standard
SCons options. | [
"def Parser(version):\n \n\n formatter = SConsIndentedHelpFormatter(max_help_position=30)\n\n op = SConsOptionParser(option_class=SConsOption,\n add_help_option=False,\n formatter=formatter,\n usage=\"usage: scons [OPTION] [TARGE... | [
"def _env(self, line):\n '''\n \n '''\n line = self._setup('ENV', line)\n\n # Extract environment (list) from the line\n environ = parse_env(line)\n\n # Add to global environment, run during install\n self.install += environ\n\n # Also define for global envi... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Add the given {@link UserDefinition} to this tenant definition's list of defined
users. If a user with the given name already exists, an InvalidArgumentException is
thrown.
@param userDef New {@link UserDefinition} to add to this tenant definition. | [
"public void addUser(UserDefinition userDef) {\n String userID = userDef.getID();\n Utils.require(!Utils.isEmpty(userID), \"User ID must be set\");\n Utils.require(!m_users.containsKey(userID), \"Duplicate user ID: \" + userID);\n m_users.put(userID, userDef);\n }"
] | [
"function DataModelMigration() {\n /**\n * Gets an array that contains the definition of fields that are going to be added\n * @type {Array}\n */\n this.add = [];\n /**\n * Gets an array that contains a collection of constraints which are going to be added\n * @type {Array}\n */\n ... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Return all property's fields from this user
@param UserModel $userRow
@throws \ByJG\MicroOrm\Exception\InvalidArgumentException
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"protected function setPropertiesInUser(UserModel $userRow)\n {\n $query = Query::getInstance()\n ->table($this->getUserPropertiesDefinition()->table())\n ->where(\"{$this->getUserPropertiesDefinition()->getUserid()} = :id\", ['id' =>$userRow->getUserid()]);\n $userRow->setPro... | [
"protected function registerDocumentTypeInterface()\n\t{\n\t\t$this->app->bind('Mgallegos\\DecimaAccounting\\Accounting\\Repositories\\DocumentType\\DocumentTypeInterface', function($app)\n\t\t{\n\t\t\t$AuthenticationManager = $app->make('App\\Kwaai\\Security\\Services\\AuthenticationManagement\\AuthenticationManag... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Call this with the Bokeh figure object. | [
"def set_figure(self, figure, handle=None):\n \"\"\"\"\"\"\n self.figure = figure\n self.bkimage = None\n self._push_handle = handle\n\n wd = figure.plot_width\n ht = figure.plot_height\n\n self.configure_window(wd, ht)\n\n doc = curdoc()\n #self.logger... | [
"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(wh... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Fetch command from folder. | [
"def get_command(self, ctx, name):\n \"\"\"\"\"\"\n plugin = os.path.basename(self.folder)\n try:\n command = importlib.import_module(\"honeycomb.commands.{}.{}\".format(plugin, name))\n except ImportError:\n raise click.UsageError(\"No such command {} {}\\n\\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 # BaseRt... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Prepare and send a notification.
@param Vulnerabilities $vulnerabilities List of vulnerabilities.
@return void | [
"public function notify( Vulnerabilities $vulnerabilities ) {\n\t\t$use_html = 'html' === $this->options->email_type;\n\n\t\twp_mail(\n\t\t\t$this->options->email_address,\n\t\t\t'Vulnerabilities detected on ' . get_bloginfo( 'name' ),\n\t\t\t$use_html\n\t\t\t\t? $this->render_html_email( $vulnerabilities )\n\t\t\t... | [
"public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
// encodeSecret encodes a Secret.
// Data, Kind, Name, and Type are taken into account. | [
"func encodeSecret(sec *v1.Secret) (string, error) {\n\t// json.Marshal sorts the keys in a stable order in the encoding\n\tdata, err := json.Marshal(map[string]interface{}{\"kind\": \"Secret\", \"type\": sec.Type, \"name\": sec.Name, \"data\": sec.Data})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn stri... | [
"func ExternalCAsEqualStable(a, b []*api.ExternalCA) bool {\n\t// because DeepEqual will treat an empty list and a nil list differently, we want to manually check this first\n\tif len(a) == 0 && len(b) == 0 {\n\t\treturn true\n\t}\n\t// The assumption is that each individual api.ExternalCA within both lists are cre... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Return a copy of the tuple as a list
If the tuple contains HasProperties instances, they are serialized. | [
"def to_json(value, **kwargs):\n \n serial_list = [\n val.serialize(**kwargs) if isinstance(val, HasProperties)\n else val for val in value\n ]\n return serial_list"
] | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the Github summarization about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Note: kubeconfigPath is optional (see note on loadFromKubeConfig) | [
"public static Config fromKubeconfig(String context, String kubeconfigContents, String kubeconfigPath) {\n // we allow passing context along here, since downstream accepts it\n Config config = new Config();\n Config.loadFromKubeconfig(config, context, kubeconfigContents, kubeconfigPath);\n return config... | [
"func (c *agentConf) AddFlags(f *gnuflag.FlagSet) {\n\t// TODO(dimitern) 2014-02-19 bug 1282025\n\t// We need to pass a config location here instead and\n\t// use it to locate the conf and the infer the data-dir\n\t// from there instead of passing it like that.\n\tf.StringVar(&c.dataDir, \"data-dir\", util.DataDir,... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Encodes the format bits. BCH(15,5)
@param level Error correction level
@param mask The type of mask that is applied to the qr code
@return encoded bit field | [
"public static int encodeFormatBits(QrCode.ErrorLevel level , int mask ) {\n\t\tint message = (level.value << 3) | (mask & 0xFFFFFFF7);\n\t\tmessage = message << 10;\n\t\treturn message ^ bitPolyModulus(message, FORMAT_GENERATOR,15,5);\n\t}"
] | [
"def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Returns the false positive and true positive rates | [
"def roc_curve(input:Tensor, targ:Tensor):\n \"\"\n targ = (targ == 1)\n desc_score_indices = torch.flip(input.argsort(-1), [-1])\n input = input[desc_score_indices]\n targ = targ[desc_score_indices]\n d = input[1:] - input[:-1]\n distinct_value_indices = torch.nonzero(d).transpose(0,1)[0]\n ... | [
"def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@param string $name
@return Part[]
@throws \LogicException if is not multipart | [
"public function getPartsByName($name)\n {\n $parts = array();\n\n foreach ($this->getParts() as $part) {\n if ($part->getName() === $name) {\n $parts[] = $part;\n }\n }\n\n return $parts;\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 Plugi... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Is this entity the 'account' entity? | [
"public boolean setupAccount(Entity e) {\n AccountAttributes accountAttributes = new AccountAttributes();\n\n // 0- reject entity having a composite PK.\n if (e.hasCompositePk()) {\n return false;\n }\n\n // 1- detect mandatory username\n for (Attribute a : e.get... | [
"def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Natural Language Processing:"
} |
// New generates a new agent token for authenticating to the drone server. | [
"func New(secret string) (string, error) {\n\ttoken := jwt.New(jwt.SigningMethodHS256)\n\ttoken.Claims[\"type\"] = \"agent\"\n\ttoken.Claims[\"text\"] = \"\"\n\treturn token.SignedString([]byte(secret))\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 # CAR... | 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:"
} |
Just pack fully resolved resources into an outputstream.
@param agg
@param out | [
"public void pack( Map<String, URI> agg, OutputStream out )\n throws IOException\n {\n // calculate the final map\n\n JarOutputStream jout = new JarOutputStream( out );\n try\n {\n // first set manifest if available:\n URI manifest = agg.get( \"META-INF/MA... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
检查URL是否已经定义过路由
@access protected
@param string $route 路由信息
@param string $bind 绑定信息
@return bool | [
"protected function hasDefinedRoute($route, $bind)\n {\n list($module, $controller, $action) = $route;\n\n // 检查地址是否被定义过路由\n $name = strtolower($module . '/' . $controller . '/' . $action);\n\n $name2 = '';\n\n if (empty($module) || $module == $bind) {\n $name2 = str... | [
"private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
The return of Get | [
"def get_cache_key(self, offset=0, limit=0, order=None, post_slug=''):\n \n return hashlib.sha1(\n '.'.join([\n str(self._get_data_source_url()),\n str(offset),\n str(limit),\n str(order),\n str(post_slug),\n ... | [
"public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about File management:"
} |
Add the value of an API call to the cache.
Args:
api_name: a string name of the API. Keys and values are segmented by api_name.
key: a string key for the specific call. | [
"def lookup_value(self, api_name, key):\n \n if api_name in self._cache:\n return self._cache[api_name].get(key, None)\n return None"
] | [
"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... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.