query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// SetCrop sets the Crop field's value.
[ "func (s *VideoDescription) SetCrop(v *Rectangle) *VideoDescription {\n\ts.Crop = v\n\treturn s\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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Command-line validation checks.
[ "def main() -> None:\n \n _ = \"\"\"\n print(twos_comp_to_signed(0, n_bits=32)) # 0\n print(twos_comp_to_signed(2 ** 31 - 1, n_bits=32)) # 2147483647\n print(twos_comp_to_signed(2 ** 31, n_bits=32)) # -2147483648 == -(2 ** 31)\n print(twos_comp_to_signed(2 ** 32 - 1, n_bits=32)) # -1\n prin...
[ "@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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
##Beanstalk client A client that binds to one single socket
[ "function BeanstalkClient() {\n\tevents.EventEmitter.call(this);\n\n\tthis.address = '127.0.0.1';\n\tthis.port = 11300;\n\tthis.isRaw = false;\n\tthis.conn;\n\tthis.default_priority = 10;\n\tthis.reserve_multichunk_timeout = 500;\n\n\tthis.queue = [];\n\tthis.waitingForResponses = 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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// ErrorHandler calls the error handler, and is a wrapper around the // embedded ErrorHandler function. It is not part of the Sender interface.
[ "func (b *Base) ErrorHandler(err error, m message.Composer) {\n\tb.mutex.RLock()\n\tdefer b.mutex.RUnlock()\n\n\tb.errHandler(err, m)\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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Returns true if the source file must be load or reloaded. Otherwise returns false. @return bool
[ "private function mustLoadStoredRoutine(): bool\n {\n // If this is the first time we see the source file it must be loaded.\n if (!isset($this->phpStratumOldMetadata)) return true;\n\n // If the source file has changed the source file must be loaded.\n if ($this->phpStratumOldMetadata['timestamp']!=$t...
[ "@Override\n public boolean setProperty(String name, Object value)\n {\n /* Note: can not call local method, since it'll return false for\n * recognized but non-mutable properties\n */\n return mConfig.setProperty(name, value);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Update table configuration @param $writerId @param $tableId @param null $title @param null $export @param null $incrementalLoad @param null $ignoreFilter @return mixed
[ "public function updateTable($writerId, $tableId, $title = null, $export = null, $incrementalLoad = null, $ignoreFilter = null)\n {\n $params = [\n 'writerId' => $writerId,\n 'tableId' => $tableId\n ];\n if ($title !== null) {\n $params['title'] = $title;\n ...
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the description about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
Return a transformer instance for the requested object. @param object $object @return object|null
[ "public static function getTransformer($object)\n\t{\n\t\t$class = get_class($object);\n\t\t\n\t\tif (isset(static::$transformations[$class])) {\n\t\t\treturn new static::$transformations[$class];\n\t\t}\n\t\t\n\t\tif (isset($object->transformer)) {\n\t\t\treturn new $object->transformer;\n\t\t}\n\t\t\n\t\treturn n...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code:" }
Return a list of all jobs information filtered by the given criteria. :param int count: show not more than the count of most recent jobs :param bool filter_find_jobs: filter out 'saltutil.find_job' jobs
[ "def get_jids_filter(count, filter_find_job=True):\n '''\n \n '''\n keys = []\n ret = []\n for jid, job, _, _ in _walk_through(_job_dir()):\n job = salt.utils.jid.format_jid_instance_ext(jid, job)\n if filter_find_job and job['Function'] == 'saltutil.find_job':\n continue\...
[ "def read(calc_id, username=None):\n \n if isinstance(calc_id, str) or calc_id < 0 and not username:\n # get the last calculation in the datastore of the current user\n return datastore.read(calc_id)\n job = logs.dbcmd('get_job', calc_id, username)\n if job:\n return datastore.read(...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Get url parameter by id --- serializer: AbsParamSerializer responseMessages: - code: 401 message: Not authenticated
[ "def get(self, request, bot_id, handler_id, id, format=None):\n \n return super(UrlParameterDetail, self).get(request, bot_id, handler_id, id, format)" ]
[ "def raise_errors(self, response):\n \"\"\"\"\"\"\n # Errors: 400, 403 permissions or REQUEST_LIMIT_EXCEEDED, 404, 405, 415, 500)\n # TODO extract a case ID for Salesforce support from code 500 messages\n\n # TODO disabled 'debug_verbs' temporarily, after writing better default messages\...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Natural Language Processing:" }
// max returns the value of the highest key in this list // of entries. The bool indicates if it's a valid key, that // is if there is more than zero entries in this list.
[ "func (entries Entries) max() (uint64, bool) {\n\tif len(entries) == 0 {\n\t\treturn 0, false\n\t}\n\n\treturn entries[len(entries)-1].Key(), true\n}" ]
[ "public function containsValue($value): bool {\n\n /**\n * @var string $arrayIndex\n * @var SinglyLinkedList $list\n */\n foreach ($this->bucket as $arrayIndex => $list) {\n /* $list is the first element in the bucket. The bucket\n * can contain max $maxS...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// ParsePlatform parses a Platform from its string representation.
[ "func ParsePlatform(v string) (Platform, error) {\n\tparts := strings.Split(v, \"-\")\n\tif len(parts) != 2 {\n\t\treturn Platform{}, errors.Reason(\"platform must be <os>-<arch>: %q\", v).Err()\n\t}\n\treturn Platform{parts[0], parts[1]}, nil\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Decorator for views which supplies a single, user-selected token for the view to process. Same parameters as tokens_required.
[ "def token_required(scopes='', new=False):\n \n\n def decorator(view_func):\n @wraps(view_func, assigned=available_attrs(view_func))\n def _wrapped_view(request, *args, **kwargs):\n\n # if we're coming back from SSO for a new token, return it\n token = _check_callback(reque...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
A utility function to return samples according to type
[ "def _return_samples(return_type, samples):\n \n if return_type.lower() == \"dataframe\":\n if HAS_PANDAS:\n return pandas.DataFrame.from_records(samples)\n else:\n warn(\"Pandas installation not found. Returning numpy.recarray object\")\n return samples\n els...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
合并依赖 @param depends
[ "function combineDepends( depends ) {\n var deps, items;\n\n deps = [];\n\n _.each(depends, function(ex) {\n items = [];\n switch (ex.type) {\n case 'Literal':\n items = _.map(ex.value.split(','), function(v) {\n return v.trim();\n })...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Return an array of stored cache ids @return array array of stored cache ids (string)
[ "public function getIds()\n {\n $this->_checkAndBuildStructure();\n $res = $this->_query(\"SELECT id FROM cache WHERE (expire=0 OR expire>\" . time() . \")\");\n $result = array();\n while ($id = @sqlite_fetch_single($res)) {\n $result[] = $id;\n }\n return $r...
[ "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 Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
setter for lemma - sets lemma of the Form @generated @param v value to set into the feature
[ "public void setLemma(String v) {\n if (WordForm_Type.featOkTst && ((WordForm_Type)jcasType).casFeat_lemma == null)\n jcasType.jcas.throwFeatMissing(\"lemma\", \"com.digitalpebble.rasp.WordForm\");\n jcasType.ll_cas.ll_setStringValue(addr, ((WordForm_Type)jcasType).casFeatCode_lemma, v);}" ]
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
vagrant Initialize Vagrant in the current directory Supported options: * :force [boolean] force overwritting
[ "def vagrant(dir = Dir.pwd, options = {})\n info \"Initialize Vagrant (see https://www.vagrantup.com/)\"\n path = normalized_path(dir)\n use_git = FalkorLib::Git.init?(path)\n rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path\n templatedir = File.join( FalkorLib.templates, 'vagrant'...
[ "protected function showHelp($msg = '', $code = 0)\n {\n $usage = Cli::color('USAGE:', 'brown');\n $commands = Cli::color('COMMANDS:', 'brown');\n $sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');\n $pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');\n $version = Cli::color(...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about PHP programming:" }
Method: page Display the page starting at the given index from the cache. Returns: {Boolean} A new page was displayed.
[ "function(start, event) {\n var changed = false;\n if(this.features) {\n if(start >= 0 && start < this.features.length) {\n var num = Math.floor(start / this.length);\n if(num != this.num) {\n this.paging = true;\n var feat...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Gets all the remote subscriptions that have been sent to this Bus. Returns a cloned list of subscriptions to the requester. @return Hashtable The cloned subscription hashtable.
[ "Hashtable getRemoteSubscriptions()\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n {\n SibTr.entry(tc, \"getRemoteSubscriptions\");\n SibTr.exit(tc, \"getRemoteSubscriptions\", iRemoteSubscriptions);\n }\n\n return (Hashtable) iRemoteSubscriptions.clone();\n }" ]
[ "private void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n checkNotNull(\"event\",\n event);\n String uuid = event.getDataSetDef().getUUID();\n\n // Remove any stale data existing on the client.\n // This will force next lookup requests to push a refresh...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Count implements Count.
[ "func (r *RecordingStatter) Count(name string, value int64, rate float64, tags ...string) {\n\tif r.Counts == nil {\n\t\tr.Counts = make(map[string]int64)\n\t}\n\tr.Counts[name] += value\n}" ]
[ "public List<Integer> getIntegerList(final String param) {\n return getList(param, new StringToInteger(),\n new AlwaysValid<Integer>(), \"integer\");\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Displays the result.
[ "@Route(method = HttpMethod.POST, uri = \"/result\")\n public Result hello(@Body MyForm form) {\n return ok(render(hello,\n ImmutableMap.<String, Object>of(\"form\", form)));\n }" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Removes a directory @param string $url Path @param int $options Options @return boolean
[ "public function rmdir($url, $options)\n {\n $partition = self::getPartition($url);\n $path = self::getRelativePath($url);\n\n return !!$partition->removeDirectory($path, $options);\n }" ]
[ "public function help()\n {\n $style = new Eurekon\\Style(' *** RUN - HELP ***');\n Eurekon\\Out::std($style->color('fg', Eurekon\\Style::COLOR_GREEN)->get());\n Eurekon\\Out::std('');\n\n $help = new Eurekon\\Help('...', true);\n $help->addArgument('', 'directory', 'Config dir...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about NLP:" }
Start the validation process.
[ "def _begin_validation(\n session: UpdateSession,\n config: config.Config,\n loop: asyncio.AbstractEventLoop,\n downloaded_update_path: str)\\\n -> asyncio.futures.Future:\n \n session.set_stage(Stages.VALIDATING)\n cert_path = config.update_cert_path\\\n if config...
[ "@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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Renders the template. @param context a Map denoting the (possibly nested) variables that can be used in this Template. @return a string denoting the rendered template.
[ "public String render(Map<String, Object> context) {\n\n LiquidWalker walker = new LiquidWalker(new CommonTreeNodeStream(root), this.tags, this.filters, this.flavor);\n\n try {\n LNode node = walker.walk();\n Object rendered = node.render(context);\n return rendered ==...
[ "function Entry (content, name, parent) {\n if (!(this instanceof Entry)) return new Entry(content, name, parent);\n\n this._parent = parent; // parent can be a Document or ArrayField\n this._schema = parent._schema; // the root Document\n this._name = name; // the field name supplied by the user\n this._hidde...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// CreateFile creates a new file and returns a Writer
[ "func (l *localFileSystem) CreateFile(filePath string, length uint64) (io.WriteCloser, error) {\n\tf, err := os.Create(filePath)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\treturn f, nil\n}" ]
[ "def open(self, mode=MODE_READ):\n \n if mode not in [MODE_READ, MODE_WRITE]:\n error = \"Open mode must be '{}' or '{}'\".format(\n MODE_READ, MODE_WRITE)\n raise ValueError(error)\n self._openMode = mode\n if mode == MODE_READ:\n self.ass...
codesearchnet
{ "query": "Represent the Github comment about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about Software development:" }
// Fill in tags for volume or snapshot
[ "func (d *driver) createTags(ctx types.Context, id, name string) (err error) {\n\tvar (\n\t\tctInput *awsec2.CreateTagsInput\n\t\tinputName string\n\t)\n\tinitCTInput := func() {\n\t\tif ctInput != nil {\n\t\t\treturn\n\t\t}\n\t\tctInput = &awsec2.CreateTagsInput{\n\t\t\tResources: []*string{&id},\n\t\t\tTags: ...
[ "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 Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
/* ------------------------------------------------------------
[ "protected void statsRequestStart()\n {\n if (_statsOn)\n {\n if (_reqTime>0)\n statsRequestEnd();\n _requests++;\n _tmpTime=_request.getTimeStamp();\n _reqTime=_tmpTime;\n _httpServer.statsGotRequest();\n }\n }" ]
[ "public function description()\n {\n //====================================================================//\n // Stack Trace\n Splash::log()->trace();\n\n //====================================================================//\n // Build & Return Widget Description Array\n ...
codesearchnet
{ "query": "Represent the post about N/A:", "pos": "Represent the code about N/A:", "neg": "Represent the code about Software Development:" }
returns all additional js from this to upper menu item hierarchy beginning with the root. @return @since 1.1.4
[ "public Map<String, Boolean> getAdditionalJSReverse() {\r\n\t\tMap<String, Boolean> result = new LinkedHashMap<>();\r\n\t\tList<MenuEntry> parents = reverseFlattened().collect(AdminToolMenuUtils.toListReversed());\r\n\t\tparents.forEach(menuEntry -> {\r\n\t\t\tif (null != menuEntry.getAdditionalJS()) {\r\n\t\t\t\tr...
[ "public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Return the ConstructResult block from a list of IR blocks.
[ "def _get_construct_result(ir_blocks):\n \"\"\"\"\"\"\n last_block = ir_blocks[-1]\n if not isinstance(last_block, blocks.ConstructResult):\n raise AssertionError(\n u'The last IR block {} for IR blocks {} was unexpectedly not '\n u'a ConstructResult block.'.format(last_block, ...
[ "@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:", "pos": "Represent the code:", "neg": "Represent the code:" }
For each char in the {@code string} in reverse order, execute the {@link CharProcedure}. @since 7.0
[ "public static void reverseForEachChar(String string, CharProcedure procedure)\n {\n for (int i = string.length() - 1; i >= 0; i--)\n {\n procedure.value(string.charAt(i));\n }\n }" ]
[ "public static <T extends Comparable<? super T>> void sort(List<T> list) {\n\t\tsort(list, QuickSort.<T>naturalOrder()); // JAVA_8 replace with Comparator.naturalOrder() (and cleanup) \n\t}" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// BuildNetworkFlags CLI networking flags for given binary
[ "func BuildNetworkFlags(binary string) []cli.Flag {\n\tbinUpper := strings.ToUpper(binary)\n\tbinLower := strings.ToLower(binary)\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: \"mode, plugin-mode, cluster-mode\",\n\t\t\tEnvVar: fmt.Sprintf(\"CONTIV_%s_MODE\", binUpper),\n\t\t\tUsage: fmt.Sprintf(\"set ...
[ "@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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Set the data definition @param EntityStructure $definition The data definition @return void
[ "public function setDefinition(EntityStructure $definition)\n {\n $tmp = new \\ReflectionProperty(entity::class, 'definition');\n $tmp->setAccessible(true);\n $tmp->setValue($this->entity, $definition);\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// getPeers sends get_peers query to the chan.
[ "func (tm *transactionManager) getPeers(no *node, infoHash string) {\n\ttm.sendQuery(no, getPeersType, map[string]interface{}{\n\t\t\"id\": tm.dht.id(infoHash),\n\t\t\"info_hash\": infoHash,\n\t})\n}" ]
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns the content loaded from the given URL. Uses curl to fetch the cookie from the response and insert it into requests, if available. @param string $URL to fetch @return string
[ "protected function fetchURL($URL)\n {\n $cookieHeader = [];\n if ($this->cookie) {\n $cookieHeader[] = 'Cookie: ' . $this->cookie . ';';\n }\n\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $URL);\n curl_setopt($curl, CURLOPT_HEADER, 1);\n cu...
[ "def handleHeader(self, key, value):\n \"\"\n key_lower = key.lower()\n if key_lower == 'location':\n value = self.modLocationPort(value)\n self._response.headers[key_lower] = value\n if key_lower != 'cache-control':\n # This causes us to not pass on the 'cac...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Pulls the zone for the current domain from authenticated Hetzner account and returns it as an zone object.
[ "def _get_zone(self, domain, domain_id):\n \n api = self.api[self.account]\n for request in api['zone']['GET']:\n url = (request.copy()).get('url', '/').replace('<id>', domain_id)\n params = request.get('params', {}).copy()\n for param in params:\n ...
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the text about AWS Route 53:", "pos": "Represent the code about AWS Route 53:", "neg": "Represent the code about Technology:" }
// Following two functions are adapted from // github.com/crowdmob/goamz/cloudwatch, since the putData implementation of // that package was broken.
[ "func putData(c *cloudwatch.CloudWatch, metrics []cloudwatch.MetricDatum) (result *aws.BaseResponse, err error) {\n\t// Serialize the params\n\tparams := aws.MakeParams(\"PutMetricData\")\n\tfor i, metric := range metrics {\n\t\tprefix := \"MetricData.member.\" + strconv.Itoa(i+1)\n\t\tif metric.MetricName == \"\" ...
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Collect a database transaction event. @param string $event @param \Illuminate\Database\Connection $connection @return array
[ "public function collectTransactionEvent($event, $connection)\n {\n $source = [];\n\n if ($this->findSource) {\n try {\n $source = $this->findSource();\n } catch (\\Exception $e) {\n }\n }\n\n $this->queries[] = [\n 'query' =>...
[ "public function logError(ContactEventLog $eventLog, $errorMessage)\n {\n // @todo - add translator for messages.\n $eventLog->addProperty('error', $errorMessage)\n ->setAction('failed');\n $this->ContactEventLogRepo->saveEntity($eventLog);\n // $this->logDebug('Line '. 1 ....
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// SetReservedNodeId sets the ReservedNodeId field's value.
[ "func (s *AcceptReservedNodeExchangeInput) SetReservedNodeId(v string) *AcceptReservedNodeExchangeInput {\n\ts.ReservedNodeId = &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:" }
With no arguments, closes the currently active menu - if nothing is active it closes all menus. If passed an argument, it will search for menus BELOW
[ "function( startMenu ) {\n\t\tif ( !startMenu ) {\n\t\t\tstartMenu = this.active ? this.active.parent() : this.element;\n\t\t}\n\n\t\tstartMenu.find( \".ui-menu\" )\n\t\t\t.hide()\n\t\t\t.attr( \"aria-hidden\", \"true\" )\n\t\t\t.attr( \"aria-expanded\", \"false\" );\n\t}" ]
[ "def _restore_clipboard_selection(self, backup: str):\n \"\"\"\"\"\"\n # Pasting takes some time, so wait a bit before restoring the content. Otherwise the restore is done before\n # the pasting happens, causing the backup to be pasted instead of the desired clipboard content.\n\n # Prog...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Parse a type argument. @param parser The parser. @param definingClassName The name of the defining class (for resolving type variables). @return The parsed method type signature. @throws ParseException If method type signature could not be parsed.
[ "private static TypeArgument parse(final Parser parser, final String definingClassName) throws ParseException {\n final char peek = parser.peek();\n if (peek == '*') {\n parser.expect('*');\n return new TypeArgument(Wildcard.ANY, null);\n } else if (peek == '+') {\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 about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Deserializes the given representation of the serialized object. :param to_deserialize: the serialized object as a dictionary :return: the deserialized object or collection of deserialized objects
[ "def deserialize(self, to_deserialize: PrimitiveJsonType) \\\n -> Optional[Union[SerializableType, List[SerializableType]]]:\n \n if to_deserialize is None:\n # Implements #17\n return None\n elif isinstance(to_deserialize, List):\n deserialized = []\...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
One of ways of creating builder. This might be the only way (considering all _functional_ builders) that might be utilize to specify generic params only once.
[ "@Nonnull\n\tpublic static <R> DoubleFunctionBuilder<R> dblFunction(Consumer<DoubleFunction<R>> consumer) {\n\t\treturn new DoubleFunctionBuilder(consumer);\n\t}" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// MonitorSize monitors the terminal's size. It returns a TerminalSizeQueue primed with // initialSizes, or nil if there's no TTY present.
[ "func (t *TTY) MonitorSize(initialSizes ...*remotecommand.TerminalSize) remotecommand.TerminalSizeQueue {\n\toutFd, isTerminal := term.GetFdInfo(t.Out)\n\tif !isTerminal {\n\t\treturn nil\n\t}\n\n\tt.sizeQueue = &sizeQueue{\n\t\tt: *t,\n\t\t// make it buffered so we can send the initial terminal sizes without block...
[ "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 Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about File management:" }
Parse the k-point and then continue to iterate over the band energies and occupations
[ "def _parse_kpoint(line, lines):\n \"\"\"\"\"\"\n toks = line.split()\n kpoint = [float(x) for x in toks[:3]]\n weight = float(toks[-1])\n newline = next(lines)\n\n bands_up = []\n occ_up = []\n bands_down = []\n occ_down = []\n ispin = None\n\n while len(newline.split()) > 0:\n ...
[ "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 text about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code about Natural Language Processing:" }
Returns the ProxyConstructor for this ProxyClass. Creates it if needed. @return ProxyConstructor
[ "public function getConstructor()\n {\n if (!isset($this->constructor)) {\n $this->constructor = new ProxyConstructor($this->fullOriginalClassName);\n $this->constructor->injectReflectionService($this->reflectionService);\n }\n return $this->constructor;\n }" ]
[ "protected Expression instantiate(Object oldInstance, Encoder out)\n {\n //\n // An implementation instance is actually constructed at decode time by calling\n // ControlBean.ensureControl on the parent bean. This will create a new impl\n // instance and run the impl initializer on i...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
When automapping the table name, use singular case rather than plural. @return string
[ "public function getTable()\n {\n // If the table is set manually, return it.\n if(isset($this->table))\n {\n return $this->table;\n }\n\n // Return only the class name in snake case.\n return snake_case(array_pop( explode('\\\\', get_class($this))));\n }" ...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Override $configuration parameters with $override. Only first level keys in main configuration and separately under 'parameters' key are replaced. @param array $configuration @param array $override @return array
[ "private function overrideConfiguration(array $configuration, array $override)\n {\n $configuration['parameters'] = array_replace(\n $configuration['parameters'],\n $override['parameters']\n );\n\n unset($override['parameters']);\n\n return array_replace($configu...
[ "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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Make the register storage.
[ "def _make_register(self) -> BaseRegisterStore:\n \n\n s = settings.REGISTER_STORE\n store_class = import_class(s['class'])\n return store_class(**s['params'])" ]
[ "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:" }
Initializes this message queue. Adds this queue to the message manager. @param manager My parent message manager. @param strQueueName This queue's name. @param strQueueType This queue's type (LOCAL/JMS).
[ "public void init(BaseMessageManager manager, String strQueueName, String strQueueType)\n {\n super.init(manager, strQueueName, strQueueType);\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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Tests if the driver supports Common Table Expression. If it doesn't we'll fall back to a manually recursive query. @return bool
[ "protected function supportsCommonTableExpressionQuery()\n {\n $driver = DB::connection()->getDriverName();\n\n if ($driver == 'mysql') {\n return true;\n }\n\n if ($driver == 'sqlite' && \\SQLite3::version()['versionNumber'] >= 3008003) {\n return true;\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 text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
name find function abbreviation
[ "def search_name(self, name, dom=None):\n \"\"\"\"\"\"\n if dom is None:\n dom = self.browser\n return expect(dom.find_by_name, args=[name])" ]
[ "def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
format and return report (translatable) messages @return array
[ "public function formatReport()\n {\n $messages = array();\n $report = $this->getReport();\n\n switch(true){\n\n case $report instanceof ConstraintViolationListInterface:\n foreach ($report as $constraintViolation){\n $messages[] = $constraintViol...
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the Github comment about translation:", "pos": "Represent the Github code about translation:", "neg": "Represent the Github code about Software development:" }
Pseudo entry()-method. @param returnType (ignored) @param object (ignored) @param methodSignature (ignored) @return always null
[ "@Override\r\n final public TraceMethod entry(String returnType, Object object, String methodSignature) {\r\n return null;\r\n }" ]
[ "function Message(instanceList, // @arg InstanceObject - address list. { id: instance, ... }\n methodName) { // @arg MethodNameString = \"inbox\" - instance[method]\n // @desc MessagePassing implementation.\n this._instanceList = instanceList;\n this._methodName ...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// Context specifies the script context (optional).
[ "func (s *PutScriptService) Context(context string) *PutScriptService {\n\ts.context = context\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 post about Go programming language:", "pos": "Represent the Github code about Go programming language:", "neg": "Represent the Github code about programming:" }
getTwig @param bool $new @return \Twig_Environment
[ "public function getEngine($new = false)\n {\n if (!($this->engine instanceof \\Twig_Environment) || $new) {\n $this->engine = new \\Twig_Environment($this->getLoader(), $this->config->toArray());\n\n foreach (GlobalContainer::getExtensions() as $extension) {\n $this->...
[ "public function logBanner($additions = null)\n {\n $this->addStatusMessage('FlexiBee '.str_replace('://',\n '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\\Ease\\Atom::$frameworkVersion.' '.$additio...
codesearchnet
{ "query": "Represent the description about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
// RetrieveBlocksHashesAll retrieve the hash of every block in the blocks table, // ordered by their row ID.
[ "func RetrieveBlocksHashesAll(ctx context.Context, db *sql.DB) ([]string, error) {\n\tvar hashes []string\n\trows, err := db.QueryContext(ctx, internal.SelectBlocksHashes)\n\tif err != nil {\n\t\treturn hashes, err\n\t}\n\tdefer closeRows(rows)\n\n\tfor rows.Next() {\n\t\tvar hash string\n\t\terr = rows.Scan(&hash)...
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the Github summarization about Redis command documentation:", "pos": "Represent the Github code about Redis command documentation:", "neg": "Represent the Github code about Software development:" }
Creates data provider instance with search query applied @param array $params @return ArrayDataProvider
[ "public function search(array $params): ArrayDataProvider\n {\n $query = new ArrayQuery(Yii::$app->authManager->getRules());\n\n if ($this->load($params) && $this->validate()) {\n $query->addCondition('name', $this->name ? \"~{$this->name}\" : null);\n }\n\n return new Arra...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
=================
[ "protected Proxy copy() {\n\t\tSocks5Proxy copy = new Socks5Proxy(proxyIP, proxyPort);\n\t\tcopy.authMethods = this.authMethods; // same Hash, no copy\n\t\tcopy.directHosts = this.directHosts;\n\t\tcopy.chainProxy = this.chainProxy;\n\t\tcopy.resolveAddrLocally = this.resolveAddrLocally;\n\t\treturn copy;\n\t}" ]
[ "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 summarization about Language and Writing:", "pos": "Represent the code about Language and Writing:", "neg": "Represent the code:" }
Finds the prefixes of the external variables for a given application or template. <p> If this list is not empty, it means this application depends on other ones. </p> @param app an application or an application template @return a non-null application
[ "public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) {\n\n\t\tSet<String> result = new TreeSet<> ();\n\t\tfor( Component c : ComponentHelpers.findAllComponents( app )) {\n\t\t\tfor( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) {\n\t\t\t\tif( ! var.i...
[ "private void loadConfigurationFiles() {\n\n // Parse the first annotation found (manage overriding)\n final Configuration conf = ClassUtility.getLastClassAnnotation(this.getClass(), Configuration.class);\n\n // Conf variable cannot be null because it was defined in this class\n // It's ...
codesearchnet
{ "query": "Represent the sentence about Juju model:", "pos": "Represent the code about Juju model:", "neg": "Represent the code:" }
// Connect with a password. If username is empty simplessh will attempt to get the current user.
[ "func ConnectWithPassword(host, username, pass string) (*Client, error) {\n\treturn ConnectWithPasswordTimeout(host, username, pass, DefaultTimeout)\n}" ]
[ "func tagUserCredentials(conf agent.Config) (string, string, error) {\n\tusername := conf.Tag().String()\n\tvar password string\n\t// TODO(perrito) we might need an accessor for the actual state password\n\t// just in case it ever changes from the same as api password.\n\tapiInfo, ok := conf.APIInfo()\n\tif ok {\n\...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Creates a file. Args: filename (str): Filename. settings (dict): Must be {"content": actual_content}
[ "def file_create(filename, settings):\n \n if len(settings) != 1:\n raise ValueError(\"Settings must only contain one item with key \"\n \"'content'.\")\n for k, v in settings.items():\n if k == \"content\":\n with open(filename, ...
[ "def modify_log_flags(self, settings):\n \n if not isinstance(settings, basestring):\n raise TypeError(\"settings can only be an instance of type basestring\")\n self._call(\"modifyLogFlags\",\n in_p=[settings])" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Returns length of the internal value. @param value a value. @param propType @return the length of the internal value or <code>-1</code> if the length cannot be determined.
[ "public static long getLength(ValueData value, int propType)\n {\n if (propType == PropertyType.BINARY)\n {\n return value.getLength();\n }\n else if (propType == PropertyType.NAME || propType == PropertyType.PATH)\n {\n return -1;\n }\n else\n {\n r...
[ "public function singlePcmlToParam(\\SimpleXmlElement $dataElement)\n {\n $tagName = $dataElement->getName();\n \n // get attributes of this element.\n $attrs = $dataElement->attributes();\n \n // both struct and data have name, count (optional), usage\n $name = (isset($a...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Validates the current object, invalid objects will not be written. By default all Kapost objects are valid if they have a value in the KapostRefID @return ValidationResult @see DataObject::validate()
[ "protected function validate() {\n $validator=parent::validate();\n \n //Verify we have a KapostRefID\n $kapostID=$this->KapostRefID;\n if(empty($kapostID)) {\n $validator->error(_t('KapostObject.MISSING_KAPOST_ID', '_Kapost Reference ID is missing'), 'missing-kapost-id...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Add "member vni" configuration to the NVE interface. Called during update postcommit port event.
[ "def _configure_nve_member(self, vni, device_id, mcast_group, host_id):\n \n host_nve_connections = self._get_switch_nve_info(host_id)\n\n for switch_ip in host_nve_connections:\n\n # If configured to set global VXLAN values then\n # If this is the first database entry f...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Override django-bakery to skip profiles that raise 404
[ "def build_object(self, obj):\n \"\"\"\"\"\"\n try:\n build_path = self.get_build_path(obj)\n self.request = self.create_request(build_path)\n self.request.user = AnonymousUser()\n self.set_kwargs(obj)\n self.build_file(build_path, self.get_conten...
[ "async def get_object_proxy_location(self, client, pid):\n \n try:\n return (await client.describe(pid)).get(\"DataONE-Proxy\")\n except d1_common.types.exceptions.DataONEException:\n # Workaround for older GMNs that return 500 instead of 404 for describe()\n pa...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
// https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key
[ "func DeleteDeploykey(c *context.APIContext) {\n\tif err := models.DeleteDeployKey(c.User, c.ParamsInt64(\":id\")); err != nil {\n\t\tif models.IsErrKeyAccessDenied(err) {\n\t\t\tc.Error(403, \"\", \"You do not have access to this key\")\n\t\t} else {\n\t\t\tc.Error(500, \"DeleteDeployKey\", err)\n\t\t}\n\t\treturn...
[ "def configure_user(gh_token, repo):\n \n user = user_from_token(gh_token)\n repo.git.config('user.email', user.email or 'aspysdk2@microsoft.com')\n repo.git.config('user.name', user.name or 'SwaggerToSDK Automation')" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software Development:" }
Read the next frame(s) from the socket. :return: list of frames read :rtype: list(bytes)
[ "def __read(self):\n \n fastbuf = BytesIO()\n while self.running:\n try:\n try:\n c = self.receive()\n except exception.InterruptedException:\n log.debug(\"socket read interrupted, restarting\")\n ...
[ "def start_index(self, value):\n \"\"\"\"\"\"\n # TODO: Validate contents? (May want to set before adding the data.)\n if not isinstance(value, dict):\n raise TypeError('start_index attribute must be a dict.')\n self._start_index = value" ]
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Create a user. @param username: Username @param password: Password @param roles: List of roles for the user. This should be [] for a regular user, or ['ROLE_ADMIN'] for an admin. @return: An ApiUser object
[ "def create_user(self, username, password, roles):\n \n return users.create_user(self, username, password, roles)" ]
[ "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 comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
check if one of arguments or operations is unresolved
[ "private boolean isResolved()\n\t{\n\t\tif (getStatus() < Command.CHILDREN_PROCESSED)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tfor (int i = 0; i < arguments.size(); ++i)\n\t\t{\n\t\t\tCommand arg = arguments.elementAt(i);\n\n\t\t\tif (!arg.isResolved())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tfor (int j...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Generates an authorization grant represented as a dictionary. :param request: OAuthlib request. :type request: oauthlib.common.Request
[ "def create_authorization_code(self, request):\n \n grant = {'code': common.generate_token()}\n if hasattr(request, 'state') and request.state:\n grant['state'] = request.state\n log.debug('Created authorization code grant %r for request %r.',\n grant, request...
[ "def verify_request_common(consumers, url, method, headers, params):\n \n log.debug(\"consumers %s\", consumers)\n log.debug(\"url %s\", url)\n log.debug(\"method %s\", method)\n log.debug(\"headers %s\", headers)\n log.debug(\"params %s\", params)\n\n oauth_server = LTIOAuthServer(consumers)\n...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Creates a gauge that will sum the current value of a metric for all column families in this keyspace @param name @param MetricValue @return Gauge&gt;Long> that computes sum of MetricValue.getValue()
[ "private <T extends Number> Gauge<Long> createKeyspaceGauge(String name, final MetricValue extractor)\n {\n allMetrics.add(name);\n return Metrics.newGauge(factory.createMetricName(name), new Gauge<Long>()\n {\n public Long value()\n {\n long sum = 0;\n ...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the instruction about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
IR channel calibration.
[ "def _ir_calibrate(self, data, key):\n \"\"\"\"\"\"\n # Not sure if Lv is correct, FCI User Guide is a bit unclear\n\n Lv = data.data * \\\n self.nc[\n '/data/{}/measured/radiance_unit_conversion_coefficient'\n .format(key.name)][...]\n\n vc = sel...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
TODO(jz) consider the appropriate tabs for this case
[ "public void createTabs(ILaunchConfigurationDialog dialog, String mode) {\n setTabs(new ILaunchConfigurationTab[] { new JavaArgumentsTab(),\n new JavaJRETab(), new JavaClasspathTab(), new CommonTab() });\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 instruction about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code about programming:" }
@param array $options @param array $textOptions @return string
[ "public function format($options = [], $textOptions = [])\n {\n return \\Yii::$app->money->format($this, $options, $textOptions);\n }" ]
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Sign the specified envelope with this signer @param envelope envelope to be signed @return signed envelope @throws LRException
[ "public LREnvelope sign(LREnvelope envelope) throws LRException\n {\n // Bencode the document\n String bencodedMessage = bencode(envelope.getSignableData());\n\n // Clear sign the bencoded document\n String clearSignedMessage = signEnvelopeData(bencodedMessage);\n\n envelope.ad...
[ "def get_value_from_content(key):\n \n def value_from_content_function(service, message):\n \"\"\"Actual implementation of get_value_from_content function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa...
codesearchnet
{ "query": "Represent the Github comment about API documentation:", "pos": "Represent the Github code about API documentation:", "neg": "Represent the Github code about Software development:" }
Parses comparisons and adds logic to the filter. @param string $compareLogic @param string $property @param mixed $value @return void
[ "private function _parseComparison($compareLogic, $property, $value)\n {\n switch ($property) {\n case self::FILTER_CONFIG_LENGTH:\n $this->length($value);\n break;\n case self::FILTER_CONFIG_OFFSET:\n $this->offset($value);\n ...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Strip off the dl=0 suffix from dropbox links >>> dropbox_basename('https://www.dropbox.com/s/yviic64qv84x73j/aclImdb_v1.tar.gz?dl=1') 'aclImdb_v1.tar.gz'
[ "def dropbox_basename(url):\n \n filename = os.path.basename(url)\n match = re.findall(r'\\?dl=[0-9]$', filename)\n if match:\n return filename[:-len(match[0])]\n return filename" ]
[ "def configuration():\n ''\n defaults = '''\n[oauth2]\nhostname = localhost\nport = 9876\napi_endpoint = https://api.coursera.org\nauth_endpoint = https://accounts.coursera.org/oauth2/v1/auth\ntoken_endpoint = https://accounts.coursera.org/oauth2/v1/token\nverify_tls = True\ntoken_cache_base = ~/.coursera\n\n...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software Development:" }
Separates the sliced (partitioned) and unsliced variables in var_list. Args: var_list: a list of variables. Returns: A list of unsliced variables in var_list, and a dict mapping names to parts for the sliced variables in var_list.
[ "def _get_sliced_variables(var_list):\n \n unsliced_variables = []\n sliced_variables = collections.defaultdict(lambda: [])\n for var in var_list:\n if var._save_slice_info:\n sliced_variables[var._save_slice_info.full_name].append(var)\n else:\n unsliced_variables.append(var)\n return unsliced...
[ "def non_unique_bin_edges_error(func):\n \n message = \"\"\"\n\n An error occurred while computing bins/quantiles on the input provided.\n This usually happens when the input contains too many identical\n values and they span more than one quantile. The quantiles are choosen\n to have the same num...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Create a regular expression which will match any of the values from the supplied enum type
[ "public static <T extends Enum<T>> Pattern createValidationPatternFromEnumType(Class<T> enumType) {\n\n String regEx = Stream.of(enumType.getEnumConstants())\n .map(Enum::name)\n .collect(Collectors.joining(\"|\", \"(?i)\", \"\"));\n\n //Enum constants may contain $ which...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Select rows where the given field `is` the given value.
[ "def selectis(table, field, value, complement=False):\n \"\"\"\"\"\"\n\n return selectop(table, field, value, operator.is_, complement=complement)" ]
[ "def _extract_lookup(self, key):\n \"\"\"\"\"\"\n parts = key.split('__')\n # 'exact' is the default lookup if there was no explicit comparison op in `key`\n # Assume there is only one `__` in the key.\n # FIXME Change for child attribute query support\n op = 'exact' if...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Examples:: locate_ami(product="com.ubuntu.cloud:server:16.04:amd64", channel="daily", stream="daily", region="us-west-2") locate_ami(product="Amazon Linux AMI 2016.09")
[ "def locate_ami(product, region=None, channel=\"releases\", stream=\"released\", root_store=\"ssd\", virt=\"hvm\"):\n \n if region is None:\n region = clients.ec2.meta.region_name\n if product.startswith(\"com.ubuntu.cloud\"):\n partition = \"aws\"\n if region.startswith(\"cn-\"):\n ...
[ "def get_OS_UUID(cls, os):\n \n if os in cls.templates:\n return cls.templates[os]\n\n uuid_regexp = '^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$'\n if re.search(uuid_regexp, os):\n return os\n\n raise Exception((\n \"Invalid OS ...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about container management:" }
// reportError reports the given error.
[ "func reportError(w http.ResponseWriter, r *http.Request, err error) {\n\tw.WriteHeader(http.StatusInternalServerError)\n\tlog.Printf(\"[%s] %v\\n\", time.Now(), err)\n\terrorTemplate.Execute(w, err)\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Inserts a single record (given $data) in the given $table via prepared statements. @param string $table Table to insert @param array $data Data to insert @throws \Exception @return int Last inserted id
[ "public function insertRecord($table, array $data)\n {\n $dbHandle = $this->getDatabaseConnection();\n\n $fieldSet = array_keys($data);\n\n // Prepare sets\n $valueSet = array();\n foreach ($data as $key => $value) {\n $valueSet[':' . $key] = $value;\n }\n\n ...
[ "public function createRecord($eventData, $peopleId) {\n\n // Basically, just want to throw the data to the \"API\", and have the database magically updated.\n // Don't want to do the Command Bus thing, although has worked out well! The data's ready, just\n // want to get to the persist.\n\n ...
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software Development:" }
// enable enables HA peering for the node on which the engine is running.
[ "func (h *haManager) enable() {\n\tif h.state() == seesaw.HADisabled {\n\t\th.setState(seesaw.HAUnknown)\n\t}\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the comment about Networking:", "pos": "Represent the code about Networking:", "neg": "Represent the code about programming:" }
// Extract extracts a single file from the given source archive. If the target // is a directory, the entire folder will be extracted into destination. The // archive format is chosen implicitly.
[ "func Extract(source, target, destination string) error {\n\teIface, err := ByExtension(source)\n\tif err != nil {\n\t\treturn err\n\t}\n\te, ok := eIface.(Extractor)\n\tif !ok {\n\t\treturn fmt.Errorf(\"format specified by source filename is not an extractor format: %s (%T)\", source, eIface)\n\t}\n\treturn e.Extr...
[ "def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be...
codesearchnet
{ "query": "Represent the description about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about Software development:" }
Add the created action message for the key 'errors.failed_to_print_thread_dump' with parameters. <pre> message: Failed to print thread dump. </pre> @param property The property name for the message. (NotNull) @return this. (NotNull)
[ "public FessMessages addErrorsFailedToPrintThreadDump(String property) {\n assertPropertyNotNull(property);\n add(property, new UserMessage(ERRORS_failed_to_print_thread_dump));\n return this;\n }" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
/* (non-Javadoc) @see com.ibm.wsspi.injectionengine.InjectionBinding#mergeSaved(com.ibm.wsspi.injectionengine.InjectionBinding)
[ "@Override\n public void mergeSaved(InjectionBinding<JMSDestinationDefinition> injectionBinding) throws InjectionException {\n JMSDestinationDefinitionInjectionBinding jmsDestDefObjectBinding = (JMSDestinationDefinitionInjectionBinding) injectionBinding;\n\n mergeSavedValue(name, jmsDestDefObjectBi...
[ "@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
return redirect url path @param string $path @param boolean $isUpdate @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
[ "protected function redirectRoute($path, $isUpdate = false)\n {\n $indexPos = strpos($path,'index');\n $dotPos = strpos($path,'.');\n $slug = getModelSlug($this->model);\n\n // İlişkisiz yalın sayfalardan index hariç\n if ( $indexPos === false && $dotPos === false ) {\n ...
[ "public function beforeSend(\\Mmi\\Http\\Request $request)\n {\n //pobranie odpowiedzi\n $response = \\Mmi\\App\\FrontController::getInstance()->getResponse();\n //zmiana contentu\n $response->setContent((new \\Cms\\Model\\ContentFilter($response->getContent()))->getFilteredContent())...
codesearchnet
{ "query": "Represent the comment about Laravel:", "pos": "Represent the code about Laravel:", "neg": "Represent the code about Programming:" }
// SetLevel sets the Level field's value.
[ "func (s *Permission) SetLevel(v string) *Permission {\n\ts.Level = &v\n\treturn s\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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// FeatureCollectionFromMap constructs a FeatureCollection from a map // and returns its pointer
[ "func FeatureCollectionFromMap(input map[string]interface{}) *FeatureCollection {\n\tresult := NewFeatureCollection(nil)\n\tfeaturesIfc := input[FEATURES]\n\tswitch it := featuresIfc.(type) {\n\tcase []interface{}:\n\t\tfor _, featureIfc := range it {\n\t\t\tif featureMap, ok := featureIfc.(map[string]interface{});...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Merge an associative array to the map. @param array $array The array to merge @param boolean $merge_back If `true` merge the map over the $array, if `false` (default) the reverse.
[ "public function merge($array, $merge_back=false){\n $this->fields = $merge_back\n ? array_replace_recursive((array)$array, $this->fields)\n : array_replace_recursive($this->fields, (array)$array);\n }" ]
[ "def filter_connec_entity_for_id_refs(connec_entity, id_references)\n return {} if id_references.empty?\n\n entity = connec_entity.dup.with_indifferent_access\n tree = build_id_references_tree(id_references)\n\n filter_connec_entity_for_id_refs_helper(entity, tree)\n\n # TODO, improve perfo...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Finds the end of a block from a start location and a suggested end location.
[ "def _find_complete_block_bounds(self, table, used_cells, possible_block_start,\n start_pos, end_pos):\n '''\n \n '''\n block_start = list(possible_block_start)\n block_end = list(possible_block_start)\n table_row = table[block_start[0]]\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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// ContainsPoint reports whether the polygon contains the point.
[ "func (p *Polygon) ContainsPoint(point Point) bool {\n\t// NOTE: A bounds check slows down this function by about 50%. It is\n\t// worthwhile only when it might allow us to delay building the index.\n\tif !p.index.IsFresh() && !p.bound.ContainsPoint(point) {\n\t\treturn false\n\t}\n\n\t// For small polygons, and du...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Clears accumulated statistics on the local node. .. code-block:: yaml clear_ats_node: trafficserver.clear_node
[ "def clear_node(name):\n '''\n \n '''\n ret = {'name': name,\n 'changes': {},\n 'result': None,\n 'comment': ''}\n\n if __opts__['test']:\n ret['comment'] = 'Clearing local node statistics'\n return ret\n\n __salt__['trafficserver.clear_node']()\n\n r...
[ "def create_logstash(self, **kwargs):\n \n logstash = predix.admin.logstash.Logging(**kwargs)\n logstash.create()\n logstash.add_to_manifest(self)\n\n logging.info('Install Kibana-Me-Logs application by following GitHub instructions')\n logging.info('git clone https://githu...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Call another goal after restart has finished
[ "public void callPluginGoal(String fullGoal) throws MojoFailureException, MojoExecutionException {\n String[] parts = splitGoalSpec(fullGoal);\n Plugin plugin = project.getPlugin(parts[0]);\n String goal = parts[1];\n\n if (plugin == null) {\n throw new MojoFailureException(\"...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Loads the audio file given via data.files and data.index as audio element if the browser supports playing it. Accepts the options fileTypes (regular expression) and maxFileSize (integer) to limit the files to load:
[ "function (data, options) {\n if (options.disabled) {\n return data;\n }\n var file = data.files[data.index],\n url,\n audio;\n if (this._audioElement.canPlayType &&\n this._au...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// SetNumberOfFiles sets the NumberOfFiles field's value.
[ "func (s *DataSource) SetNumberOfFiles(v int64) *DataSource {\n\ts.NumberOfFiles = &v\n\treturn s\n}" ]
[ "public static void reset(File directory, int processNumber) {\n try (DefaultProcessCommands processCommands = new DefaultProcessCommands(directory, processNumber, true)) {\n // nothing else to do than open file and reset the space of specified process\n }\n }" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Respond with the list of applicable pages for a given filter @param HTTPRequest $request @return HTTPResponse
[ "public function handleApplicablePages($request)\n {\n // Find the action handler\n $action = $request->param('BatchAction');\n $actionHandler = $this->actionByName($action);\n\n // Sanitise ID list and query the database for apges\n $csvIDs = $request->requestVar('csvIDs');\n ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
@param mixed $value @param string $type @param bool $nullable @return mixed
[ "public static function setType($value, $type, $nullable = TRUE)\n\t{\n\t\tif (!$nullable || NULL !== $value) {\n\t\t\tsettype($value, $type);\n\t\t}\n\n\t\treturn $value;\n\t}" ]
[ "public static function ExpectRetrievedValueIsArray(\n string $property,\n $value,\n string $class_name\n ) : array {\n /**\n * @psalm-var T\n */\n $value = static::MaybeThrowIfNotType($property, $value, $class_name, 'array');\n\n return $value;\n }" ]
codesearchnet
{ "query": "Represent the Github post about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Software development:" }
Reads out bundle values from UI and stores keys with values in HashMap.<p> @return hash map
[ "private Map<String, String> getBundleMap() {\n\n Map<String, String> bundles = new HashMap<String, String>();\n\n if (m_bundleComponentKeyMap != null) {\n Set<TextField> fields = m_bundleComponentKeyMap.keySet();\n\n for (TextField field : fields) {\n bundles.put(...
[ "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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }