query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// BodyString is documented as: The template definition.
[ "func (s *IndicesPutTemplateService) BodyString(body string) *IndicesPutTemplateService {\n\ts.bodyString = body\n\treturn s\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Return the width of the field (sizeof)
[ "def _pfp__width(self):\n \n raw_output = six.BytesIO()\n output = bitwrap.BitwrappedStream(raw_output)\n self._pfp__build(output)\n output.flush()\n return len(raw_output.getvalue())" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// ExecuteBatch executes a batch of queries. This is a V3 function.
[ "func (vtg *VTGate) ExecuteBatch(ctx context.Context, session *vtgatepb.Session, sqlList []string, bindVariablesList []map[string]*querypb.BindVariable) (*vtgatepb.Session, []sqltypes.QueryResponse, error) {\n\t// In this context, we don't care if we can't fully parse destination\n\tdestKeyspace, destTabletType, _,...
[ "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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Generate the key for a nested param attribute
[ "def query_key(path)\n i = 0\n path.map do |v|\n i += 1\n if i != 1\n \"[#{v}]\"\n else\n v\n end\n end.join('')\n end" ]
[ "@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:" }
Read the SMILES given in the input line - or return an empty container. @param line input line @return the read container (or an empty one)
[ "private IAtomContainer readSmiles(final String line) {\n try {\n return sp.parseSmiles(line);\n } catch (CDKException e) {\n logger.error(\"Error while reading the SMILES from: \" + line + \", \", e);\n final IAtomContainer empty = builder.newInstance(IAtomContainer.c...
[ "def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Resumes this QEMU VM.
[ "def resume(self):\n \n\n vm_status = yield from self._get_vm_status()\n if vm_status is None:\n raise QemuError(\"Resuming a QEMU VM is not supported\")\n elif vm_status == \"paused\":\n yield from self._control_vm(\"cont\")\n log.debug(\"QEMU VM has bee...
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// GetGroupVersion returns the "group/version". It returns "version" is if group // is empty. It returns "group/" if version is empty.
[ "func GetGroupVersion(group, version string) string {\n\tif len(group) == 0 {\n\t\treturn version\n\t}\n\treturn group + \"/\" + version\n}" ]
[ "func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, defaultTLS bool) (*url.URL, string, error) {\n\tif host == \"\" {\n\t\treturn nil, \"\", fmt.Errorf(\"host must be a URL or a host:port pair\")\n\t}\n\tbase := host\n\thostURL, err := url.Parse(base)\n\tif err != nil || hostURL.Scheme ==...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Creates the Message-ID @return string
[ "public function createMessageId() {\n\n $time = time();\n\n if ($this->_from !== null) {\n $user = $this->_from;\n } elseif (isset($_SERVER['REMOTE_ADDR'])) {\n $user = $_SERVER['REMOTE_ADDR'];\n } else {\n $user = getmypid();\n }\n\n $rand...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Create proper argument value @param mixed $object @param array $arguments @throws ServiceManagerException @return mixed|object
[ "private function createValue($object, $arguments = [])\n {\n\n if ($this->isInstanceOf($arguments, ConfigObject::class)) {\n $arguments = $arguments->toArray();\n }\n\n if (!$this->isArray($arguments)) {\n throw new ServiceManagerException(ServiceManagerException::INVA...
[ "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 description about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
Gets a model's link if one was provided, substituting for field names with this format: (:field_name). @return mixed
[ "public function getModelLink()\n {\n $linkCallback = $this->getOption('link');\n\n if ($linkCallback && is_callable($linkCallback)) {\n return $linkCallback($this->getDataModel());\n } else {\n return false;\n }\n }" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get required ports based on services. @return array An array of unique ports required by defined services.
[ "public function requiredPorts()\n {\n $ports = [];\n\n foreach ($this->getServiceInstances() as $info) {\n if (!isset($info['instance'])) {\n continue;\n }\n $instance = $info['instance'];\n\n if ($instance instanceof ServiceInterface) {\n...
[ "func (c *NetworkGetCommand) Info() *cmd.Info {\n\targs := \"<binding-name> [--ingress-address] [--bind-address] [--egress-subnets]\"\n\tdoc := `\nnetwork-get returns the network config for a given binding name. By default\nit returns the list of interfaces and associated addresses in the space for\nthe binding, as...
codesearchnet
{ "query": "Represent the Github comment about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code about programming:" }
// SetTokenNameList sets the TokenNameList field's value.
[ "func (s *ListGitHubAccountTokenNamesOutput) SetTokenNameList(v []*string) *ListGitHubAccountTokenNamesOutput {\n\ts.TokenNameList = 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:" }
Returns a new stream that contains all items of the current stream in reverse order. The operator creates a list of all items internally. @return a new stream that emits all items of the current stream in reverse order.
[ "public Stream<T> reverse() {\n return new Stream<T>() {\n @Override\n public Iterator<T> iterator() {\n final ArrayList<T> array = ToArrayList.<T>toArrayList().call(Stream.this);\n Collections.reverse(array);\n return array.iterator();\n ...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @throws \Spryker\Zed\DataImport\Business\Exception\InvalidDataException @throws \Spryker\Zed\DataImport\Business\Exception\EntityNotFoundException @return void
[ "public function execute(DataSetInterface $dataSet): void\n {\n $merchantRelationshipKey = $dataSet[MerchantRelationshipProductListDataSetInterface::MERCHANT_RELATION_KEY];\n if (!$merchantRelationshipKey) {\n throw new InvalidDataException(sprintf('\"%s\" is required.', MerchantRelation...
[ "public function PrepareTheDefaultParametersForGeneration() {\n $this->params = array(\n \\Puzzlout\\Framework\\GeneratorEngine\\Core\\BaseClassGenerator::NameSpaceKey => null,\n \\Puzzlout\\Framework\\GeneratorEngine\\Core\\BaseClassGenerator::ClassNameKey => null,\n \\Puzzl...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Are Identical. @return boolean Whether both inner iterators are valid and have identical current and key values or both are non valid.
[ "public function areIdentical()\n {\n return $this->valid()\n ? $this->lhs->current() === $this->rhs->current()\n && $this->lhs->key() === $this->rhs->key()\n : $this->lhs->valid() == $this->rhs->valid();\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 ...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Generates a string describing what arguments the double expected. :return: A string describing expected arguments. :rtype: str
[ "def _expected_argument_string(self):\n \n\n if self.args is _any and self.kwargs is _any:\n return 'any args'\n elif self._custom_matcher:\n return \"custom matcher: '{}'\".format(self._custom_matcher.__name__)\n else:\n return build_argument_repr_string...
[ "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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
TODO Do we need to go through whole tree? Save references or consider collapsed nodes as not selected
[ "private List<TreeNode> getSelected(TreeNode parent) {\n List<TreeNode> result = new ArrayList<>();\n for (TreeNode n : parent.getChildren()) {\n if (n.isSelected()) {\n result.add(n);\n }\n result.addAll(getSelected(n));\n }\n return resul...
[ "def set_identifiers(self, data):\n \n for id_info in self._details.identifiers:\n var_name = id_info['var_name']\n self._data[var_name] = data.get(var_name)\n\n # FIXME: This needs to likely kick off invalidating/rebuilding\n # relations.\n # F...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Updates the response. @since 1.0.0 @param ApplicationInterface $application The application. @param RequestInterface $request The request. @param ResponseInterface $response The response.
[ "public function updateResponse(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response): void\n {\n parent::updateResponse($application, $request, $response);\n\n $response->setHeader('Content-Type', 'application/json');\n }" ]
[ "private function issueResponse(Request $request, \\Exception $exception = null)\n {\n $responder = null;\n if ($exception === null) {\n // No exception, just return a normal responder.\n $responder = ResponderFactory::getResponder($request);\n } else {\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:" }
Sorts this data using the specified {@link Comparator}.
[ "@CheckResult\n @NonNull\n public final Data<T> sort(@NonNull Comparator<? super T> comparator) {\n return new SortData<>(this, comparator);\n }" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
restores invariants of the various states (e.g. spinningCount, descheduled collection and thread park status)
[ "boolean assign(Work work, boolean self)\n {\n Work state = get();\n while (state.canAssign(self))\n {\n if (!compareAndSet(state, work))\n {\n state = get();\n continue;\n }\n // if we were spinning, exit the state (d...
[ "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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// CreateBoard creates a board remote. // Attribute currently supported as exra argument: powerUps. // Attributes currently known to be unsupported: idBoardSource, keepFromSource. // // API Docs: https://developers.trello.com/reference/#boardsid
[ "func (c *Client) CreateBoard(board *Board, extraArgs Arguments) error {\n\tpath := \"boards\"\n\targs := Arguments{\n\t\t\"desc\": board.Desc,\n\t\t\"name\": board.Name,\n\t\t\"prefs_selfJoin\": fmt.Sprintf(\"%t\", board.Prefs.SelfJoin),\n\t\t\"prefs_cardCovers\": fmt.Sprintf(\"%t\", boar...
[ "def syncItems(self):\n \n if 'sync-target' not in self.provides:\n raise BadRequest('Requested syncList for device which do not provides sync-target')\n\n return self._server.syncItems(client=self)" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Escapes a string as a URI query parameter (same as a strict query, but also escaping & and =) @param queryParam the parameter to escape @param strict whether or not to do strict escaping @return the escaped string
[ "public static String escapeQueryParam(final String queryParam, final boolean strict) {\n return (strict ? STRICT_ESCAPER : ESCAPER).escapeQueryParam(queryParam);\n }" ]
[ "public static String pathEncode(String path, Charset charset) {\n return encodeReserved(path, FragmentType.PATH_SEGMENT, charset);\n\n /*\n * path encoding is not equivalent to query encoding, there are few differences, namely dealing\n * with spaces, !, ', (, ), and ~ characters. we will need to man...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Boot extension components. @return void
[ "protected function bootExtensionComponents()\n {\n $path = realpath(__DIR__.'/../resources');\n\n $acl = $this->app->make('orchestra.acl');\n $memory = $this->app->make('orchestra.platform.memory');\n\n $acl->make('orchestra/story')->attach($memory);\n\n $this->addConfigCom...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Starts the Application. :return: Definition success. :rtype: bool
[ "def main():\n \n\n args = get_command_line_arguments()\n return build_toc_tree(args.title,\n args.input,\n args.output,\n args.content_directory)" ]
[ "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 Github description about NLP:", "pos": "Represent the Github code about NLP:", "neg": "Represent the Github code about programming:" }
Get Emoji Map Array. @return array @throws TelegramEmojiMapFileNotFoundException
[ "protected function getEmojiMap()\n {\n if (!isset($this->emojiMapFile)) {\n $this->emojiMapFile = realpath(__DIR__.self::DEFAULT_EMOJI_MAP_FILE);\n }\n\n if (!file_exists($this->emojiMapFile)) {\n throw new TelegramEmojiMapFileNotFoundException();\n }\n\n ...
[ "final public static function sinfo(array $params):string\n {\n return (\\iumioFramework\\Core\\Base\\Server\\GlobalServer::getServerInfo($params['name']));\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Update the JSON file. @param JsonFile $jsonFile @param array $package @param bool $isPostInstall
[ "private function updateComposerJson(JsonFile $jsonFile, array $package, $isPostInstall)\n {\n $composerJson = $jsonFile->parse();\n\n $sortPackages = $this->getOptions()->sortPackages();\n $requireKey = $this->getOptions()->dev() ? 'require-dev' : 'require';\n $removeKey = $this->get...
[ "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 comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Make the main exception data
[ "protected function makeMainException()\r\n\t{\r\n\t\t$this->mainExceptionData['uses'] = [\r\n\t\t\t'RuntimeException'\r\n\t\t];\r\n\t\t$this->mainExceptionData['className'] = 'ApiException';\r\n\t\t$this->mainExceptionData['classPhpDocTitle'] = 'Api Exception class';\r\n\t\t$this->mainExceptionData['namespace'] = ...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param array $items @return array
[ "public function filter(array $items): array\n {\n foreach ($this->filter as $filter) {\n $items = $filter->filter($items);\n }\n\n return $items;\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns the result of this decorator.
[ "def _getParameters(self):\n \"\"\"\"\"\"\n param = self.query._getParameters() \n index = self._getFilterIndex()\n param.update({\n 'filter['+str(index)+'][columnAlias]' : self.__column,\n 'filter['+str(index)+'][data][type]' : self.__type,\n 'filter['+str(index)+']...
[ "@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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Validates that {@link URI} expressed as {@link String} is of proper format and could be converted to an instance of the {@link URI}.
[ "public static boolean isURI(String source){\n\t\tPattern pattern = Pattern.compile(\"^[a-zA-Z0-9\\\\-_]+:\");\n\t\treturn pattern.matcher(source).find();\n\t}" ]
[ "static String getHostString(InetSocketAddress socketAddress) {\n InetAddress address = socketAddress.getAddress();\n if (address == null) {\n // The InetSocketAddress was specified with a string (either a numeric IP or a host name). If\n // it is a name, all IPs for that name should be tried. If it...
codesearchnet
{ "query": "Represent the instruction about Healthcare IT:", "pos": "Represent the code about Healthcare IT:", "neg": "Represent the code:" }
Populate info from serialized string
[ "function Unserialize(&$serialized)\r\n {\r\n // load the util from the serialized code\r\n $tmp = unserialize(base64_decode($serialized));\r\n $this->Type = $tmp->Type;\r\n $this->Username = $tmp->Username;\r\n $this->Password = $tmp->Password;\r\n $this->ConnectionStri...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Callback used as the handler argument to process_docs(). This converts Stone doc references to Sphinx-friendly annotations.
[ "def _docf(self, tag, val):\n \n if tag == 'type':\n return ':class:`{}`'.format(val)\n elif tag == 'route':\n if self.args.route_method:\n return ':meth:`%s`' % self.args.route_method.format(\n ns=self.cur_namespace.name, route=fmt_func(v...
[ "def add_reference(self, reftype: str, label: str, target):\n \n\n # The self.data[reftype] dict springs into being during the\n # register_references event handler at startup, which looks in the\n # kb registry for all registered reference names.\n self.data[reftype][label] = tar...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Insert a value in an existing array only if the value isn't already contained in the array (by way of string comparison). @param path the path to mutate in the JSON. @param value the value to insert.
[ "public <T> AsyncMutateInBuilder arrayAddUnique(String path, T value) {\n this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_ADD_UNIQUE, path, value));\n return this;\n }" ]
[ "function(node)\n {\n // declarations is an array of the comma-separated variable declarations like \"var foo, zerp;\"\n node.declarations.forEach(declaration =>\n {\n // id contains info about the variable being declare.\n var variable_name = declaration.id.name;\n // Skip if...
codesearchnet
{ "query": "Represent the Github description about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code:" }
add a new option @param string $name @param Option $opt @return Option @throws ConfigException
[ "public function addOption($name, Option $opt = null) {\r\n if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {\r\n throw new ConfigException('option/argument already set: ' . $name);\r\n }\r\n\r\n if (is_null($opt)) {\r\n $opt = new Option();\r\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 Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
/* <functionName>: function() {}
[ "function (node) {\n if (node.body && node.body.type === \"FunctionDeclaration\") {\n if (node.label) {\n _addResult(node.label);\n }\n }\n }" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Set the initial value of Dataset variables and dimensions
[ "def _set_init_vars_and_dims(self, data_vars, coords, compat):\n \n both_data_and_coords = [k for k in data_vars if k in coords]\n if both_data_and_coords:\n raise ValueError('variables %r are found in both data_vars and '\n 'coords' % both_data_and_coords...
[ "@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:" }
calls a Static Method on the given CLass @param clazz Class to call Method on it @param methodName Name of the Method to get @param args Arguments of the Method to get @return return return value of the called Method @throws PageException
[ "public static Object callStaticMethod(Class clazz, String methodName, Object[] args) throws PageException {\n\ttry {\n\t return getMethodInstance(null, clazz, methodName, args).invoke(null);\n\t}\n\tcatch (InvocationTargetException e) {\n\t Throwable target = e.getTargetException();\n\t if (target instanc...
[ "public static boolean isVoidMethod(@Nullable Object target, String method, Object... args) {\n if (target == null) return false; // no way to tell\n\n Class[] argTypes = ReflectionUtil.getTypes(args);\n\n // the way we choose metaClass, we won't find methods on java.lang.Class\n // but since java.lang....
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Post authorization.
[ "function (context, run, done) {\n // if no response is provided, there's nothing to do, and probably means that the request errored out\n // let the actual request command handle whatever needs to be done.\n if (!context.response) { return done(); }\n\n // bail out if there is no auth\n...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns true if the hierarchy is disabled for given log level and false otherwise. @return boolean
[ "public function isDisabled(\\n2n\\log4php\\LoggerLevel $level) {\r\n\t\treturn ($this->threshold->toInt() > $level->toInt());\r\n\t}" ]
[ "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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Text has changed
[ "def text_changed(self):\r\n \"\"\"\"\"\"\r\n # Save text as bytes, if it was initially bytes\r\n if self.is_binary:\r\n self.text = to_binary_string(self.edit.toPlainText(), 'utf8')\r\n else:\r\n self.text = to_text_string(self.edit.toPlainText())\r\n if sel...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Shortcut for a success @param string $msg @param string $url @return SS_HTTPResponse
[ "protected function success($msg, $url = null)\n {\n return $this->msg($msg, self::MSG_GOOD, $url);\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code:" }
Convert the interactive input format (see above) to a dictionary. Args: feature_map: dict with inputs. hparams: model hyperparameters Returns: a features dictionary, as expected by the decoder.
[ "def _interactive_input_tensor_to_features_dict(feature_map, hparams):\n \n inputs = tf.convert_to_tensor(feature_map[\"inputs\"])\n input_is_image = False if len(inputs.get_shape()) < 3 else True\n\n x = inputs\n if input_is_image:\n x = tf.image.resize_images(x, [299, 299])\n x = tf.reshape(x, [1, 299,...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/* (non-Javadoc) @see org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom#matches(org .openscience.cdk.interfaces.IAtom)
[ "@Override\n public boolean matches(IAtom atom) {\n String symbol = atom.getSymbol();\n return !(symbol.equals(\"C\") || symbol.equals(\"H\"));\n\n }" ]
[ "public static GroupAnalyzer createGroupAnalyzer(AreaImpl root)\n {\n //return new org.fit.segm.grouping.op.GroupAnalyzerByGrouping(root);\n //return new org.fit.segm.grouping.op.GroupAnalyzerBySeparators(root);\n //return new org.fit.segm.grouping.op.GroupAnalyzerByGroupingAndSeparators(roo...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Deep Learning:" }
Scan module folders to prepare init mechanism. @param string $basedir Base directory to looking for module folders. @param array &$folders Array passed by reference to be filled with modules found.
[ "private function scanModuleFolders($basedir, &$folders)\n {\n if (is_dir($basedir) && ($h = opendir($basedir))) {\n while (($folder = readdir($h))) {\n if ($folder !== '.' && $folder !== '..') {\n $this->scanModuleFiles($basedir . DIRECTORY_SEPARATOR . $folder...
[ "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...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Sets the target niterations/nsamples for the sampler. One or the other must be provided, not both.
[ "def set_target(self, niterations=None, eff_nsamples=None):\n \n if niterations is None and eff_nsamples is None:\n raise ValueError(\"Must provide a target niterations or \"\n \"eff_nsamples\")\n if niterations is not None and eff_nsamples is not None:\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 s...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
data from $_REQUEST
[ "public function request($key, $type = 'string', $default = null)\n {\n $request = array_merge($this->get, $this->post, $this->cookie, $this->routeParams);\n $value = $default;\n if (isset($request[$key])) {\n $value = $request[$key];\n }\n settype($value, $type);\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...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetIds sets the Ids field's value.
[ "func (s *RemoveTargetsInput) SetIds(v []*string) *RemoveTargetsInput {\n\ts.Ids = v\n\treturn s\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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Initializes (loads) an uninitialized persistent collection of a document. @param PersistentCollection $collection The collection to initialize.
[ "public function loadCollection(PersistentCollection $collection)\n {\n $this->getDocumentPersister(get_class($collection->getOwner()))->loadCollection($collection);\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
DeleteScope. [Preview API] :param str scope_id:
[ "def delete_scope(self, scope_id):\n \n route_values = {}\n if scope_id is not None:\n route_values['scopeId'] = self._serialize.url('scope_id', scope_id, 'str')\n self._send(http_method='DELETE',\n location_id='4e11e2bf-1e79-4eb5-8f34-a6337bd0de38',\n ...
[ "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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "public function handle($request, Closure $next)\n {\n $request->merge($request->xml(true));\n \n return $next($request);\n }" ]
[ "public function registerWildcard()\n {\n // Setup a wildcarded catch all route\n Route::any('{path}', ['as' => 'decoy::wildcard', function ($path) {\n\n // Remember the detected route\n App::make('events')->listen('wildcard.detection', function ($controller, $action) {\n ...
codesearchnet
{ "query": "Represent the Github instruction about Laravel:", "pos": "Represent the Github code about Laravel:", "neg": "Represent the Github code:" }
Execute the request for this resource. @param \mod_lti\local\ltiservice\response $response Response object for this request.
[ "public function execute($response) {\n global $CFG;\n\n $version = service_base::LTI_VERSION2P0;\n $params = $this->parse_template();\n $ok = $this->get_service()->check_tool_proxy($params['tool_proxy_id']);\n if (!$ok) {\n $response->set_code(404);\n } else if ...
[ "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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Checks if the stack has the same element more than once. @param distinctQueryStack @return true is there are duplicates else false
[ "public boolean duplicatesInStack(LinkedList<SchemaTableTree> distinctQueryStack) {\n Set<SchemaTable> alreadyVisited = new HashSet<>();\n for (SchemaTableTree schemaTableTree : distinctQueryStack) {\n if (!alreadyVisited.contains(schemaTableTree.getSchemaTable())) {\n alread...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// AddRelation adds a relation between the specified endpoints and returns the relation info.
[ "func (c *Client) AddRelation(endpoints, viaCIDRs []string) (*params.AddRelationResults, error) {\n\tvar addRelRes params.AddRelationResults\n\targs := params.AddRelation{Endpoints: endpoints, ViaCIDRs: viaCIDRs}\n\terr := c.facade.FacadeCall(\"AddRelation\", args, &addRelRes)\n\treturn &addRelRes, err\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Log a named numeric value. The value type may be 'value', 'count', or None.
[ "def log(self, name, value, valueType=None, stamp=None):\n \"\"\"\"\"\"\n if type(value) == float:\n form = \"%s%s %2.2f %d\\n\"\n else:\n form = \"%s%s %s %d\\n\"\n\n if valueType is not None and len(valueType) > 0 and valueType[0] != '.':\n valueType = '.' + valueType\n\n if not stam...
[ "def check_field_cohesion(self, present_label_fields):\n \n # Ensure all written annotation fields have the same length\n nannots = len(self.sample)\n\n for field in ['sample', 'num', 'subtype', 'chan', 'aux_note']+present_label_fields:\n if getattr(self, field) is not None:\n...
codesearchnet
{ "query": "Represent the Github post about Software Engineering:", "pos": "Represent the Github code about Software Engineering:", "neg": "Represent the Github code about programming:" }
Return data in wraparound order. i0 and stride are used to traverse data; the new array is in packed (i0=0, stride=1) format. @see <a href="package-summary.html#wraparound">wraparound format</A>
[ "public double[] toWraparoundOrder(double data[]){\n double newdata[] = new double[2*n];\n int nh = n/2;\n newdata[0] = data[0];\n newdata[1] = 0.0;\n newdata[n] = data[1];\n newdata[n+1] = 0.0;\n for(int i=1; i<nh; i++){\n newdata[2*i] = data[2*i];\n newdata[2*i+1] = da...
[ "def reftoindex(self, sds_ref):\n \n\n sds_idx = _C.SDreftoindex(self._id, sds_ref)\n _checkErr('reftoindex', sds_idx, 'illegal SDS ref number')\n return sds_idx" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Starts new context using provided configuration. Raises RuntimeConfigError if a context is already active.
[ "def start(**kwargs):\n \n if CORE_MANAGER.started:\n raise RuntimeConfigError('Current context has to be stopped to start '\n 'a new context.')\n\n try:\n waiter = kwargs.pop('waiter')\n except KeyError:\n waiter = hub.Event()\n common_config = Co...
[ "def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in mo...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
This is a lazily detected absolute filename of the corresponding property list file (*.plist). None if it doesn't exist.
[ "def plistfilename(self):\n '''\n \n '''\n if self._plist_fname is None:\n self._plist_fname = discover_filename(self.label)\n return self._plist_fname" ]
[ "def get_root_path(self, name):\n \n module = modules.get(name)\n if module is not None and hasattr(module, '__file__'):\n return dirname(abspath(module.__file__))\n\n # Flask keeps looking at this point. We instead set the root path to None,\n # assume that the user do...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// MustBool returns request form as bool with default
[ "func (p *Params) MustBool(key string, defaults ...bool) bool {\n\tr, err := strconv.ParseBool(p.Get(key))\n\tif len(defaults) > 0 && err != nil {\n\t\treturn defaults[0]\n\t}\n\treturn r\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 post about NLP:", "pos": "Represent the Github code about NLP:", "neg": "Represent the Github code:" }
Load values from a Python file.
[ "def from_pyfile(self, filename: str) -> None:\n \"\"\"\"\"\"\n globals_ = {} # type: Dict[str, Any]\n locals_ = {} # type: Dict[str, Any]\n with open(filename, \"rb\") as f:\n exec(compile(f.read(), filename, 'exec'), globals_, locals_)\n\n for key, value in locals_....
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
with a new MCWrapper. The fromMCWrapper can be null - needed for SmartHandle support.
[ "private void reassociateConnectionHandle(Object connection,\n MCWrapper fromMCWrapper,\n MCWrapper toMCWrapper,\n UOWCoordinator uowCoord) throws ResourceException {\n\n final ...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Connect the device to a link @param link @throws TooManyConnectionException
[ "public void connectToLink(Link link) throws ShanksException {\n if (!this.linksList.contains(link)) {\n this.linksList.add(link);\n logger.finer(\"Device \" + this.getID()\n + \" is now connected to Link \" + link.getID());\n link.connectDevice(this);\n ...
[ "public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about N/A:" }
// SetVersionId sets the VersionId field's value.
[ "func (s *GetDocumentVersionInput) SetVersionId(v string) *GetDocumentVersionInput {\n\ts.VersionId = &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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// NewRates reports rolling rate information for countTracker. samples specifies // the number of samples to report, and interval specifies the time interval // between samples. The minimum interval is 1 second.
[ "func NewRates(name string, countTracker CountTracker, samples int, interval time.Duration) *Rates {\n\tif interval < 1*time.Second {\n\t\tpanic(\"interval too small\")\n\t}\n\trt := &Rates{\n\t\ttimeStamps: NewRingInt64(samples + 1),\n\t\tcounts: make(map[string]*RingInt64),\n\t\tcountTracker: countTracker...
[ "protected void purgeObsoleteSamples(MetricConfig config, long now) {\n long expireAge = config.samples() * config.timeWindowMs();\n for (int i = 0; i < samples.size(); i++) {\n Sample sample = this.samples.get(i);\n if (now - sample.lastWindowMs >= expireAge) {\n ...
codesearchnet
{ "query": "Represent the instruction about Signal Processing:", "pos": "Represent the code about Signal Processing:", "neg": "Represent the code:" }
TODO: new cache mechanism using format string
[ "def parse(value)\n unless value.is_a?(String)\n raise TimeParseError, \"value must be string: #{value}\"\n end\n\n if @cache1_key == value\n return @cache1_time\n elsif @cache2_key == value\n return @cache2_time\n else\n begin\n time = @parse.call(value...
[ "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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Runs the specified build command with the provided configuration. @param {Object} options
[ "async function runBuildCommand({command, config, watch}) {\n try {\n const {size, count, warnings} = await workboxBuild[command](config);\n\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n logger.log(`The service worker was written to ${config.swDest}\\n` +\n `${count} fil...
[ "@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 post:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Retrieves a Storage Object for the specified key in this bucket. The object need not exist. Args: key: the key of the object within the bucket. Returns: An Object instance representing the specified key.
[ "def object(self, key):\n \n return _object.Object(self._name, key, context=self._context)" ]
[ "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 ...
codesearchnet
{ "query": "Represent the Github description about AWS S3:", "pos": "Represent the Github code about AWS S3:", "neg": "Represent the Github code about Software development:" }
增量存储order_queue Arguments: order_queue {[type]} -- [description] Keyword Arguments: client {[type]} -- [description] (default: {DATABASE})
[ "def QA_SU_save_order_queue(order_queue, client=DATABASE):\n \n collection = client.order_queue\n collection.create_index(\n [('account_cookie',\n ASCENDING),\n ('order_id',\n ASCENDING)],\n unique=True\n )\n for order in order_queue.values():\n order_js...
[ "def QA_fetch_stock_realtime_adv(code=None,\n num=1,\n collections=DATABASE.get_collection('realtime_{}'.format(datetime.date.today()))):\n '''\n \n '''\n if code is not None:\n # code 必须转换成list 去查询数据库\n if isinstance(code, str)...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Remove a directory, but only if it is empty. @param string $folder Absolute folder path @param boolean $recursive Remove contained empty folders before attempting to remove this one @return boolean True on success, false on failure.
[ "public static function remove_folder_if_empty($folder, $recursive = true)\n {\n if (!is_readable($folder)) {\n return false;\n }\n $handle = opendir($folder);\n while (false !== ($entry = readdir($handle))) {\n if ($entry != \".\" && $entry != \"..\") {\n ...
[ "function (src, target) {\n /*\n * Copy a file from one path relative to the src, to another relative to the\n * target.\n * @param {String} from - the path to copy from, relative to the src.\n * @param {String} to - the path to copy to.\n * @return {Promise} - promise to copy\n */\n this.copy = funct...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Parses an includes string.
[ "private String[] parseIncludes(String sincludes) {\n sincludes = sincludes.trim();\n if (\"\".equals(sincludes)) {\n return null;\n }\n String[] arr = sincludes.split(\",\");\n if (arr != null) {\n for (int i = 0; i < arr.length; i++) {\n arr[i] = arr[i].trim();\n }\n }\n ...
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the text about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code:" }
String to upper and trim @param $string @return string @SuppressWarnings(PHPMD.ShortMethodName)
[ "public static function up($string): string\n {\n $cleaned = Str::up($string);\n $cleaned = Str::trim($cleaned);\n\n return $cleaned;\n }" ]
[ "@Pure\n\t@Inline(value = \"AssertMessages.invalidTrueValue(0, $1)\", imported = {AssertMessages.class})\n\tpublic static String invalidTrueValue(String functionName) {\n\t\treturn invalidTrueValue(0, functionName);\n\t}" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// SetCloseTimestamp sets the CloseTimestamp field's value.
[ "func (s *WorkflowExecutionInfo) SetCloseTimestamp(v time.Time) *WorkflowExecutionInfo {\n\ts.CloseTimestamp = &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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param null $limit @param null $offset @return array
[ "public function getAllFriendships($limit = null, $offset = null): array\n {\n return $this->findFriendshipsByStatus(null, $limit, $offset);\n }" ]
[ "public static function getPageAuthority($url = false)\n {\n $data = static::getCols('34359738368', $url);\n return (parent::noDataDefaultValue() == $data) ? $data :\n $data['upa'];\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return whether this rule is considered "empty" -- i.e., has no contents that should end up in the final CSS.
[ "def is_empty(self):\n \n if self.properties:\n # Rules containing CSS properties are never empty\n return False\n\n if not self.descendants:\n for header in self.ancestry.headers:\n if header.is_atrule and header.directive != '@media':\n ...
[ "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...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Validate validates the given value against this Constraint
[ "func (c *ArrayConstraint) Validate(v interface{}) (err error) {\n\tif pdebug.Enabled {\n\t\tg := pdebug.IPrintf(\"START ArrayConstraint.Validate\")\n\t\tdefer func() {\n\t\t\tif err == nil {\n\t\t\t\tg.IRelease(\"END ArrayConstraint.Validate (PASS)\")\n\t\t\t} else {\n\t\t\t\tg.IRelease(\"END ArrayConstraint.Valid...
[ "@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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Simplified method form for invoking the DescribeMetricCollectionTypes operation with an AsyncHandler. @see #describeMetricCollectionTypesAsync(DescribeMetricCollectionTypesRequest, com.amazonaws.handlers.AsyncHandler)
[ "@Override\n public java.util.concurrent.Future<DescribeMetricCollectionTypesResult> describeMetricCollectionTypesAsync(\n com.amazonaws.handlers.AsyncHandler<DescribeMetricCollectionTypesRequest, DescribeMetricCollectionTypesResult> asyncHandler) {\n\n return describeMetricCollectionTypesAsync...
[ "@Override\n @Deprecated\n public java.util.concurrent.Future<RevokeSecurityGroupIngressResult> revokeSecurityGroupIngressAsync(\n com.amazonaws.handlers.AsyncHandler<RevokeSecurityGroupIngressRequest, RevokeSecurityGroupIngressResult> asyncHandler) {\n\n return revokeSecurityGroupIngressAsy...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns the list of current events for a given client.
[ "def get_all_client_events(self, client):\n \n data = self._request('GET', '/events/{}'.format(client))\n return data.json()" ]
[ "@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 about Agent Identity Management:", "pos": "Represent the code about Agent Identity Management:", "neg": "Represent the code:" }
// // NewStructFieldDef - creates an initialized StructFieldDef instance, returns a pointer to it //
[ "func NewStructFieldDef(init ...*StructFieldDef) *StructFieldDef {\n\tvar o *StructFieldDef\n\tif len(init) == 1 {\n\t\to = init[0]\n\t} else {\n\t\to = new(StructFieldDef)\n\t}\n\treturn o\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Get the type for a field @param $fieldName @param $documentDefinition @return mixed @throws \Exception
[ "private function getFieldType($fieldName, $documentDefinition)\n {\n foreach ($documentDefinition->fields as $fieldTypeDefinition) {\n if ($fieldTypeDefinition->slug === $fieldName) {\n return $fieldTypeDefinition->type;\n }\n }\n\n throw new \\Exception...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
[ "@Override\n public Request<DescribeSpotPriceHistoryRequest> getDryRunRequest() {\n Request<DescribeSpotPriceHistoryRequest> request = new DescribeSpotPriceHistoryRequestMarshaller().marshall(this);\n request.addParameter(\"DryRun\", Boolean.toString(true));\n return request;\n }" ]
[ "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 Github instruction about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Software development:" }
Builds the more compact fmtstrs by using fromstr( of the control sequences)
[ "def _getitem_normalized(self, index):\n \"\"\"\"\"\"\n index = normalize_slice(len(self), index)\n counter = 0\n output = ''\n for fs in self.chunks:\n if index.start < counter + len(fs) and index.stop > counter:\n s_part = fs.s[max(0, index.start - coun...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Replace the value if it exists, does not set if it doesn't. // Returns true if the item existed an was replaced, false otherwise. // Replace does not reset item's TTL nor does it alter its position in the LRU
[ "func (c *LayeredCache) Replace(primary, secondary string, value interface{}) bool {\n\titem := c.bucket(primary).get(primary, secondary)\n\tif item == nil {\n\t\treturn false\n\t}\n\tc.Set(primary, secondary, value, item.TTL())\n\treturn true\n}" ]
[ "boolean setReplica( H2ONode h2o ) {\n assert _key.home(); // Only the HOME node for a key tracks replicas\n assert h2o != H2O.SELF; // Do not track self as a replica\n if( !read_lock() ) return false; // Write-locked; no new replications. Read fails to read *this* value\n // Narrow non-race here. ...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// ReadTimeout acts as Read but takes a timeout. If that timeout is reached, it's assumed // there's no proxy protocol header.
[ "func ReadTimeout(reader *bufio.Reader, timeout time.Duration) (*Header, error) {\n\ttype header struct {\n\t\th *Header\n\t\te error\n\t}\n\tread := make(chan *header, 1)\n\n\tgo func() {\n\t\th := &header{}\n\t\th.h, h.e = Read(reader)\n\t\tread <- h\n\t}()\n\n\ttimer := time.NewTimer(timeout)\n\tselect {\n\tcase...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about File management:" }
Provide the last and next leap-second events relative to a date Args: date (float): Date in MJD Return: tuple:
[ "def get_last_next(self, date):\n \n past, future = (None, None), (None, None)\n\n for mjd, value in reversed(self.data):\n if mjd <= date:\n past = (mjd, value)\n break\n future = (mjd, value)\n\n return past, future" ]
[ "def _parse_filter_word(self, word):\n \n if isinstance(word, str):\n word = \"'{}'\".format(word)\n elif isinstance(word, dt.date):\n if isinstance(word, dt.datetime):\n if word.tzinfo is None:\n # if it's a naive datetime, localize the d...
codesearchnet
{ "query": "Represent the sentence about datetime:", "pos": "Represent the code about datetime:", "neg": "Represent the code:" }
Encode the given input.
[ "public static ByteBuffer encode(byte[] input) {\r\n\t\tint pos = input.length + input.length / 3;\r\n\t\tif (pos < 64) pos = 64;\r\n\t\tbyte[] out = new byte[pos];\r\n\t\tpos = 0;\r\n\t\tint lineCount = 0;\r\n\t\tfor (int i = 0; i < input.length; ++i) {\r\n\t\t\tbyte b = input[i];\r\n\t\t\tif ((b >= 33 && b <= 60)...
[ "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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Get the keys from relation in order to join the table. @param \Illuminate\Database\Eloquent\Relations\Relation $relation @return array @throws \LogicException
[ "protected function getJoinKeys(Relation $relation)\n {\n if ($relation instanceof HasOne || $relation instanceof MorphOne) {\n return [$relation->getQualifiedForeignKeyName(), $relation->getQualifiedParentKeyName()];\n }\n\n if ($relation instanceof BelongsTo && !$relation instan...
[ "public function applyFilters($filters, FilterFactory $filterFactory, ConditionAwareRepository $repository)\n {\n // @see Ipunkt\\LaravelJsonApi\\Services\\FilterApplier\\FilterApplier\n \\FilterApplier::applyFiltersToRepository($filters, $filterFactory, $repository);\n }" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
// SetSetSnapshot to true is the same as calling // Transaction::SetSnapshot().
[ "func (opts *TransactionOptions) SetSetSnapshot(value bool) {\n\tC.rocksdb_transaction_options_set_set_snapshot(opts.c, boolToChar(value))\n}" ]
[ "public void doAddNew() throws DBException\n {\n if (this.lockOnDBTrxType(null, DBConstants.ADD_TYPE, false)) // ADD_TYPE = Add new; Should I do the unlock in my code?\n this.unlockIfLocked(this.getRecord(), null); // Release any locks\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// checkPreApply does the verification of a check before it is applied to Raft.
[ "func checkPreApply(check *structs.HealthCheck) {\n\tif check.CheckID == \"\" && check.Name != \"\" {\n\t\tcheck.CheckID = types.CheckID(check.Name)\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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetRepositoryId sets the RepositoryId field's value.
[ "func (s *RepositoryNameIdPair) SetRepositoryId(v string) *RepositoryNameIdPair {\n\ts.RepositoryId = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n classLoaderIdentifier = (String) fields.get(CLASS_LOADER_IDENTIFIER, null);\n\n // Note that further processing is required in JEEMetadataContextProviderImp...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param string $endpoint @param string|null $where @param bool $strictMode @throws \Exception
[ "private function createSnapshot(string $endpoint, ?string $where = null, $strictMode = false): void\n {\n if ($this->endpoints && !\\in_array($endpoint, $this->endpoints)) {\n if (DefinitionRegistry::DEFAULT_ENDPOINT === $endpoint) {\n throw new \\Exception('Must specify a valid...
[ "public function addFromRequest(Type $type, Request $request)\n {\n $key = parent::addFromRequest($type, $request);\n /*\n * @var ExpressKey\n */\n $key->setEntity($this->expressEntity);\n\n return $key;\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software Development:" }
Returns an Inspector for a previous Exception, if any. @todo Clean this up a bit, cache stuff a bit better. @return Inspector
[ "public function getPreviousExceptionInspector()\n {\n if ($this->previousExceptionInspector === null) {\n $previousException = $this->exception->getPrevious();\n\n if ($previousException) {\n $this->previousExceptionInspector = new Inspector($previousException);\n ...
[ "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:" }
Add entries to the components array. Allow single add (with a string arg) and bulk adding (with an array arg). @param string|array $components @return bool
[ "public function addComponents($components)\n {\n // if a string was supplied, check for valid component name\n if (ThrottlerHelper::validateName($components)) {\n $components = array($components);\n }\n // ensure elements to add are not already in components\n if (is_array($components) && !$th...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Check the database for missing notifications.
[ "def check_db_for_missing_notifications():\n \"\"\"\"\"\"\n config = dallinger.config.get_config()\n participants = Participant.query.filter_by(status=\"working\").all()\n reference_time = datetime.now()\n\n run_check(participants, config, reference_time)" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetPlanId sets the PlanId field's value.
[ "func (s *DeleteProvisionedProductPlanInput) SetPlanId(v string) *DeleteProvisionedProductPlanInput {\n\ts.PlanId = &v\n\treturn s\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 programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Map MXNet's crop operator attributes to onnx's Crop operator and return the created node.
[ "def convert_crop(node, **kwargs):\n \n name, inputs, attrs = get_inputs(node, kwargs)\n num_inputs = len(inputs)\n\n y, x = list(parse_helper(attrs, \"offset\", [0, 0]))\n h, w = list(parse_helper(attrs, \"h_w\", [0, 0]))\n if num_inputs > 1:\n h, w = kwargs[\"out_shape\"][-2:]\n border...
[ "@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:" }
Restore access token from the session. @return boolean whether the access token was successfuly restored.
[ "protected function restoreAccessToken() {\n\t\tif (!$this->authenticated) {\n\t\t\tif ($this->hasState('auth_token') && $this->getState('expires', 0) > time()) {\n\t\t\t\t$this->access_token = $this->getState('auth_token');\n\t\t\t\t$this->authenticated = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$this->access_token =...
[ "protected function getAuthForLogin()\n {\n if ($this->useAgent()) {\n return $this->getAgent();\n }\n\n // If a \"key\" was specified in the auth credentials, we will load it into a\n // secure RSA key instance, which will be used to connect to the servers\n // in p...
codesearchnet
{ "query": "Represent the Github sentence about NLP:", "pos": "Represent the Github code about NLP:", "neg": "Represent the Github code about Software development:" }
Generates a new secret (also known as symmetric) key for use with {@value #SYMMETRIC_ALGORITHM}. <p> The key size is determined by {@link #SYMMETRIC_KEY_SIZE}. @return A new, randomly generated secret key.
[ "public static SecretKey newSecretKey() {\r\n\r\n // FYI: AES keys are just random bytes from a strong source of randomness.\r\n\r\n // Get a key generator instance\r\n KeyGenerator keyGenerator;\r\n try {\r\n keyGenerator = KeyGenerator.getInstance(SYMMETRIC_ALGORITHM);\r\n ...
[ "public static SecretKey deserializeSecretKey(byte[] keyData, String algorithm) {\n LOGGER.trace(\"deserialize secret key from data using algorithm \\\"{}\\\"\", algorithm);\n return new SecretKeySpec(keyData, algorithm);\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
DOCUMENT ME! @return DOCUMENT ME! @throws CpoException DOCUMENT ME!
[ "@Override\n protected Connection getWriteConnection() throws CpoException {\n Connection connection = getStaticConnection();\n\n setConnectionBusy(connection);\n\n return connection;\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...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Check if the user has at least one role. @param int|string|array $role @return bool
[ "public function isOne($role)\n {\n foreach ($this->getArrayFrom($role) as $role) {\n if ($this->hasRole($role)) {\n return true;\n }\n }\n\n return false;\n }" ]
[ "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 // F...
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
Compute a weighting score based on the cosine distance between the kernel density estimates of two terms. Args: term1 (str) term2 (str) Returns: float
[ "def score_cosine(self, term1, term2, **kwargs):\n\n \n\n t1_kde = self.kde(term1, **kwargs)\n t2_kde = self.kde(term2, **kwargs)\n\n return 1-distance.cosine(t1_kde, t2_kde)" ]
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the sentence about Computer programming or scientific field:", "pos": "Represent the code about Computer programming or scientific field:", "neg": "Represent the code about programming:" }
// Put is a shortcut for router.Add("PUT", path, handle)
[ "func (r *Router) Put(path string, handler HandlerFunc) {\n\tr.Add(PUT, path, handler)\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 summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }