query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// NewStorageProviderRegistry returns a storage.ProviderRegistry that chains // the provided registry with the common storage providers.
[ "func NewStorageProviderRegistry(reg storage.ProviderRegistry) storage.ProviderRegistry {\n\treturn storage.ChainedProviderRegistry{reg, provider.CommonStorageProviders()}\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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Returns a JSON ready object representation of this pivot specification. @return {Object} The JSON ready object representation of this pivot specification. @method splunkjs.Service.PivotSpecification
[ "function() {\n return {\n dataModel: this.dataModelObject.dataModel.name,\n baseClass: this.dataModelObject.name,\n rows: this.rows,\n columns: this.columns,\n cells: this.cells,\n filters: this.filters\n ...
[ "function initializeItemSerializer(hasItems) {\n // Is there is a itemSerializer specified, we MUST use it.\n // If existing data and no itemSerializer specified, this is an old JSON database,\n // so \"fake\" the compatible JSON serializer\n var providerInfo = storageProvider.getMetadat...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Checks if addresses have been set and sets new ones @param ApiOrderInterface $cart
[ "protected function validateOrCreateAddresses($cart)\n {\n if ($cart instanceof ApiOrderInterface) {\n $cart = $cart->getEntity();\n }\n if (!$cart->getDeliveryAddress() || !$cart->getInvoiceAddress()) {\n $addresses = $cart->getCustomerAccount()->getAccountAddresses();...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about Aimeos:", "pos": "Represent the Github code about Aimeos:", "neg": "Represent the Github code:" }
Iterates over all source names and IDs.
[ "def iter_sources(self):\n \"\"\"\"\"\"\n for src_id in xrange(self.get_source_count()):\n yield src_id, self.get_source_name(src_id)" ]
[ "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 sentence about Data transformation:", "pos": "Represent the Github code about Data transformation:", "neg": "Represent the Github code about Software development:" }
Place the export button in a <p> tag below the field
[ "public function getHTMLFragments($gridField)\n {\n $button = GridField_FormAction::create(\n $gridField,\n 'export',\n _t('SilverStripe\\\\Forms\\\\GridField\\\\GridField.CSVEXPORT', 'Export to CSV'),\n 'export',\n null\n );\n $button->...
[ "protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Data synchronization:" }
Get all authors for the item Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>` @since Beta 2 @return array|null List of {@see SimplePie_Author} objects
[ "public function get_authors()\n\t{\n\t\t$authors = array();\n\t\tforeach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)\n\t\t{\n\t\t\t$name = null;\n\t\t\t$uri = null;\n\t\t\t$email = null;\n\t\t\tif (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))\n\t\t\t...
[ "func (m *Oauth2Scopes) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m == nil {\n\t\treturn info\n\t}\n\t// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}\n\treturn info\n}" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Warn if the user's target API is less than the current minimum recommendation
[ "def check_target_api(api, arch):\n \n\n if api >= ARMEABI_MAX_TARGET_API and arch == 'armeabi':\n raise BuildInterruptingException(\n 'Asked to build for armeabi architecture with API '\n '{}, but API {} or greater does not support armeabi'.format(\n api, ARMEABI_M...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Save current instance - as per the gludb spec.
[ "def save(self, obj):\n \"\"\"\"\"\"\n cur = self._conn().cursor()\n\n tabname = obj.__class__.get_table_name()\n\n index_names = obj.__class__.index_names() or []\n\n col_names = ['id', 'value'] + index_names\n value_holders = ['%s'] * len(col_names)\n updates = ['%...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Quote special characters for LaTeX. (Incomplete, currently only deals with underscores, dollar and hash.)
[ "def latex_quote(s):\n \n special = {'_':r'\\_', '$':r'\\$', '#':r'\\#'}\n s = str(s)\n for char,repl in special.items():\n new = s.replace(char, repl)\n s = new[:]\n return s" ]
[ "def _safe_match_string(value):\n \"\"\"\"\"\"\n if not isinstance(value, six.string_types):\n if isinstance(value, bytes): # should only happen in py3\n value = value.decode('utf-8')\n else:\n raise GraphQLInvalidArgumentError(u'Attempting to convert a non-string into a s...
codesearchnet
{ "query": "Represent the Github sentence about Technology:", "pos": "Represent the Github code about Technology:", "neg": "Represent the Github code about programming:" }
@param $value @return bool|string
[ "private function getClassValidator($value)\n {\n $classModel = get_class($value);\n $className = substr(strrchr($classModel, '\\\\'), 1);\n $fullClass = 'Greenter\\\\Validator\\\\Loader\\\\'.$className.'Loader';\n\n if (!class_exists($fullClass)) {\n return false;\n ...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Deserialize Vocab object from json string. Parameters ---------- json_str : str Serialized json string of a Vocab object. Returns ------- Vocab
[ "def from_json(cls, json_str):\n \n vocab_dict = json.loads(json_str)\n\n unknown_token = vocab_dict.get('unknown_token')\n vocab = cls(unknown_token=unknown_token)\n vocab._idx_to_token = vocab_dict.get('idx_to_token')\n vocab._token_to_idx = vocab_dict.get('token_to_idx')...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Sets the @param mixed $id The ID of the resource model. Also sets the base URL based on the Nova config @return void
[ "protected function setResourceId($id)\n {\n $path = Config::get('nova.path');\n // If the path is the site route, prevent a double-slash\n if ('/' === $path) {\n $path = '';\n }\n return $this->withMeta(['id' => $id, 'nova_path' => $path]);\n }" ]
[ "@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Gets an element from the form if it exists @param string $elementname @return HTML_QuickForm_input|MoodleQuickForm_group
[ "public function get_element($elementname) {\n if ($this->_form->elementExists($elementname)) {\n return $this->_form->getElement($elementname);\n } else {\n return false;\n }\n }" ]
[ "protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// SetContentLanguage sets the ContentLanguage field's value.
[ "func (s *S3ObjectMetadata) SetContentLanguage(v string) *S3ObjectMetadata {\n\ts.ContentLanguage = &v\n\treturn s\n}" ]
[ "public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Parse a transformer class and set relations. @param \Flugg\Responder\Transformer|callable $transformer @param \Illuminate\Database\ELoquent\Model $model @return \Flugg\Responder\Transformer|callable @throws \InvalidTransformerException
[ "protected function parseTransformer($transformer, Model $model)\n {\n if ($transformer instanceof Transformer) {\n $relations = $transformer->allRelationsAllowed() ? $this->resolveRelations($model) : $transformer->getRelations();\n $transformer = $transformer->setRelations($relation...
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Logs a message at {@link java.util.logging.Level#FINEST}. @param message The message accompanying the log @param args The arguments for the message.
[ "public void finest(String message, Object... args) {\n log(Level.FINEST, message, args);\n }" ]
[ "void forceLoggingViaChildLogger(LogRecord record) {\n // Assume that nobody else will configure or manipulate loggers with this \"secret\" name.\n Logger forcingLogger = getForcingLogger(logger);\n\n // This logger can be garbage collected at any time, so we must always reset any configuration.\n // Th...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Check to see if the all the properties in the model are valid @return true if the model is valid
[ "def valid?\n return false if @payment_id.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"FULL\", \"PARTIAL\"])\n return false unless type_validator.valid?(@type)\n return false if @reason.nil?\n return true\n end" ]
[ "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:" }
This method does the actual map matching. <p> @param gpxList the input list with GPX points which should match to edges of the graph specified in the constructor
[ "public MatchResult doWork(List<Observation> gpxList) {\n // filter the entries:\n List<Observation> filteredGPXEntries = filterGPXEntries(gpxList);\n\n // now find each of the entries in the graph:\n List<Collection<QueryResult>> queriesPerEntry = lookupGPXEntries(filteredGPXEntries, De...
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *CreateBillingGroupInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateBillingGroupInput\"}\n\tif s.BillingGroupName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"BillingGroupName\"))\n\t}\n\tif s.BillingGroupName != nil && len(*s.BillingGroupName) < 1 {\...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Import connectivity rules from Excel sheet
[ "def importConnFromExcel (fileName, sheetName):\n ''' '''\n import openpyxl as xl\n\n # set columns\n colPreTags = 0 # 'A'\n colPostTags = 1 # 'B'\n colConnFunc = 2 # 'C'\n colSyn = 3 # 'D'\n colProb = 5 # 'F'\n colWeight = 6 # 'G'\n colAnnot = 8 # 'I' \n\n outFileName = fileName[:-...
[ "protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Data synchronization:" }
Removes all cache entries of this cache which are tagged by the specified tag. @param string $tag The tag the entries must have @throws \TYPO3\CMS\Core\Cache\Exception
[ "public function flushByTag($tag)\n {\n $this->throwExceptionIfFrontendDoesNotExist();\n\n $this->logger->debug('SFC flushByTags', [$tag]);\n $identifiers = $this->findIdentifiersByTagIncludingExpired($tag);\n\n if ($this->isBoostMode()) {\n $this->getQueue()->addIdentifier...
[ "public function removeAccessLevel($key)\n {\n if (!isset($this->accessLevels[$key])) {\n return false;\n }\n \n // Remove the access level\n unset($this->accessLevels[$key]);\n \n // Save the access levels\n $this->saveAccessLevels();\n \...
codesearchnet
{ "query": "Represent the summarization about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code about Software Development:" }
Create condition of compare operator. @param compareRightValue right value of compare operator @param column column @return condition
[ "public static Optional<Condition> createCompareCondition(final PredicateCompareRightValue compareRightValue, final Column column) {\n return compareRightValue.getExpression() instanceof SimpleExpressionSegment\n ? Optional.of(new Condition(column, ((SimpleExpressionSegment) compareRightValue....
[ "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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// WithHTTPClient adds the HTTPClient to the reject consent request params
[ "func (o *RejectConsentRequestParams) WithHTTPClient(client *http.Client) *RejectConsentRequestParams {\n\to.SetHTTPClient(client)\n\treturn o\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github sentence about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Returns the value of f(x) for given solution @param array $theta @return float
[ "protected function cost(array $theta)\n {\n list($cost) = parent::gradient($theta);\n\n return array_sum($cost) / $this->sampleCount;\n }" ]
[ "def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// serviced pool set-conn-timeout POOLID TIMEOUT
[ "func (c *ServicedCli) cmdSetConnTimeout(ctx *cli.Context) {\n\targs := ctx.Args()\n\tif len(args) != 2 {\n\t\tfmt.Printf(\"Incorrect Usage.\\n\\n\")\n\t\tcli.ShowCommandHelp(ctx, \"set-conn-timeout\")\n\t\treturn\n\t}\n\n\tconnTimeout, err := time.ParseDuration(args[1])\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stder...
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// GetCharset returns the current numerical values of the per-session character // set variables.
[ "func GetCharset(conn *Conn) (*binlogdatapb.Charset, error) {\n\t// character_set_client\n\trow, err := ExecuteFetchMap(conn, \"SHOW COLLATION WHERE `charset`=@@session.character_set_client AND `default`='Yes'\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient, err := strconv.ParseInt(row[\"Id\"], 10, 16)\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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
/*-------------------------------------------------[ closeOutputs ]---------------------------------------------------
[ "protected void closeInputs() throws IOException{\n while(true){\n if(in instanceof Transport)\n return;\n in.close();\n in = in.detachInput();\n }\n }" ]
[ "function openTable()\n {\n $this->examples = [];\n $this->markdown = ''; // Clear table\n $this->declareAbstraction = true;\n $this->add('| Visibility | Function |');\n $this->add('|:-----------|:---------|');\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Return whether or not the given dir contains a build.
[ "def is_build_dir(self, folder_name):\n \"\"\"\"\"\"\n # Cannot move up to base scraper due to parser.entries call in\n # get_build_info_for_date (see below)\n\n url = '%s/' % urljoin(self.base_url, self.monthly_build_list_regex, folder_name)\n if self.application in APPLICATIONS_...
[ "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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// Dec function use to decrement an ip
[ "func Dec(ip net.IP) {\n\tfor j := len(ip) - 1; j >= 0; j-- {\n\t\tip[j]--\n\t\tif ip[j] == 255 {\n\t\t\tcontinue\n\t\t}\n\t\tif ip[j] > 0 {\n\t\t\tbreak\n\t\t}\n\t}\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 comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Validate the process can be run. @throws LogicException
[ "protected final function validate()\n {\n if (isset($this->pid) && !isset($this->resource)) {\n throw new LogicException('Process already closed.', static::ERR_COMPLETED);\n } elseif ($this->running) {\n throw new LogicException('Process already running.', static::ERR_RUNNING...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Set a view to render. @param string $view @param array $variables
[ "public function setView($view, $variables = [])\n {\n if (!empty($variables)) {\n $this->with($variables);\n }\n\n $this->view = $view;\n }" ]
[ "public function getViewer($action)\n {\n // Answer Viewer Object (from parent):\n \n if (!$this->isCMSPreview()) {\n return parent::getViewer($action);\n }\n \n // Load Page Requirements (uses theme):\n \n PageController::create(Page::create())-...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// SetFlags handles known option flags.
[ "func (c *restoreCommand) SetFlags(f *gnuflag.FlagSet) {\n\tc.CommandBase.SetFlags(f)\n\tf.StringVar(&c.Filename, \"file\", \"\", \"Provide a file to be used as the backup\")\n\tf.StringVar(&c.BackupId, \"id\", \"\", \"Provide the name of the backup to be restored\")\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Calculates processing sequence length according to tempo setting
[ "function() {\n var seq;\n var seek;\n\n if (this.bAutoSeqSetting) {\n seq = AUTOSEQ_C + AUTOSEQ_K * this._tempo;\n seq = this.checkLimits(seq, AUTOSEQ_AT_MAX, AUTOSEQ_AT_MIN);\n this.sequenceMs = Math.floor(seq + 0.5);\n }\n\n...
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Get simple tree as list.
[ "public function getSimpleTree($fields=array(),$transfields=array(),$lang='',$wh=array()){\n\t\t$lang=$this->detectLanguage($lang);\n\t\t//\n\t\t$cachekey=$this->tableName.':simpletree:'.$lang;\n\t\tif(!empty($wh)){\n\t\t\t$cachekey.=':wh('.implode(';',$wh).')';\n\t\t}\n\t\t//Try to get simple tree from internal ca...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Args: key (str | unicode): Key to lookup default (bool | None): Default to use if key is not configured Returns: (bool | None): Value of key, if defined
[ "def get_bool(self, key, default=None):\n \n value = self.get_str(key)\n if value is not None:\n return to_boolean(value)\n\n return default" ]
[ "def _wrap_field(field):\n \"\"\"\"\"\"\n class WrappedField(field):\n def output(self, key, obj):\n value = _fields.get_value(key if self.attribute is None else self.attribute, obj)\n\n # For all fields, when its value was null (None), return null directly,\n # instea...
codesearchnet
{ "query": "Represent the comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Attribute annotation elements creating a list of pairs of the Symbol representing that element and the value of that element as an Attribute.
[ "private List<Pair<MethodSymbol, Attribute>> attributeAnnotationValues(JCAnnotation a,\n Type expected, Env<AttrContext> env)\n {\n // The annotation might have had its type attributed (but not\n // checked) by attr.attribAnnotationTypes during MemberEnter,\n // in which case we d...
[ "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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// setCallStatus sets the http section and related status
[ "func setCallStatus(s *awsxray.Segment, url, method string, err error) {\n\ts.HTTP = getHTTP(url, method, err)\n\n\tstatus := getStatus(err)\n\tswitch {\n\tcase status >= 500:\n\t\ts.Fault = true\n\tcase status >= 400:\n\t\ts.Error = true\n\tcase err != nil:\n\t\ts.Fault = true\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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Return the products from a query response as a Pandas DataFrame with the values in their appropriate Python types.
[ "def to_dataframe(products):\n \n try:\n import pandas as pd\n except ImportError:\n raise ImportError(\"to_dataframe requires the optional dependency Pandas.\")\n\n return pd.DataFrame.from_dict(products, orient='index')" ]
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
记录运行日志 @param string $msg @param string $level 日志级别:info、error、warning
[ "private function log($msg, $level = 'info') {\n static $logFile = null;\n if (is_null($logFile)) {\n $logDir = $this->appContext->getRuntimeDir() . '/log';\n if (!is_dir($logDir)) {\n mkdir($logDir, 0755, true);\n }\n $logFilePath = \"$logDir...
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Store an item in the cache for a given number of seconds. @param string $key @param mixed $value @param int $seconds @return bool
[ "public function put($key, $value, $seconds)\n {\n $key = $this->prefix.$key;\n\n $value = $this->serialize($value);\n\n $expiration = $this->getTime() + $seconds;\n\n try {\n return $this->table()->insert(compact('key', 'value', 'expiration'));\n } catch (Exception ...
[ "public function setSecureData(array $data, $expires = 0, $path = null, $domain = null)\n {\n //argment test\n Argument::i()\n //argument 2 must be a integer\n ->test(2, 'int')\n //argument 3 must be a string or null\n ->test(3, 'string', 'null')\n ...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Save a redirect by it's slug @param $slug @param $postValues
[ "public function saveRedirect($slug, $postValues)\n {\n $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues);\n\n $redirects = $this->repository->redirects;\n foreach ($redirects as $key => $redirect) {\n if ($redirect->slug == $slug) {\n $r...
[ "public function delete($id)\n {\n $this->innerHandler->delete($id);\n // Delete by primary key will remove the object, so we don't need to clear `ez-language-code-` here.\n $this->cache->deleteMulti(['ez-language-' . $id, 'ez-language-list']);\n }" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software Development:" }
@param {string} str String @return {string} The string, with "educated" curly quote HTML entities. Example input: "Isn't this fun?" Example output: &#8220;Isn&#8217;t this fun?&#8221;
[ "function (str) {\n /**\n * Make our own \"punctuation\" character class, because the POSIX-style\n * [:PUNCT:] is only available in Perl 5.6 or later:\n *\n * JavaScript don't have punctuation class neither.\n */\n var punct_class = '[!\"#\\$\\%\\'()*+,-./:;<=>?\\@\\[\\\\\\]\\^_`{|}~]';\n...
[ "public static String entify (String text)\n {\n // this could perhaps be done more efficiently, but this function\n // is not likely to be called on large quantities of text\n // (first we turn the entified versions normal so that if text is\n // repeatedly run through this it doesn'...
codesearchnet
{ "query": "Represent the comment about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about PHP programming:" }
Removes the items with the specified ids from the database. @param array|int[] $itemIds
[ "protected function removeIds(array $itemIds): void\n {\n $queryBuilder = $this->entityManager->createQueryBuilder();\n $queryBuilder->delete(Item::class, 'i')\n ->andWhere('i.id IN (:itemIds)')\n ->setParameter('itemIds', array_values($itemIds));\n\n ...
[ "def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// GetBootTime returns the time at which the machine was started, truncated to the nearest second
[ "func GetBootTime() (time.Time, error) {\n\tcurrentTime := time.Now()\n\toutput, _, err := tickCount.Call()\n\tif errno, ok := err.(syscall.Errno); !ok || errno != 0 {\n\t\treturn time.Time{}, err\n\t}\n\treturn currentTime.Add(-time.Duration(output) * time.Millisecond).Truncate(time.Second), nil\n}" ]
[ "function generateInterval (k) {\n let maxInterval = (Math.pow(2, k) - 1) * 1000\n\n if (maxInterval > 30 * 1000) {\n // If the generated interval is more than 30 seconds, truncate it down to 30 seconds.\n maxInterval = 30 * 1000\n }\n // generate the interval to a random number between 0 and the maxInter...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Rounds the given time down to the closest day, using the given timezone. @param pTime time @param pTimeZone the timezone to use when rounding @return the time rounded to the closest day.
[ "public static long roundToDay(final long pTime, final TimeZone pTimeZone) {\r\n int offset = pTimeZone.getOffset(pTime);\r\n return (((pTime + offset) / DAY) * DAY) - offset;\r\n }" ]
[ "private function to8601Utc(\\DateTimeInterface $dateTime): string\n {\n // Convert to UTC if we can\n if ($dateTime instanceof DateTime) {\n $dateTime->setTimezone(new \\DateTimeZone('UTC'));\n } elseif ($dateTime instanceof \\DateTimeImmutable && $dateTime->getOffset() > 0) {\n ...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Add two or more colors, MODIFIES FIRST ARGUMENT @param {number[]} color1 @param {number[]} color2 @returns {number[]}
[ "function(color1, color2) {\n\t\tfor (var i=0;i<3;i++) {\n\t\t\tfor (var j=1;j<arguments.length;j++) {\n\t\t\t\tcolor1[i] += arguments[j][i];\n\t\t\t}\n\t\t}\n\t\treturn color1;\n\t}" ]
[ "public int getCount(T x, T y) {\n // REMINDER: check for indexing?\n return counts.get(getIndex(x, y));\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
/* Have to register custom interceptor to set "x-li-format: "json" header as otherwise we appear to get error from linkedin which suggests its expecting xml rather than json. API appears to ignore Content-Type header
[ "private void registerJsonFormatInterceptor() {\t\t\n\t\tRestTemplate restTemplate = getRestTemplate();\n\t\tif (interceptorsSupported) {\n\t\t\tList<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors();\n\t\t\tinterceptors.add(new JsonFormatInterceptor());\n\t\t} else {\n\t\t\t// for Spring ...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
/* func GetRegion Argument : provider name and location name Returns : Region JSON object */
[ "func GetRegion(id string) (Region, error) {\n\n\turl := \"\"\n\tif string(id[0]) == \"/\" {\n\t\turl = id[8:]\n\t} else {\n\t\turl = \"region/\" + id + \"/\"\n\t}\n\n\trequest := \"GET\"\n\t//Empty Body Request\n\tbody := []byte(`{}`)\n\tvar response Region\n\n\tdata, err := TutumCall(url, request, body)\n\tif err...
[ "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 Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Returns a monthly archive link for the current blog post. @param string $type @return string
[ "public function getMonthlyArchiveLink($type = 'day')\n {\n /** @var DBDatetime $date */\n $date = $this->dbObject('PublishDate');\n\n if ($type !== 'year') {\n if ($type === 'day') {\n return Controller::join_links(\n $this->Parent()->Link('archi...
[ "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 Github sentence about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code:" }
Generate the OAuth authorize url @param [Hash] options parameters to be included in the url. +:redirect_uri+ is required. @return [String] the authorize url
[ "def authorize_url(options)\n raise ArgumentError, ':redirect_uri required' unless options[:redirect_uri]\n params = {\n :client_id => @app_id,\n :response_type => 'code',\n :scope => 'manage_merchant'\n }\n # Faraday doesn't flatten params in this case (Faraday issue #115)\...
[ "def renew_access_token(access_token = nil, access_secret = nil, session_handle = nil)\n access_token ||= @atoken\n access_secret ||= @asecret\n session_handle ||= @session_handle\n\n old_token = ::OAuth::RequestToken.new(consumer, access_token, access_secret)\n\n # Underlying oauth cons...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Generate controller of all routes & middlewares
[ "function generate() {\n for(const i in Routes) {\n if(!Routes[i].generated) {\n Routes[i] = generateController(path.controllers, Routes[i]);\n }\n }\n\n for(const i in MiddleWares) {\n MiddleWares[i] = generateController(path.middlewares, MiddleWares[i]);\n }\n\n for(const i in GlobalMiddleWares...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
@param string $id @param array $headers @throws Exception @return array|string
[ "public function removeScheduledCancellation(string $id, array $headers = [])\n {\n $url = $this->url('subscriptions/%s/remove_scheduled_cancellation', $id);\n\n return $this->post($url, [], $headers);\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 instruction about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about programming:" }
// deriveOtherConditions given a LogicalJoin, check the OtherConditions to see if we can derive more // conditions for left/right child pushdown.
[ "func deriveOtherConditions(p *LogicalJoin, deriveLeft bool, deriveRight bool) (leftCond []expression.Expression,\n\trightCond []expression.Expression) {\n\tleftPlan, rightPlan := p.children[0], p.children[1]\n\tisOuterSemi := (p.JoinType == LeftOuterSemiJoin) || (p.JoinType == AntiLeftOuterSemiJoin)\n\tfor _, expr...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Prepare message to be sent through messaging service. @return Message to be sent with messaging service.
[ "public MessageToSend prepareMessageToSend() {\n originalMessage.getParts().clear();\n originalMessage.getParts().addAll(publicParts);\n return originalMessage;\n }" ]
[ "public void away (ClientObject caller, String message)\n {\n BodyObject body = _locator.forClient(caller);\n // we modify this field via an invocation service request because a body object is not\n // modifiable by the client\n body.setAwayMessage(message);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
// SetNextToken sets the NextToken field's value.
[ "func (s *DescribeSessionsInput) SetNextToken(v string) *DescribeSessionsInput {\n\ts.NextToken = &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 Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Return shape and axes with single-dimensional entries removed. Remove unused dimensions unless their axes are listed in 'skip'. >>> squeeze_axes((5, 1, 2, 1, 1), 'TZYXC') ((5, 2, 1), 'TYX')
[ "def squeeze_axes(shape, axes, skip=None):\n \n if len(shape) != len(axes):\n raise ValueError('dimensions of axes and shape do not match')\n if skip is None:\n skip = 'XY'\n shape, axes = zip(*(i for i in zip(shape, axes)\n if i[0] > 1 or i[1] in skip))\n return ...
[ "def normal_h3(size: int = 10000) -> HistogramND:\n \n data1 = np.random.normal(0, 1, (size,))\n data2 = np.random.normal(0, 1, (size,))\n data3 = np.random.normal(0, 1, (size,))\n return h3([data1, data2, data3], name=\"normal\", axis_names=tuple(\"xyz\"), title=\"3D normal distribution\")" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Data analysis:" }
/* (non-Javadoc) @see com.ibm.ws.sib.admin.JsEngineComponent#setConfig(JsEObject)
[ "public void setConfig(LWMConfig me) {\n\n String thisMethodName = \"setConfig\";\n\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {\n SibTr.entry(tc, thisMethodName, new Object[] { me });\n }\n meHighMessageThreshold=this._me.getMessagingEngine().getHighMe...
[ "public static void setTextInfoEnabled(boolean textInfoEnabled) {\n com.ibm.ws.pmi.stat.StatsImpl.setEnableTextInfo(textInfoEnabled);\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Encodes the object to a xml.etree.ElementTree.Element :return: the encoded element :rtype: xml.etree.ElementTree.Element
[ "def encode(self):\n \n root_element = ElementTree.Element(self.TAG_NAME)\n for value in [value for value in self.__dict__.values() if isinstance(value, fields.Field)]:\n if value.required or value.value:\n root_element.append(value.encode())\n return root_eleme...
[ "def _validate_teaching(cls, belief, teaching, *args, **kwargs):\n \n # attempt to transform\n namespaces = kwargs.get('namespaces', None)\n if not namespaces:\n for a in args:\n if isinstance(a, dict): # @TODO check types\n namespaces = a\n ...
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// AddNamespacedName adds namespaced name by node
[ "func (nsr *NamespaceResolver) AddNamespacedName(nn node.Node, nodeName string) {\n\tif nsr.Namespace.Namespace == \"\" {\n\t\tnsr.ResolvedNames[nn] = nodeName\n\t} else {\n\t\tnsr.ResolvedNames[nn] = nsr.Namespace.Namespace + \"\\\\\" + nodeName\n\t}\n}" ]
[ "public void addClass(ClassDescriptorDef classDef)\r\n {\r\n classDef.setOwner(this);\r\n // Regardless of the format of the class name, we're using the fully qualified format\r\n // This is safe because of the package & class naming constraints of the Java language\r\n _classDefs.put...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Retrieve the model collection loader. @throws RuntimeException If the collection loader was not previously set. @return CollectionLoader
[ "protected function collectionLoader()\n {\n if ($this->collectionLoader === null) {\n throw new RuntimeException(sprintf(\n 'Collection Loader is not defined for \"%s\"',\n get_class($this)\n ));\n }\n\n return $this->collectionLoader;\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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// GetBestBlockHash returns the hash of the best block.
[ "func (db *DB) GetBestBlockHash() string {\n\thash, err := db.RetrieveBestBlockHash()\n\tif err != nil {\n\t\tlog.Errorf(\"RetrieveBestBlockHash failed: %v\", err)\n\t\treturn \"\"\n\t}\n\treturn hash\n}" ]
[ "@Override\n public Message deserialize(ByteBuffer in) throws ProtocolException, IOException {\n // A Bitcoin protocol message has the following format.\n //\n // - 4 byte magic number: 0xfabfb5da for the testnet or\n // 0xf9beb4d9 for production\n //...
codesearchnet
{ "query": "Represent the Github text about Blockchain:", "pos": "Represent the Github code about Blockchain:", "neg": "Represent the Github code about Programming:" }
// MonthNarrow returns the locales narrow month given the 'month' provided
[ "func (en *en_DK) MonthNarrow(month time.Month) string {\n\treturn en.monthsNarrow[month]\n}" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns the bounding box which is an array of coordinates (SouthWest & NorthEast). @return CoordinateInterface[]
[ "public function getBoundingBox()\n {\n return array(\n new Coordinate(array(\n $this->latitudeInterval[0],\n $this->longitudeInterval[0]\n )),\n new Coordinate(array(\n $this->latitudeInterval[1],\n $this->longit...
[ "def setTopRight(self, loc):\n \n offset = self.getTopRight().getOffset(loc) # Calculate offset from current top right\n return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset" ]
codesearchnet
{ "query": "Represent the description about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
POST method for handling custom model item actions. @param string $modelName @param int $id @return JSON
[ "public function customModelItemAction($modelName, $id = null)\n {\n $config = app('itemconfig');\n $actionFactory = app('admin_action_factory');\n $model = $config->getDataModel();\n $model = $model::find($id);\n $actionName = $this->request->input('a...
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// GetAPINameByPattern return API name by analyze pattern
[ "func GetAPINameByPattern(\n\tpattern string,\n\trepl func(string) string,\n) string {\n\tresult := pattern\n\tresult = regexpAPIVersionPrefix.ReplaceAllString(result, \"\")\n\n\tresult = regexpAPIParam.ReplaceAllStringFunc(result, func(str string) string {\n\t\tparam := str[1:]\n\t\treturn \"(?P<\" + param + \">[^...
[ "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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Generate Swagger documents @api private @param {Object} opt
[ "function generate(opt) {\n if (!opt) {\n throw new Error('\\'option\\' is required.');\n }\n\n if (!opt.swaggerUI) {\n throw new Error('\\'swaggerUI\\' is required.');\n }\n\n if (!opt.basePath) {\n throw new Error('\\'basePath\\' is required.');\n }\n\n descriptor.basePath = opt.basePath;\n descr...
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Validate the command before execution. @param object $command @param \Closure $next @throws \AltThree\Validator\ValidationException @return void
[ "public function handle($command, Closure $next)\n {\n if (property_exists($command, 'rules') && is_array($command->rules)) {\n $this->validate($command);\n }\n\n return $next($command);\n }" ]
[ "private function handleErrorUnit(Invoke\\Error $unit): Result\\AbstractResult\n {\n return new Result\\Error(null, $unit->getBaseException());\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
L2 normalize squared
[ "def l2norm_squared(a):\n \n value = 0\n for i in xrange(a.shape[1]):\n value += np.dot(a[:,i],a[:,i])\n return value" ]
[ "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 summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add a frequency that will be displayed on the variant level Args: name (str): The name of the frequency field
[ "def add_frequency(self, name, value):\n \n logger.debug(\"Adding frequency {0} with value {1} to variant {2}\".format(\n name, value, self['variant_id']))\n self['frequencies'].append({'label': name, 'value': value})" ]
[ "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 about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Rendering this very control @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
[ "public function renderControl()\n {\n $path = $this->configurable\n ? 'antares/foundation::form.controls.configured_dropzone'\n : 'antares/foundation::form.controls.dropzone';\n\n return view($path, [\n 'control' => $this,\n 'current_image_path' => $this...
[ "public function registerCoreContainerAliases()\n {\n $aliases = [\n 'app' => [\\Flarum\\Foundation\\Application::class, \\Illuminate\\Contracts\\Container\\Container::class, \\Illuminate\\Contracts\\Foundation\\Application::class, \\Psr\\Container\\ContainerInterface::class],...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Data management:" }
Wraps callback @static @param callable $cb @param double $timeout = null @return \Closure
[ "public static function wrap($cb, $timeout = null, $ctx = false)\n {\n if ($cb instanceof CallbackWrapper || ((Daemon::$context === null) && ($timeout === null))) {\n return $cb;\n }\n if ($cb === null) {\n return null;\n }\n return new static($cb, $timeou...
[ "final static function f($m, array $stages = []) {return dfcf(function(M $m, array $stages) {\n\t\t/** @var string $c */$c = df_con_hier($m, __CLASS__); return new $c($m, $stages ?: ['', '']);\n\t}, [dfpm($m), $stages]);}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns a prettier, more comprehensible version of a row evolution label for display.
[ "private function cleanOriginalLabel($label)\n {\n $label = str_replace(LabelFilter::SEPARATOR_RECURSIVE_LABEL, ' - ', $label);\n $label = SafeDecodeLabel::decodeLabelSafe($label);\n return $label;\n }" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Walidacja porówniania wartości @param mixed $value wartość @return boolean
[ "public function isValid($value)\n {\n //wartość nierówna\n if ($this->getValue() != $value) {\n return $this->_error(self::INVALID);\n }\n return true;\n }" ]
[ "public function send($headers = true)\n {\n //wysłanie nagłówków\n $headers ? $this->sendHeaders() : null;\n //opcjonalne uruchomienie panelu deweloperskiego\n if ($this->_debug) {\n //debugger wykonuje zmianę w contencie\n new \\Mmi\\Http\\ResponseDebugger;\n ...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Handle Request Data persistence or output based on the request type.
[ "public function after() {\n\t\tif($this->_handle_ajax == true)\n\t\t{\n\t\t\tif($this->request->is_ajax())\n\t\t\t{\n\t\t\t\t$return = array();\n\n\t\t\t\tif(RD::has_messages() == false)\n\t\t\t\t{\n\t\t\t\t\t$return['status'] = 'success';\n\t\t\t\t\t$return['response'] = [''];\n\t\t\t\t}\n\t\t\t\telse if(RD::get_...
[ "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 comment about Web development:", "pos": "Represent the code about Web development:", "neg": "Represent the code about programming:" }
Addes the current member as a nested object. @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="content"
[ "public String processNested(Properties attributes) throws XDocletException\r\n {\r\n String name = OjbMemberTagsHandler.getMemberName();\r\n XClass type = OjbMemberTagsHandler.getMemberType();\r\n int dim = OjbMemberTagsHandler.getMemberDimension();\r\n Ne...
[ "public void visitEnd() {\n String classname = workbench.getType().getClassName();\n\n component.addAttribute(new Attribute(\"classname\", classname));\n\n // Generates the provides attribute.\n component.addElement(ElementHelper.getProvidesElement(specifications));\n\n if (workbe...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Register for a new account on this HS. Args: username (str): Account username password (str): Account password Returns: str: Access Token Raises: MatrixRequestError
[ "def register_with_password(self, username, password):\n \n response = self.api.register(\n auth_body={\"type\": \"m.login.dummy\"},\n kind='user',\n username=username,\n password=password,\n )\n return self._post_registration(r...
[ "def update(self):\n \n error = \"\"\n\n if self.key is None:\n error = \"To update a client you need to provide a key\"\n if self.secret is None:\n error = \"To update a client you need to provide the secret\"\n\n if error:\n raise ClientException...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
对类HTML文件进行资源加载注入 @param file @param include
[ "function injectAutoLoad(file, include) {\n var depList = getDepList(file);\n var asyncList = getAsyncList(file);\n var jsList = [];\n var cssList = [];\n //将include资源添加入异步资源\n asyncList = asyncList.concat(include);\n asyncList = asyncList.filter(function (async, ind...
[ "public void addSharedFunctionByString(String content) {\r\n\t\t// content 中的内容被解析后会存放在 Env 之中,而 StringSource 所对应的\r\n\t\t// Template 对象 isModified() 始终返回 false,所以没有必要对其缓存\r\n\t\tStringSource stringSource = new StringSource(content, false);\r\n\t\tdoAddSharedFunction(stringSource, null);\r\n\t}" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
// NewForConfigOrDie creates a new CoreClient for the given config and // panics if there is an error in the config.
[ "func NewForConfigOrDie(c *unversioned.Config) *CoreClient {\n\tclient, err := NewForConfig(c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn client\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// checkNewOrdersPerAccountLimit enforces the rlPolicies `NewOrdersPerAccount` // rate limit. This rate limit ensures a client can not create more than the // specified threshold of new orders within the specified time window.
[ "func (ra *RegistrationAuthorityImpl) checkNewOrdersPerAccountLimit(ctx context.Context, acctID int64) error {\n\tlimit := ra.rlPolicies.NewOrdersPerAccount()\n\tif !limit.Enabled() {\n\t\treturn nil\n\t}\n\tlatest := ra.clk.Now()\n\tearliest := latest.Add(-limit.Window.Duration)\n\tcount, err := ra.SA.CountOrders(...
[ "func (p *provisioningIdentityMapper) UserFor(info authapi.UserIdentityInfo) (kuser.Info, error) {\n\t// Retrying up to three times lets us handle race conditions with up to two conflicting identity providers without returning an error\n\t// * A single race is possible on user creation for every conflicting identit...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// RunCmdChecks runs all the CmdCheck functions passed, skipping skippable commands and looks for error
[ "func RunCmdChecks(cmd *cobra.Command, cmdChecks []CmdCheck, skipCmd []string) []error {\n\tcmdPath := cmd.CommandPath()\n\n\tfor _, skipCmdPath := range skipCmd {\n\t\tif cmdPath == skipCmdPath {\n\t\t\tfmt.Fprintf(os.Stdout, \"---+ skipping command %s\\n\", cmdPath)\n\t\t\treturn []error{}\n\t\t}\n\t}\n\n\terrors...
[ "def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
bench for retrieving an element at a specified index
[ "@Bench(runs = RUNS, beforeEachRun = \"intArrayListAdd\")\n public void intArrayListGet() {\n for (int i = 0; i < list.size(); i++) {\n list.get(i);\n }\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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Return True if the code at offset is some sort of jump forward. That is, it is ether "JUMP_FORWARD" or an absolute jump that goes forward.
[ "def is_jump_forward(self, offset):\n \n opname = self.get_inst(offset).opname\n if opname == 'JUMP_FORWARD':\n return True\n if opname != 'JUMP_ABSOLUTE':\n return False\n return offset < self.get_target(offset)" ]
[ "def _compute_stacksize(self):\n '''\n \n\n '''\n\n # get local access to code, save some attribute lookups later\n code = self.code\n\n # A mapping from labels to their positions in the code list\n label_pos = { op : pos\n for pos, (op, arg) i...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Performs Left Outer Join :return left_outer: dict
[ "def left_outer(self):\n \n self.get_collections_data()\n left_outer_join = self.merge_join_docs(\n set(self.collections_data['left'].keys()))\n return left_outer_join" ]
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Add an <CODE>Object</CODE> to this cell. @param o the object to add @return always <CODE>true</CODE>
[ "public boolean add(Object o) {\n\t\ttry {\n\t\t\tthis.addElement((Element) o);\n\t\t\treturn true;\n\t\t}\n\t\tcatch(ClassCastException cce) {\n\t\t\tthrow new ClassCastException(\"You can only add objects that implement the Element interface.\");\n\t\t}\n\t\tcatch(BadElementException bee) {\n\t\t\tthrow new Class...
[ "@Override\n public boolean shouldStyle(Object data, Object element) {\n if (!doStyle()) {\n log.warning(String.format(\"not styling becasue parameter %s is false. %s, key: %s\", DOSTYLE, getClass().getName(), getStyleClass()));\n }\n return doStyle() && super.shouldStyle(data, element);\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about text processing:" }
// New returns a new instance of translator for the 'sw_CD' locale
[ "func New() locales.Translator {\n\treturn &sw_CD{\n\t\tlocale: \"sw_CD\",\n\t\tpluralsCardinal: []locales.PluralRule{2, 6},\n\t\tpluralsOrdinal: []locales.PluralRule{6},\n\t\tpluralsRange: []locales.PluralRule{2, 6},\n\t\tdecimal: \",\",\n\t\tgroup: ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Writes the header of the IO object container
[ "private function write_header()\n {\n $this->write(DataIO::magic());\n $this->datum_writer->write_data(DataIO::metadata_schema(),\n $this->metadata, $this->encoder);\n $this->write($this->sync_marker);\n }" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// DeleteAllPayments deletes all payments from DB.
[ "func (db *DB) DeleteAllPayments() error {\n\treturn db.Update(func(tx *bbolt.Tx) error {\n\t\terr := tx.DeleteBucket(paymentBucket)\n\t\tif err != nil && err != bbolt.ErrBucketNotFound {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = tx.CreateBucket(paymentBucket)\n\t\treturn err\n\t})\n}" ]
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Provide a prediction of q in the output space @param xq an array of float of length dim_x @param estimated_sigma if False (default), sigma_sq=self.sigma_sq, else it is estimated from the neighbor distances in self._weights(.)
[ "def predict_dims(self, q, dims_x, dims_y, dims_out, sigma=None, k=None):\n \n assert len(q) == len(dims_x) + len(dims_y)\n sigma_sq = self.sigma_sq if sigma is None else sigma*sigma\n k = k or self.k \n \n dists, index = self.dataset.nn_dims(q[:len(dims_x)], q[len(di...
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github instruction about Deep Learning:", "pos": "Represent the Github code about Deep Learning:", "neg": "Represent the Github code about Software development:" }
// NewQuestion creates a new question
[ "func NewQuestion(key string, text string) *Question {\n\treturn &Question{\n\t\tKey: key,\n\t\tText: text,\n\t\tAnswerKind: reflect.String,\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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Call LE to get a new signed CA.
[ "def get_cert(zappa_instance, log=LOGGER, CA=DEFAULT_CA):\n \n out = parse_account_key()\n header = get_boulder_header(out)\n accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':'))\n thumbprint = _b64(hashlib.sha256(accountkey_json.encode('utf8')).digest())\n\n # find d...
[ "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:" }
Null safe annotation checker @param <A> @param element element or null @param annotationClass @return the annotation, if element is not null and the annotation is present. Otherwise null
[ "private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {\n return (element != null) ? element.getAnnotation(annotationClass) : null;\n }" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is...
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Adds a new fisbone for the given stream
[ "public SkeletonFisbone addBoneForStream(int sid) {\n SkeletonFisbone bone = new SkeletonFisbone();\n bone.setSerialNumber(sid);\n fisbones.add(bone);\n\n if (sid == -1 || bonesByStream.containsKey(sid)) {\n throw new IllegalArgumentException(\"Invalid / duplicate sid \" + sid...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
A helper function for creating signature. Return the signature on success. Return error code if parameter is not valid.
[ "private static function createSignature(\n $appId, $secretId, $secretKey, $expiration, $bucket, $fileId) {\n if (empty($secretId) || empty($secretKey)) {\n return self::AUTH_SECRET_ID_KEY_ERROR;\n }\n\n $now = time();\n $random = rand();\n $plainText = \"a=$...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
create the code necessary to load the bcbioRNAseq object
[ "def create_load_string(upload_dir, groups=None, organism=None):\n \n libraryline = 'library(bcbioRNASeq)'\n load_template = Template(\n ('bcb <- bcbioRNASeq(uploadDir=\"$upload_dir\",'\n 'interestingGroups=$groups,'\n 'organism=\"$organism\")'))\n load_noorganism_template = Templ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Self-explanatory @param $value @return bool
[ "protected function isValueSelected($value)\n\t{\n\t\t$val = $this->getValue();\n\t\tif (is_null($value)) {\n\t\t\treturn FALSE;\n\t\t}\n\t\telseif (is_array($val)) {\n\t\t\treturn in_array($value, $val);\n\t\t}\n\n\t\treturn $value == $val;\n\t}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Does the work when creating peptide and protein quant lookups. This loops through storing options and parses columns, passing on to the storing functions
[ "def create_pep_protein_quant_lookup(fns, pqdb, poolnames, featcolnr, patterns,\n storefuns, isobqcolpattern=None,\n psmnrpattern=None):\n \"\"\"\"\"\"\n tablefn_map = create_tablefn_map(fns, pqdb, poolnames)\n feat_map = pqdb.get_featur...
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Set the value of Name / name @param $value string @return User
[ "public function setName(?string $value) : User\n {\n\n if ($this->data['name'] !== $value) {\n $this->data['name'] = $value;\n $this->setModified('name');\n }\n\n return $this;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Scales this image. @return Image
[ "public function rescale($x, $y) {\r\n\t\tif(is_object($x) && $x instanceof Dimensions) {\r\n\t\t\t$y = $x->height;\r\n\t\t\t$x = $x->width;\r\n\t\t}\r\n\t\t$newImage = imagecreatetruecolor($this->width * $x, $this->height * $y);\r\n\t\t$x = imagesx($newImage);\r\n\t\t$y = imagesy($newImage);\r\n\t\timagecopyresamp...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled.
[ "func (c *PreuploadCall) Context(ctx context.Context) *PreuploadCall {\n\tc.ctx_ = ctx\n\treturn c\n}" ]
[ "@Override\n public void handlerAdded(ChannelHandlerContext ctx) throws Exception {\n if (ctx.channel().isRegistered()) {\n // This should always be true with our current DefaultChannelPipeline implementation.\n // The good thing about calling initChannel(...) in handlerAdded(...) is...
codesearchnet
{ "query": "Represent the description about Go programming language:", "pos": "Represent the code about Go programming language:", "neg": "Represent the code about programming:" }
Renders the provided Pagerfanta view.
[ "public function renderCollectionPager(Pagerfanta $pagerfanta, Block $block, string $collectionIdentifier, array $options = []): string\n {\n $options['block'] = $block;\n $options['collection_identifier'] = $collectionIdentifier;\n\n return $this->pagerfantaView->render($pagerfanta, $this->...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }