query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Updates orders
@param string $json JSON string
@param \Krystal\Tree\AdjacencyList\ChildrenOrderSaverMapperInterface $mapper
@return boolean | [
"public function update($json, ChildrenOrderSaverMapperInterface $mapper)\n {\n $array = $this->parse($json);\n\n foreach ($array as $range => $value) {\n if (is_array($value)) {\n $mapper->save($value[RelationBuilder::TREE_PARAM_ID], $value[RelationBuilder::TREE_PARAM_PAR... | [
"public function GetTableColumnNames($tableName) {\n $this->setDbConfigList(array());\n $dbConfig = new \\Puzzlout\\Framework\\Dal\\DbStatementConfig(null, \\Puzzlout\\Framework\\Dal\\DbExecutionType::COLUMNNAMES, new \\Puzzlout\\Framework\\Dal\\DbQueryFilters());\n $dbConfig->setQuery(\"DESCRI... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Listen forever on the zmq.PULL socket. | [
"def listen(self):\n \"\"\"\"\"\"\n while True:\n message = self.pull.recv()\n logger.debug(\"received message of length %d\" % len(message))\n uuid, message = message[:32], message[32:]\n response = uuid + self.handle(message)\n self.push.send(re... | [
"public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
/* Same as "_writeString2()", except needs additional escaping
for subset of characters | [
"private void _writeStringASCII(final int len, final int maxNonEscaped)\n throws IOException, JsonGenerationException\n {\n // And then we'll need to verify need for escaping etc:\n int end = _outputTail + len;\n final int[] escCodes = _outputEscapes;\n final int escLimit = Mat... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Receive server's response
This method validates `$response`'s status
@param HTTP_Request2_Response $response Response from server
@return void | [
"protected function processResponse(HTTP_Request2_Response $response): void\n {\n $status = $response->getStatus();\n $reasonPhrase = $response->getReasonPhrase();\n $this->log(\"Response status: $status\", Project::MSG_DEBUG);\n $this->log(\"Response reason: $reasonPhrase\", Project:... | [
"private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }"
] | codesearchnet | {
"query": "Represent the post about NLP:",
"pos": "Represent the code about NLP:",
"neg": "Represent the code about Programming:"
} |
Is the object provided a Bignumber object.
@method (isBigNumber) | [
"function(value){\n if(_.isUndefined(value) || !_.isObject(value))\n return false;\n\n return (value instanceof BigNumber) ? true : false;\n}"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Anonymizes any DICOM files found at the given path (file or directory)
with the settings of this Anonymizer instance.
@param [String] path a file or directory path | [
"def anonymize_path(path)\n if @tags.length > 0\n prepare_anonymization\n files = DICOM.load_files(path)\n logger.info(\"#{files.length} DICOM files have been prepared for anonymization.\")\n files.each do |f|\n dcm = anonymize_file(f)\n write(dcm)\n end\n ... | [
"def spec(self):\n \"\"\"\"\"\"\n from ambry_sources.sources import SourceSpec\n\n d = self.dict\n d['url'] = self.url\n\n # Will get the URL twice; once as ref and once as URL, but the ref is ignored\n\n return SourceSpec(**d)"
] | codesearchnet | {
"query": "Represent the description about Image compression:",
"pos": "Represent the code about Image compression:",
"neg": "Represent the code:"
} |
// UnmarshalJSON sets the object from the provided JSON representation | [
"func (l *GlueTableColumnList) UnmarshalJSON(buf []byte) error {\n\t// Cloudformation allows a single object when a list of objects is expected\n\titem := GlueTableColumn{}\n\tif err := json.Unmarshal(buf, &item); err == nil {\n\t\t*l = GlueTableColumnList{item}\n\t\treturn nil\n\t}\n\tlist := []GlueTableColumn{}\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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
onRead
@return void | [
"protected function onRead()\n {\n start:\n if ($this->state === static::STATE_STANDBY) {\n if (($hdr = $this->readExact(2)) === false) {\n return; // not enough data\n }\n\n $u = unpack('S', $hdr);\n $this->responseCode = $u[1];\n ... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Resolves $content value.
@param ContentSet $content
@param array $matches
@return mixed | [
"private function resolveContentSet(ContentSet $content, array $matches)\r\n {\r\n if ('ContentSet' === $matches[1]) {\r\n return $content->item($matches[3]);\r\n }\r\n\r\n $index = intval($matches[3]);\r\n $classname = AbstractClassContent::getFullClassname(str_replace('/'... | [
"func (m *Strings) 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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// GetAWSCognitoUserPoolGroupWithName retrieves all AWSCognitoUserPoolGroup items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found. | [
"func (t *Template) GetAWSCognitoUserPoolGroupWithName(name string) (*resources.AWSCognitoUserPoolGroup, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSCognitoUserPoolGroup:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"re... | [
"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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
@param string $name
@return Index | [
"final public function removeColumn(string $name): Index\n {\n if (!$this->hasColumn($name)) {\n throw new InvalidArgumentException('Index not contains the column '.$name);\n }\n\n $this->columns = array_filter(\n $this->columns,\n function (IndexColumn $inde... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Returns one notifiable by name
@param $name
@return array
@throws \InvalidArgumentException
@throws \RuntimeException | [
"public function getNotifiable($name)\n {\n $notifiables = $this->getDiscoveryNotifiables();\n if (isset($notifiables[$name])) {\n return $notifiables[$name];\n }\n\n throw new \\RuntimeException('Notifiable not found.');\n }"
] | [
"function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi... | codesearchnet | {
"query": "Represent the Github sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
Guess a column's formatter based on its type.
@param Column $column
@param string $tableName
@return \Closure|null
@throws \InvalidArgumentException | [
"public function guessFormat(Column $column, $tableName)\n {\n switch ($column->getType()->getName()) {\n case 'smallint':\n return function () {\n return mt_rand(0, 65535);\n };\n case 'integer':\n return function () {\... | [
"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 description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Removes the given CSS/JSDocument from _relatedDocuments. Signals that the
given file is no longer associated with the HTML document that is live (e.g.
if the related file has been deleted on disk). | [
"function _closeRelatedDocument(liveDoc) {\n if (_relatedDocuments[liveDoc.doc.url]) {\n delete _relatedDocuments[liveDoc.doc.url];\n }\n\n if (_server) {\n _server.remove(liveDoc);\n }\n\n _closeDocument(liveDoc);\n }"
] | [
"function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// SetOutputs sets the Outputs field's value. | [
"func (s *CreateFlowInput) SetOutputs(v []*AddOutputRequest) *CreateFlowInput {\n\ts.Outputs = v\n\treturn s\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// SetPermissions sets the Permissions field's value. | [
"func (s *Device) SetPermissions(v []*string) *Device {\n\ts.Permissions = 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 comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// Duplicates functionality in strconv, but avoids dependency. | [
"func atoi(s string) (x int, err error) {\n\tq, rem, err := signedLeadingInt(s)\n\tx = int(q)\n\tif err != nil || rem != \"\" {\n\t\treturn 0, atoiError\n\t}\n\treturn x, nil\n}"
] | [
"void appendGoogRequiresTo(StringBuilder sb) {\n for (GoogRequire require : googRequires.values()) {\n // TODO(lukes): we need some namespace management here... though really we need namespace\n // management with all declarations... The problem is that a require could introduce a name\n // alias ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
"Should we download this tile?", either because it's not cached yet or because it's expired
@since 5.6.5 | [
"public boolean isTileToBeDownloaded(final ITileSource pTileSource, final long pMapTileIndex) {\n final Long expiration = mTileWriter.getExpirationTimestamp(pTileSource, pMapTileIndex);\n if (expiration == null) {\n return true;\n }\n final long now = System.currentTimeMillis(... | [
"private boolean isCloudantAuthError(Response response) {\n String server = response.header(\"Server\");\n // Cloudant could send `CouchDB/ad97a06 (Erlang OTP/17)` as Server header value\n // Another cloudant server value example: `CouchDB/1.0.2`\n if (server == null || server.indexOf(\"... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Concatenates the associative array in a pipe-delimited string
in the following form FIELD_TYPE_STRING|key|FIELD_TYPE_STRING|value.
Values are encoded as strings.
@param {Array} data an associative array
@return {String} the pipe-delimited string
@private | [
"function implodeData(data) {\n\tvar dataArray = [], field;\n\tfor(field in data) {\n\t\tdataArray.push(types.STRING);\n\t\tdataArray.push(encodeString(field));\n\t\tdataArray.push(types.STRING);\n\t\tdataArray.push(encodeString(data[field]));\n\t}\n\treturn implodeArray(dataArray);\n}"
] | [
"def wrap_embedded_keyvalue(self, data):\n \n if data is not None:\n try:\n data = u'{}'.format(data)\n # variables = re.findall(self._vars_keyvalue_embedded, u'{}'.format(data))\n except UnicodeEncodeError:\n # variables = re.findall(... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
// toSnakeCase produces a monitoring compliant name from the original.
// For systems (like Prometheus) that ask for snake-case names.
// It converts CamelCase to camel_case, and CAMEL_CASE to camel_case.
// For numbers, it converts 0.5 to v0_5. | [
"func toSnakeCase(name string) (hyphenated string) {\n\tsnakeMemoizer.Lock()\n\tdefer snakeMemoizer.Unlock()\n\tif hyphenated = snakeMemoizer.memo[name]; hyphenated != \"\" {\n\t\treturn hyphenated\n\t}\n\thyphenated = name\n\tfor _, converter := range snakeConverters {\n\t\thyphenated = converter.re.ReplaceAllStri... | [
"func goCase(s string) string {\n\tif len(s) == 0 {\n\t\tpanic(fmt.Sprintf(\"%q is not a valid identifier\", s))\n\t}\n\n\twords := strings.Split(s, \"_\")\n\treturn pascalCase(len(words) == 1 /* all caps */, words...)\n\t// goCase allows all caps only if the string is a single all caps word.\n\t// That is, \"FOO\"... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Converts the specified *RGB(A)* value to *RGB(A)* components.
@param integer $rgb The *RGB(A)* color value to convert.
@return mixed[] The *RGB(A)* components.
@throws InvalidArgumentException If `$rgb` is not a *RGB(A)* color value. | [
"public static function rgbaValueToRgbaComponents($rgb)\n {\n self::throwExceptionIfNotRgbaValue($rgb);\n\n $alpha = self::rgbaValueToAlphaComponent($rgb);\n\n if (0 === $alpha) {\n $alpha = 0xFF;\n }\n\n return [\n 'R' => self::rgbaValueToRedComponent($rg... | [
"def _enforceDataType(self, data):\n \n qColor = QtGui.QColor(data) # TODO: store a RGB string?\n if not qColor.isValid():\n raise ValueError(\"Invalid color specification: {!r}\".format(data))\n return qColor"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Subtraction from two vectors | [
"public IVector sub(IVector b) {\n IVector result = new IVector(size);\n sub(b, result);\n return result;\n }"
] | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(Accelerator accelerator, ProtocolMarshaller protocolMarshaller) {\n\n if (accelerator == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(accelerator.getAcceleratorArn(),... | [
"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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Like :attr:`url` but without the querystring
See also: :attr:`trusted_hosts`. | [
"def base_url(self):\n \n return get_current_url(\n self.environ, strip_querystring=True, trusted_hosts=self.trusted_hosts\n )"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Get status of player from mopidy core and send webhook. | [
"def report_status(self):\n \n current_status = {\n 'current_track': self.core.playback.current_track.get(),\n 'state': self.core.playback.state.get(),\n 'time_position': self.core.playback.time_position.get(),\n }\n send_webhook(self.config, {'status_rep... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Calculates the arcsecant of this with the highest possible accuracy
@param integer $scale
@return Decimal | [
"public function arcsec(int $scale = null): Decimal\n {\n if($this->comp(DecimalConstants::one(), $scale + 2) === -1 && $this->comp(DecimalConstants::negativeOne(), $scale + 2) === 1) {\n throw new \\DomainException(\n \"The arcsecant of this number is undefined.\"\n )... | [
"def getPostStates(self):\n '''\n \n '''\n self.aNrmNow = self.mNrmNow - self.cNrmNow\n self.aLvlNow = self.aNrmNow*self.pLvlNow # Useful in some cases to precalculate asset level\n return None"
] | codesearchnet | {
"query": "Represent the comment about mathematics:",
"pos": "Represent the code about mathematics:",
"neg": "Represent the code:"
} |
// Draw draws the label. | [
"func (l *Label) Draw(p *Painter) {\n\tlines := l.lines()\n\n\tstyle := \"label\"\n\tif l.styleName != \"\" {\n\t\tstyle += \".\" + l.styleName\n\t}\n\n\tp.WithStyle(style, func(p *Painter) {\n\t\tfor i, line := range lines {\n\t\t\tp.DrawText(0, i, line)\n\t\t}\n\t})\n}"
] | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Get OpenSSL action from buffer
@private
@param {buffer} key Private key, certificate or CSR
@returns {string} OpenSSL action | [
"function getAction(key) {\n const keyString = key.toString();\n\n if (keyString.match(/CERTIFICATE\\sREQUEST-{5}$/m)) {\n return 'req';\n }\n else if (keyString.match(/(PUBLIC|PRIVATE)\\sKEY-{5}$/m)) {\n return 'rsa';\n }\n\n return 'x509';\n}"
] | [
"byte[] readSignResponse() throws IOException {\n // Read the first 9 bytes from the InputStream which are the SSH2_AGENT_SIGN_RESPONSE headers.\n final byte[] headerBytes = readBytes(9, \"SSH2_AGENT_SIGN_RESPONSE\");\n log.debug(\"Received SSH2_AGENT_SIGN_RESPONSE message from ssh-agent.\");\n final Si... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
apply filter on given value
@param \stubbles\values\Value $value
@return array | [
"public function apply(Value $value): array\n {\n $filter = $this->filter;\n $errors = [];\n $filtered = $filter($value, $errors);\n if (count($errors) > 0) {\n return $this->errors($errors);\n }\n\n return $this->filtered($filtered);\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// CopyBindVariables returns a shallow-copy of the given bindVariables map. | [
"func CopyBindVariables(bindVariables map[string]*querypb.BindVariable) map[string]*querypb.BindVariable {\n\tresult := make(map[string]*querypb.BindVariable, len(bindVariables))\n\tfor key, value := range bindVariables {\n\t\tresult[key] = value\n\t}\n\treturn result\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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Given a structure, returns back the structure scaled to predicted
volume.
Args:
structure (Structure): structure w/unknown volume
Returns:
a Structure object with predicted volume | [
"def get_predicted_structure(self, structure, icsd_vol=False):\n \n new_structure = structure.copy()\n new_structure.scale_lattice(self.predict(structure, icsd_vol=icsd_vol))\n return new_structure"
] | [
"def set_prop(self, prop, value, ef=None):\n \n if ef:\n # prop should be restricted to n_decoys, an int, the no. of decoys corresponding to a given FPF.\n # value is restricted to the corresponding enrichment factor and should be a float\n self.ef[prop] = value\n ... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Register release (packages) in artifact-store/repository. | [
"def register_packages(ctx, repo=None, dry_run=False):\n \"\"\"\"\"\"\n original_ctx = ctx\n if repo is None:\n repo = ctx.project.repo or \"pypi\"\n if dry_run:\n ctx = DryRunContext(ctx)\n\n packages = ensure_packages_exist(original_ctx)\n print_packages(packages)\n for artifact... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
/ Get Stats using the older API. Used by all current versions of Chrome. | [
"function parseStatsOldAPI (peerConnection,\n prevStats,\n currentStats,\n completion) {\n\n /* this parses a result if there it contains the video bitr... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Dump Python object as JSON string. | [
"def dump_json(obj):\n \"\"\"\"\"\"\n return simplejson.dumps(obj, ignore_nan=True, default=json_util.default)"
] | [
"def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// headerValues is equivalent to http.Header.Get but assumes that the keys and
// the header name to lookup are already in their canonical form so we can save
// the expansive call to net/textproto.CanonicalMIMEHeaderKey. | [
"func headerValue(header http.Header, name string) string {\n\tvalues := header[name]\n\tif len(values) == 0 {\n\t\treturn \"\"\n\t}\n\treturn values[0]\n}"
] | [
"func (m metadataTextMap) Set(key, val string) {\n\t// gRPC allows for complex binary values to be written.\n\tencodedKey, encodedVal := encodeKeyValue(key, val)\n\t// The metadata object is a multimap, and previous values may exist, but for opentracing headers, we do not append\n\t// we just override.\n\tm[encoded... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Statement ::= AggrGroup
| AggrObject
| AssignmentStmt | [
"def parse_statement(self, stream):\n \n\n if self.has_group(stream):\n return self.parse_group(stream)\n\n if self.has_object(stream):\n return self.parse_object(stream)\n\n if self.has_assignment(stream):\n return self.parse_assignment(stream)\n\n ... | [
"Rule pieDescriptor() {\n return NodeSequence(\n pieType(),\n push(new PieNode()),\n ZeroOrMore(Sequence(pieElement(), Newline())),\n ANY);\n }"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about language and writing:"
} |
Create a new route
@param null|string $method
@param string $path
@param mixed $handlers
@return Route | [
"public function createRoute(?string $method, string $path, $handlers): Route\n {\n if ($handlers instanceof \\Peak\\Blueprint\\Http\\Stack) {\n return new Route($method, $path, $handlers);\n }\n if (!is_array($handlers)) {\n $handlers = [$handlers];\n }\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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Retrieve GECOS field info and return it in dictionary form | [
"def _get_gecos(name):\n '''\n \n '''\n try:\n gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3)\n except KeyError:\n raise CommandExecutionError(\n 'User \\'{0}\\' does not exist'.format(name)\n )\n if not gecos_field:\n return {}\n else:\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
setter for copyright - sets Copyright information, C
@generated
@param v value to set into the feature | [
"public void setCopyright(String v) {\n if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_copyright == null)\n jcasType.jcas.throwFeatMissing(\"copyright\", \"de.julielab.jules.types.Header\");\n jcasType.ll_cas.ll_setStringValue(addr, ((Header_Type)jcasType).casFeatCode_copyright, v);}"
] | [
"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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// WithSessionTimeout overrides the DefaultTimeout and should be parseable by time.ParseDuration | [
"func WithSessionTimeout(timeout string) ClientOptionFunc {\n\treturn func(c *Client) error {\n\t\tif timeout == \"\" {\n\t\t\tc.sessionTimeout = DefaultTimeout\n\t\t\treturn nil\n\t\t}\n\n\t\tt, err := time.ParseDuration(timeout)\n\t\tif err != nil {\n\t\t\treturn client.InvalidTimeoutError{Timeout: timeout}\n\t\t... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// SOASerialIfDefined returns the SOA's serial if the zone has a SOA record in the Apex, or
// -1 otherwise. | [
"func (z *Zone) SOASerialIfDefined() int64 {\n\tz.reloadMu.Lock()\n\tdefer z.reloadMu.Unlock()\n\tif z.Apex.SOA != nil {\n\t\treturn int64(z.Apex.SOA.Serial)\n\t}\n\treturn -1\n}"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Generates the graph string of the Cobweb tree
@return a <code>String</code> value
@throws Exception if an error occurs | [
"public String graph() {// throws Exception {\n StringBuffer text = new StringBuffer();\n\n text.append(\"digraph CobwebTree {\\n\");\n m_cobwebTree.graphTree(text);\n text.append(\"}\\n\");\n return text.toString();\n }"
] | [
"def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
generate the array dictionary for <data> component for the App Link intent filter | [
"function getAppLinkIntentFilterDictionary(linkDomain, androidPrefix) {\n const scheme = \"https\";\n const output = {\n $: {\n \"android:host\": linkDomain,\n \"android:scheme\": scheme\n }\n };\n\n if (androidPrefix) {\n output.$[\"android:pathPrefix\"] = androidPrefix;\n ... | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param \Spryker\Install\Stage\Section\Command\CommandInterface $command
@param array $definition
@return void | [
"protected function setExcluded(CommandInterface $command, array $definition)\n {\n if (isset($definition[static::CONFIG_EXCLUDED]) && $definition[static::CONFIG_EXCLUDED]) {\n $command->markAsExcluded();\n }\n }"
] | [
"public function createService(ServiceLocatorInterface $serviceLocator)\n {\n /** @var $processingConfig ProcessingConfig */\n $processingConfig = $serviceLocator->get('processing_config');\n\n return ProcessingNode::initializeAs(NodeName::fromString($processingConfig->getNodeName()));\n ... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
/* [MS-XLS] 2.5.344 | [
"function parse_XTI(blob, length, opts) {\n\tvar w = opts.biff > 8 ? 4 : 2;\n\tvar iSupBook = blob.read_shift(w), itabFirst = blob.read_shift(w,'i'), itabLast = blob.read_shift(w,'i');\n\treturn [iSupBook, itabFirst, itabLast];\n}"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github text about MS-XLS:",
"pos": "Represent the Github code about MS-XLS:",
"neg": "Represent the Github code:"
} |
// IsErrUnknownNomadVersion returns whether the error is due to Nomad being
// unable to determine the version of a node. | [
"func IsErrUnknownNomadVersion(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), errUnknownNomadVersion)\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 comment about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
// CreateMulticastGroup creates the given multi-cast group. | [
"func CreateMulticastGroup(db sqlx.Execer, mg *MulticastGroup) error {\n\tnow := time.Now()\n\tmg.CreatedAt = now\n\tmg.UpdatedAt = now\n\n\tif mg.ID == uuid.Nil {\n\t\tvar err error\n\t\tmg.ID, err = uuid.NewV4()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"new uuid v4 error\")\n\t\t}\n\t}\n\n\t_, err := ... | [
"public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// isValidUgenInput returns false if val is not a valid ugen input and true otherwise. | [
"func isValidUgenInput(val interface{}) (Input, bool) {\n\tswitch x := val.(type) {\n\tcase int:\n\t\treturn C(float32(x)), true\n\tcase float64:\n\t\treturn C(float32(x)), true\n\tcase float32:\n\t\treturn C(x), true\n\tcase Input:\n\t\treturn x, true\n\tdefault:\n\t\treturn nil, false\n\t}\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 Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
Internal function to reset sequence to specific value.
Note: this function is for PostgreSQL compatibility.
:param val: The value to be set. | [
"def _set_sequence(cls, val):\n \n if db.engine.dialect.name == 'postgresql': # pragma: no cover\n db.session.execute(\n \"SELECT setval(pg_get_serial_sequence(\"\n \"'{0}', 'recid'), :newval)\".format(\n cls.__tablename__), dict(newval=val)... | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
如果最后一个参数为异常参数,则获取之,否则返回null
@param arguments 参数
@return 最后一个异常参数
@since 4.0.3 | [
"private static Throwable getLastArgumentIfThrowable(Object... arguments) {\r\n\t\tif (ArrayUtil.isNotEmpty(arguments) && arguments[arguments.length - 1] instanceof Throwable) {\r\n\t\t\treturn (Throwable) arguments[arguments.length - 1];\r\n\t\t} else {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}"
] | [
"public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
for doctests kwargs
SeeAlso:
ut.exec_func_src
ut.argparse_funckw | [
"def execstr_funckw(func):\n \n import utool as ut\n funckw = ut.get_func_kwargs(func)\n return ut.execstr_dict(funckw, explicit=True)"
] | [
"def sub_via_value(self,*vs,**kwargs):\n '''\n \n '''\n sd = _select_norecur_via_value(self.dict,*vs,**kwargs)\n return(Edict(sd))"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
/*
Clean cleans up the process and then the pipe.
*/ | [
"func (konsolePipe *ConsolePipe) Clean() {\n\tkonsolePipe.Konsole.Process.Kill()\n\tos.Remove(konsolePipe.PipePath)\n}"
] | [
"def buffer_leave(self, filename):\n \"\"\"\"\"\"\n self.log.debug('buffer_leave: %s', filename)\n # TODO: This is questionable, and we should use location list for\n # single-file errors.\n self.editor.clean_errors()"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Create zip file upload bundles.
@param tag Use git tag instead of hash? | [
"def zip_bundle(tag=True):\n \n #rev = get_rev(tag)\n rev = __version__\n\n print(\"Cleaning old build files.\")\n clean()\n\n local(\"mkdir -p build\")\n\n print(\"Bundling new files.\")\n with lcd(\"sphinx_bootstrap_theme/bootstrap\"):\n local(\"zip -r ../../build/bootstrap.zip .\")... | [
"function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Get the actual declarations associated with a given symbol.
@param name
@return | [
"public List<Decl.Named> getRegisteredDeclarations(QualifiedName name) {\n\t\tGroup g = symbolTable.get(name.getUnit());\n\t\tif (g != null) {\n\t\t\treturn g.getRegisteredDeclarations(name.getName());\n\t\t} else {\n\t\t\treturn Collections.EMPTY_LIST;\n\t\t}\n\t}"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Creates a method used to call all extensions' .interceptPropertyGet(...) method when needed (if the extension is implementing it)
@param {any} entity Reference to the parent entity instance
@param {any} properties Properties configuration | [
"function interceptPropertyGet(_ref7) {\n var _this2 = this;\n\n var entity = _ref7.entity,\n properties = _ref7.properties;\n\n // Create a proxy .interceptPropertyGet(...) methods, per property\n this.interceptPropertyGet = _lodash2.default.reduce(properties, function (interceptPropertyGet, propertyConfi... | [
"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 comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Parse HTML snippet, save all found <img> tags using media_handle_sideload(), return the HTML with changed <img> paths.
@param \DOMDocument $dom
@return array An array containing the \DOMDocument and the IDs of created attachments | [
"public function scrapeAndKneadImages( \\DOMDocument $dom ) {\n\n\t\t$images = $dom->getElementsByTagName( 'img' );\n\t\t$attachments = [];\n\n\t\tforeach ( $images as $image ) {\n\t\t\t/** @var \\DOMElement $image */\n\t\t\t// Fetch image, change src\n\t\t\t$src_old = $image->getAttribute( 'src' );\n\t\t\t$attachm... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the instruction about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
generates the XML content for the plugin
@return SimpleXMLElement entire XML content for the plugin | [
"public function xml()\n {\n foreach ($this->_result as $bat_item) {\n $xmlbat = $this->xml->addChild(\"Bat\");\n if (isset($bat_item['name'])) {\n $xmlbat->addAttribute(\"Name\", $bat_item['name']);\n }\n if (isset($bat_item['model']) && ($bat_it... | [
"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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Verifies that provided $class exists
@param string $class Name of the class to verify
@param string $message Error message to display when class don't exists | [
"protected function classExists(string $class, string $message): void\n {\n if (!class_exists($class)) {\n $this->log($message, Project::MSG_ERR);\n throw new BuildException($message);\n }\n }"
] | [
"public function get($key, $default = null)\n {\n $this->hydrate();\n\n // Create an Element instance using the data for the key\n if ($this->has($key)) {\n return new $this->model(array_merge($this->items[$key], ['key' => $key]));\n }\n\n // If the key doesn't exist... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
// CompareAndSwap atomatically swaps the old with the new value. | [
"func (i *AtomicBool) CompareAndSwap(o, n bool) bool {\n\tvar old, new int32\n\tif o {\n\t\told = 1\n\t}\n\tif n {\n\t\tnew = 1\n\t}\n\treturn atomic.CompareAndSwapInt32(&i.int32, old, new)\n}"
] | [
"int blockForReadSpace(int readLocation) {\n\n // sets the nextReadLocation my moving it on by 1, this may cause it it wrap back to the start.\n final int nextReadLocation = (readLocation + 1 == capacity) ? 0 : readLocation + 1;\n\n // in the for loop below, we are blocked reading unit another ... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Called from asset helpers to alert you if you reference an asset URL that
isn't precompiled and hence won't be available in production. | [
"def asset_precompiled?(logical_path)\n if precompiled_assets.include?(logical_path)\n true\n elsif !config.cache_classes\n # Check to see if precompile list has been updated\n precompiled_assets(true).include?(logical_path)\n else\n false\n end\n end"
] | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Language and programming:"
} |
prefixedName: PNAME_LN | PNAME_NS
PNAME_NS: PN_PREFIX? ':' ;
PNAME_LN: PNAME_NS PN_LOCAL ; | [
"def prefixedname_to_iriref(self, prefix: ShExDocParser.PrefixedNameContext) -> ShExJ.IRIREF:\n \n return ShExJ.IRIREF(self.prefixedname_to_str(prefix))"
] | [
"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 Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
/* (non-Javadoc)
@see org.kie.spi.Accumulator#accumulate(java.lang.Object, org.kie.spi.Tuple, org.kie.common.InternalFactHandle, org.kie.rule.Declaration[], org.kie.rule.Declaration[], org.kie.WorkingMemory) | [
"public void accumulate(Object workingMemoryContext,\n Object context,\n Tuple leftTuple,\n InternalFactHandle handle,\n Declaration[] declarations,\n Declaration[] innerDeclarations,\n ... | [
"public void removeFunction(KnowledgePackageImpl pkg,\n org.drools.core.rule.Function function) {\n this.functionFactory.removeFunction( function.getName() );\n\n }"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about MS-XLS:"
} |
/*
Add user's tweets to provided user object. | [
"private static Tweets addTweets(User user, String body, Date tweetDate, String tweetId)\r\n {\r\n Tweets tweet = new Tweets();\r\n tweet.setTweetId(tweetId);\r\n tweet.setBody(body);\r\n tweet.setTweetDate(tweetDate);\r\n user.getTweets().add(tweet);\r\n return tweet;\r... | [
"function(list){\n localStorage.setItem(localStorageKey, JSON.stringify(list));\n // if we used a real database, we would likely do the below in a callback\n this.list = list;\n this.trigger(list); // sends the updated list to all listening components (TodoApp)\n }... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Create the production build and print the deployment instructions. | [
"function build(previousSizeMap) {\n console.log('Creating an optimized production build...');\n webpack(config).run((err, stats) => {\n if (err) {\n printErrors('Failed to compile.', [err]);\n process.exit(1);\n }\n\n if (stats.compilation.errors.length) {\n printErrors('Failed to compile... | [
"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 comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
return C = A + B | [
"public Matrix3D plus(Matrix3D B) {\n Matrix3D A = this;\n if (B.M != A.M || B.N != A.N || B.K != A.K) throw new RuntimeException(\"Illegal matrix dimensions.\");\n Matrix3D C = new Matrix3D(M, N, K);\n for (int i = 0; i < M; i++)\n for (int j = 0; j < N; j++)\n \tf... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// GE returns whether a is greater than or equal to b. | [
"func (a Protocol) GE(b Protocol) bool {\n\treturn a.Major > b.Major ||\n\t\t(a.Major == b.Major && a.Minor >= b.Minor)\n}"
] | [
"static boolean isSymmetricOperation(Node n) {\n switch (n.getToken()) {\n case EQ: // equal\n case NE: // not equal\n case SHEQ: // exactly equal\n case SHNE: // exactly not equal\n case MUL: // multiply, unlike add it only works on numbers\n // or results NaN if any of the opera... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Sets the media queries for the rule.
@param MediaQuery[]|MediaQuery $queries
@return $this | [
"public function setQueries($queries)\n {\n $this->queries = [];\n if (!is_array($queries)) {\n $queries = [$queries];\n }\n foreach ($queries as $query) {\n $this->addQuery($query);\n }\n\n return $this;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
从多个客服帐号中,获取接待数最少的客服
@param array $customServices 完整客服帐号的数组,帐号格式为:帐号前缀@公众号微信号
@return string|false | [
"public function getMinAcceptedCustomService(array $customServices)\n {\n if (!$customServices) {\n return false;\n }\n\n if (count($customServices) === 1) {\n return $customServices[0];\n }\n\n $onlineList = $this->getOnLineList();\n if (!$onlineLi... | [
"public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Removes an OPTION from the SELECT
@param string $value Value for the OPTION to remove
@return void | [
"function removeOption($value)\n {\n $key=array_search($value, $this->_values);\n if ($key!==FALSE and $key!==null) {\n unset($this->_values[$key]);\n }\n foreach ($this->_options as $key=>$option){\n if ($option['attr']['value']==$value){\n unset(... | [
"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 post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Prevent circular stringify and convert arguments to real array | [
"function safeToArray(args) {\n\t\tconst seen = [];\n\t\tconst argsArray = [];\n\n\t\tlet res;\n\n\t\t// Massage some arguments with special treatment\n\t\tif (args.length) {\n\t\t\tfor (let i = 0; i < args.length; i++) {\n\n\t\t\t\t// Any argument of type 'undefined' needs to be specially treated because\n\t\t\t\t... | [
"@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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Check that a Docker image exists in a JHipster app.
@param opts Options to pass.
@property pwd JHipster app directory. default is './'
@property appConfig Configuration for the current application | [
"function checkImageExist(opts = { cwd: './', appConfig: null }) {\n if (this.abort) return;\n\n let imagePath = '';\n this.warning = false;\n this.warningMessage = 'To generate the missing Docker image(s), please run:\\n';\n if (opts.appConfig.buildTool === 'maven') {\n imagePath = this.desti... | [
"function (name) {\n // initialize module instance with default module configuration\n _.merge(this, defaultModuleConfig)\n // set app name\n this.name = name\n // set absolute path of base directory for module\n this.base = getBase()\n // store reference to global app\n this.immutableApp = ... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
// SetName sets the Name field's value. | [
"func (s *CreateUploadInput) SetName(v string) *CreateUploadInput {\n\ts.Name = &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 summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Parse token and secret from raw token response. | [
"def parse_raw_token(self, raw_token):\n \"\"\n if raw_token is None:\n return (None, None)\n # Load as json first then parse as query string\n try:\n token_data = json.loads(raw_token)\n except ValueError:\n qs = parse_qs(raw_token)\n t... | [
"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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Project logical coordinates to Java2D coordinates. | [
"public int[] screenProjection(double... coord) {\n double[] sc = new double[2];\n sc[0] = baseScreenCoords[0][0];\n sc[1] = baseScreenCoords[0][1];\n\n for (int i = 0; i < canvas.base.dimension; i++) {\n sc[0] += ((coord[i] - canvas.base.baseCoords[0][i]) / (canvas.base.baseC... | [
"def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Save document
@param bool $validate
@return Document
@throws WriteException
@throws Exception | [
"public function save($validate = true)\n {\n // if document already in db and not modified - skip this method\n if (!$this->isSaveRequired()) {\n return $this;\n }\n\n if ($validate) {\n $this->validate();\n }\n\n // handle beforeSave event\n ... | [
"public function onDelete()\n {\n $this->validateRequestTheme();\n\n $type = Request::input('templateType');\n\n $this->loadTemplate($type, trim(Request::input('templatePath')))->delete();\n\n /*\n * Extensibility - documented above\n */\n $this->fireSystemEvent... | codesearchnet | {
"query": "Represent the Github text about PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code about Programming:"
} |
calculates differences between topologies 'old' and 'new'
returns a tuple with two network graph objects
the first graph contains the added nodes, the secnod contains the added links | [
"def _make_diff(old, new, both):\n \n # make a copy of old topology to avoid tampering with it\n diff_edges = new.copy()\n not_different = [tuple(edge) for edge in both]\n diff_edges.remove_edges_from(not_different)\n # repeat operation with nodes\n diff_nodes = new.copy()\n not_different = ... | [
"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 comment about Deep Learning:",
"pos": "Represent the Github code about Deep Learning:",
"neg": "Represent the Github code:"
} |
Check if the time that has been typed so far is completely legal, as is. | [
"private boolean isTypedTimeFullyLegal() {\n if (mIs24HourMode) {\n // For 24-hour mode, the time is legal if the hours and minutes are each legal. Note:\n // getEnteredTime() will ONLY call isTypedTimeFullyLegal() when NOT in 24hour mode.\n Boolean[] enteredZeros = {false, f... | [
"def can_pull(self, initial, scheduled):\n \n if not initial and self.config.is_valid_schedule():\n # if the config has a valid schedule, return True if this is a scheduled run\n return scheduled\n return True"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software Development:"
} |
An HTML form to edit block settings
@param Tree $tree
@param int $block_id
@return void | [
"public function editBlockConfiguration(Tree $tree, int $block_id): void\n {\n $PEDIGREE_ROOT_ID = $tree->getPreference('PEDIGREE_ROOT_ID');\n $gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid');\n\n $type = $this->getBlockSetting($block_id, 'type', 'pedigree');\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 Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Returns A list with the package names of the modules to be installed.<p>
@return A list with the package names of the modules to be installed | [
"public List<String> getModulesToInstall() {\n\n if ((m_installModules == null) || m_installModules.isEmpty()) {\n return Collections.emptyList();\n }\n return Collections.unmodifiableList(m_installModules);\n }"
] | [
"def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types... | codesearchnet | {
"query": "Represent the sentence about Documentation:",
"pos": "Represent the code about Documentation:",
"neg": "Represent the code:"
} |
Return the custom field object based on the identifier | [
"public function getCustomFieldObject($postTypeModel, $key)\n\t{\n\t\t$allKeys = $this->getValidationsKeys($postTypeModel);\n\n\t\tif(array_key_exists($key, $allKeys)){\n\t\t\treturn $allKeys[$key];\n\t\t}\n\n\t\treturn false;\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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
shows or hides the coordinateline in the map according to it's visible property.
@param coordinateLineId
the id of the CoordinateLine object | [
"private void setCoordinateLineVisibleInMap(final String coordinateLineId) {\n if (null != coordinateLineId) {\n final WeakReference<CoordinateLine> coordinateLineWeakReference = coordinateLines.get(coordinateLineId);\n if (null != coordinateLineWeakReference) {\n final C... | [
"def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Save or update the model in the database.
@param mixed $identifier
@param array $attributes
@return Eloquent | [
"public function update($identifier, array $attributes = [])\n {\n return $this->mediator->transform($this->mediator(func_get_args()))->first();\n }"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Resync instructs the monitor to do a resync. | [
"func (l *LinuxMonitor) Resync(ctx context.Context) error {\n\treturn l.proc.Resync(ctx, nil)\n}"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
/*
(non-Javadoc)
@see org.openprovenance.prov.model.LiteralConstructor#newGMonthDay(int, int) | [
"public XMLGregorianCalendar newGMonthDay(int month, int day) {\n XMLGregorianCalendar cal=dataFactory.newXMLGregorianCalendar();\n cal.setMonth(month);\n cal.setDay(day);\n return cal;\n }"
] | [
"private void writeMembershipType(MembershipType membershipType, Node mtNode) throws Exception\n {\n if (!mtNode.isNodeType(\"exo:datetime\")) {\n mtNode.addMixin(\"exo:datetime\");\n }\n mtNode.setProperty(MembershipTypeProperties.JOS_DESCRIPTION, membershipType.getDescription());\n }"
] | codesearchnet | {
"query": "Represent the post about datetime:",
"pos": "Represent the code about datetime:",
"neg": "Represent the code about Software development:"
} |
Join a list of objects to a string with a given separator by calling Object.toString() on the elements.
@param list to join
@param separator separator to use
@return the joined string. | [
"public static String stringJoin(List list, String separator) {\n StringBuilder ret = new StringBuilder();\n boolean first = true;\n for (Object o : list) {\n if (!first) {\n ret.append(separator);\n }\n ret.append(o);\n first = false;\... | [
"function parsePointer(pointer) {\n // Let's split pointer string by tokens' separator character.\n // Also we will reverse resulting array to simplify it's further usage.\n var tokens = pointer.split(tokenSeparator).reverse();\n // Last item in resulting array is always an empty string, we don't need it.\n to... | codesearchnet | {
"query": "Represent the post about Documentation:",
"pos": "Represent the code about Documentation:",
"neg": "Represent the code about Programming:"
} |
/*
Convert an internal identifier to an external identifier, suitable for notifications. | [
"private String getUrl(final IRI identifier) {\n return getServices().getResourceService().toExternal(identifier, getBaseUrl()).getIRIString();\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 summarization about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Insert a new row in the table
@param array $data key value pairs, where each key is the column name and the value is the value to insert
@return array the inserted ID where keys are column names and values are column values | [
"public function insert(array $data) : array\n {\n $table = $this->definition->getName();\n $columns = $this->definition->getFullColumns();\n $insert = [];\n foreach ($data as $column => $value) {\n if (isset($columns[$column])) {\n $insert[$column] = $this->... | [
"public function doBind( PDOStatement $stmt )\n {\n foreach ( $this->boundValues as $key => $value )\n {\n try\n {\n $stmt->bindValue( $key, $value, $this->boundValuesType[$key] );\n }\n catch ( PDOException $e )\n {\n ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software Development:"
} |
send a packet in the vendapin format | [
"def sendcommand(self, command, datalength=0, data=None):\n ''''''\n packet = chr(Vendapin.STX) + chr(Vendapin.ADD) + chr(command) + chr(datalength)\n if datalength > 0:\n packet += chr(data)\n packet += chr(Vendapin.ETX)\n sendpacket = packet + chr(self._checksum(packe... | [
"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:"
} |
Load {@link Config} from 'file' but do not resolve it. | [
"static Config loadOvercastConfigFromClasspath(String path) {\n try {\n // resource.toURI().getPath() so path gets URL decoded so spaces are no issue\n // using resource.getPath() runs into a bug with guava\n return loadOvercastConfigFromFile(Resources.getResource(path).toURI... | [
"function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m... | codesearchnet | {
"query": "Represent the post about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
// SetDestinationPort sets the DestinationPort field's value. | [
"func (s *NeighborConnectionDetail) SetDestinationPort(v int64) *NeighborConnectionDetail {\n\ts.DestinationPort = &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:"
} |
Return a dict of managed keys under a named status | [
"def list_status(self, match):\n '''\n \n '''\n acc, pre, rej, den = self._check_minions_directories()\n ret = {}\n if match.startswith('acc'):\n ret[os.path.basename(acc)] = []\n for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(acc)):\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 text about AWS Route 53:",
"pos": "Represent the code about AWS Route 53:",
"neg": "Represent the code:"
} |
// SetAPNSSandboxChannelResponse sets the APNSSandboxChannelResponse field's value. | [
"func (s *GetApnsSandboxChannelOutput) SetAPNSSandboxChannelResponse(v *APNSSandboxChannelResponse) *GetApnsSandboxChannelOutput {\n\ts.APNSSandboxChannelResponse = v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Set attribute
@return \Ark\Database\Model | [
"public function setAttribute($attribute, $value){\n if($attribute === 'table'){\n $this->_table = $value;\n }\n elseif($attribute === 'pk'){\n $this->_pk = $value;\n }\n elseif($attribute === 'relations'){\n $this->_relations = $value;\n }\... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
删除用户接口
@param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
@param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
@param array $options - 可选参数对象,key: value都为string类型
@description options列表:
@return array | [
"public function deleteUser($groupId, $userId, $options=array()){\n\n $data = array();\n \n $data['group_id'] = $groupId;\n $data['user_id'] = $userId;\n\n $data = array_merge($data, $options);\n\n return $this->request($this->userDeleteUrl, $data);\n }"
] | [
"public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
sets Entity's Main-Fax.
@param Contact|AccountInterface $entity | [
"public function setMainFax($entity)\n {\n // set main to first entry or to null\n if ($entity->getFaxes()->isEmpty()) {\n $entity->setMainFax(null);\n } else {\n $entity->setMainFax($entity->getFaxes()->first()->getFax());\n }\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// addNodelets generates the DOT boxes for the node tags if they exist. | [
"func (b *builder) addNodelets(node *Node, nodeID int) bool {\n\tvar nodelets string\n\n\t// Populate two Tag slices, one for LabelTags and one for NumericTags.\n\tvar ts []*Tag\n\tlnts := make(map[string][]*Tag)\n\tfor _, t := range node.LabelTags {\n\t\tts = append(ts, t)\n\t}\n\tfor l, tm := range node.NumericTa... | [
"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 comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Installs an interval loop that dumps stats to a file. | [
"def installStatsLoop(statsFile, statsDelay):\n \"\"\"\"\"\"\n\n def dumpStats():\n \"\"\"Actual stats dump function.\"\"\"\n scales.dumpStatsTo(statsFile)\n reactor.callLater(statsDelay, dumpStats)\n\n def startStats():\n \"\"\"Starts the stats dump in \"statsDelay\" seconds.\"\"\"\n reactor.call... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Runs a sequential task.
@param task A handler to be called once the task is started. | [
"public void runTask(Handler<Task> task) {\n if (currentTask == null) {\n currentTask = new Task(this);\n task.handle(currentTask);\n } else {\n queue.add(task);\n }\n }"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Creates an unmodifiable view of a Map.
@param self a Map
@return an unmodifiable view of the Map
@see java.util.Collections#unmodifiableMap(java.util.Map)
@see #asUnmodifiable(java.util.List)
@since 2.5.0 | [
"public static <K, V> Map<K, V> asUnmodifiable(Map<K, V> self) {\n return Collections.unmodifiableMap(self);\n }"
] | [
"@Inline(value=\"$2.$3copyOf($1)\", imported=ImmutableSet.class)\n\tpublic static <T> Set<T> immutableCopy(Set<? extends T> set) {\n\t\treturn ImmutableSet.copyOf(set);\n\t}"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Reads an IP Address and returns it in a dot formatted string
@access public
@return string Dot formatted string, or a PEAR_Error if
not connected. | [
"public function readIPAddress()\n {\n if (!is_resource($this->fp)) {\n return $this->raiseError('not connected');\n }\n\n $buf = @fread($this->fp, 4);\n\n return sprintf('%d.%d.%d.%d', ord($buf[0]), ord($buf[1]),\n ord($buf[2]), ord($buf[3]));\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 post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.