query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// Value returns the value of the Coin | [
"func (c *SimpleCoin) Value() btcutil.Amount {\n\treturn btcutil.Amount(c.txOut().Value)\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Set XML property or method argument value.
@param string $value
@param \DOMElement $node
@param ClassMetadata[] $classesMetadata | [
"protected function setAttribute(string $value, \\DOMElement $node, array $classesMetadata)\n {\n if (array_key_exists($value, $classesMetadata)) {\n $node->setAttribute('service', $value);\n } elseif (class_exists($value)) {\n $node->setAttribute('class', $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 comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Get valid string length
@param string $string Some string
@return int | [
"protected function _strlen($string)\r\n {\r\n $encoding = function_exists('mb_detect_encoding') ? mb_detect_encoding($string) : false;\r\n return $encoding ? mb_strlen($string, $encoding) : strlen($string);\r\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Marshall the given parameter object. | [
"public void marshall(ImportCatalogToGlueRequest importCatalogToGlueRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (importCatalogToGlueRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshal... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Send "insert" etc. command, returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, the command message. | [
"def write_command(self, request_id, msg):\n \n self.send_message(msg, 0)\n reply = self.receive_message(request_id)\n result = reply.command_response()\n\n # Raises NotMasterError or OperationFailure.\n helpers._check_command_response(result)\n return result"
] | [
"def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Returns a copy of d with compressed leaves. | [
"def compress(self, d=DEFAULT):\n \"\"\"\"\"\"\n if d is DEFAULT:\n d = self\n if isinstance(d, list):\n l = [v for v in (self.compress(v) for v in d)]\n try:\n return list(set(l))\n except TypeError:\n # list contains no... | [
"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 programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Returns all the {@link JavaClassSource} objects from the given {@link Project} | [
"public List<JavaResource> getProjectClasses(Project project)\n {\n final List<JavaResource> classes = new ArrayList<>();\n if (project != null)\n {\n project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaClassSourceVisitor(classes));\n }\n return classes;\n }"
] | [
"public void setClasspath (Path path)\n {\n _cloader = ClasspathUtils.getClassLoaderForPath(getProject(), path, \"narya\");\n\n // set the parent of the classloader to be the classloader used to load this task, rather\n // than the classloader used to load Ant, so that we have access to Nary... | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Technology:"
} |
// SetGroupMemberList sets the GroupMemberList field's value. | [
"func (s *ListGroupMembershipsOutput) SetGroupMemberList(v []*GroupMember) *ListGroupMembershipsOutput {\n\ts.GroupMemberList = 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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// GameControllerAddMapping adds support for controllers that SDL is unaware of or to cause an existing controller to have a different binding.
// (https://wiki.libsdl.org/SDL_GameControllerAddMapping) | [
"func GameControllerAddMapping(mappingString string) int {\n\t_mappingString := C.CString(mappingString)\n\tdefer C.free(unsafe.Pointer(_mappingString))\n\treturn int(C.SDL_GameControllerAddMapping(_mappingString))\n}"
] | [
"function (event) {\n // Add the new gamepad on the list of gamepads to look after.\n gamepadSupport.gamepads.push(event.gamepad);\n\n // Ask the tester to update the screen to show more gamepads.\n window.tester.updateGamepads(gamepadSupport.gamepads);\n\n // Start the polling loop to monitor button... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
update spectating coordinates in "spectate" mode | [
"function(client, packet) {\r\n var x = packet.readFloat32LE();\r\n var y = packet.readFloat32LE();\r\n var zoom = packet.readFloat32LE();\r\n\r\n if(client.debug >= 4)\r\n client.log('spectate FOV update: x=' + x + ' y=' + y + ' zoom=' + zoom);\r\n\r... | [
"def _enter(self):\n \"\"\"\"\"\"\n command = self.command\n logger.log(5, \"Snippet keystroke `Enter`.\")\n # NOTE: we need to set back the actions (mode_off) before running\n # the command.\n self.mode_off()\n self.run(command)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Validate label and its shape. | [
"def _check_valid_label(self, label):\n \"\"\"\"\"\"\n if len(label.shape) != 2 or label.shape[1] < 5:\n msg = \"Label with shape (1+, 5+) required, %s received.\" % str(label)\n raise RuntimeError(msg)\n valid_label = np.where(np.logical_and(label[:, 0] >= 0, label[:, 3] ... | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
<pre>
Use this operation to enable/disable ntpd.
</pre> | [
"public static ntp_sync update(nitro_service client, ntp_sync resource) throws Exception\r\n\t{\r\n\t\tresource.validate(\"modify\");\r\n\t\treturn ((ntp_sync[]) resource.update_resource(client))[0];\r\n\t}"
] | [
"def remove_all_servers(self):\n \n # 'no ntp' removes all server entries.\n # For command_builder, disable command 'ntp' gives the desired command\n cmd = self.command_builder('ntp', disable=True)\n return self.configure(cmd)"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Networking:"
} |
This function sanitize the user given field and return a common Array structure field
list
@param {DataModel} dataModel the dataModel operating on
@param {Array} fieldArr user input of field Array
@return {Array} arrays of field name | [
"function getFieldArr (dataModel, fieldArr) {\n const retArr = [];\n const fieldStore = dataModel.getFieldspace();\n const dimensions = fieldStore.getDimension();\n\n Object.entries(dimensions).forEach(([key]) => {\n if (fieldArr && fieldArr.length) {\n if (fieldArr.indexOf(key) !== -1... | [
"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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// Get returns value for the given key. | [
"func (r *RedisStore) Get(key string) (interface{}, error) {\n\tcmd := redis.NewCmd(\"get\", key)\n\n\tif err := r.client.Process(cmd); err != nil {\n\t\tif err == redis.Nil {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn cmd.Val(), cmd.Err()\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary. | [
"def Tags(self):\n \n return {\n TENSORS: list(self.tensors_by_tag.keys()),\n # Use a heuristic: if the metagraph is available, but\n # graph is not, then we assume the metagraph contains the graph.\n GRAPH: self._graph is not None,\n META_GRAPH: self._meta_graph is not None... | [
"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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Source returns serializable JSON of the TermsOrder. | [
"func (order *TermsOrder) Source() (interface{}, error) {\n\tsource := make(map[string]string)\n\tif order.Ascending {\n\t\tsource[order.Field] = \"asc\"\n\t} else {\n\t\tsource[order.Field] = \"desc\"\n\t}\n\treturn source, nil\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Minify minifies SVG data, it reads from r and writes to w. | [
"func (o *Minifier) Minify(m *minify.M, w io.Writer, r io.Reader, _ map[string]string) error {\n\tvar tag svg.Hash\n\tdefaultStyleType := cssMimeBytes\n\tdefaultStyleParams := map[string]string(nil)\n\tdefaultInlineStyleParams := map[string]string{\"inline\": \"1\"}\n\n\tp := NewPathData(o)\n\tminifyBuffer := buffe... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Declarative Services method for unsetting the connection manager service reference
@param ref reference to the service | [
"protected void unsetConnectionManager(ServiceReference<ConnectionManagerService> ref) {\n if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())\n Tr.debug(this, tc, \"unsetConnectionManager\", ref);\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Filter out optional query parameters with no value provided in request data
@private
@param {json} data Generated Data
@returns {json} return all the properties information | [
"function filterOutOptionalQueryParams(data) {\n data.queryParameters = data.queryParameters.filter(function(queryParam) {\n // Let's be conservative and treat params without explicit required field as not-optional\n var optional = queryParam.required !== undefined && !queryParam.required;\n var dataProvi... | [
"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 summarization about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code:"
} |
// Del removes a section or key from Ini returning whether or not it did.
// Set the key to an empty string to remove a section. | [
"func (ini *INI) Del(section, key string) bool {\n\t// Remove the section.\n\tif key == \"\" {\n\t\tif section == \"\" {\n\t\t\tini.global = iniSection{}\n\t\t\treturn true\n\t\t}\n\n\t\treturn ini.rmSection(section)\n\t}\n\n\t// Remove the key for the section.\n\treturn ini.getSection(section).rmItem(key, ini.isCa... | [
"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 about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
http://bookofzeus.com/articles/convert-simplexml-object-into-php-array/
Convert a simpleXMLElement in to an array
@todo this is duplicated from CIMAbstractResponse. Put somewhere shared.
@param \SimpleXMLElement $xml
@return array | [
"public function xml2array(\\SimpleXMLElement $xml)\n {\n $arr = array();\n foreach ($xml as $element) {\n $tag = $element->getName();\n $e = get_object_vars($element);\n if (!empty($e)) {\n $arr[$tag][] = $element instanceof \\SimpleXMLElement ? $thi... | [
"public static function newDocumentPHP($markup = null, $contentType = \"text/html\") \n {\n // TODO pass charset to phpToMarkup if possible (use DOMDocumentWrapper function)\n $markup = phpQuery::phpToMarkup($markup, self::$defaultCharset);\n return self::newDocument($markup, $contentType);\... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
// parseAlterRetentionPolicyStatement parses a string and returns an alter retention policy statement.
// This function assumes the ALTER RETENTION POLICY tokens have already been consumed. | [
"func (p *Parser) parseAlterRetentionPolicyStatement() (*AlterRetentionPolicyStatement, error) {\n\tstmt := &AlterRetentionPolicyStatement{}\n\n\t// Parse the retention policy name.\n\ttok, pos, lit := p.ScanIgnoreWhitespace()\n\tif tok == DEFAULT {\n\t\tstmt.Name = \"default\"\n\t} else if tok == IDENT {\n\t\tstmt... | [
"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 about Data processing:",
"pos": "Represent the code about Data processing:",
"neg": "Represent the code:"
} |
Checks to see if the current user object is registered. If so, it queries that records
default language. Otherwise, it falls back to sitewide settings.
@return string | [
"public function getUserLanguageToDisplay()\n {\n if ($this->getUserDefaultLanguage() != '') {\n return $this->getUserDefaultLanguage();\n } else {\n $app = Application::getFacadeApplication();\n $config = $app['config'];\n\n return $config->get('concrete... | [
"def get_render_language(contentitem):\n \n plugin = contentitem.plugin\n\n if plugin.render_ignore_item_language \\\n or (plugin.cache_output and plugin.cache_output_per_language):\n # Render the template in the current language.\n # The cache also stores the output under the current lang... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Language and programming:"
} |
Returns an array of field values
@return array | [
"protected function getListFieldValue()\n {\n $id = $this->getParam(0);\n\n if (!isset($id)) {\n return $this->field_value->getList(array('limit' => $this->getLimit()));\n }\n\n if ($this->getParam('field')) {\n return $this->field_value->getList(array('field_id'... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Add a new review | [
"protected function addReview()\n {\n if (!$this->isError()) {\n $id = $this->review->add($this->getSubmitted());\n if (empty($id)) {\n $this->errorAndExit($this->text('Unexpected result'));\n }\n $this->line($id);\n }\n }"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Delete ------------- | [
"public function delete( $model, $config = [] ) {\n\n\t\t// Delete files\n\t\t$this->fileService->deleteMultiple( [ $model->avatar, $model->banner, $model->video ] );\n\t\t$this->fileService->deleteMultiple( $model->files );\n\n\t\t// Delete File Mappings - Shared Files\n\t\t$this->modelFileService->deleteMultiple(... | [
"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:"
} |
elem = a graphic element will have an attribute like marker-start attr - marker-start, marker-mid, or marker-end returns the marker element that is linked to the graphic element | [
"function getLinked(elem, attr) {\n\t\tvar str = elem.getAttribute(attr);\n\t\tif(!str) {return null;}\n\t\tvar m = str.match(/\\(\\#(.*)\\)/);\n\t\tif(!m || m.length !== 2) {\n\t\t\treturn null;\n\t\t}\n\t\treturn S.getElem(m[1]);\n\t}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Free all the child sFields.
@param bIncludeToolScreens If true, also free the toolScreens. | [
"public void freeAllSFields(boolean bIncludeToolScreens)\n {\n int iToolScreens = 0;\n while (this.getSFieldCount() > iToolScreens)\n { // First, get rid of all child screens.\n ScreenField sField = this.getSField(iToolScreens);\n if ((!bIncludeToolScreens) && (sField... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the Github summarization about computer programming:",
"pos": "Represent the Github code about computer programming:",
"neg": "Represent the Github code:"
} |
If the entry is being prepopulated, we may want to filter other views by this entry's
value. This function will create that filter query string.
@since Symphony 2.5.2
@return string | [
"public function getFilterString()\n {\n $filter_querystring = '';\n\n if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) {\n foreach ($_REQUEST['prepopulate'] as $field_id => $value) {\n $handle = FieldManager::fetchHandleFromID($field_id);\n ... | [
"protected function getSingleFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())\n {\n // booleans were handled here. They are now handled as complextypes\n\n // q: do we really want this to happen by default on all scalar field values?\n //... | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Programming:"
} |
Prepare the validator.
@param \Asgard\Validation\ValidatorInterface $validator
@param array $locales
@return \Asgard\Validation\ValidatorInterface | [
"public function prepareValidator(\\Asgard\\Validation\\ValidatorInterface $validator, array $locales=[]) {\n\t\t$this->getDefinition()->trigger('validation', [$this, $validator], function($chain, $entity, $validator) use($locales) {\n\t\t\t$messages = [];\n\n\t\t\tforeach($this->getDefinition()->properties() as $n... | [
"static function parseWith($optionsResource, array $_ = null)\n {\n if (!static::isConfigurableWith($optionsResource))\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid Configuration Resource provided on (%s); given: (%s).'\n , static::class, \\Poirot\\Std... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Return a format string for printing an `expr_type`
ket/bra/ketbra/braket | [
"def _braket_fmt(self, expr_type):\n \"\"\"\"\"\"\n if self._settings['unicode_sub_super']:\n sub_sup_fmt = SubSupFmt\n else:\n sub_sup_fmt = SubSupFmtNoUni\n mapping = {\n 'bra': {\n True: sub_sup_fmt('⟨{label}|', sup='({space})'),\n ... | [
"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 instruction about text processing:",
"pos": "Represent the Github code about text processing:",
"neg": "Represent the Github code:"
} |
Escape special characters in HTML | [
"def escape(self, text, quote = True):\n \n if isinstance(text, bytes):\n return escape_b(text, quote)\n else:\n return escape(text, quote)"
] | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Returns the URL for the given model and admin url name. | [
"def admin_url(model, url, object_id=None):\n \n opts = model._meta\n url = \"admin:%s_%s_%s\" % (opts.app_label, opts.object_name.lower(), url)\n args = ()\n if object_id is not None:\n args = (object_id,)\n return reverse(url, args=args)"
] | [
"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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
getEndTag - returns the end tag representation as HTML string
@return - String of end tag | [
"def getEndTag(self):\n '''\n \n '''\n # If this is a self-closing tag, we have no end tag (opens and closes in the start)\n if self.isSelfClosing is True:\n return ''\n\n tagName = self.tagName\n\n # Do not add any indentation to the end of preformatt... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
//Each runs through the function lists and executing with args | [
"func (f *ListenerStack) Each(d Event) {\n\tif f.Size() <= 0 {\n\t\treturn\n\t}\n\n\tf.lock.RLock()\n\n\t// var ro sync.Mutex\n\tvar stop bool\n\n\tfor _, fx := range f.listeners {\n\t\tif stop {\n\t\t\tbreak\n\t\t}\n\t\t//TODO: is this critical that we send it into a goroutine with a mutex?\n\t\tfx(d, func() {\n\t... | [
"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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Gets the type for a property setter.
@param name the name of the property
@return the Class of the property setter
@throws NoSuchMethodException when a setter method cannot be found | [
"public Class<?> getSetterType(String name) throws NoSuchMethodException {\n Class<?> type = setterTypes.get(name);\n if (type == null) {\n throw new NoSuchMethodException(\"There is no WRITABLE property named '\" + name +\n \"' in class '\" + className + \"'\");\n ... | [
"private static boolean tryToSetValueThroughField(OpenEngSBModelEntry entry, Object instance)\n throws IllegalAccessException {\n try {\n Field field = instance.getClass().getDeclaredField(entry.getKey());\n field.setAccessible(true);\n field.set(instance, entry.getVal... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// EjectIso removes the iso file based backing and replaces with the default cdrom backing. | [
"func (l VirtualDeviceList) EjectIso(device *types.VirtualCdrom) *types.VirtualCdrom {\n\tl.setDefaultCdromBacking(device)\n\treturn device\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Helper function that handles creating the lower and upper bounds for calling {@link
SortedMap#subMap(Object, Object)}.
@see SortedMap#subMap(Object, Object) | [
"private static <E> SortedMap<PrefixKey, E> getPrefixSubMap(\n TreeMap<PrefixKey, E> map, PrefixKey lowerBound) {\n PrefixKey upperBound =\n new PrefixKey(lowerBound.getBucket(), lowerBound.getObjectName() + Character.MAX_VALUE);\n return map.subMap(lowerBound, upperBound);\n }"
] | [
"public static <C extends Comparable> RangeTree<C> create(final Iterable<Range<C>> ranges) {\n return new CenteredRangeTree<C>(ranges);\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Returns the **real** type for the real or imaginary part of a **real** complex type.
For instance:
COMPLEX128_t -> FLOAT64_t
Args:
cysparse: | [
"def cysparse_real_type_from_real_cysparse_complex_type(cysparse_type):\n \n r_type = None\n\n if cysparse_type in ['COMPLEX64_t']:\n r_type = 'FLOAT32_t'\n elif cysparse_type in ['COMPLEX128_t']:\n r_type = 'FLOAT64_t'\n elif cysparse_type in ['COMPLEX256_t']:\n r_type = 'FLOAT1... | [
"def IOWR(cls, op, structure):\n \n return cls._IOC(READ | WRITE, op, structure)"
] | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Invokes $fn with $args while managing our internal invocation context
in order to ensure our view of the test DSL's call graph is accurate. | [
"public function invokeWithin($fn, $args = array())\n {\n $this->invocation_context->activate();\n\n $this->invocation_context->push($this);\n try {\n $result = call_user_func_array($fn, $args);\n $this->invocation_context->pop();\n $this->invocation_context-... | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// NewDefaultTrimaWithSrcLen creates a Triangular Moving Average Indicator (Trima) for offline usage with default parameters | [
"func NewDefaultTrimaWithSrcLen(sourceLength uint) (indicator *Trima, err error) {\n\tind, err := NewDefaultTrima()\n\n\t// only initialise the storage if there is enough source data to require it\n\tif sourceLength-uint(ind.GetLookbackPeriod()) > 1 {\n\t\tind.Data = make([]float64, 0, sourceLength-uint(ind.GetLook... | [
"public void setLossVariables(String... lossVariableNames){\n this.lossVariables.clear();\n for(String s : lossVariableNames){\n addLossVariable(s);\n }\n //After changing loss function variables, we (probably) need to recreate gradient function - as gradient\n // funct... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Obtains all the tags assigned to this area and its child areas (not all descendant areas).
@return a set of tags | [
"protected Set<Tag> getAllTags(Area area)\n {\n Set<Tag> ret = new HashSet<Tag>(area.getTags().keySet());\n for (int i = 0; i < area.getChildCount(); i++)\n ret.addAll(area.getChildAt(i).getTags().keySet());\n return ret;\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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Answer a pending approval
:param issue_id_or_key: str
:param approval_id: str
:param decision: str
:return: | [
"def answer_approval(self, issue_id_or_key, approval_id, decision):\n \n url = 'rest/servicedeskapi/request/{0}/approval/{1}'.format(issue_id_or_key, approval_id)\n data = {'decision': decision}\n\n return self.post(url, headers=self.experimental_headers, data=data)"
] | [
"def initialize(self, action=None, comment=None, user=None,\n restricted=None):\n self.action = none_or(action, bool)\n \n\n self.comment = none_or(comment, bool)\n \"\"\"\n Is the comment of this revision deleted/suppressed? : `bool`\n \"\"\"\n\n s... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Encode the given object into a series of statements and expressions.
<p>
The implementation simply finds the <code>PersistenceDelegate</code> responsible for the object's class, and delegate the call to it.
</p>
@param o
the object to encode | [
"protected void writeObject(Object o)\n\t{\n\t\tif (o == null)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tgetPersistenceDelegate(o.getClass()).writeObject(o, this);\n\t}"
] | [
"public String getNotifierClass()\n {\n StringBuffer sb = new StringBuffer(getShortName());\n sb.append(\"Notifier\");\n\n //\n // If the event set declaration has any parameterized types, then include them on\n // the notifier class as well. Currently, these can only be param... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Store an item in the cache for a given number of minutes.
@param string $key
@param mixed $value
@param int $minutes
@return void | [
"public function put($key, $value, $minutes) {\n $this->cache[$key] = [\n 'value' => $value,\n 'ttl' => $this->getNow() + ($minutes * 60),\n ];\n }"
] | [
"public function set($key, $value, $ttl = null)\n {\n if (null == $ttl) {\n return $this->redis->set($key, $value);\n }\n\n if (null == $ttl) {\n return $this->redis->set($key, $value);\n }\n\n if (!is_int($ttl) || 0 >= $ttl) {\n throw new \\Inv... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Retourne l'ann�e et mois format�s
@param integer $mmaaaa
@param string $format
@param string $separator default ' '
@return string | [
"public static function getmoisanneemini($mmaaaa, $format = 'mm/aaaa', $separator = ' ')\n {\n $str = '';\n switch ($format) {\n case 'aaaamm':\n $str = self::getmoismini(substr($mmaaaa, 4, 2)) . $separator . substr($mmaaaa, 0, 4);\n break;\n case... | [
"def as_dict(self):\n \n opt_info = {}\n opt_info[\"type\"] = \"value\"\n opt_info[\"name\"] = self.name\n opt_info[\"value\"] = self.value\n opt_info[\"otype\"] = self.otype.as_dict()\n #TODO: est-ce que l'on ne met pas a plat et les attr de otype et ceux de l'optio... | codesearchnet | {
"query": "Represent the description about translation:",
"pos": "Represent the code about translation:",
"neg": "Represent the code about AWS Route 53:"
} |
Parse and yield array items from the token stream. | [
"def array_items(self, number_type, *, number_suffix=''):\n \"\"\"\"\"\"\n for token in self.collect_tokens_until('CLOSE_BRACKET'):\n is_number = token.type == 'NUMBER'\n value = token.value.lower()\n if not (is_number and value.endswith(number_suffix)):\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:"
} |
Build the transaction dictionary without sending | [
"def buildTransaction(self, transaction=None):\n \n if transaction is None:\n built_transaction = {}\n else:\n built_transaction = dict(**transaction)\n\n if 'data' in built_transaction:\n raise ValueError(\"Cannot set data in build transaction\")\n\n ... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Convert_image_ImageLayerData_To_v1_ImageLayerData is an autogenerated conversion function. | [
"func Convert_image_ImageLayerData_To_v1_ImageLayerData(in *image.ImageLayerData, out *v1.ImageLayerData, s conversion.Scope) error {\n\treturn autoConvert_image_ImageLayerData_To_v1_ImageLayerData(in, out, s)\n}"
] | [
"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:"
} |
Apply a series of transformations defined as closures in the configuration file.
@param string $string
@return string | [
"private function applyTransformers(string $string): string\n {\n foreach (Transformer::getAll() as $transformer) {\n $string = $transformer($string);\n }\n\n return $string;\n }"
] | [
"def changeTo(self, path):\n '''\n '''\n dictionary = DictSingle(Pair('PATH', StringSingle(path)))\n self.value = [dictionary]"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Return selector special pseudo class info (steps and other). | [
"def extract_selector_info(sel):\n \"\"\"\"\"\"\n # walk the parsed_tree, looking for pseudoClass selectors, check names\n # add in steps and/or deferred extras\n steps, extras = _extract_sel_info(sel.parsed_tree)\n steps = sorted(set(steps))\n extras = sorted(set(extras))\n if len(steps) == 0... | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetGatewayARN sets the GatewayARN field's value. | [
"func (s *DescribeVTLDevicesInput) SetGatewayARN(v string) *DescribeVTLDevicesInput {\n\ts.GatewayARN = &v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n classLoaderIdentifier = (String) fields.get(CLASS_LOADER_IDENTIFIER, null);\n\n // Note that further processing is required in JEEMetadataContextProviderImp... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Retrieves the project start date. If an explicit start date has not been
set, this method calculates the start date by looking for
the earliest task start date.
@return project start date | [
"public Date getStartDate()\n {\n Date result = (Date) getCachedValue(ProjectField.START_DATE);\n if (result == null)\n {\n result = getParentFile().getStartDate();\n }\n return (result);\n }"
] | [
"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:"
} |
Merges and returns current query data with defined data and returns as query string
@param string $ns Target namespace (Group)
@param array $data Data to be merged
@param boolean $mark Whether to prepend question mark
@return string | [
"public function getWithNsQuery($ns, array $data, $mark = true)\n {\n if ($this->hasQuery($ns)) {\n $query = $this->getQuery($ns);\n $url = null;\n\n if ($mark === true) {\n $url = '?';\n }\n\n $url .= http_build_query(array($ns => arra... | [
"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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Represent date and datetime objects as MATCH strings. | [
"def _safe_match_date_and_datetime(graphql_type, expected_python_types, value):\n \"\"\"\"\"\"\n # Python datetime.datetime is a subclass of datetime.date,\n # but in this case, the two are not interchangeable.\n # Rather than using isinstance, we will therefore check for exact type equality.\n 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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
//
// The returned GasTable's fields shouldn't, under any circumstances, be changed. | [
"func (c *ChainConfig) GasTable(num *big.Int) GasTable {\n\tif num == nil {\n\t\treturn GasTableHomestead\n\t}\n\tswitch {\n\tcase c.IsConstantinople(num):\n\t\treturn GasTableConstantinople\n\tcase c.IsEIP158(num):\n\t\treturn GasTableEIP158\n\tcase c.IsEIP150(num):\n\t\treturn GasTableEIP150\n\tdefault:\n\t\tretu... | [
"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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Register the bindings for the main JWTAuth class.
@return void | [
"protected function registerJWTAuth()\n {\n $this->app->singleton('tymon.jwt.auth', function ($app) {\n return (new JWTAuth(\n $app['tymon.jwt.manager'],\n $app['tymon.jwt.provider.auth'],\n $app['tymon.jwt.parser']\n ))->lockSubject($this... | [
"@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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
If the prefix is a JSON string with key-value data, extract it as an
associative array. Otherwise return null.
@param mixed $prefix The raw prefix string.
@return null|array | [
"private function extractPrefixKeyValueData($prefix)\n {\n $result = null;\n \n // If it has key-value data, as evidenced by the raw prefix string\n // being a JSON object (not JSON array), use it.\n if (substr($prefix, 0, 1) === '{') {\n if ($this->isJsonString($pre... | [
"public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software Development:"
} |
Finds all the snapshots in all the places we know of which could possibly
store snapshots, like command log snapshots, auto snapshots, etc.
@return All snapshots | [
"private Map<String, Snapshot> getSnapshots() {\n /*\n * Use the individual snapshot directories instead of voltroot, because\n * they can be set individually\n */\n Map<String, SnapshotPathType> paths = new HashMap<String, SnapshotPathType>();\n if (VoltDB.instance().ge... | [
"function _prepSnapshot() {\n var config = this.constructor.config,\n copy = (config.snapshotSerializer || config.serializer).serialize(this);\n\n // we don't want to store our snapshots in the snapshots because that would make the rollback kind of funny\n // not to m... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
------------------------------------------------------------------------ | [
"private void serializeMasterState(MasterState state, DataOutputStream dos) throws IOException {\n\t\t// magic number for error detection\n\t\tdos.writeInt(MASTER_STATE_MAGIC_NUMBER);\n\n\t\t// for safety, we serialize first into an array and then write the array and its\n\t\t// length into the checkpoint\n\t\tfina... | [
"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 sentence about language and writing:",
"pos": "Represent the Github code about language and writing:",
"neg": "Represent the Github code:"
} |
Call a RPC method.
return object: a result | [
"def rpc_call(self, request, method=None, params=None, **kwargs):\n \n args = []\n kwargs = dict()\n if isinstance(params, dict):\n kwargs.update(params)\n else:\n args = list(as_tuple(params))\n\n method_key = \"{0}.{1}\".format(self.scheme_name, meth... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Transform reference catalog sky positions (self.all_radec)
to reference tangent plane (self.wcs) to create output X,Y positions. | [
"def transformToRef(self):\n \n if 'refxyunits' in self.pars and self.pars['refxyunits'] == 'pixels':\n log.info('Creating RA/Dec positions for reference sources...')\n self.outxy = np.column_stack([self.all_radec[0][:,np.newaxis],self.all_radec[1][:,np.newaxis]])\n sk... | [
"def _load_data(self, band):\n \n # `band` should be 'nuv' or 'fuv'\n df = bandpass_data_frame('filter_galex_' + band + '.dat', 'wlen resp')\n df.resp *= df.wlen # QE -> EE response convention.\n return df"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Strings reflects over a structure and calls Parse when strings are located | [
"func Strings(parser StringParser, obj interface{}) {\n\tparsers := Parsers{\n\t\tStringParser: parser,\n\t}\n\tparseRecursive(parsers, reflect.ValueOf(obj))\n}"
] | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code about programming:"
} |
Recalculate dynamic property values
@param {any} entity Entity instance
@param {any} properties Entity's properties' configuration
@memberof EnTTExt | [
"function recalculateAllDynamicProperties(entity, properties) {\n // Find all dynamic properties\n _lodash2.default.forEach(properties, function (propertyConfiguration, propertyName) {\n if (isDynamicProperty(propertyConfiguration)) {\n // Recalculate dynamic property value\n var dynamicValue = prope... | [
"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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Set twitterImage w/ proxy.
@param Image $twitterImage
@return PageSeo | [
"public function setTwitterImage($twitterImage, $locale = null)\n {\n $this->translate($locale, false)->setTwitterImage($twitterImage);\n $this->mergeNewTranslations();\n\n return $this;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Notify a danger alert.
@param string $message
@param string|null $title
@param array $options | [
"protected function notifyDanger($message, $title = null, array $options = [])\n {\n $this->notifyFlash($message, 'danger', $title, $options);\n }"
] | [
"public function setNotificationType($s) {\n if (is_string($s)){\n $this->options['Subscription.NotificationType'] = $s;\n $this->options['NotificationType'] = $s;\n } else {\n return false;\n }\n /*\n * List of valid Notification Types:\n ... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Tries to fetch the given subcommand, printing a message with the
appropriate command called from the command line (usually
"jira.py") if it can't be found. | [
"def fetch_command(self, subcommand):\n \n # Get commands outside of try block to prevent swallowing exceptions\n commands = get_commands()\n try:\n app_name = commands[subcommand]\n except KeyError:\n # This might trigger ImproperlyConfigured (masked in get_... | [
"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 post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Executes a command on the server and returns an array of string.
@param string $command Command to execute
@param string $target First parameter
@param string $value Second parameter
@return array The result of the command as an array of string | [
"public function getStringArray($command, $target = null, $value = null)\n {\n $string = $this->getString($command, $target, $value);\n\n $results = preg_split('/(?<!\\\\\\),/', $string);\n foreach ($results as &$result) {\n $result = str_replace('\\,', ',', $result);\n }\n... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Setup WordPress conditions.
@param array $conditions | [
"public function setConditions(array $conditions = [])\n {\n $config = $this->container->has('config') ? $this->container->make('config') : null;\n\n if (! is_null($config)) {\n $this->conditions = array_merge(\n $config->get('app.conditions', []),\n $condit... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Ensure that the field counts match the validation rule counts.
@param array $data | [
"private function check_fields(array $data)\n {\n $ruleset = $this->validation_rules();\n $mismatch = array_diff_key($data, $ruleset);\n $fields = array_keys($mismatch);\n\n foreach ($fields as $field) {\n $this->errors[] = array(\n 'field' => $field,\n ... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the post about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Return a list of IR blocks with all Backtrack blocks removed. | [
"def remove_backtrack_blocks_from_fold(folded_ir_blocks):\n \"\"\"\"\"\"\n new_folded_ir_blocks = []\n for block in folded_ir_blocks:\n if not isinstance(block, Backtrack):\n new_folded_ir_blocks.append(block)\n return new_folded_ir_blocks"
] | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Generate header with module table entries for builtin modules.
:param List[(module_name, obj_module, enabled_define)] modules: module defs
:return: None | [
"def generate_module_table_header(modules):\n \n\n # Print header file for all external modules.\n mod_defs = []\n print(\"// Automatically generated by makemoduledefs.py.\\n\")\n for module_name, obj_module, enabled_define in modules:\n mod_def = \"MODULE_DEF_{}\".format(module_name.upper())\... | [
"def _MakeGroupFromRootSection(root_section, undefined_str):\n \n group = {}\n for statement in root_section.Statements():\n if isinstance(statement, six.string_types):\n continue\n func, args = statement\n # here the function acts as ID for the block type\n if func i... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Builds a property transform from a kernel and some options
@param kernel The transform kernel
@param options Some options regarding the property transform | [
"function buildPropertyTransform(kernel, options = {}) {\n if (options.splitArrays == null)\n options.splitArrays = true;\n if (options.neverSkip == null)\n options.neverSkip = false;\n const ret = kernel;\n ret.splitArrays = options.splitArrays;\n ret.neverSkip = options.neverSkip;\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
LOWER LEVEL INDEX OPERATIONS | [
"def with_index(new_index) # :yields: new_index\n old_index = @index\n set_index(new_index, false)\n return_value = yield @index\n set_index(old_index)\n return_value\n end"
] | [
"private void populateMilestone(Row row, Task task)\n {\n task.setMilestone(true);\n //PROJID\n task.setUniqueID(row.getInteger(\"MILESTONEID\"));\n task.setStart(row.getDate(\"GIVEN_DATE_TIME\"));\n task.setFinish(row.getDate(\"GIVEN_DATE_TIME\"));\n //PROGREST_PERIOD\n //SYMBO... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Data management:"
} |
Loads project data by namespace:name
@param string $project_name namespace:name
@return \stdClass
@throws \Exception | [
"protected function getByName($project_name) {\n\n if (!strstr($project_name, \":\")) {\n throw (new \\Exception(\"You must search for project with namespace: prefix\"));\n }\n $parts = explode(':', $project_name);\n\n $projects = $this->_client->get('/projects/search/' . urle... | [
"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 description about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Validates subscription data before creating Outbound message | [
"def post(self, request, *args, **kwargs):\n \n schedule_disable.delay(kwargs[\"subscription_id\"])\n return Response({\"accepted\": True}, status=201)"
] | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
If this node is newly selected, scroll it into view. Also, move the selection or
context boxes as appropriate. | [
"function (prevProps, prevState) {\n var wasSelected = prevProps.entry.get(\"selected\"),\n isSelected = this.props.entry.get(\"selected\");\n\n if (isSelected && !wasSelected) {\n // TODO: This shouldn't really know about project-files-container\n ... | [
"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 Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// CapFromCenterHeight constructs a cap with the given center and height. A
// negative height yields an empty cap; a height of 2 or more yields a full cap.
// The center should be unit length. | [
"func CapFromCenterHeight(center Point, height float64) Cap {\n\treturn CapFromCenterChordAngle(center, s1.ChordAngleFromSquaredLength(2*height))\n}"
] | [
"@Override\n public int parity() {\n\n // create three vectors, v->u, v->w and u->x\n double[] vu = toVector(v, u);\n double[] vw = toVector(v, w);\n double[] ux = toVector(u, x);\n\n // normal vector (to compare against), the normal vector (n) looks like:\n // x n w... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Get valid user attempts that match the given request and credentials. | [
"def get_user_attempts(request: AxesHttpRequest, credentials: dict = None) -> QuerySet:\n \n\n attempts = filter_user_attempts(request, credentials)\n\n if settings.AXES_COOLOFF_TIME is None:\n log.debug('AXES: Getting all access attempts from database because no AXES_COOLOFF_TIME is configured')\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 Access control:",
"pos": "Represent the Github code about Access control:",
"neg": "Represent the Github code:"
} |
Remove all of the event listeners for the model.
@return void | [
"public static function flushEventListeners()\n {\n if (! isset(static::$dispatcher)) {\n return;\n }\n\n $instance = new static;\n\n foreach ($instance->getObservableEvents() as $event) {\n static::$dispatcher->forget(\"eloquent.{$event}: \".static::class);\n ... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// SetShippingOption sets the ShippingOption field's value. | [
"func (s *UpdateClusterInput) SetShippingOption(v string) *UpdateClusterInput {\n\ts.ShippingOption = &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 Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Raise the given event.
@param object $event
@return void | [
"protected function raise($event)\n {\n $qualified = get_class($event);\n $name = str_replace('\\\\', '.', $qualified);\n\n $this->events->fire($name, [$event]);\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Adds the main file definitions from the root package.
@param Config $config
@param PackageInterface $package
@param string $section
@return PackageInterface | [
"public static function addMainFiles(Config $config, PackageInterface $package, $section = 'main-files')\n {\n if ($package instanceof Package) {\n $packageExtra = $package->getExtra();\n $rootMainFiles = $config->getArray($section);\n\n foreach ($rootMainFiles as $package... | [
"private static function validation()\n {\n $files = ['Validator', 'ValidationResult'];\n $folder = static::$root.'Validation'.'/';\n\n self::call($files, $folder);\n\n //Initiate the validation surface\n Validator::ini();\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
Return dict of extra fields added to the historical record model | [
"def get_extra_fields(self, model, fields):\n \"\"\"\"\"\"\n\n def revert_url(self):\n \"\"\"URL for this change in the default admin site.\"\"\"\n opts = model._meta\n app_label, model_name = opts.app_label, opts.model_name\n return reverse(\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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Remove the appropriate target listeners to this component
and all its children. | [
"protected void removeTargetListeners (Component comp)\n {\n comp.removeMouseListener(_targetListener);\n comp.removeMouseMotionListener(_targetListener);\n if (comp instanceof Container) { // again, always true for JComp...\n Container cont = (Container) comp;\n cont.r... | [
"public void clearHandleList() {\n\n final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();\n\n if (isTracingEnabled && tc.isDebugEnabled()) {\n Tr.debug(this, tc, \"Clear the McWrapper handlelist for the following MCWrapper: \" + this);\n }\n\n // since we kn... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Adjust a single component (red, green, blue or alpha) of a colour.
@param component The value to mutate.
@return The mutated component value. | [
"private int mutateColourComponent(int component)\n {\n int mutatedComponent = (int) Math.round(component + mutationAmount.nextValue());\n mutatedComponent = Maths.restrictRange(mutatedComponent, 0, 255);\n return mutatedComponent;\n }"
] | [
"function (element) {\n $.data(element, \"velocity\", {\n /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */\n isSVG: Type.isSVG(element),\n /* Keep track of whether the element i... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Perform fling action.
Usage:
d().fling() # default vertically, forward
d().fling.horiz.forward()
d().fling.vert.backward()
d().fling.toBeginning(max_swipes=100) # vertically
d().fling.horiz.toEnd() | [
"def fling(self):\n '''\n \n '''\n @param_to_property(\n dimention=[\"vert\", \"vertically\", \"vertical\", \"horiz\", \"horizental\", \"horizentally\"],\n action=[\"forward\", \"backward\", \"toBeginning\", \"toEnd\"]\n )\n def _fling(dimention=\"vert... | [
"def on_for_rotations(self, speed, rotations, brake=True, block=True):\n \n speed_sp = self._speed_native_units(speed)\n self._set_rel_position_degrees_and_speed_sp(rotations * 360, speed_sp)\n self._set_brake(brake)\n self.run_to_rel_pos()\n\n if block:\n self.w... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(ReservationPurchaseRecommendationSummary reservationPurchaseRecommendationSummary, ProtocolMarshaller protocolMarshaller) {\n\n if (reservationPurchaseRecommendationSummary == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Given one format, one block id and, optionally, one moduleid, return the corresponding backup_xxx_block_task() | [
"public static function get_backup_block_task($format, $blockid, $moduleid = null) {\n global $CFG, $DB;\n\n // Check blockid exists\n if (!$block = $DB->get_record('block_instances', array('id' => $blockid))) {\n throw new backup_task_exception('block_task_block_instance_not_found',... | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Technology:"
} |
Pretty version
:param diff_to_increase_ratio: Ratio to convert number of changes into
version increases
:return: string: Pretty version of this repository | [
"def get_pretty_version(self, diff_to_increase_ratio):\n \n version = self.get_version(diff_to_increase_ratio)\n build = self.get_last_commit_hash()\n return str(version) + \" (\" + build + \")\""
] | [
"def output(ret, bar, **kwargs): # pylint: disable=unused-argument\n '''\n \n '''\n if 'return_count' in ret:\n val = ret['return_count']\n # Avoid to fail if targets are behind a syndic. In this case actual return count will be\n # higher than targeted by MoM itself.\n # TO... | codesearchnet | {
"query": "Represent the Github post about software development:",
"pos": "Represent the Github code about software development:",
"neg": "Represent the Github code:"
} |
// GetUint32 gets given key as a uint32 | [
"func (e *Entity) GetUint32(name string) (uint32, bool) {\n\tif v := e.Get(name); v != nil {\n\t\tswitch x := v.(type) {\n\t\tcase uint32:\n\t\t\treturn x, true\n\t\tcase uint64:\n\t\t\treturn uint32(x), true\n\t\t}\n\t}\n\treturn 0, false\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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Returns an iterator over this page's {@code results} that:
<ul>
<li>Will not be {@code null}.</li>
<li>Will not support {@link java.util.Iterator#remove()}.</li>
</ul>
@return a non-null iterator. | [
"@Override\n public java.util.Iterator<com.google.api.ads.admanager.axis.v201805.User> iterator() {\n if (results == null) {\n return java.util.Collections.<com.google.api.ads.admanager.axis.v201805.User>emptyIterator();\n }\n return java.util.Arrays.<com.google.api.ads.admanager.... | [
"public static <T> CloseableIterable<T> chain(final Iterable<? extends CloseableIterable<? extends T>> iterables) {\n requireNonNull(iterables);\n\n //Don't use CloseableIterators here, as Iterables can reiterate over their data\n //and don't want to close it on them.\n return new Fluent... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
A wrapper around {@link FileSystem#rename(Path, Path)} which throws {@link IOException} if
{@link FileSystem#rename(Path, Path)} returns False. | [
"public static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite) throws IOException {\n if (!fs.exists(oldName)) {\n throw new FileNotFoundException(String.format(\"Failed to rename %s to %s: src not found\", oldName, newName));\n }\n if (fs.exists(newName)) {\n if (ov... | [
"@Override\n public void checkAccess(final Path path, final AccessMode... modes) throws IOException {\n // We support READ, WRITE, and EXECUTE on everything, so long as a file exists\n final Archive<?> archive = this.getArchive(path);\n final String desired = path.toString();\n if (!a... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Read a single message from the connection.
Re-assemble data frames if the message is fragmented.
Return ``None`` when the closing handshake is started. | [
"async def read_message(self) -> Optional[Data]:\n \n frame = await self.read_data_frame(max_size=self.max_size)\n\n # A close frame was received.\n if frame is None:\n return None\n\n if frame.opcode == OP_TEXT:\n text = True\n elif frame.opcode == OP... | [
"void writeRecord(EngineOutputRecord eor) throws IOException {\n // eventually compress as well.\n writer.writeRecord(eor, writeMAC, writeCipher);\n\n /*\n * Check the sequence number state\n *\n * Note that in order to maintain the connection I/O\n * properly, w... | codesearchnet | {
"query": "Represent the Github instruction about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Software development:"
} |
Log an error. By default this will also raise an exception. | [
"def error(self, *args):\n \"\"\"\"\"\"\n if _canShortcutLogging(self.logCategory, ERROR):\n return\n errorObject(self.logObjectName(), self.logCategory,\n *self.logFunction(*args))"
] | [
"public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get type from vmodl name | [
"def GetVmodlType(name):\n \n\n # If the input is already a type, just return\n if isinstance(name, type):\n return name\n\n # Try to get type from vmodl type names table\n typ = vmodlTypes.get(name)\n if typ:\n return typ\n\n # Else get the type from the _wsdlTypeMap\n isArray = name.ends... | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Prints a nice side block with an optional header.
@param block_contents $bc HTML for the content
@param string $region the region the block is appearing in.
@return string the HTML to be output. | [
"public function block(block_contents $bc, $region) {\n $bc = clone($bc); // Avoid messing up the object passed in.\n if (empty($bc->blockinstanceid) || !strip_tags($bc->title)) {\n $bc->collapsible = block_contents::NOT_HIDEABLE;\n }\n\n $id = !empty($bc->attributes['id']) ? ... | [
"def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// SetGracePeriod sets the health check initial grace period, in seconds | [
"func (p *PodHealthCheck) SetGracePeriod(gracePeriodSeconds int) *PodHealthCheck {\n\tp.GracePeriodSeconds = &gracePeriodSeconds\n\treturn p\n}"
] | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
// UpdateSplunk updates a specific splunk. | [
"func (c *Client) UpdateSplunk(i *UpdateSplunkInput) (*Splunk, error) {\n\tif i.Service == \"\" {\n\t\treturn nil, ErrMissingService\n\t}\n\n\tif i.Version == 0 {\n\t\treturn nil, ErrMissingVersion\n\t}\n\n\tif i.Name == \"\" {\n\t\treturn nil, ErrMissingName\n\t}\n\n\tpath := fmt.Sprintf(\"/service/%s/version/%d/l... | [
"@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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Helper around 'locate' | [
"def find(pattern, root=os.curdir):\n ''' '''\n hits = ''\n for F in locate(pattern, root):\n hits = hits + F + '\\n'\n l = hits.split('\\n')\n if(not len(l[-1])): l.pop()\n if len(l) == 1 and not len(l[0]):\n return None\n else:\n return l"
] | [
"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 Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.