query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// InfoForObject creates an Info object for the given Object. An error is returned
// if the object cannot be introspected. Name and namespace will be set into Info
// if the mapping's MetadataAccessor can retrieve them. | [
"func (m *mapper) infoForObject(obj runtime.Object, typer runtime.ObjectTyper, preferredGVKs []schema.GroupVersionKind) (*Info, error) {\n\tgroupVersionKinds, _, err := typer.ObjectKinds(obj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get type info from the object %q: %v\", reflect.TypeOf(obj), err)... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Load routes for all services tagged with graviton.rest
@param string $resource unused
@param string $type unused
@return RouteCollection | [
"public function load($resource, $type = null)\n {\n if (true === $this->loaded) {\n throw new \\RuntimeException('Do not add the \"graviton.rest.routing.loader\" loader twice');\n }\n\n foreach ($this->services as $service => $serviceConfig) {\n $this->loadService($ser... | [
"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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
@param name The entry key.
@param values The List of multiple values. | [
"public void addValues(Object name, List values) \n {\n Object lo = super.get(name);\n Object ln = LazyList.addCollection(lo,values);\n if (lo!=ln)\n super.put(name,ln);\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 text about Documentation:",
"pos": "Represent the Github code about Documentation:",
"neg": "Represent the Github code about programming:"
} |
Check LoginDeniedConfiguration.
@param TypoScriptFrontendController $frontendController
@param string $uri
@param array $explanation
@param bool $skipProcessing | [
"public function checkRule(TypoScriptFrontendController $frontendController, string $uri, array &$explanation, bool &$skipProcessing)\n {\n $name = 'sendCacheHeaders_onlyWhenLoginDeniedInBranch';\n $loginDeniedCfg = (!$frontendController->config['config'][$name] || !$frontendController->loginAllowe... | [
"protected function cleanUrl($alias)\n {\n if ($this->isOldRealUrlVersion()) {\n\n /** @var \\tx_realurl_advanced $realUrl */\n $realUrl = GeneralUtility::makeInstance('tx_realurl_advanced');\n $configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT']['p... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
// Distance computes Cosine distance.
// It will return distance which represented as 1-cos() (ranged from 0 to 2). | [
"func (c *Cosine) Distance(vectorX *mat.Dense, vectorY *mat.Dense) float64 {\n\tdotXY := c.Dot(vectorX, vectorY)\n\tlengthX := math.Sqrt(c.Dot(vectorX, vectorX))\n\tlengthY := math.Sqrt(c.Dot(vectorY, vectorY))\n\n\tcos := dotXY / (lengthX * lengthY)\n\n\treturn 1 - cos\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 sentence about mathematics:",
"pos": "Represent the code about mathematics:",
"neg": "Represent the code:"
} |
Asset Css
@param $name
@param $rel
@param $version
@return bool|string | [
"public static function assetCss($name, $rel = 'stylesheet', $version = false)\n {\n // Get cache\n $cache = Cache::get('potion_assets', []);\n\n // Check for asset\n if (!isset($cache[$name])) {\n return false;\n }\n\n // Url\n $url = self::assetUrl($n... | [
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Process contents of a section
@param array $contents Section contents
@return array | [
"private function processSectionContents(array $contents)\n {\n $result = [];\n\n // loop through each line and convert it to an array\n foreach ($contents as $path => $value) {\n // convert all a.b.c.d to multi-dimensional arrays\n $process = $this->processContentEntry... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Downloads the signature.
Returns: | [
"def download(self):\n \n if not self.can_update():\n self._tcex.handle_error(910, [self.type])\n\n return self.tc_requests.download(self.api_type, self.api_sub_type, self.unique_id)"
] | [
"def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
/* AmqpStream ( options, callback ) | [
"function ( options, callback ) {\n \n if ( typeof options == 'function' && typeof callback != 'function' ) {\n callback = options;\n }\n var callback = callback || function (){};\n\n // Validate arguments\n if ( typeof options != 'object' || options.constructor != Object ) {\n callb... | [
"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 instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// WithSkipGetServer adds the option skipping of the get server verification to
// the server spec. | [
"func (s ServerSpec) WithSkipGetServer(b bool) ServerSpec {\n\ts.connectionArgs.SkipGetServer = b\n\treturn s\n}"
] | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the Github sentence about IT infrastructure management:",
"pos": "Represent the Github code about IT infrastructure management:",
"neg": "Represent the Github code about Programming:"
} |
Gets plaftform restrictions for the specified campaign feed. | [
"private static function getPlatformRestrictionsForCampaignFeed(\n $campaignFeed\n ) {\n $platformRestrictions = ExtensionSettingPlatform::NONE;\n\n if ($campaignFeed->getMatchingFunction()->getOperator() === FunctionOperator::AND_VALUE) {\n foreach ($campaignFeed->getMatchingFunc... | [
"@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:"
} |
Helper to create an immutable data object depending on the type of the input
@private | [
"function createSub(value, computed) {\n if (isArray(value)) {\n return new List(value, computed);\n } else if (isObject(value)) {\n if (isImmutable(value)) {\n return value;\n } else if (value.constructor === Object) {\n return new Struct... | [
"@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 about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// List lists all ControllerRevisions in the indexer. | [
"func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.ControllerRevision))\n\t})\n\treturn ret, err\n}"
] | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Update the text tuple at `x` and `y` with the given `s` and `d` | [
"def _update_texttuple(self, x, y, s, cs, d):\n \"\"\"\"\"\"\n pos = (x, y, cs)\n for i, (old_x, old_y, old_s, old_cs, old_d) in enumerate(self.value):\n if (old_x, old_y, old_cs) == pos:\n self.value[i] = (old_x, old_y, s, old_cs, d)\n return\n r... | [
"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 about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
获取列是不是数值
@return array | [
"public function getFieldsType() {\n $data = $this->getAllColumn();\n $args = [];\n foreach ($data as $field) {\n $args[$field['Field']] = $this->isNumeric($field['Type']);\n }\n return $args;\n }"
] | [
"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 Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Merge report results into a summary
@param {Object} linter - markdown linter
@param {Object} summary - summary of results
@param {String} filePath - path to file to lint
@returns {Object} summary | [
"function reportReducer (linter, summary, filePath) {\n const fileContents = fs.readFileSync(filePath, {encoding: 'utf8'})\n const file = linter.process(fileContents)\n\n if (file.messages.length !== 0) {\n this.printFilePath(filePath)\n\n file.messages.forEach((message) => {\n const severity = messag... | [
"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 Technical writing:",
"pos": "Represent the Github code about Technical writing:",
"neg": "Represent the Github code:"
} |
执行传入的sql,prepare、execute。并返$stmt
@param array $parameters 绑定参数
@return bool|\PDOStatement
@throws \Exception | [
"public function execute($parameters = [])\n {\n $this->_fields = \"*\"; //重置 select\n if(X_DEBUG){\n $sql = $this->sql;\n foreach ($parameters as $k=>$v){\n $sql = str_replace(':'.$k,$v,$sql);\n }\n $this->queries[] = $sql;\n }\n ... | [
"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 Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
footer group band (gc!= null & hasFunction=true) | [
"private void printBand(GroupCache gc, Band staticBand, boolean hasFunction, boolean usePrevious)\n throws QueryException {\n\n Band band;\n List<FunctionCache> fCache = null;\n isDetail = false;\n boolean isPageHeaderFooter = false;\n if (gc == null) {\n if ... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Normalize field name or path.
@param nameOrPath a field name or a path to be normalized, must not be null
@return the normalized version of the name or path | [
"public static String normalizeFieldNameOrPath(final String nameOrPath) {\n assertNotNull(nameOrPath, \"Name of path must not be null\");\n return nameOrPath.trim().toLowerCase(Locale.ENGLISH);\n }"
] | [
"function inflate(object) {\n // check if the object is an object and isn't empty\n if (is(object) && !empty(object)) {\n // create a new object for the result\n let result = {};\n\n // for each key in the object\n Object.keys(object).forEach((path) => {\n // get value from the object\n cons... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
return all suitable-for-sortable elements in a guaranteed order | [
"function(element, options) {\n return Element.findChildren(\n element, options.only, options.tree ? true : false, options.tag);\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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Builds the `HelicalHelix`. | [
"def build(self):\n \"\"\"\"\"\"\n helical_helix = Polypeptide()\n primitive_coords = self.curve_primitive.coordinates\n helices = [Helix.from_start_and_end(start=primitive_coords[i],\n end=primitive_coords[i + 1],\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// ScheduleAppGarbageCollection schedules a garbage collection cycle for the app | [
"func (c *Client) ScheduleAppGarbageCollection(appID string) error {\n\treturn c.Post(fmt.Sprintf(\"/apps/%s/gc\", appID), nil, nil)\n}"
] | [
"private void makeJobRunning(JobInProgress job, JobSchedulingInfo oldInfo, \n QueueInfo qi) {\n // Removing of the job from job list is responsibility of the\n //initialization poller.\n // Add the job to the running queue\n qi.addRunningJob(job);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Batch callback for acknowledgement | [
"function BatchCB (response) {\n console.log (\"### Batch SMS CallBack --> Status=%j\", response);\n\n if (response.status === 0 || response.status === -4) {\n console.log (\"SMS Batch Test done\");\n setTimeout (process.exit, 1000);\n }\n }"
] | [
"def ObjectInitializedEventHandler(analysis, event):\n \n\n # Initialize the analysis if it was e.g. added by Manage Analysis\n wf.doActionFor(analysis, \"initialize\")\n\n # Try to transition the analysis_request to \"sample_received\". There are\n # some cases that can end up with an inconsistent s... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@param array $attributes
@return \O2System\Framework\Libraries\Ui\Components\Form\Input\Group | [
"public function createInputGroup(array $attributes = [])\n {\n $inputGroup = new Form\\Input\\Group();\n\n if (count($attributes)) {\n $inputGroup->createInput($attributes);\n }\n\n $this->childNodes->push($inputGroup);\n\n return $this->input = $this->childNodes->l... | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Convert SAM to BAM, including unmapped reads from fastq BAM file. | [
"def picard_sam_to_bam(picard, align_sam, fastq_bam, ref_file,\n is_paired=False):\n \n to_retain = [\"XS\", \"XG\", \"XM\", \"XN\", \"XO\", \"YT\"]\n if align_sam.endswith(\".sam\"):\n out_bam = \"%s.bam\" % os.path.splitext(align_sam)[0]\n elif align_sam.endswith(\"-align.b... | [
"def runner(self):\n \n logging.info('Starting {} analysis pipeline'.format(self.analysistype))\n if not self.pipeline:\n # If the metadata has been passed from the method script, self.pipeline must still be false in order to\n # get Sippr() to function correctly, but the ... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Check if a character is a delimiter as defined in section 3.2.6 of RFC 7230.
@param {number} code The code of the character to check.
@returns {boolean} `true` if the character is a delimiter, else `false`.
@public | [
"function isDelimiter(code) {\n return code === 0x22 // '\"'\n || code === 0x28 // '('\n || code === 0x29 // ')'\n || code === 0x2C // ','\n || code === 0x2F // '/'\n || code >= 0x3A && code <= 0x40 // ':', ';', '<'... | [
"function isValidJSONPointer(pointer) {\n // Validates JSON pointer string.\n\n if (!isString(pointer)) {\n // If it's not a string, it obviously is not valid.\n return false;\n }\n\n if ('' === pointer) {\n // If it is string and is an empty string, it's valid.\n return true;\n }... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
get last uploaded directory backup
:param aws_access_key_id:
:param aws_secret_access_key:
:param bucket_name:
:param s3_folder:
:param zip_backups_dir:
:param project:
:return: | [
"def s3_get_dir_backup(aws_access_key_id, aws_secret_access_key, bucket_name, s3_folder, zip_backups_dir, project):\n \n\n matches = []\n pat = dir_zip_pat % project\n print('looking for pat \"%s\" in bucket %s' % (pat, bucket_name))\n bucket = s3_bucket(aws_access_key_id, aws_secret_access_key, buck... | [
"def save_ec2_state_locally(instance_id,\n region,\n username,\n access_key_id,\n secret_access_key):\n \n # retrieve the IP information from the instance\n data = get_ec2_info(instance_id,\n ... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Creates the plain text JWT. | [
"protected String createPlainTextJWT() {\n com.google.gson.JsonObject header = createHeader();\n com.google.gson.JsonObject payload = createPayload();\n\n String plainTextTokenString = computeBaseString(header, payload);\n StringBuffer sb = new StringBuffer(plainTextTokenString);\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// SetName sets the Name field's value. | [
"func (s *ResourceTargetDefinition) SetName(v string) *ResourceTargetDefinition {\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Returns all the cp instances where CPDefinitionId = ? and displayDate < ? and status = ?.
@param CPDefinitionId the cp definition ID
@param displayDate the display date
@param status the status
@return the matching cp instances | [
"@Override\n\tpublic List<CPInstance> findByC_LtD_S(long CPDefinitionId,\n\t\tDate displayDate, int status) {\n\t\treturn findByC_LtD_S(CPDefinitionId, displayDate, status,\n\t\t\tQueryUtil.ALL_POS, QueryUtil.ALL_POS, null);\n\t}"
] | [
"def getSampleTypeTitles(self):\n \n sample_types = self.getSampleTypes()\n sample_type_titles = map(lambda obj: obj.Title(), sample_types)\n\n # N.B. This is used only for search purpose, because the catalog does\n # not add an entry to the Keywordindex for an empty list.\n ... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
--------------------------------------------------------------------- base64EncodeOutputStream --------------------------------------------------------------------- | [
"function() {\n\n var _buffer = 0;\n var _buflen = 0;\n var _length = 0;\n var _base64 = '';\n\n var _this = {};\n\n var writeEncoded = function(b) {\n _base64 += String.fromCharCode(encode(b & 0x3f) );\n };\n\n var encode = function(n) {\n if (n < 0) {\n // error.\n } ... | [
"func (s *StringCodeGenerator) Init() {\n\ts.Position = vm.Position{State: vm.NewState()}\n\ts.Lines = []string{\"(Exported by gocnc)\", \"G21G90\\n\"}\n}"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Finds the first component with the given id (NOT clientId!).
@param id The id.
@param base The base component to start the traversal.
@return The component or null. | [
"public static UIComponent firstWithId(String id, UIComponent base) {\n if (id.equals(base.getId())) {\n return base;\n }\n\n UIComponent result = null;\n\n Iterator<UIComponent> kids = base.getFacetsAndChildren();\n while (kids.hasNext() && (result == null)) {\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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Requires a {@link LockMode#WRITE} lock. | [
"public Addon getAddon(final AddonView view, final AddonId id)\n {\n Assert.notNull(view, \"AddonView must not be null.\");\n Assert.notNull(id, \"AddonId must not be null.\");\n return lock.performLocked(LockMode.WRITE, new Callable<Addon>()\n {\n @Override\n public Addon call... | [
"public void doAddNew() throws DBException\n {\n if (this.lockOnDBTrxType(null, DBConstants.ADD_TYPE, false)) // ADD_TYPE = Add new; Should I do the unlock in my code?\n this.unlockIfLocked(this.getRecord(), null); // Release any locks\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Retrieves an optimized array structure we the monitored pageId as key and the relevant site rootIds as value.
@param string $table
@param integer $uid
@return array | [
"protected function getSiteRootsByObservedPageIds($table, $uid)\n {\n $cacheId = 'RootPageResolver' . '_' . 'getSiteRootsByObservedPageIds' . '_' . $table . '_' . $uid;\n $methodResult = $this->runtimeCache->get($cacheId);\n if (!empty($methodResult)) {\n return $methodResult;\n ... | [
"@Override\n public List findByRange(byte[] muinVal, byte[] maxVal, EntityMetadata m, boolean isWrapReq, List<String> relations,\n List<String> columns, List<IndexExpression> conditions, int maxResults) throws Exception {\n throw new UnsupportedOperationException(\"Support available only for thrift... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// globalLogTags returns tags to be added to all logdog streams by default. | [
"func globalLogTags(args *pb.RunnerArgs) map[string]string {\n\tret := make(map[string]string, 4)\n\tret[logDogViewerURLTag] = fmt.Sprintf(\"https://%s/build/%d\", args.BuildbucketHost, args.Build.Id)\n\n\t// SWARMING_SERVER is the full URL: https://example.com\n\t// We want just the hostname.\n\tenv := environ.Sys... | [
"func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Computer Science:"
} |
Adds a parameter to the dictionary of query parameters
@param array $arguments Arbitrary keyword arguments.
@return self | [
"public function where(array $arguments)\n {\n foreach ($arguments as $key => $value) {\n $this->params[$key] = $value;\n }\n\n return $this;\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 Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Make sure all values in the $needle array is present in the $haystack array
@param array $needle
@param array $haystack
@throws ArrayContainsComparatorException
@return boolean | [
"protected function inArray(array $needle, array $haystack) {\n // Loop over all the values in the needle array, and make sure each and every one is in some\n // way present in the haystack, in a recursive manner.\n foreach ($needle as $needleValue) {\n if (is_array($needleValue)) {\... | [
"public static function Strict(&$data, $key)\n {\n if ($data instanceof DataPacket)\n $data = $data->get();\n\n if (!(in_array($key, array_keys($data))))\n Throw New \\CatapultApiException(\"You must add $key to call this function\");\n }"
] | codesearchnet | {
"query": "Represent the instruction about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software Development:"
} |
This method initializes jContentPane
@return javax.swing.JPanel | [
"private JPanel getMainPanel()\n {\n if (mainPanel == null)\n {\n GridBagConstraints gridBagConstraints = new GridBagConstraints();\n gridBagConstraints.insets = new Insets(10, 10, 5, 10);\n gridBagConstraints.gridx = 0;\n gridBagConstraints.fill = java.a... | [
"@Override\n public void afterInitialized(BaseComponent comp) {\n super.afterInitialized(comp);\n propertyGrid = PropertyGrid.create(null, comp, true);\n getPlugin().registerProperties(this, \"provider\", \"group\");\n }"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Regular font with a color | [
"func (c colorBase) Regular(a ...interface{}) string {\n\treturn color.New(color.Attribute(c)).Sprint(a...)\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 Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
数据自动完成
@access protected
@param array $auto 要自动更新的字段列表
@return void | [
"protected function autoCompleteData($auto = [])\n {\n foreach ($auto as $field => $value) {\n if (is_integer($field)) {\n $field = $value;\n $value = null;\n }\n\n if (!isset($this->data[$field])) {\n $default = null;\n ... | [
"private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Searches for any File Storage entity by entity ID.
Result can be File, Image or Folder.
@param string $fileId
@param string $type
@return null | FileAbstraction | [
"public function find($fileId, $type = null)\n\t{\n\t\tif (! is_string($fileId)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (empty($type)) {\n\t\t\t$type = FileAbstraction::CN();\n\t\t}\n\t\t\n\t\treturn $this->getDoctrineEntityManager()\n\t\t\t\t->find($type, $fileId);\n\t}"
] | [
"public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about File management:"
} |
// GetBlockHeaderVerboseByString creates a *dcrjson.GetBlockHeaderVerboseResult
// for the block specified by hash via an RPC connection to a chain server. | [
"func GetBlockHeaderVerboseByString(client BlockFetcher, hash string) *dcrjson.GetBlockHeaderVerboseResult {\n\tblockhash, err := chainhash.NewHashFromStr(hash)\n\tif err != nil {\n\t\tlog.Errorf(\"Invalid block hash %s: %v\", blockhash, err)\n\t\treturn nil\n\t}\n\n\tblockHeaderVerbose, err := client.GetBlockHeade... | [
"func parseTxAcceptedVerboseNtfnParams(params []json.RawMessage) (*btcjson.TxRawResult,\n\terror) {\n\n\tif len(params) != 1 {\n\t\treturn nil, wrongNumParams(len(params))\n\t}\n\n\t// Unmarshal first parameter as a raw transaction result object.\n\tvar rawTx btcjson.TxRawResult\n\terr := json.Unmarshal(params[0], ... | codesearchnet | {
"query": "Represent the Github text about Blockchain:",
"pos": "Represent the Github code about Blockchain:",
"neg": "Represent the Github code about Transaction Management:"
} |
// handlePrimaryStoreEvent changes the PrimaryTranslateStore
// used for replication by TranslateFile. | [
"func (s *TranslateFile) handlePrimaryStoreEvent(ev primaryStoreEvent) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif ev.id == s.primaryID {\n\t\treturn nil\n\t}\n\n\t// Stop translate store replication.\n\tclose(s.replicationClosing)\n\ts.repWG.Wait()\n\n\t// Set the primary node for translate store replica... | [
"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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Decorate decorates stream.Status.DockerImageRepository using the logic from
// dockerImageRepository(). | [
"func (s Strategy) Decorate(obj runtime.Object) error {\n\tswitch t := obj.(type) {\n\tcase *imageapi.ImageStream:\n\t\tt.Status.DockerImageRepository = s.dockerImageRepository(t, true)\n\t\tt.Status.PublicDockerImageRepository = s.publicDockerImageRepository(t)\n\tcase *imageapi.ImageStreamList:\n\t\tfor i := rang... | [
"func (e *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {\n\t// This provider doesn't track instance -> controller.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// GetCacheStatus returns a TabletCacheStatus representing the current gateway status. | [
"func (tsa *TabletStatusAggregator) GetCacheStatus() *TabletCacheStatus {\n\tstatus := &TabletCacheStatus{\n\t\tKeyspace: tsa.Keyspace,\n\t\tShard: tsa.Shard,\n\t\tName: tsa.Name,\n\t}\n\ttsa.mu.RLock()\n\tdefer tsa.mu.RUnlock()\n\tstatus.TabletType = tsa.TabletType\n\tstatus.Addr = tsa.Addr\n\tstatus.QueryC... | [
"@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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Backport support for original codes. | [
"def get(key, default=-1):\n \"\"\"\"\"\"\n if isinstance(key, int):\n return NotifyMessage(key)\n if key not in NotifyMessage._member_map_:\n extend_enum(NotifyMessage, key, default)\n return NotifyMessage[key]"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// guessFilename returns a filename for the given http.Response. If none can be
// determined ErrNoFilename is returned. | [
"func guessFilename(resp *http.Response) (string, error) {\n\tfilename := resp.Request.URL.Path\n\tif cd := resp.Header.Get(\"Content-Disposition\"); cd != \"\" {\n\t\tif _, params, err := mime.ParseMediaType(cd); err == nil {\n\t\t\tfilename = params[\"filename\"]\n\t\t}\n\t}\n\n\t// sanitize\n\tif filename == \"\... | [
"func (cli *Client) CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) {\n\tquery := make(url.Values, 1)\n\tquery.Set(\"path\", filepath.ToSlash(srcPath)) // Normalize the paths used in the API.\n\n\tapiPath := \"/containers/\" + containerID + \"/arch... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// Has returns true if the index has an entry for a chart with the given name and exact version. | [
"func (i IndexFile) Has(name, version string) bool {\n\t_, err := i.Get(name, version)\n\treturn err == 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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Marshall the given parameter object. | [
"public void marshall(UnclaimDeviceRequest unclaimDeviceRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (unclaimDeviceRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(uncla... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Display the topic review if needed | [
"public function topicReview($tid)\n {\n $post_data = [];\n\n $post_data = Container::get('hooks')->fire('model.post.topic_review_start', $post_data, $tid);\n\n $select_topic_review = ['poster', 'message', 'hide_smilies', 'posted'];\n\n $result = DB::forTable('posts')->select_many($se... | [
"protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Data synchronization:"
} |
Add a 64-bit int to the stream.
:param long n: long int to add | [
"def add_int64(self, n):\n \n self.packet.write(struct.pack(\">Q\", n))\n return self"
] | [
"def genKw(w,msk,z):\n \n # Hash inputs into a string of bytes\n b = hmac(msk, z + w, tag=\"TAG_PYTHIA_KW\")\n\n # Convert the string into a long value (no larger than the order of Gt),\n # then return a BigInt value.\n return BigInt(longFromString(b) % long(orderGt()))"
] | codesearchnet | {
"query": "Represent the summarization about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Check if the given route name is matching the request route name or alias route names
@return boolean | [
"protected function isMatchingRouteName()\n {\n return $this->getCurrentRouteName() == $this->getRouteName() || array_key_exists($this->getCurrentRouteName(), $this->getAliasRouteNames());\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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Add return tracking params into url
@param moodle_url $url A URL
@return string $url with return tracking params | [
"public function add_url_params(moodle_url $url) {\n if (empty($this->type)) {\n return $url;\n }\n\n $url->param('gpr_type', $this->type);\n\n if (!empty($this->plugin)) {\n $url->param('gpr_plugin', $this->plugin);\n }\n\n if (!empty($this->courseid)... | [
"public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $... | codesearchnet | {
"query": "Represent the text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code:"
} |
// Call shells out to a provider and return its output
// If call succeeds, stdout is returned with no error
// If call fails, "" is return with error containing stderr | [
"func Call(provider, specPath string) (string, error) {\n\tvar (\n\t\tstdOut bytes.Buffer\n\t\tstdErr bytes.Buffer\n\t)\n\tcmd := exec.Command(provider, specPath)\n\tcmd.Stdout = &stdOut\n\tcmd.Stderr = &stdErr\n\terr := cmd.Run()\n\n\tif err != nil {\n\t\terrstr := err.Error()\n\t\tif stdErr.Len() > 0 {\n\t\t\terr... | [
"def if_device_path_exists(device_serial, device_path)\n return if run_adb_command(\"adb -s #{device_serial} shell ls #{device_path}\",\n print_all: false,\n print_command: false).include?('No such file')\n\n yield(device_path)\n rescue\n ... | codesearchnet | {
"query": "Represent the comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Obfuscated Object type or primitive array iterator.
@param array the object array
@return the iterator | [
"private Iterator<Object> arrayIt(final Object array) {\n return new Iterator<Object>() {\n private int index = 0;\n private final int length = Array.getLength(array);\n @Override\n public boolean hasNext() {\n return this.index < this.length;\n ... | [
"public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
field : alias name arguments selection_set | [
"def p_field_optional1_3(self, p):\n \n p[0] = Field(name=p[2], alias=p[1], arguments=p[3], selections=p[4])"
] | [
"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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Validates date string against known formats
@param string $data
@return boolean | [
"private function isValidFormat($date)\n {\n foreach ($this->formats as $format) {\n if (date($format, strtotime($date)) == $date) {\n return true;\n }\n }\n\n return false;\n }"
] | [
"public static function configureInput(InputDefinition $definition)\n {\n $definition->addOption(new InputOption(\n 'date-fmt',\n null,\n InputOption::VALUE_REQUIRED,\n 'The date format (as a PHP date format string)',\n // @todo refactor so this can b... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
// newEvalState creates and initializes a new monitorState | [
"func newEvalState() *evalState {\n\treturn &evalState{\n\t\tstatus: structs.EvalStatusPending,\n\t\tallocs: make(map[string]*allocState),\n\t}\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// QueryRow is a wrapper for database/sql's QueryRow(), using dotsql named query. | [
"func (d DotSql) QueryRow(db QueryRower, name string, args ...interface{}) (*sql.Row, error) {\n\tquery, err := d.lookupQuery(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db.QueryRow(query, args...), nil\n}"
] | [
"func (sq *subquery) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, whereType string, _ builder) error {\n\treturn errors.New(\"unsupported: filtering on results of cross-shard subquery\")\n}"
] | codesearchnet | {
"query": "Represent the Github text about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about programming:"
} |
Load exchange data and return dataset. | [
"def load_exchange_word_vectors(\n filename = \"database.db\",\n maximum_number_of_events = None\n ):\n \n log.info(\"load word vectors of database {filename}\".format(\n filename = filename\n ))\n # Ensure that the database exists.\n if not os.path.isfile(filename):\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 about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code:"
} |
保存要缓存的数据
这将保存到设置好的缓存目录(默认是/cache)下的data目录下
@param string $srcKey 要缓存的数据名(Key),取数据时要用到,可以是复杂名字
@param mixed $data 要缓存的数据,可以是复杂数据结构
@param int $expire 秒数
@return bool | [
"protected function doSet(string $srcKey, $data, int $expire = self::EXPIRE): bool\n {\n // 获取文件名与文件位置\n list ($key, $path, $sqlPath) = $this->getFile($srcKey);\n\n // 创建目录\n makeDir(dirname($path));\n\n // 保存缓存数据\n write($path, serialize($data), LOCK_EX);\n\n // ... | [
"protected boolean isVirtualDns(Host host) {\n\t\tlong millis = host.getExpiration() - System.currentTimeMillis();\n\t\t// JVM的DNS缓存默认是30秒过期,如果过期时间大于1年则表示自定义的域名解析记录\n\t\t// 在要求特别准确的情况下请注意:如果自定义了JVM DNS缓存时间超过1年,则会返回错误数据.\n\t\treturn (millis > ABOUT_YEAR);\n\t}"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
// Once all resources have been retrieved from dcrd, update VoteTracker fields. | [
"func (tracker *VoteTracker) update(voteInfo *dcrjson.GetVoteInfoResult, blocks []int32,\n\tstakeInfo *dcrjson.GetStakeVersionInfoResult, stakeVersion uint32) {\n\t// Check if voteCounts are needed\n\tfor idx := range voteInfo.Agendas {\n\t\tagenda := &voteInfo.Agendas[idx]\n\t\tif agenda.Status != statusDefined &&... | [
"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 post about software development:",
"pos": "Represent the Github code about software development:",
"neg": "Represent the Github code:"
} |
// SetExpiresAt sets the ExpiresAt field's value. | [
"func (s *AuthorizationData) SetExpiresAt(v time.Time) *AuthorizationData {\n\ts.ExpiresAt = &v\n\treturn s\n}"
] | [
"function(loader) {\n // public\n this.maxRecursion = 5;\n this.loader = (typeof loader === 'function') ? loader : null;\n\n // internal\n this._schemaRegistry = new SchemaRegistry();\n this._customFormatHandlers = {};\n\n // _refsRequested is an object where the key is the normalized ID\n // of the schema ... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {\r\n\t\treturn FileWriter.create(file, charset).writeLines(list, isAppend);\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 instruction about Encryption:",
"pos": "Represent the code about Encryption:",
"neg": "Represent the code about programming:"
} |
Transform a coordinate from view space to pan space.
@param coordinate
The views pace coordinate.
@return Returns the pan space equivalent of the given coordinate. | [
"public Coordinate viewToPan(Coordinate coordinate) {\n\t\tif (coordinate != null) {\n\t\t\tVector2D position = new Vector2D(coordinate);\n\t\t\tdouble scale = mapView.getCurrentScale();\n\t\t\tCoordinate panOrigin = mapView.getPanOrigin();\n\t\t\t\n\t\t\tdouble translateX = (mapView.getViewState().getX() - panOrig... | [
"public static AffineTransformation axisProjection(int dim, int ax1, int ax2) {\n // setup a projection to get the data into the interval -1:+1 in each\n // dimension with the intended-to-see dimensions first.\n AffineTransformation proj = AffineTransformation.reorderAxesTransformation(dim, ax1, ax2);\n ... | codesearchnet | {
"query": "Represent the Github sentence about mathematics:",
"pos": "Represent the Github code about mathematics:",
"neg": "Represent the Github code:"
} |
Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged | [
"def post_build(self, pkt, pay):\n \n if conf.contribs['CAN']['swap-bytes']:\n return CAN.inv_endianness(pkt) + pay\n return pkt + pay"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// OnError registers a function. Function will be executed if an error
// occurs during the HTTP request. | [
"func (c *Collector) OnError(f ErrorCallback) {\n\tc.lock.Lock()\n\tif c.errorCallbacks == nil {\n\t\tc.errorCallbacks = make([]ErrorCallback, 0, 4)\n\t}\n\tc.errorCallbacks = append(c.errorCallbacks, f)\n\tc.lock.Unlock()\n}"
] | [
"function (message) {\n if ('string' !== typeof message) {\n callFunc(WebViewBridge.onError, \"message is type '\" + typeof message + \"', and it needs to be string\");\n return;\n }\n\n //we queue the messages to make sure that native can collects all of them in one shot.\n sendQu... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Load the config files as specified via +files+.
@param files [Array<String>] The path(s) for config files.
@return [Config] The config hash. (+self+) | [
"def load_site_configs(*files)\n # Allows both:\n # load_site_configs('foo', 'bar')\n # load_site_configs(['foo', bar'])\n # but not:\n # load_site_configs(['foo'], 'bar')\n files = files[0] if files.length == 1 && files[0].is_a?(Array)\n\n load_files(*files)\n end"
] | [
"def get_config(self, key, default=None):\n \n depr(0, 13, \"Route.get_config() is deprectated.\",\n \"The Route.config property already includes values from the\"\n \" application config for missing keys. Access it directly.\")\n return self.config.get(key... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Process a metadata update from the {@link MetadataFinder}, and see if it means the waveform information
associated with any player has changed.
@param update describes the new metadata we have for a player, if any | [
"private void handleUpdate(final TrackMetadataUpdate update) {\n boolean foundInCache = false;\n\n if (update.metadata == null || update.metadata.trackType != CdjStatus.TrackType.REKORDBOX) {\n clearDeck(update);\n } else {\n // We can offer waveform information for this d... | [
"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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Polling function that runs before the onload event fires,
attempting to attach to DOM Nodes as soon as they are
available
@method _tryPreloadAttach
@static
@private | [
"function() {\n\n if (onAvailStack.length === 0) {\n retryCount = 0;\n if (this._interval) {\n // clearInterval(this._interval);\n this._interval.cancel();\n this._interval = null;\n ... | [
"function () {\n if (__autoresizes == null) {\n __autoresizes = [];\n ariaUtilsAriaWindow.attachWindow();\n eventUtils.addListener(Aria.$window, \"resize\", {\n fn : __onResize\n });\n // PTR 08127833 - it updates the viewport sizes the fi... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SendError is used to respond to any request with an error | [
"func SendError(w http.ResponseWriter, data interface{}, rCode int) {\n\trw := responseWriter{\n\t\tResponseWriter: w,\n\t\tcode: rCode,\n\t}\n\n\terr := json.NewEncoder(rw).Encode(errOutput{data, rCode})\n\tif err != nil {\n\t\t/*\n\t\t\tIn case of encoding error, send \"internal server error\" after\n\t... | [
"def get(resource, params: {}, key: Steam.apikey)\n params[:key] = key\n response = @conn.get resource, params\n JSON.parse(response.body)\n rescue JSON::ParserError\n # If the steam web api returns an error it's virtually never in json, so\n # lets pretend that we're getting some sort... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Enqueue the email for each recipient.
@param mixed $ts A date/time to initiate the queue processing.
@return boolean Success / Failure. | [
"public function queue($ts = null)\n {\n $recipients = $this->to();\n $author = $this->from();\n $subject = $this->subject();\n $msgHtml = $this->msgHtml();\n $msgTxt = $this->msgTxt();\n $campaign = $this->campaign();\n $queueId = $this->queueI... | [
"public function body($payload, $mimeType = null)\n {\n $this->mime($mimeType);\n $this->payload = $payload;\n // Iserntentially don't call _serializePayload yet. Wait until\n // we actually send off the request to convert payload to string.\n // At that time, the `serialized_... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
>>> print humanize(0)
now
>>> print humanize(1)
in a minute
>>> print humanize(60)
in a minute
>>> print humanize(61)
in 2 minutes
>>> print humanize(3600)
in an hour
>>> print humanize(3601)
in 2 hours | [
"def humanize(t):\n \n m, s = divmod(t, 60)\n if s:\n m += 1 # ceil minutes \n h, m = divmod(m, 60)\n if m and h:\n h += 1 # ceil hours\n# d, h = divmod(h, 24)\n\n if h > 1:\n res = 'in %d hours' % h\n elif h == 1:\n res = 'in an ho... | [
"def distance_of_time_in_words(from_time, to_time = Time.now) # rubocop:disable CyclomaticComplexity\n seconds = (to_time - from_time).abs\n minutes = seconds / 60\n case minutes\n when 0...1\n case seconds\n when 0...1\n 'a split second'\n when 1...2\n 'a ... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Prepare an array of products
@param array $list | [
"protected function prepareListProduct(array &$list)\n {\n foreach ($list as &$item) {\n $this->setItemPriceFormatted($item, $this->price);\n $this->setItemUrlEntity($item, $this->store, 'product');\n }\n }"
] | [
"def search_prod_type_tags(self, ins, type, tags, pipeline):\n ''''''\n return StoredProduct(id=100, content='null.fits', tags={})"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// NewSalt returns a 20 character salt. | [
"func NewSalt() ([]byte, error) {\n\tsalt := make([]byte, 20)\n\tif _, err := rand.Read(salt); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Salt must be a legal UTF8 string.\n\tfor i := 0; i < len(salt); i++ {\n\t\tsalt[i] &= 0x7f\n\t\tif salt[i] == '\\x00' || salt[i] == '$' {\n\t\t\tsalt[i]++\n\t\t}\n\t}\n\n\tre... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Gets a C{dict} of valid method callables for the underlying service
object. | [
"def getMethods(self):\n \n callables = {}\n\n for name in dir(self.service):\n method = getattr(self.service, name)\n\n if name.startswith('_') or not python.callable(method):\n continue\n\n callables[name] = method\n\n return callables"
] | [
"@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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Iterates through each datamodel/database, dumps the contents of all tables and creates a DOM XML doc.
@return void
@throws BuildException | [
"public function main()\n {\n $this->validate();\n\n $buf = \"Database settings:\\n\"\n . \" driver: \" . ($this->databaseDriver ? $this->databaseDriver : \"(default)\" ). \"\\n\"\n . \" URL: \" . $this->databaseUrl . \"\\n\"\n . ($this->databaseUser ? \" user: \" .... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
// SetRecurrenceInHours sets the RecurrenceInHours field's value. | [
"func (s *DescribeSnapshotScheduleOutput) SetRecurrenceInHours(v int64) *DescribeSnapshotScheduleOutput {\n\ts.RecurrenceInHours = &v\n\treturn s\n}"
] | [
"function (fieldDefinition, fieldName) {\n const fieldType = propertyHelper.getFieldType(fieldDefinition);\n\n if (fieldType === 'date') {\n // This field is a date field. Create the checks\n return createDateChecks(fieldDefinition, fieldName);\n }\n }"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software Development:"
} |
Process the end of a node under xtvd/stations | [
"def _endStationsNode(self, name, content):\n \"\"\"\"\"\"\n\n if name == 'callSign':\n self._callSign = content\n elif name == 'name':\n self._stationName = content\n elif name == 'affiliate':\n self._affiliate = content\n elif name == 'fccChannel... | [
"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 comment about Task management:",
"pos": "Represent the code about Task management:",
"neg": "Represent the code:"
} |
Returns the rank of the matrix | [
"function() {\n \tvar M = this.toRightTriangular(), rank = 0;\n \tvar i = this.elements.length, nj = this.elements[0].length, j;\n \twhile (i--) {\n \t j = nj;\n \t while (j--) {\n \t\tif (Math.abs(M.elements[i][j]) > sylvester.precision) { ran... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Helper for job-type specific statistics-based properties. | [
"def _job_statistics(self):\n \"\"\"\"\"\"\n statistics = self._properties.get(\"statistics\", {})\n return statistics.get(self._JOB_TYPE, {})"
] | [
"@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:"
} |
Static configurator for filter | [
"protected static function configure(AspectKernel $kernel, string $filterName, CachePathManager $cacheManager): void\n {\n if (self::$kernel !== null) {\n throw new RuntimeException('Filter injector can be configured only once.');\n }\n self::$kernel = $kernel;\n ... | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// MarshalText lets Level implements the TextMarshaler interface used by encoding packages | [
"func (l Level) MarshalText() ([]byte, error) {\n\tvar t []byte\n\tswitch l {\n\tcase LevelDebug:\n\t\tt = levelBytesDebug\n\tcase LevelInfo:\n\t\tt = levelBytesInfo\n\tcase LevelWarn:\n\t\tt = levelBytesWarn\n\tcase LevelError:\n\t\tt = levelBytesError\n\tcase LevelFatal:\n\t\tt = levelBytesFatal\n\tdefault:\n\t\t... | [
"func (re RawExtension) MarshalJSON() ([]byte, error) {\n\tif re.Raw == nil {\n\t\t// TODO: this is to support legacy behavior of JSONPrinter and YAMLPrinter, which\n\t\t// expect to call json.Marshal on arbitrary versioned objects (even those not in\n\t\t// the scheme). pkg/kubectl/resource#AsVersionedObjects and ... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// SetId sets the Id field's value. | [
"func (s *ParameterObject) SetId(v string) *ParameterObject {\n\ts.Id = &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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Construct a sentence. If strictness is used and invariants do not hold, convert
the exception to an IOException. | [
"private Sentence constructSentence(List<Token> tokens) throws IOException {\n Sentence sentence;\n try {\n sentence = new SimpleSentence(tokens, strict);\n } catch (IllegalArgumentException e) {\n throw new IOException(e.getMessage());\n }\n return sentence;... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Init this object.
@param database The raw data database for this raw data table.
@param table The table this raw data table will supply data to.
@param The unique lookup key for this raw data table. | [
"public void init(MDatabase pDatabase, FieldList record, Object key)\n {\n super.init(pDatabase, record, key);\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 Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Get user specified header and the footer.
@param header if true print the user provided header else print the
user provided footer. | [
"public Content getUserHeaderFooter(boolean header) {\n String content;\n if (header) {\n content = replaceDocRootDir(configuration.header);\n } else {\n if (configuration.footer.length() != 0) {\n content = replaceDocRootDir(configuration.footer);\n ... | [
"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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Lock the mutex for writing | [
"func (m *RWMutex) Lock() {\n\tatomic.AddInt64(&m.pendingWriters, 1)\n\tm.mutex.Lock()\n\tatomic.AddInt64(&m.writers, 1)\n\tatomic.AddInt64(&m.pendingWriters, -1)\n\n\tstackBufLen := RWMutexStackBufferLength()\n\n\tm.stateMutex.Lock()\n\tif len(m.stackBuf) < stackBufLen {\n\t\tm.stackBuf = make([]byte, stackBufLen)... | [
"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:"
} |
The complete class structure will be initialized only when really
needed to avoid having too many objects during compilation | [
"private void lazyClassInit() {\n if (lazyInitDone) return;\n synchronized (lazyInitLock) {\n if (redirect!=null) {\n throw new GroovyBugError(\"lazyClassInit called on a proxy ClassNode, that must not happen.\"+\n \"A redirect() call i... | [
"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 sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Remove the specified resource from storage.
@param \TypiCMS\Modules\Attributes\Shells\Models\Attribute $attribute
@return \Illuminate\Http\JsonResponse | [
"public function destroy(AttributeGroup $attribute)\n {\n $deleted = $this->repository->delete($attribute);\n\n return response()->json([\n 'error' => !$deleted,\n ]);\n }"
] | [
"public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\... | codesearchnet | {
"query": "Represent the text about Metadata management:",
"pos": "Represent the code about Metadata management:",
"neg": "Represent the code:"
} |
{@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"@Override\n public R visitAttribute(AttributeTree node, P p) {\n return defaultAction(node, p);\n }"
] | [
"public void addHandlers(Object... handlers) {\n for ( Object handler : handlers) {\n //assert that this is a Handler\n checkValidHandlerType(handler);\n\n StepInvokerProvider invokerFactory = new HandlerClassInvokerFactory(handler);\n List<StepInvoker> invokers = ... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
get trial log path | [
"def log_trial(args):\n '''''''\n trial_id_path_dict = {}\n nni_config = Config(get_config_filename(args))\n rest_port = nni_config.get_config('restServerPort')\n rest_pid = nni_config.get_config('restServerPid')\n if not detect_process(rest_pid):\n print_error('Experiment is not running...... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Get schema
@param boolean $reload
@return \Doctrine\DBAL\Schema\Schema | [
"protected function getSchema($reload = false)\n {\n if (!isset($this->dbalSchema) || $reload) {\n $this->dbalSchema = new \\Espo\\Core\\Utils\\Database\\DBAL\\Schema\\Schema();\n }\n\n return $this->dbalSchema;\n }"
] | [
"public static function getDescription()\n {\n $pdoDriver = \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriverFactory::getDescription();\n $pdoDriver->getConfig()->response('dsn', \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriver::POSTGRESQL);\n\n $dataObject = new MetaDataSource();\n ... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Param returns named param | [
"func (cmd *CLI) Param(name string) values.Value {\n\tvalue, ok := cmd.Params()[name]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"param not defined %v\", name))\n\t}\n\treturn value\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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Matches against args or kwargs. | [
"def match_in_args_kwargs(self, match_args, args, kwargs, allow_star_args=False):\n \"\"\"\"\"\"\n req_len = 0\n arg_checks = {}\n to_match = [] # [(move_down, match, against)]\n for i, arg in enumerate(match_args):\n if isinstance(arg, tuple):\n (match,... | [
"def star_expr_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"35\", \"star unpacking (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:"
} |
// Report starts periodic telemetry reporting each interval. | [
"func (r *Reporter) Report(ctx context.Context) {\n\tlogger := r.Logger.With(\n\t\tzap.String(\"service\", \"telemetry\"),\n\t\tinfluxlogger.DurationLiteral(\"interval\", r.Interval),\n\t)\n\n\tlogger.Info(\"Starting\")\n\tif err := r.Pusher.Push(ctx); err != nil {\n\t\tlogger.Debug(\"failure reporting telemetry me... | [
"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:"
} |
Make sure :attr:`directory` exists.
:raises: :exc:`.MissingPasswordStoreError` when the password storage
directory doesn't exist. | [
"def ensure_directory_exists(self):\n \n if not os.path.isdir(self.directory):\n msg = \"The password storage directory doesn't exist! (%s)\"\n raise MissingPasswordStoreError(msg % self.directory)"
] | [
"def _validate_backend(self):\n \n try:\n self.backend_class\n # if we get an import error the specified path is wrong\n except (ImportError, AttributeError) as e:\n raise ValidationError(_('No valid backend found, got the following python exception: \"%s\"') % e)"
... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// getWorkItemsByFilterExpression retrieves Work Items, children and parents for a given expression and parameters | [
"func getWorkItemsByFilterExpression(ctx context.Context, db application.DB, filterExpression string, filterParentexists *bool, offset *int, limit *int) ([]workitem.WorkItem, link.WorkItemLinkList, link.AncestorList, error) {\n\tvar result []workitem.WorkItem\n\tvar childLinks link.WorkItemLinkList\n\tvar parents l... | [
"def _reflex_rule_process(self, wf_action):\n \n # Check out if the analysis has any reflex rule bound to it.\n # First we have get the analysis' method because the Reflex Rule\n # objects are related to a method.\n a_method = self.getMethod()\n if not a_method:\n ... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Create the AnnotationTypeElementDoc for a MethodSymbol.
Should be called only on symbols representing annotation type elements. | [
"protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) {\n AnnotationTypeElementDocImpl result =\n (AnnotationTypeElementDocImpl)methodMap.get(meth);\n if (result != null) {\n if (treePath != null) result.setTreePath(treePath);\n } else {\n ... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Simple quick method to set shop and access token in one shot.
@param string $shop The shop's domain
@param string $accessToken The access token for API requests
@return self | [
"public function setSession(string $shop, string $accessToken)\n {\n $this->setShop($shop);\n $this->setAccessToken($accessToken);\n\n return $this;\n }"
] | [
"public function getRefreshToken()\n {\n if ($this->has('refresh_token')) {\n $token = $this->get('refresh_token');\n\n return Crypt::decrypt($token);\n }\n\n throw new MissingRefreshTokenException(sprintf('No refresh token stored in current session. Verify you have add... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.