query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
实体类 复制
@param pSource 源实体类
@param pTtarget 目标实体类
@param <T> | [
"public static <T> void copy(T pSource, T pTtarget) {\n Method[] vMethods = pSource.getClass().getMethods();\n for (int i = 0; i < vMethods.length; i++) {\n if (vMethods[i].getDeclaringClass().equals(Object.class)) {\n continue;\n }\n if (vMethods[i].get... | [
"public void addSharedFunctionByString(String content) {\r\n\t\t// content 中的内容被解析后会存放在 Env 之中,而 StringSource 所对应的\r\n\t\t// Template 对象 isModified() 始终返回 false,所以没有必要对其缓存\r\n\t\tStringSource stringSource = new StringSource(content, false);\r\n\t\tdoAddSharedFunction(stringSource, null);\r\n\t}"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Find the corresponding TypeMirror from Elemental2 for a given DOM Element
@param element The element we want the TypeMirror of
@return The type mirror | [
"private TypeMirror getTypeFromDOMElement(Element element) {\n return DOMElementsUtil\n .getTypeForElementTag(element.getStartTag().getName())\n .map(Class::getCanonicalName)\n .map(elements::getTypeElement)\n .map(TypeElement::asType)\n .orElse(null);\n }"
] | [
"@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
scan media files in all paths | [
"def scan(self, paths=None, depth=2):\n \n song_exts = ['mp3', 'ogg', 'wma', 'm4a']\n exts = song_exts\n paths = paths or [Library.DEFAULT_MUSIC_FOLDER]\n depth = depth if depth <= 3 else 3\n media_files = []\n for directory in paths:\n logger.debug('正在扫描目... | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
// Put will return a resource to the pool. You MUST return every resource to the pool,
// even if it's closed. If a resource is closed, you should call Put(nil). | [
"func (rr *RoundRobin) Put(resource Resource) {\n\trr.mu.Lock()\n\tdefer rr.available.Signal()\n\tdefer rr.mu.Unlock()\n\n\tif rr.size > int64(cap(rr.resources)) {\n\t\tif resource != nil {\n\t\t\tgo resource.Close()\n\t\t}\n\t\trr.size--\n\t} else if resource == nil {\n\t\trr.size--\n\t} else {\n\t\tif len(rr.reso... | [
"public void close() throws IOException {\n guard.close();\n synchronized (this) {\n if (channel != null && channel.isOpen()) {\n channel.close();\n\n // j2objc: since a @RetainedWith field cannot be reassigned, the following line is\n // comment... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// NewDrop creates new drop exec task. | [
"func NewDrop(ctx *plan.Context, p *plan.Drop) *Drop {\n\tm := &Drop{\n\t\tTaskBase: NewTaskBase(ctx),\n\t\tp: p,\n\t}\n\treturn m\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 post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Constraint that ensures that the field has precision and scale settings if the jdbc type requires it.
@param fieldDef The field descriptor
@param checkLevel The current check level (this constraint is checked in all levels) | [
"private void ensurePrecisionAndScale(FieldDescriptorDef fieldDef, String checkLevel)\r\n {\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_PRECISION, null);\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_SCALE, null);\r\n if (!fieldDef.hasProperty(PropertyHelper.O... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Handles de-/compression via #inflate() and #deflate(), calls you back via #deflatedReady() and #inflatedReady().
The chunk we get from deflater is actually a view of a 16kB arraybuffer, so we need to copy the relevant parts
memory to a new arraybuffer. | [
"function Compressor(inflatedReady, deflatedReady) {\n this.inflatedReady = inflatedReady;\n this.deflatedReady = deflatedReady;\n this._inflate = inflater(chunk => this.inflatedReady(chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.length)));\n this._deflate = deflater(chunk => this.deflatedReady(... | [
"function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about File management:"
} |
:: String -> String | [
"function flip(name) {\n return name.toLowerCase()\n .split('')\n .reverse()\n .join('')\n .replace(/./g, function(a) {\n var i = chars.indexOf(a);\n return i != -1? flipped[i]\n ... | [
"@Deprecated\n public static <F, T> Function <F, T> constant(T v) {\n return from -> v;\n }"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
{@inheritdoc}
@see <a href="http://php.net/manual/en/function.debug-backtrace.php">debug_backtrace()</a>
for information on how to get a stack trace within this method. | [
"public function throwException(\n $message,\n $code,\n $connectionErrorNumber = null,\n $httpStatusCode = null,\n $previousException = null\n ) {\n throw new PhpCapException(\n $message,\n $code,\n $connectionErrorNumber,\n $h... | [
"public static function setupExceptionHandling() {\n $previous = set_exception_handler(self::$exceptionHandler=__CLASS__.'::handleException');\n\n /**\n * Detect entering of the script's shutdown phase to be capable of handling destructor exceptions during shutdown\n * differently and ... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Returns a total volume of all products in the order
@param array $order
@param array $cart
@return float|null | [
"public function getVolume(array $order, array &$cart)\n {\n $result = null;\n $this->hook->attach('order.volume.get.before', $order, $cart, $result, $this);\n\n if (isset($result)) {\n return (float) $result;\n }\n\n $total = 0.0;\n\n foreach ($cart['items'] ... | [
"public static function getEquityLinkCount($url = false)\n {\n $data = static::getCols('2048', $url);\n return (parent::noDataDefaultValue() == $data) ? $data :\n $data['uid'];\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Creates the day selection view.<p> | [
"private void createDayPanel() {\r\n\r\n CmsCheckBox box = new CmsCheckBox(Messages.get().key(Messages.GUI_SERIALDATE_DAY_MONDAY_0));\r\n box.setInternalValue(WeekDay.MONDAY.toString());\r\n box.addValueChangeHandler(m_checkBoxValueChangeHandler);\r\n m_checkboxes.add(box);\r\n m_... | [
"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:"
} |
// SetTags sets the Tags field's value. | [
"func (s *CreateRobotOutput) SetTags(v map[string]*string) *CreateRobotOutput {\n\ts.Tags = v\n\treturn s\n}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// SetMax sets the Max field's value. | [
"func (s *FieldStats) SetMax(v string) *FieldStats {\n\ts.Max = &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 post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Generates the blacklist.
@param model model to use
@return the blacklist | [
"public Blacklist generateBlacklist(Model model)\n\t{\n\t\tChemicalNameNormalizer normalizer = new ChemicalNameNormalizer(model);\n\t\tSIFSearcher searcher = new SIFSearcher(new Fetcher(normalizer), SIFEnum.USED_TO_PRODUCE);\n\n\t\tSet<SIFInteraction> sifs = searcher.searchSIF(model);\n\n\t\t// read interactions in... | [
"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:"
} |
@param string $name Name for the endpoint to return
@return \PhalconRest\Api\ApiEndpoint|null Endpoint with the given name | [
"public function getEndpoint($name)\n {\n return array_key_exists($name, $this->endpointsByName) ? $this->endpointsByName[$name] : null;\n }"
] | [
"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 summarization about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code about Programming:"
} |
map of tag => version | [
"protected IPromise<JsonObject> getDistributions(String module) {\n Promise res = new Promise();\n// http://registry.npmjs.org/-/package/react/dist-tags\n http.getContent(config.getRepo()+\"/-/package/\"+module+\"/dist-tags\").then( (cont,err) -> {\n if ( cont != null ) {\n ... | [
"function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns a list of mini-venues partially matching the search term, near the location.
@see https://developer.foursquare.com/docs/venues/suggestcompletion
@param array $params
@return array | [
"public function suggestCompletion(array $params = array())\n {\n $resource = '/venues/suggestcompletion';\n $response = $this->makeApiRequest($resource, $params);\n\n if(property_exists($response, 'minivenues')) {\n return $response->minivenues;\n }\n\n return array... | [
"def fetch_all_records(self):\n \n \"\"\"\n api = self.doapi_manager\n return map(self._record, api.paginate(self.record_url, 'domain_records'))"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about AWS Route 53:"
} |
Maybe add a rating prompt for an activity.
@since 2.7.7
@param string $activity The name of an activity
@param string $config_path The path to our plugin's rating prompt configs.
@return bool Whether or not we added a rating prompt. | [
"public function maybeAddRatingPrompt( $activity, $config_path ) {\n\t\t$added = false;\n\n\t\t$configs = $this->getActivityConfigs( $activity, $config_path );\n\n\t\tif ( isset( $configs['threshold'] ) && $this->getActivityCount( $activity ) >= $configs['threshold'] ) {\n\t\t\t$rating_prompt = new \\Boldgrid\\Libr... | [
"public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// SetTargets sets the Targets field's value. | [
"func (s *AutomationExecutionMetadata) SetTargets(v []*Target) *AutomationExecutionMetadata {\n\ts.Targets = 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:"
} |
// SetConcurrentExecutions sets the ConcurrentExecutions field's value. | [
"func (s *AccountLimit) SetConcurrentExecutions(v int64) *AccountLimit {\n\ts.ConcurrentExecutions = &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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Replaces `length` bytes starting at `addr` with a symbolic variable named name. Adds a constraint equaling that
symbolic variable to the value previously at `addr`, and returns the variable. | [
"def make_symbolic(self, name, addr, length=None):\n \n l.debug(\"making %s bytes symbolic\", length)\n\n if isinstance(addr, str):\n addr, length = self.state.arch.registers[addr]\n else:\n if length is None:\n raise Exception(\"Unspecified length!\"... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the description about 32-bit integers:",
"pos": "Represent the code about 32-bit integers:",
"neg": "Represent the code about programming:"
} |
Get the absolutely positioned coordinates of a DOM element.
@returns Object containing the element's position, width, and height.
@private | [
"function(el) {\n var pos = {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n };\n if (el.getBoundingClientRect) {\n var elRect = el.getBoundingClientRect();\n var pageXOffset = _window.pageXOffset;\n var pageYOffset = _window.pageYOffset;\n var leftBorderWidth = _doc... | [
"function positionModalOpening(targetElement, openingElement) {\n if (targetElement.getBoundingClientRect && openingElement instanceof SVGElement) {\n const { x, y, width, height, left, top } = targetElement.getBoundingClientRect();\n\n // getBoundingClientRect is not consistent. Some browsers use x and y, w... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Set Event organizer
@param string $email Organizer email
@return void | [
"public function setOrganizer(string $email) : void\n {\n if ('' !== $email) {\n $this->event->setOrganizer(\n new Organizer($email, ['MAILTO' => $email])\n );\n }\n }"
] | [
"public function sample1()\n {\n $data = null;\n $template_html = 'sample-1.html';\n\n $mail = new Mail();\n $mail->setMailBody($data, $template_html);\n $mail->sendMail('Test Sample 1 - external HTML template');\n exit('Message Sent!');\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get the sum of all transaction legs in to_account during given billing cycle | [
"def get_amount_arrears_transactions(self, billing_cycle):\n \"\"\"\"\"\"\n previous_billing_cycle = billing_cycle.get_previous()\n if not previous_billing_cycle:\n return Decimal(0)\n return self.to_account.balance(\n transaction__date__lt=previous_billing_cycle.da... | [
"@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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// edge returns a graph with two edges (0, 1) and (1, 0). | [
"func edge() *Virtual {\n\tg := &Virtual{\n\t\torder: 2,\n\t\tcost: zero,\n\t\tedge: alwaysEdge,\n\t\tdegree: degreeOne,\n\t}\n\tg.visit = func(v int, a int, do func(w int, c int64) bool) (aborted bool) {\n\t\tw := 1 - v\n\t\tif w < a {\n\t\t\treturn\n\t\t}\n\t\treturn do(w, 0)\n\t}\n\treturn g\n}"
] | [
"def controlPoints(cmd, data):\n \n cmd = cmd.lower()\n if cmd in ['c', 's', 'q']:\n indices = range(len(data))\n if cmd == 'c': # c: (x1 y1 x2 y2 x y)+\n return [index for index in indices if (index % 6) < 4]\n elif cmd in ['s', 'q']: # s: (x2 y2 x y)+ q: (x1 y1 x y)+\n... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Handler of the SIGTERM (graceful shutdown) signal in worker process.
@return void | [
"protected function sigterm()\n {\n if (Daemon::$config->logsignals->value) {\n $this->log('caught SIGTERM.');\n }\n\n $this->graceful = false;\n EventLoop::$instance->stop();\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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// MaybeSaveHostFile will output or write the Hostfile, or exit 1 and error. | [
"func MaybeSaveHostFile(c *cli.Context, hostfile *Hostfile) {\n\t// If -n is passed, no-op and output the resultant hosts file to stdout.\n\t// Otherwise it's for real and we're going to write it.\n\tif AnyBool(c, \"n\") {\n\t\tfmt.Printf(\"%s\", hostfile.Format())\n\t} else {\n\t\terr := hostfile.Save()\n\t\tif er... | [
"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 sentence about File management:",
"pos": "Represent the code about File management:",
"neg": "Represent the code about programming:"
} |
Sets a date by ISO-8601 conform data.
@param integer $year The year
@param integer $week The Week number (Weeks begins at monday)
@param integer $day The day
@return \Beluga\Date\DateTime | [
"public function setISODate( $year, $week, $day = null )\n : DateTime\n {\n\n parent::setISODate( $year, $week, $day );\n\n return $this;\n\n }"
] | [
"public function during($starting,$ending)\n {\n if(! is_numeric($starting) || ! is_numeric($ending))\n throw new \\Edujugon\\GoogleAds\\Exceptions\\Report('During clause only accepts the following date format: \"Ymd\" => e.g. 20170112');\n\n $this->during = [$starting,$ending];\n\n ... | codesearchnet | {
"query": "Represent the post about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
{@inheritdoc}
@throws \InvalidArgumentException If source file does not exist | [
"public function provideName(FileInfo $srcFileInfo)\n {\n if (!$srcFileInfo->isFile()) {\n throw new \\InvalidArgumentException(sprintf(\n 'The source file does not exist on \"%s\" specified path.',\n $srcFileInfo->toString()\n ));\n }\n $h... | [
"public function validate() {\n if ($this->initializer) {\n Ensure::isFalse($this->initializer->getRepository() && $this->initializer->getValue(), 'It makes no sense to define initializer repository and value simultaneously for column [%s]', $this->name);\n }\n }"
] | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
cache variable initializer
@param {String} key
@param {String} envKey
@param {Boolean} def
@returns {Boolean} | [
"function initVar (key, envKey, def) {\n var negate = !def;\n switch (true) {\n case cacheObj.hasOwnProperty(key):\n return cacheObj[key];\n case process.env.hasOwnProperty(envGlobalCacheKey):\n return process.env[envGlobalCacheKey] !== '';\n ... | [
"function function_ (options) {\n options.hash.kind = 'function'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find function.'\n}"
] | codesearchnet | {
"query": "Represent the post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
/* jshint ignore: start | [
"function _fn (context, object) {\n return context.customElement(_name, _attributes, _fnBody, context, object);\n }"
] | [
"function esmangleify(opt) {\n\n // options is mostly the escodegen format\n var format = {\n renumber : true,\n hexadecimal: true,\n escapeless : true,\n compact : true,\n semicolons : false,\n parentheses: false\n }\n\n // fail silently allows us to process json (and other non js) files... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Creates whole directory structure.
Structure example: ['dir' => ['subdir' => ['file' => 'content']]].
@param array $structure
@return string Path to root directory | [
"public function createStructure($structure)\n {\n vfsStream::create($this->prepareStructure($structure), $this->getRoot());\n\n return $this->getRootPath();\n }"
] | [
"public function load(Config $config)\n {\n $php = new Service\\PhpService();\n\n foreach ($php->getConfig() as $k => $v) {\n $config->set('php_'.$k, $v);\n }\n\n $config->setDefaultItem('commands', 'loc', ['cmd' => \"!bin/phploc src\", 'description' => \"display code size ... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software Development:"
} |
// IndexByHash returns the index of this transaction hash in the list, or -1 if not found | [
"func (txs Txs) IndexByHash(hash []byte) int {\n\tfor i := range txs {\n\t\tif bytes.Equal(txs[i].Hash(), hash) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}"
] | [
"public static long createFileId(long containerId) {\n long id = BlockId.createBlockId(containerId, BlockId.getMaxSequenceNumber());\n if (id == INVALID_FILE_ID) {\n // Right now, there's not much we can do if the file id we're returning is -1, since the file\n // id is completely determined by the ... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Called when file upload started
@param Input $in Input buffer
@return void | [
"public function onUploadFileStart($in)\n {\n $this->freezeInput();\n FileSystem::tempnam(ini_get('upload_tmp_dir'), 'php', function ($fp) use ($in) {\n if (!$fp) {\n $in->curPart['fp'] = false;\n $in->curPart['error'] = UPLOAD_ERR_NO_TMP_DIR;\n }... | [
"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 Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
Send your visitor packing to another **$url** eg. after a form has been submitted.
@param string $url Either the full url, or just the path.
@param int $http_response_code The status code.
@example
```php
$page->eject('users');
``` | [
"public function eject($url = '', $http_response_code = 302)\n {\n $url = (!empty($url)) ? $this->formatLocalPath($url) : $this->url['base'];\n\n return $this->send(RedirectResponse::create(htmlspecialchars_decode($url), $http_response_code));\n }"
] | [
"protected function configureApp ()\n {\n $this->envData['APP_ENV'] = $this->choice (\"Choose environment. [local|production]\", ['local', 'production'], 0);\n $this->envData['APP_KEY'] = \"\";\n $this->envData['APP_DEBUG'] = $this->confirm (\"Enable debugging?\", 'yes') ? \"true\" : \"f... | codesearchnet | {
"query": "Represent the summarization about Laravel:",
"pos": "Represent the code about Laravel:",
"neg": "Represent the code about Software development:"
} |
Show the tooltip and determine whether to grab the content from an AJAX call,
a DOM node, or plain text. The content can also be passed as an argument.
@param {jQuery} node
@param {String|jQuery} [content] | [
"function(node, content) {\n this.node = node = $(node).addClass('is-active');\n\n // Load the new element\n this.loadElement(node, function(tooltip) {\n tooltip\n .addClass(this.readOption(node, 'position'))\n .attr('role', 'tooltip');\n });\n\n ... | [
"function(element, options) {\n\n var $el = $(element);\n // React on every server/socket.io message.\n // If the element is defined with a data-react-on-event attribute\n // we take that as an eventType the user wants to be warned on this\n // element and we forward the event via jQuery events on $(... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Force Download
@param String
@return Download | [
"public static function forceDownload($file)\r\n {\r\n if (isset($file)&&(file_exists($file))) {\r\n header(\"Content-length: \".filesize($file)); \r\n header('Content-Type: application/octet-stream'); \r\n header('Content-Disposition: attachment; filename=\"' . $file . '\"... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about text processing:",
"pos": "Represent the Github code about text processing:",
"neg": "Represent the Github code:"
} |
Handle export change position event
@param UpdatePositionEvent $updatePositionEvent
@param $eventName
@param EventDispatcherInterface $dispatcher | [
"public function exportChangePosition(UpdatePositionEvent $updatePositionEvent, $eventName, EventDispatcherInterface $dispatcher)\n {\n $this->handler->getExport($updatePositionEvent->getObjectId(), true);\n $this->genericUpdatePosition(new ExportQuery, $updatePositionEvent, $dispatcher);\n }"
] | [
"@Override\n protected void setAdditionalInfoToEventCallBackStruct(EventCallBackStruct callback_struct,\n String device_name, String attribute, String event_name, String[] filters, EventChannelStruct channel_struct) throws DevFailed {\n // Nothing\n ApiUtil.printTrace(\"---... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about N/A:"
} |
Use an InsertAddressHttpRequest object to make an addresses.insert method call. | [
"private static void insertNewAddressUsingRequest(AddressClient client, String newAddressName)\n throws InterruptedException, ExecutionException {\n // Begin samplegen code for insertAddress().\n ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION);\n Address address = Address.newBuil... | [
"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 post about Address:",
"pos": "Represent the code about Address:",
"neg": "Represent the code about Software development:"
} |
Sets this to a scale matrix.
@return a reference to this matrix, for chaining. | [
"public Matrix4 setToScale (IVector3 scale) {\n return setToScale(scale.x(), scale.y(), scale.z());\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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
/* ---------------------------------------------------------------------------
GET node
------------------------------------------------------------------------- | [
"function AvrYamahaNodeGet(config) {\n RED.nodes.createNode(this, config);\n\n // Save settings in local node\n this.device = config.device;\n this.deviceNode = RED.nodes.getNode(this.device);\n this.name = config.name;\n this.topic = config.topic;\n\n var node = this;\n if (this.deviceNode)... | [
"protected static function showVersion()\n {\n \\cli\\line();\n \\cli\\line(\\cli\\Colors::colorize('%y+----------------------------------------------------------------------+%N'));\n \\cli\\line(\\cli\\Colors::colorize('%y| Welcome to Doozr\\'s Demo project installer. ... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Create a new Message from this instance.
@return Message | [
"public function toMessage()\n {\n $m = new Message();\n foreach ($this->queueStatus as $action) {\n $m->push($action['action']);\n $m->push($action['queue']);\n $m->push($action['busy']);\n $m->push($action['available']);\n }\n\n return $m;... | [
"@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 comment about PHP programming:",
"pos": "Represent the code about PHP programming:",
"neg": "Represent the code:"
} |
Add the requested post parameters to the Request.
@param request Request to add post params to | [
"private void addPostParams(final Request request) {\n if (attributes != null) {\n request.addPostParam(\"Attributes\", attributes);\n }\n\n if (assignmentStatus != null) {\n request.addPostParam(\"AssignmentStatus\", assignmentStatus.toString());\n }\n\n if ... | [
"@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
// JujuMongodPath returns the path for the mongod binary
// with the specified version. | [
"func JujuMongodPath(v Version) string {\n\treturn fmt.Sprintf(\"/usr/lib/juju/mongo%d.%d/bin/mongod\", v.Major, v.Minor)\n}"
] | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Technology:"
} |
// MakeHelp generates a help string based on the capabilities of the Command | [
"func MakeHelp(c AutoHelp) string {\n\tusageText := c.Usage()\n\n\t// If the length of Usage() is zero, then assume this is a hidden\n\t// command.\n\tif len(usageText) == 0 {\n\t\treturn \"\"\n\t}\n\n\tdescriptionText := wordwrap.WrapString(c.Description(), 60)\n\tdescrLines := strings.Split(descriptionText, \"\\n... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Set the class to use when calling the API
@param string $api_client The class to use.
@return void
@throws DataSift_Exception_InvalidData | [
"public function setApiClient($api_client)\n {\n if (! class_exists($api_client) || ! method_exists($api_client, 'call')) {\n throw new DataSift_Exception_InvalidData('Class \"' . $api_client . '\" does not exist');\n }\n\n $this->_api_client = $api_client;\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 comment about PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code about Software development:"
} |
Extract the sign (the leftmost bit), exponent (the 11 following bits)
and mantissa (the 52 rightmost bits) from a double.
@see http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Tech/Chapter02/floatingPt.html | [
"public static final long[] getExpAndMantissa(double myDouble) {\r\n\t\tlong lbits = Double.doubleToLongBits(myDouble);\r\n\t\tlong lsign = lbits >>> 63;// 0(+) or 1(-)\r\n\t\tlong lexp = (lbits >>> 52 & ((1 << 11) - 1)) - ((1 << 10) - 1);\r\n\t\tlong lmantissa = lbits & ((1L << 52) - 1);\r\n\t\tlong[] ret = new lo... | [
"def loadtitlefont(self):\n \"\"\"\"\"\"\n if self.titlefont == None:\n# print 'the bloody fonts dir is????', fontsdir\n# print 'pero esto que hace??', os.path.join(fontsdir, \"courR18.pil\")\n# /home/vital/Workspace/pyResources/Scientific_Lib/f2n_fonts/f2n_fonts/co... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Actually replace the object
@author Jelle De Loecker <jelle@develry.be>
@since 0.1.0
@version 1.0.11 | [
"function replaceObject(dryReplacer, value, chain, flags, is_wrap, holder, path, value_paths, key) {\n\n\tvar class_name,\n\t seen_path,\n\t new_value,\n\t replaced,\n\t is_array,\n\t keys,\n\t last,\n\t temp,\n\t len,\n\t i;\n\n\tif (typeof value.constructor == 'function') {\n\t\tclass_n... | [
"public function mapSafariVersion(string $detectedVersion): string\n {\n $regularVersions = [\n 3.0,\n 3.1,\n 3.2,\n 4.0,\n 4.1,\n 4.2,\n 4.3,\n 4.4,\n 5.0,\n 5.1,\n 5.2,\n 6... | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Returns true if object is fully contained within area formed by 2 points
@method isContainedWithinRect
@param {Object} selectionTL
@param {Object} selectionBR
@return {Boolean} | [
"function(selectionTL, selectionBR) {\n var oCoords = this.oCoords,\n tl = new fabric.Point(oCoords.tl.x, oCoords.tl.y),\n tr = new fabric.Point(oCoords.tr.x, oCoords.tr.y),\n bl = new fabric.Point(oCoords.bl.x, oCoords.bl.y),\n br = new fabric.Point(oCoords.br.x, oCoords.br... | [
"def setTopRight(self, loc):\n \n offset = self.getTopRight().getOffset(loc) # Calculate offset from current top right\n return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset"
] | codesearchnet | {
"query": "Represent the Github comment about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
// createNewNotifier creates a new instance of the ChainNotifier interface
// implemented by BitcoindNotifier. | [
"func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) {\n\tif len(args) != 4 {\n\t\treturn nil, fmt.Errorf(\"incorrect number of arguments to \"+\n\t\t\t\".New(...), expected 4, instead passed %v\", len(args))\n\t}\n\n\tchainConn, ok := args[0].(*chain.BitcoindConn)\n\tif !ok {\n\t\treturn ... | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Gets the most current session for given user.<p>
@param user CmsUser to get session for
@return CmsSessionInfo or null if no session is available for user | [
"private CmsSessionInfo getSessionForUser(CmsUser user) {\n\n List<CmsSessionInfo> sessions = OpenCms.getSessionManager().getSessionInfos(user.getId());\n\n if (sessions.isEmpty()) {\n return null;\n }\n\n CmsSessionInfo currentSession = sessions.get(0);\n for (CmsSessi... | [
"@Override\n public IPersonAttributes findPerson(final IPerson searcher, final String username) {\n\n // get the IAuthorizationPrincipal for the searching user\n final IAuthorizationPrincipal principal = getPrincipalForUser(searcher);\n\n // build a set of all possible user attributes the cu... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Recursive path copy for php.
@param string $start_path
@param string $copy_path
@return boolean | [
"public static function copy($start_path, $copy_path, $dir_mode = 0777)\n {\n $return = mkdir($copy_path, $dir_mode, true);\n $files = self::getContent($start_path);\n foreach ($files as $file) {\n if (is_dir($start_path.DIRECTORY_SEPARATOR.$file)) {\n $return = sel... | [
"public function help()\n {\n $style = new Eurekon\\Style(' *** RUN - HELP ***');\n Eurekon\\Out::std($style->color('fg', Eurekon\\Style::COLOR_GREEN)->get());\n Eurekon\\Out::std('');\n\n $help = new Eurekon\\Help('...', true);\n $help->addArgument('', 'directory', 'Config dir... | codesearchnet | {
"query": "Represent the Github comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about NLP:"
} |
Private because it requires a specific format and cant' take a generic list of strings | [
"private static CpuAcctMetric parse(final List<String> lines)\n {\n // File has a header. We skip it\n // See src/test/resources/cpuacct.usage_all for an example\n final int ncpus = lines.size() - 1;\n final long[] usrTime = new long[ncpus];\n final long[] sysTime = new long[ncpus];\n for (int i ... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Check if there is room
@param mixed $context
@return bool | [
"public function canIUse($context = null)\n {\n $poolUsage = $this->cache->get(self::CACHE_KEY) ?: 0;\n $this->logPoolUsage($poolUsage, $context);\n return ($poolUsage < $this->maxItems) ? true : false;\n\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 sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
runAsChild
@param \QueueJitsu\Job\Job $job | [
"private function runAsChild(Job $job): void\n {\n $status = sprintf('Processing ID: %s in %s', $job->getId(), $job->getQueue());\n $this->updateProcLine($status);\n\n $this->log->info($status);\n\n $this->job_manager->run($job);\n\n if ($this->child === 0) {\n exit(... | [
"def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// IndexRange range index by rank | [
"func (eng *engine) IndexRange(index Index, start, stop int64, opts ...RangeOption) (RangeResult, error) {\n\ts := eng.newSession()\n\tdefer s.Close()\n\taction, result, err := s.indexRange(index, start, stop, s.applyRangeOption(opts))\n\tif err != nil {\n\t\treturn nil, s.catch(\"IndexRange: \"+action, err)\n\t}\n... | [
"def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetProviderDetails sets the ProviderDetails field's value. | [
"func (s *CreateIdentityProviderInput) SetProviderDetails(v map[string]*string) *CreateIdentityProviderInput {\n\ts.ProviderDetails = 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 instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
Sets a meta tag on the page
@param array $content | [
"public function setMeta($content)\n {\n $key = '_meta_tags';\n\n if (!isset($this->data[$key])) {\n $this->data[$key] = array();\n }\n\n $this->data[$key][] = $content;\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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Enable mmap of files (default is not enabled) if JVM is 64bits, call before use {@link #open()} | [
"public void enableMmapIfSupported() {\n\t\tif (validState) {\n\t\t\tthrow new InvalidStateException();\n\t\t}\n\t\tuseMmap = Check64bitsJVM.JVMis64bits();\n\t\tif (useMmap) {\n\t\t\tlog.info(\"Enabled mmap on 64bits JVM\");\n\t\t} else {\n\t\t\tlog.info(\"Disabled mmap on 32bits JVM\");\n\t\t}\n\t}"
] | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Sends a HELO/EHLO sequence
@todo Implement TLS
@return bool True if successful, false otherwise | [
"protected function helo()\r\n {\r\n // don't try if it was already done\r\n if ($this->state['helo']) {\r\n return;\r\n }\r\n try {\r\n $this->expect(self::SMTP_CONNECT_SUCCESS, $this->command_timeouts['helo']);\r\n $th... | [
"def send(self, data):\n \n if data is not None:\n data = data.encode(\"UTF-8\")\n\n try:\n self.wfile.write(data)\n self.wfile.flush()\n return True\n\n except IOError:\n # An error occurred, mask it\n # -> This allows to... | codesearchnet | {
"query": "Represent the Github sentence about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code about Software development:"
} |
Keyboard support for the calendar.
@protected
@param {aria.DomEvent} domEvt Key down event | [
"function (domEvt) {\n var domElt = this.getDom();\n if (this.sendKey(domEvt.charCode, domEvt.keyCode)) {\n domEvt.preventDefault(true);\n domElt.focus();\n }\n }"
] | [
"function SelectionField(type, options) {\n Field.call(this, type, options);\n\n this.arg = new Argument();\n\n this.menu = new Menu({\n document: this.document,\n maxPredictions: Conversion.maxPredictions\n });\n this.element = this.menu.element;\n\n this.onFieldChange = util.createEvent('SelectionFiel... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// RegisterCommands registers the resource action CLI commands. | [
"func RegisterCommands(app *cobra.Command, c *client.Client) {\n\tvar command, sub *cobra.Command\n\tcommand = &cobra.Command{\n\t\tUse: \"create\",\n\t\tShort: `create action`,\n\t}\n\ttmp1 := new(CreateAccountCommand)\n\tsub = &cobra.Command{\n\t\tUse: `account [\"/cellar/accounts\"]`,\n\t\tShort: ``,\n\t\tLo... | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Returns Declared field either from given class or it's super class
@param cls
@param fieldname
@return
@throws NoSuchFieldException | [
"public static Field getField(Class cls, String fieldname) throws NoSuchFieldException\r\n {\r\n while (true)\r\n {\r\n try\r\n {\r\n return cls.getDeclaredField(fieldname);\r\n }\r\n catch (NoSuchFieldException ex)\r\n {\r\n ... | [
"public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {\n // in global.jelly, instance==descriptor\n return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
(see Timezone#period_for) | [
"def period_for(time)\n raise ArgumentError, 'time must be specified' unless time\n timestamp = Timestamp.for(time)\n raise ArgumentError, 'time must have a specified utc_offset' unless timestamp.utc_offset\n info.period_for(timestamp)\n end"
] | [
"def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Given the key, returns the entity's name.
@param key java.lang.String | [
"@Override\n public String getName(String key) throws Exception {\n IPortletDefinitionRegistry registry =\n PortletDefinitionRegistryLocator.getPortletDefinitionRegistry();\n\n IPortletDefinition portletDefinition;\n if (StringUtils.isNumeric(key)) {\n portletDefini... | [
"public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Replaces warehouse path to base path, this allow to change a source path
to a target path.
@param string $warehouseFilePath
@return string | [
"protected function toBasePath($warehouseFilePath)\n {\n $target = $this->getBasePath();\n $target .= DIRECTORY_SEPARATOR;\n $target .= str_replace($this->getWarehousePath(), '', $warehouseFilePath);\n\n return $target;\n }"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Check access to an object in the frontend
@param Action $action The action taken on the object
@param mixed $onObject The object; page and contents are currently supported
@return GrantResult Returns the check result | [
"public function Grant(Action $action, $onObject)\n {\n if ($onObject instanceof Page)\n {\n return $this->GrantOnPage($onObject);\n }\n if ($onObject instanceof Content)\n {\n return $this->GrantOnContent($onObject, $action);\n }\n else\n ... | [
"public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software Development:"
} |
Convert raw elevation into normalized values between 0 and 255,
and return a numpy array of these values | [
"def get_normalized_elevation_array(world):\n ''' '''\n\n e = world.layers['elevation'].data\n ocean = world.layers['ocean'].data\n\n mask = numpy.ma.array(e, mask=ocean) # only land\n min_elev_land = mask.min()\n max_elev_land = mask.max()\n elev_delta_land = max_elev_land - min_elev_land\n\... | [
"def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]"
] | codesearchnet | {
"query": "Represent the post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Software development:"
} |
// SetJobStatus sets the JobStatus field's value. | [
"func (s *DominantLanguageDetectionJobProperties) SetJobStatus(v string) *DominantLanguageDetectionJobProperties {\n\ts.JobStatus = &v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
/* ------------------------------------------------------------ | [
"public void readExternal(java.io.ObjectInput in)\n throws java.io.IOException, ClassNotFoundException\n {\n _realmName= (String)in.readObject();\n _config=(String)in.readObject();\n if (_config!=null)\n load(_config);\n }"
] | [
"public function description()\n {\n //====================================================================//\n // Stack Trace\n Splash::log()->trace();\n\n //====================================================================//\n // Build & Return Widget Description Array\n ... | codesearchnet | {
"query": "Represent the Github instruction about N/A:",
"pos": "Represent the Github code about N/A:",
"neg": "Represent the Github code about Software Development:"
} |
create a random string
@return {string} | [
"function randomString() {\n var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8;\n var charset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'abcdefghijklmnopqrstuvwxyz';\n\n var text = '';\n for (var i = 0; i < length; i++) {\n text += char... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
set the active payment method. return true on succes - false if the method is not allowed
Note: you hast set a shipping group first!
@param TdbShopPaymentMethod $oShopPayment
@return bool | [
"public function SetActivePaymentMethod($oShopPayment)\n {\n // make sure the shop payment selected is valid for the shipping group selected\n $bMethodOk = false;\n if (!is_null($oShopPayment)) {\n $oList = $this->GetAvailablePaymentMethods();\n if (!is_null($oList) && ... | [
"public function paymentPage($mdxi)\n {\n $this->integrityCheck();\n\n libxml_use_internal_errors(true);\n\n if (!$mdxi || !$mdxi instanceof Mpay24Order) {\n $this->mpay24Sdk->dieWithMsg(\"To be able to use the Mpay24Api you must create an Mpay24Order object (Mpay24Order.php) and ... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Returns the column options for the inputed table type.
:param tableType | <subclass of orb.Table>
:return [<str>, ..] | [
"def columnOptions( self, tableType ):\r\n \r\n if ( not tableType ):\r\n return []\r\n \r\n schema = tableType.schema()\r\n return map(lambda x: x.name(), schema.columns())"
] | [
"def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Runs installation logic inside a safe transactional thread. This prevent
DB inconsistencies on install failure.
@return bool True on success, false otherwise | [
"protected function _runTransactional()\n {\n // to avoid any possible issue\n snapshot();\n\n if (!$this->_init()) {\n return $this->_reset();\n }\n\n if (!$this->params['no-callbacks']) {\n // \"before\" events occurs even before plugins is moved to its ... | [
"@Override\n public void destroy() // PK20881\n {\n if (tc.isEntryEnabled())\n Tr.entry(tc, \"destroy\");\n\n // Dummy transactionWrappers may not be in any table and so\n // will not have a resourceCallback registered to remove them.\n if (_resourceCallback != null)\n ... | codesearchnet | {
"query": "Represent the Github text about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code about Database management:"
} |
Compute a column-wise dependency matrix for the given relation.
@param sim Dependence measure
@param rel Vector relation
@return Similarity matrix (lower triangular form) | [
"public static double[] computeSimilarityMatrix(DependenceMeasure sim, Relation<? extends NumberVector> rel) {\n final int dim = RelationUtil.dimensionality(rel);\n // TODO: we could use less memory (no copy), but this would likely be\n // slower. Maybe as a fallback option?\n double[][] data = new doub... | [
"def is_stationary(self):\n \"\"\"\n # for disconnected matrices, the stationary distribution depends on the estimator, so we can't compute\n # it directly. Therefore we test whether the initial distribution is stationary.\n return np.allclose(np.dot(self._Pi, self._Tij), self._Pi)"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Hydrate revision with the provided puppet modules data.
@param PuppetModule[] $puppetModules
@param RevisionInterface $revision
@return RevisionInterface | [
"public function hydrate($puppetModules, $revision)\n {\n if ($revision->hasGroups()) {\n foreach ($revision->getGroups() as $group) {\n $this->groupHydrator->hydrate($puppetModules, $group);\n }\n }\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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Manage packages on remote hosts. | [
"def make(parser):\n \n\n action = parser.add_mutually_exclusive_group()\n\n action.add_argument(\n '--install',\n metavar='PKG(s)',\n help='Comma-separated package(s) to install',\n )\n\n action.add_argument(\n '--remove',\n metavar='PKG(s)',\n help='Comma-s... | [
"def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// https://docs.aws.amazon.com/AmazonCloudWatchEvents/latest/APIReference/API_PutPermission.html#API_PutPermission_RequestParameters | [
"func validateCloudWatchEventPermissionPrincipal(v interface{}, k string) (ws []string, es []error) {\n\tvalue := v.(string)\n\tif !regexp.MustCompile(`^(\\d{12}|\\*)$`).MatchString(value) {\n\t\tes = append(es, fmt.Errorf(\"%q must be * or a 12 digit AWS account ID\", k))\n\t}\n\treturn\n}"
] | [
"func s3CustRemoveHeadObjectModeledErrors(a *API) {\n\top, ok := a.Operations[\"HeadObject\"]\n\tif !ok {\n\t\treturn\n\t}\n\top.Documentation += `\n//\n// See http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses\n// for more information on returned errors.`\n\top.ErrorRefs = []Shap... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Yields nth (1-based) element of the array.
@param <E> the array element type
@param count the element cardinality
@param array the array that will be consumed
@return the nth element | [
"public static <E> E nth(long count, E[] array) {\n final Iterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), new Nth<E>(count));\n return new FirstElement<E>().apply(filtered);\n }"
] | [
"function NDDBIndex(idx, nddb) {\n // The name of the index.\n this.idx = idx;\n // Reference to the whole nddb database.\n this.nddb = nddb;\n // Map indexed-item to a position in the original database.\n this.resolve = {};\n // List of all keys in `resolve` object.... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get the XML as an UTF-8 string
:returns: bytes encoded as UTF-8 | [
"def get_xml(self, pretty=True):\n \n return etree.tostring(self.root, encoding=\"utf-8\", pretty_print=pretty)"
] | [
"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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Return the dependencies | [
"def dependencies(request, ident, stateless=False, **kwargs):\n ''\n _, app = DashApp.locate_item(ident, stateless)\n\n with app.app_context():\n view_func = app.locate_endpoint_function('dash-dependencies')\n resp = view_func()\n return HttpResponse(resp.data,\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 Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
/*
(non-Javadoc)
@see
mtas.codec.util.DataCollector.MtasDataItemFull#getDistribution(java.lang.
String) | [
"@Override\n protected HashMap<String, Object> getDistribution(String argument) {\n HashMap<String, Object> result = new LinkedHashMap<>();\n Long start = null;\n Long end = null;\n Long step = null;\n Integer number = null;\n if (argument != null) {\n Matcher m = fpArgument.matcher(argument... | [
"def DeserializeExclusiveData(self, reader):\n \n self.Type = TransactionType.StateTransaction\n\n self.Descriptors = reader.ReadSerializableArray('neo.Core.State.StateDescriptor.StateDescriptor')"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Handle an event received from an adapter. | [
"async def handle_adapter_event(self, adapter_id, conn_string, conn_id, name, event):\n \"\"\"\"\"\"\n\n if name == 'device_seen':\n self._track_device_seen(adapter_id, conn_string, event)\n event = self._translate_device_seen(adapter_id, conn_string, event)\n\n conn_s... | [
"func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// Convert_v1_ImageConfig_To_config_ImageConfig is an autogenerated conversion function. | [
"func Convert_v1_ImageConfig_To_config_ImageConfig(in *v1.ImageConfig, out *config.ImageConfig, s conversion.Scope) error {\n\treturn autoConvert_v1_ImageConfig_To_config_ImageConfig(in, out, s)\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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Determines whether the parsed value is "empty".
@param {*} value
@returns {boolean} | [
"function isEmpty (value) {\n return value === undefined ||\n (typeof value === \"object\" && Object.keys(value).length === 0) ||\n (typeof value === \"string\" && value.trim().length === 0) ||\n (Buffer.isBuffer(value) && value.length === 0);\n}"
] | [
"function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {\n /*\n * if expectations aren't met, args checker will throw appropriate exceptions\n * notifying the user regarding the errors of the arguments.\n * */\n \targs.expect(arguments, ['boolean|string', '*',... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Method to send the entity to default email for the given id in asynchronous fashion
@param entity
@param callbackHandler
@param <T>
@throws FMSException | [
"public <T extends IEntity> void sendEmailAsync(T entity, CallbackHandler callbackHandler) throws FMSException {\n sendEmailAsync(entity,null,callbackHandler);\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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Run jing.jar using the RNG file against the given XML file. | [
"def jing(rng_filepath, *xml_filepaths):\n \"\"\"\"\"\"\n cmd = ['java', '-jar']\n cmd.extend([str(JING_JAR), str(rng_filepath)])\n for xml_filepath in xml_filepaths:\n cmd.append(str(xml_filepath))\n proc = subprocess.Popen(cmd,\n stdin=subprocess.PIPE,\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// SetRouteFilterPrefixes sets the RouteFilterPrefixes field's value. | [
"func (s *NewPublicVirtualInterface) SetRouteFilterPrefixes(v []*RouteFilterPrefix) *NewPublicVirtualInterface {\n\ts.RouteFilterPrefixes = 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 post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Upgrades client protocol.
It's done by replacing whole client class in nodes table.
@param ClientUpgradeException $upgrade
@throws ServerException Old client cannot be found on server (it's serious error) | [
"private function upgradeClient(ClientUpgradeException $upgrade)\n {\n $oldClient = $upgrade->getOldClient();\n\n if (!isset($oldClient->socket, $this->nodes[(int)$oldClient->socket])) {\n $this->logger->emergency(\"Client $oldClient not found during upgrade\");\n throw new Se... | [
"public function flush(): void\n {\n if (empty($this->buffers)) {\n return;\n }\n\n foreach ($this->buffers as $buffer) {\n try {\n $this->sender->sendTo($buffer[0], $buffer[1], $buffer[2]);\n } catch (SenderException $e) {\n if ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Technology:"
} |
Get csv export file of Accounts from Tempo
:return: csv file | [
"def tempo_account_export_accounts(self):\n \n headers = self.form_token_headers\n url = 'rest/tempo-accounts/1/export'\n return self.get(url, headers=headers, not_json_response=True)"
] | [
"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:"
} |
Set the orientation of the slider (horizontal or vertical).
@param integer $orientation A value from the Orientation enumeration.
@throws \InvalidArgumentException If $orientation is not a value from the Orientation enumeration. | [
"public function setOrientation($orientation)\n {\n if (in_array($orientation, Orientation::asArray(), true) === true) {\n $this->orientation = $orientation;\n } else {\n $msg = \"The 'orientation' argument must be a value from the Orientation enumeration.\";\n thro... | [
"public function setShape($shape)\n {\n if (in_array($shape, QtiShape::asArray()) === true) {\n $this->shape = $shape;\n } else {\n $msg = \"The 'shape' argument must be a value from the Shape enumeration, '\" . $shape . \"' given.\";\n throw new InvalidArgumentExce... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Generate authentication string. | [
"def authentication(self):\n \"\"\"\"\"\"\n if self.session.digest:\n authentication = self.session.generate_digest()\n elif self.session.basic:\n authentication = self.session.generate_basic()\n else:\n return ''\n return \"Authorization: \" + aut... | [
"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 text about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
// scan parses the given line and returns a `*DiffIndexEntry` or an error,
// depending on whether or not the parse was successful. | [
"func (s *DiffIndexScanner) scan(line string) (*DiffIndexEntry, error) {\n\t// Format is:\n\t// :100644 100644 c5b3d83a7542255ec7856487baa5e83d65b1624c 9e82ac1b514be060945392291b5b3108c22f6fe3 M foo.gif\n\t// :<old mode> <new mode> <old sha1> <new sha1> <status>\\t<file name>[\\t<file name>]\n\n\tparts := strin... | [
"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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Applies scripts in order, returning number of scripts applied | [
"def apply!(dir)\n Preconditions.check_state(File.directory?(dir),\n \"Dir[%s] does not exist\" % dir)\n\n count = 0\n @scripts.each_pending(dir) do |filename, path|\n count += 1\n if @dry_run\n puts \"[DRY RUN] Applying #{filename}\"\n p... | [
"def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Returns the variable with the provided key from the
table specified by _State.vars_table_name. | [
"def get_var(name, default=None):\n \n alchemytypes = {\"text\": lambda x: x.decode('utf-8'),\n \"big_integer\": lambda x: int(x),\n \"date\": lambda x: x.decode('utf-8'),\n \"datetime\": lambda x: x.decode('utf-8'),\n \"float\": lamb... | [
"def add_reference(self, reftype: str, label: str, target):\n \n\n # The self.data[reftype] dict springs into being during the\n # register_references event handler at startup, which looks in the\n # kb registry for all registered reference names.\n self.data[reftype][label] = tar... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Common operation wrapper | [
"function CommonOperation(operationFunc, callback) {\n this.status = OperationState.Inited;\n this.operationId = -1;\n this._callbackArguments = null;\n var sliceStart = 2;\n if (azureutil.objectIsFunction(callback)) {\n this._userCallback = callback;\n } else {\n this._userCallback = null;\n sliceSt... | [
"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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// ValidateReplicaSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise | [
"func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions.ReplicaSet) error {\n\tif precondition.Size != -1 && replicaSet.Spec.Replicas != precondition.Size {\n\t\treturn PreconditionError{\"replicas\", strconv.Itoa(precondition.Size), strconv.Itoa(replicaSet.Spec.Replicas)}\n\t}\n\tif len(p... | [
"func (f *RecordFlags) AddFlags(cmd *cobra.Command) {\n\tif f == nil {\n\t\treturn\n\t}\n\n\tif f.Record != nil {\n\t\tcmd.Flags().BoolVar(f.Record, \"record\", *f.Record, \"Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If ... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
获取语言定义
@access public
@param string|null $name 语言变量
@param array $vars 变量替换
@param string $range 语言作用域
@return mixed | [
"public function get($string = null, $range = '') {\n if($range) {\n $value = isset($this->range[$range][$string]) ? $this->range[$range][$string] : $string;\n }\n else {\n $value = isset($this->lang[$string]) ? $this->lang[$string] : $string;\n }\n\n return ... | [
"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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Format errors without a type | [
"function format(errors, type) {\n return errors\n .filter(isDefaultError)\n .reduce((accum, error) => (\n accum.concat(displayError(type, error))\n ), []);\n}"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param $address
@return RussianAddress|\Protobuf\Message | [
"public function parseRussianAddress($address)\n {\n $response = $this->doRequest(\n self::RESOURCE_PARSE_RUSSIAN_ADDRESS,\n [\n 'address' => $address\n ]\n );\n\n return RussianAddress::fromStream($response);\n }"
] | [
"def DeserializeExclusiveData(self, reader):\n \n self.Type = TransactionType.StateTransaction\n\n self.Descriptors = reader.ReadSerializableArray('neo.Core.State.StateDescriptor.StateDescriptor')"
] | codesearchnet | {
"query": "Represent the Github sentence about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about Software development:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.