query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Translates a string with underscores into camel case (e.g. first_name -> firstName)
@prototype string public static function toCamelCase(string $str[, bool $capitalise_first_char = false])
@param $str
@param bool $upperFirstChar
@return mixed | [
"public static function toCamelCase($str, $upperFirstChar = false)\n {\n $str = self::strtolower($str);\n\n if ($upperFirstChar) {\n $str = self::ucfirst($str);\n }\n\n return preg_replace_callback('/_+([a-z])/', function ($c) {\n return strtoupper($c[1]);\n ... | [
"protected function parseExpressionHtmlLine( Line$line ):self\n\t{\n\t\t$content= $line->slice(1);\n\n\t\treturn $this->openNode(new StringNode($this,$line))->appendLine(\"<?$content?>\");\n\t}"
] | codesearchnet | {
"query": "Represent the description about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Return the point between two points on N dimensions. | [
"def pt_between_pts(a=(0.0, 0.0), b=(0.0, 0.0), t=0.5):\n '''\n '''\n assert isinstance(a, tuple)\n assert isinstance(b, tuple)\n l_pt = len(a)\n assert l_pt > 1\n assert l_pt == len(b)\n for i in a:\n assert isinstance(i, float)\n for i in b:\n assert isinstance(i, float)\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 about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Returns a "safe" version of the given string - basically only US-ASCII and
numbers. Needed because filenames and titles and such, can't use all characters.
@param string $str
@param bool $strict
@param string $extrachars
@return string | [
"public static function makeSafe($str, $strict = false, $extrachars = '')\n {\n $str = str_replace('&', '', $str);\n\n $delim = '/';\n if ($extrachars != '') {\n $extrachars = preg_quote($extrachars, $delim);\n }\n if ($strict) {\n $slugify = Slugify::... | [
"public function normalizeRules($rules)\n {\n // If you want to use a pipe in a regex, custom message etc,\n // single-quote the string (escaping would be too confusing in regexes):\n //\n // This works with:\n //\n // 'foo?\\'my piped | string\\''\n // \"foo?'my ... | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// Encode returns the ber packet representation | [
"func (c *ControlManageDsaIT) Encode() *ber.Packet {\n\t//FIXME\n\tpacket := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, \"Control\")\n\tpacket.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeManageDsaIT, \"Control Type (\"+ControlTypeMap... | [
"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 instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// BoundSerializedSizeInBytes returns an upper bound on the serialized size in bytes
// assuming that one wants to store "cardinality" integers in [0, universe_size) | [
"func BoundSerializedSizeInBytes(cardinality uint64, universeSize uint64) uint64 {\n\tcontnbr := (universeSize + uint64(65535)) / uint64(65536)\n\tif contnbr > cardinality {\n\t\tcontnbr = cardinality\n\t\t// we can't have more containers than we have values\n\t}\n\theadermax := 8*contnbr + 4\n\tif 4 > (contnbr+7)/... | [
"long storeSpaceForAdd() {\n return LinkedList.maximumSerializedSize() // List header.\n + 3 * LinkedList.Link.maximumSerializedSize() // Current,Previous,Next links. \n + 4 * owningToken.objectStore.getAddSpaceOverhead() // Store overhead for all of the above.\n + ... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Choose the pool
@param InputInterface $input Input interface
@param OutputInterface $output Output interface
@see Command
@return mixed | [
"protected function interact(InputInterface $input, OutputInterface $output)\n {\n if (!$input->getArgument('pool')) {\n $pool = (new InteractHelper())->askForPool($this, $input, $output);\n $input->setArgument('pool', $pool);\n }\n }"
] | [
"public static function console()\n {\n self::init();\n\n /*\n * Get the command line parameters.\n */\n $argv = $_SERVER['argv'];\n array_shift($argv); // strip the application name (\"console\")\n\n /*\n * Dispatch the command line request.\n *... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Render the running_content_front_matter_left input.
@param array $args | [
"function renderRunningContentFrontMatterLeftField( $args ) {\n\t\tunset( $args['label_for'], $args['class'] );\n\t\t$this->renderCustomSelect(\n\t\t\t[\n\t\t\t\t'id' => 'running_content_front_matter_left',\n\t\t\t\t'name' => 'running_content_front_matter_left',\n\t\t\t\t'value' => getset( $this->options, 'running_... | [
"def single(self):\n \n return 'display: none;' not in self._looking_for_xpb.li(id='ajax_single').\\\n one_(self._profile.profile_tree).attrib['style']"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
setDb
@param AbstractDatabaseDriver $db
@return void | [
"public static function setDefaultDbo(AbstractDatabaseDriver $db = null)\n {\n self::$db = $db;\n\n if ($db) {\n $driver = $db->getName();\n\n self::$instances[$driver] = $db;\n }\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
CWL target for quantitation.
XXX Needs to be split and parallelized by expression caller, with merging
of multiple calls. | [
"def quantitate(data):\n \n data = to_single_data(to_single_data(data))\n data = generate_transcript_counts(data)[0][0]\n data[\"quant\"] = {}\n if \"sailfish\" in dd.get_expression_caller(data):\n data = to_single_data(sailfish.run_sailfish(data)[0])\n data[\"quant\"][\"tsv\"] = data[\... | [
"def set_identifiers(self, data):\n \n for id_info in self._details.identifiers:\n var_name = id_info['var_name']\n self._data[var_name] = data.get(var_name)\n\n # FIXME: This needs to likely kick off invalidating/rebuilding\n # relations.\n # F... | codesearchnet | {
"query": "Represent the Github description about Go programming language:",
"pos": "Represent the Github code about Go programming language:",
"neg": "Represent the Github code about programming:"
} |
Content of the response, in bytes. | [
"def content(self):\n \"\"\"\"\"\"\n\n if self._content is False:\n # Read the contents.\n if self._content_consumed:\n raise RuntimeError(\n 'The content for this response was already consumed')\n\n if self.status_code == 0 or self.ra... | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
This is used to display the title of the current object (normally a page) in the browser's titlebar. | [
"def browser_title(yield_title = nil)\n [\n yield_title,\n @meta.browser_title.presence || @meta.path,\n Refinery::Core.site_name\n ].reject(&:blank?).join(\" - \")\n end"
] | [
"def get_render_language(contentitem):\n \n plugin = contentitem.plugin\n\n if plugin.render_ignore_item_language \\\n or (plugin.cache_output and plugin.cache_output_per_language):\n # Render the template in the current language.\n # The cache also stores the output under the current lang... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Language and programming:"
} |
group = "(" *c-wsp alternation *c-wsp ")" | [
"function group() {\n var ret = this.seq(\n this.stringf('('),\n this.manyf(c_wsp),\n alternation,\n this.manyf(c_wsp),\n this.stringf(')'));\n return new ast.Group(ret[3]);\n}"
] | [
"function atom() {\n return wrap('atom', and(colwsp(opt(cfws)), star(atext, 1), colwsp(opt(cfws)))());\n }"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Raise warning.
Parameters
----------
filepath : path-like
Given filepath.
expected : string
Expected file suffix. | [
"def warn(filepath, expected):\n \n filepath = pathlib.Path(filepath)\n message = \"file {0} has type {1} (expected {2})\".format(\n filepath, filepath.suffix, expected\n )\n warnings.warn(message, WrongFileTypeWarning)"
] | [
"def _unpack_list(example):\n \n try:\n x = example[0]\n y = example[1]\n meta = None\n return x, y, meta\n except IndexError:\n raise IndicoError(\n \"Invalid input data. Please ensure input data is \"\n \"formatted as a list of `[data, target]` pa... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// SetFleetArn sets the FleetArn field's value. | [
"func (s *UpdateCompanyNetworkConfigurationInput) SetFleetArn(v string) *UpdateCompanyNetworkConfigurationInput {\n\ts.FleetArn = &v\n\treturn s\n}"
] | [
"@NotNull\n @ApiModelProperty(required = true, value = \"Key-value pairs to add as custom property into alert. You can refer here for example values\")\n public Map<String, String> getDetails() {\n return details;\n }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// Start the polling of the events on the URL defined in the client
// Will send the events in the EventsChan of the client | [
"func (c *Client) Start() {\n\tu := c.url\n\tif c.LoggingEnabled {\n\t\tlog.Println(\"Now observing changes on\", u.String())\n\t}\n\n\tatomic.AddUint64(&(c.runID), 1)\n\tcurrentRunID := atomic.LoadUint64(&(c.runID))\n\n\tgo func(runID uint64, u *url.URL) {\n\t\tsince := time.Now().Unix() * 1000\n\t\tfor {\n\t\t\tp... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
{@inheritDoc}
@see \common_persistence_AdvKvDriver::hGetAll() | [
"public function hGetAll($key)\n {\n $this->log(__FUNCTION__, $key);\n return $this->persistence->hGetAll($key);\n }"
] | [
"def addLocalCacheService(self):\n \"\"\n _cache = self.getCacheService()\n _cache.setName('cache_proxy')\n _cache.setServiceParent(self.hendrix)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
If not already created, a new <code>around-timeout</code> element will be created and returned.
Otherwise, the first existing <code>around-timeout</code> element will be returned.
@return the instance defined for the element <code>around-timeout</code> | [
"public AroundTimeoutType<SessionBeanType<T>> getOrCreateAroundTimeout()\n {\n List<Node> nodeList = childNode.get(\"around-timeout\");\n if (nodeList != null && nodeList.size() > 0)\n {\n return new AroundTimeoutTypeImpl<SessionBeanType<T>>(this, \"around-timeout\", childNode, nodeList.ge... | [
"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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Asynchronous callback | [
"function onAudioLoad(e) {\n if (audio.soundSource === undefined) {\n // create a sound source\n audio.soundSource = audio.context.createMediaElementSource(audio.element);\n } else {\n audio.soundSource.disconnect();\n }\n\n // Connectors\n audio.soundSource.connect(audio.analyser);\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Converts microseconds to Duration. | [
"def FromMicroseconds(self, micros):\n \"\"\"\"\"\"\n self._NormalizeDuration(\n micros // _MICROS_PER_SECOND,\n (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND)"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Method called to create an actual element definition, matching
an ELEMENT directive in a DTD subset. | [
"public static DTDElement createDefined(ReaderConfig cfg, Location loc, PrefixedName name,\n StructValidator val, int allowedContent)\n {\n if (allowedContent == XMLValidator.CONTENT_ALLOW_UNDEFINED) { // sanity check\n ExceptionUtil.throwInternal(\"try... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Get notifications configured for the given bucket.
:param bucket_name: Bucket name. | [
"def get_bucket_notification(self, bucket_name):\n \n is_valid_bucket_name(bucket_name)\n\n response = self._url_open(\n \"GET\",\n bucket_name=bucket_name,\n query={\"notification\": \"\"},\n )\n data = response.data.decode('utf-8')\n retur... | [
"def from_bucket(cls, connection, bucket):\n \"\"\"\"\"\"\n if bucket is None:\n raise errors.NoContainerException\n\n # It appears that Amazon does not have a single-shot REST query to\n # determine the number of keys / overall byte size of a bucket.\n return cls(conne... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about AWS S3:"
} |
Returns a {@link NameID} that its name format equals to the specified {@code expectedFormat},
from the {@link Response}. | [
"public static Optional<NameID> getNameId(Response response, SamlNameIdFormat expectedFormat) {\n return getNameId(response, nameId -> nameId.getFormat().equals(expectedFormat.urn()));\n }"
] | [
"public static IGroupMember getGroupMember(String key, Class<?> type) throws GroupsException {\n /*\n * WARNING: The 'type' parameter is not the leafType; you're obligated\n * to say whether you want a group or a non-group (i.e. some type of\n * entity). In fact, the underlying imp... | codesearchnet | {
"query": "Represent the Github post about text processing:",
"pos": "Represent the Github code about text processing:",
"neg": "Represent the Github code about Software development:"
} |
def getLeapMonthOffset(a11, timeZone): Find the index of the leap month
after the month starting on the day a11. | [
"def getLeapMonthOffset(a11, timeZone):\n ''''''\n k = int((a11 - 2415021.076998695) / 29.530588853 + 0.5)\n last = 0\n i = 1 # start with month following lunar month 11\n arc = getSunLongitude(\n getNewMoonDay(k + i, timeZone), timeZone)\n while True:\n last = arc\n i += 1\n... | [
"func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about datetime:"
} |
// IsVendorDir tells if the specified directory is a vendor directory. | [
"func IsVendorDir(dir string) bool {\n\treturn strings.HasPrefix(dir, \"vendor/\") || strings.Contains(dir, \"/vendor/\")\n}"
] | [
"void appendGoogRequiresTo(StringBuilder sb) {\n for (GoogRequire require : googRequires.values()) {\n // TODO(lukes): we need some namespace management here... though really we need namespace\n // management with all declarations... The problem is that a require could introduce a name\n // alias ... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
View list of edits (edit/delete actions).
@since 2.0.?
@access public
@param int $Page Page number. | [
"public function Edits($Type = '', $Page = '', $Op = FALSE) {\n $this->Permission('Garden.Moderation.Manage');\n list($Offset, $Limit) = OffsetLimit($Page, 10);\n $this->SetData('Title', T('Change Log'));\n\n $Operations = array('Edit', 'Delete', 'Ban');\n if ($Op && in_array(ucfirst($Op), ... | [
"public static function all($params = null, $opts = null)\n {\n $msg = \"Subscription Schedule Revisions cannot be listed without a Subscription Schedule ID. \" .\n \"List those using \\$schedule->allRevisions('revision_id') instead.\";\n throw new Error\\InvalidRequest($msg, null);\n... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about PHP:"
} |
Resize the mesh to given size for each axis.
@param mesh Mesh to be resized.
@param xsize Size for x-axis.
@param ysize Size for y-axis.
@param zsize Size fof z-axis. | [
"public static void resize(GVRMesh mesh, float xsize, float ysize, float zsize) {\n float dim[] = getBoundingSize(mesh);\n\n scale(mesh, xsize / dim[0], ysize / dim[1], zsize / dim[2]);\n }"
] | [
"function(props) {\n props = defaultValue(props, {});\n\n this.title = props.title;\n\n /**\n * Gets or sets the list of items, ordered from bottom to top, with properties:\n * * `color`: CSS color description,\n * * `lineColor`: CSS color description,\n * * `multipleColors`: An array of CSS color descri... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Adds list of methods for the plugin based on the plugin interface.
@param &$data
The data for a single plugin type. | [
"protected function addPluginMethods(&$data) {\n // Set an empty array at the least.\n $data['plugin_interface_methods'] = [];\n\n if (empty($data['plugin_interface'])) {\n // If we didn't find an interface for the plugin, we can't do anything\n // here.\n return;\n }\n\n // Analyze th... | [
"@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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get batches data and shuffle. | [
"def get_batches(qp_pairs, batch_size, need_sort=True):\n '''\n \n '''\n if need_sort:\n qp_pairs = sorted(qp_pairs, key=lambda qp: (\n len(qp['passage_tokens']), qp['id']), reverse=True)\n batches = [{'qp_pairs': qp_pairs[i:(i + batch_size)]}\n for i in range(0, len(q... | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Register registers a handler constructor to be called upon a request arrival
// at the specified URI. The new handler made by this constructor is then used
// to handle the request. | [
"func (t *Mux) Register(uri string, h func() Handler) {\n\ta := &adapter{handler: h, log: t.log}\n\tt.handlers = append(t.handlers, a)\n\tt.mux.Handle(uri, a)\n}"
] | [
"protected WsMessageRouterImpl getMessageRouter() {\n if (msgRouter == null) {\n // First activation.\n msgRouter = MessageRouterSingleton.singleton;\n\n // Pass the MessageRouter to the TrService via the TrConfigurator.\n TrConfigurator.setMessageRouter(msgRouter)... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Set default labels
Create an labels array and implement default singular and plural labels
@return $this | [
"protected function setDefaultLabels()\n {\n $this->labels = [\n 'name' => _x($this->many, 'Post type general name', $this->i18n),\n 'singular_name' => _x($this->one, 'Post type singular name', $this->i18n),\n 'menu_name' => _x($this->m... | [
"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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
yields each element. each yielded element is the result of self[index]
for each index of the instance (see #[]).
returns an Enumerator if no block is given.
@yield [Object] each element of this JSI array
@return [self, Enumerator] | [
"def each\n return to_enum(__method__) { instance.size } unless block_given?\n instance.each_index { |i| yield(self[i]) }\n self\n end"
] | [
"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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// EndpointGet returns endpoint by ID | [
"func (c *Client) EndpointGet(id string) (*models.Endpoint, error) {\n\tparams := endpoint.NewGetEndpointIDParams().WithID(id).WithTimeout(api.ClientTimeout)\n\tresp, err := c.Endpoint.GetEndpointID(params)\n\tif err != nil {\n\t\t/* Since plugins rely on checking the error type, we don't wrap this\n\t\t * with Hin... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Return all descendants of the given node in the given tree model
(not including the given node!)
@param treeModel The tree model
@param node The node
@return The descendants | [
"public static List<Object> getAllDescendants(\r\n TreeModel treeModel, Object node)\r\n {\r\n List<Object> result = new ArrayList<Object>();\r\n getAllDescendants(treeModel, node, result);\r\n result.remove(node);\r\n return result;\r\n }"
] | [
"def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
returns a StringGrabber value specified by index <br>
even if index is less than 0 or index is beyond the size of list, safely
returns the empty string.
@param index
@return | [
"public StringGrabber get(int index) {\r\n\r\n if (index < 0) {\r\n\r\n return new StringGrabber();\r\n\r\n } else if (index > size() - 1) {\r\n\r\n return new StringGrabber();\r\n\r\n } else {\r\n\r\n return mSgList.get(index);\r\n\r\n }\r\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:"
} |
Gets a new instance of the {@link HighlightErrorConverter} with the
specified options.
@param config The current configuration
@param options The pattern options
@return The new instance | [
"public static HighlightErrorConverter newInstance(Configuration config, String[] options) {\n if (options.length != 1) {\n LOGGER.error(\"Incorrect number of options on highlightError. Expected 1 received \" + options.length);\n return null;\n }\n if (options[0] == null) ... | [
"@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 Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Sets the group name data
@param group index information array
@param groupstring name information array
@return false if there is a data error | [
"boolean setGroup(char group[], byte groupstring[])\n {\n if (group != null && groupstring != null && group.length > 0 &&\n groupstring.length > 0) {\n m_groupinfo_ = group;\n m_groupstring_ = groupstring;\n return true;\n }\n return false;\n }"... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// parseHeaders checks a response for errors and translates into
// standard errors if necessary. If an error is returned, resp.Body
// has been drained and closed. | [
"func (c *Connection) parseHeaders(resp *http.Response, errorMap errorMap) error {\n\tif errorMap != nil {\n\t\tif err, ok := errorMap[resp.StatusCode]; ok {\n\t\t\tdrainAndClose(resp.Body, nil)\n\t\t\treturn err\n\t\t}\n\t}\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\tdrainAndClose(resp.Body, nil)\n... | [
"public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Queries for a single result-set
@param string $column Optionally can be filtered by a column
@param integer $mode Fetch mode. Can be overridden when needed
@return mixed | [
"public function query($column = null, $mode = null)\n {\n if (is_null($mode)) {\n $mode = $this->pdo->getAttribute(PDO::ATTR_DEFAULT_FETCH_MODE);\n }\n\n $result = array();\n $rows = $this->getStmt()->fetch($mode);\n\n if ($column !== null) {\n if (isset(... | [
"protected function getSingleFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())\n {\n // booleans were handled here. They are now handled as complextypes\n\n // q: do we really want this to happen by default on all scalar field values?\n //... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Rewrite key in all targets (from index if necessary) to replace old with new | [
"def rewrite_refs( targets, old,new, index, key='refs', single_ref=False ):\n \"\"\"\"\"\"\n for parent in targets:\n if not isinstance( parent, dict ):\n try:\n parent = index[parent]\n except KeyError, err:\n continue \n rewrite_references( p... | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
// AddSubCommand adds a subcommand to a command | [
"func (cmd *CLI) AddSubCommand(subcmd *SubCommand) *SubCommand {\n\tsubcmd.ErrorHandling = cmd.ErrorHandling\n\tcmd.subCommands.Add(subcmd.name, subcmd)\n\tif subcmd.parent != nil {\n\t\tpanic(\"command already assigned\")\n\t}\n\tif &subcmd.CLI == cmd {\n\t\tpanic(\"cannot assign subcmd to itself as a subcmd\")\n\... | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Extract directory path from URL, e.g. hdfs://hostname:9000/a/b/c => /a/b/c | [
"private String extractPathFromUrl(String url) {\n String path = url.replaceAll(\".+://.+?(?=/)\", \"\");\n if (!path.startsWith(\"/\")) {\n throw new RuntimeException(\"Path must start with '/': \" + path);\n }\n return path;\n }"
] | [
"List<File> findNonJdkJars() throws IOException, SAXException, XPathExpressionException, ParserConfigurationException {\n Enumeration<URL> manifests = LibraryVersions.class.getClassLoader().getResources(\"META-INF/MANIFEST.MF\");\n String javaHome = System.getProperty(\"java.home\");\n List<Fil... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// ListenForSignal Manage death of application by signal. | [
"func (d *Death) listenForSignal() {\n\tdefer d.wg.Done()\n\tfor {\n\t\tselect {\n\t\tcase <-d.sigChannel:\n\t\t\treturn\n\t\tcase <-d.callChannel:\n\t\t\treturn\n\t\t}\n\t}\n}"
] | [
"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 summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// SetDatabaseName sets the DatabaseName field's value. | [
"func (s *BatchDeleteTableVersionInput) SetDatabaseName(v string) *BatchDeleteTableVersionInput {\n\ts.DatabaseName = &v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Add fields to a table row
@param array $source
@param array $spec
@param array $dest
@access protected
@return void | [
"protected function addFields($source,$spec,&$dest)\n {\n if (isset($spec['fields']))\n {\n foreach ($spec['fields'] as $f)\n {\n if(isset($f['temporary']) && $f['temporary'] === true)\n {\n if(!in_array($f['fieldName'], $this->... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Adds the mapping with the duration to the statistics.
@return this instance. | [
"public ResourceModelStatistics countMappingDuration(int durationInMs) {\n // The right-hand interval boundaries are pre-calculated. We start at the smallest (1) of the\n // interval [0, 1). Thus, when our value is less than the boundary, we know it is in the current interval (i),\n // as the r... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Graceful shutdown of test calls this, then #verifyThreadsStopped | [
"@Override\n public void tellThreadsToStop() {\n super.tellThreadsToStop();\n for (DynamicThread thread : poolThreads) {\n stopThread(thread.getThreadName(), true);\n }\n }"
] | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@param array $globalConstraints
@return string | [
"public function compileRegex(array $globalConstraints): string\n {\n $url = $this->extractInlineContraints($this->url, 'constraints');\n\n $regex = \\preg_replace('/\\{(\\w+?)\\}/', '(?P<$1>[^/]++)', $url);\n\n $constraints = \\array_merge($globalConstraints, $this->constraints);\n\n ... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncPolicyAutomated. | [
"func (in *SyncPolicyAutomated) DeepCopy() *SyncPolicyAutomated {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SyncPolicyAutomated)\n\tin.DeepCopyInto(out)\n\treturn out\n}"
] | [
"func (cip *cachedSelectorPolicy) Consume(owner policy.PolicyOwner, cache cache.IdentityCache) *policy.EndpointPolicy {\n\t// TODO: This currently computes the EndpointPolicy from SelectorPolicy\n\t// on-demand, however in future the cip is intended to cache the\n\t// EndpointPolicy for this Identity and emit datap... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Set the entity behaviors.
@param array $behaviors | [
"protected function setEntityBehaviors($behaviors)\n {\n $this->entityLocalBehaviors = $behaviors;\n $cache = $this->getCache();\n if ($cache) {\n $tagDependencyConfig = ['tags' => [$this->getEntityBehaviorsCacheTag()]];\n $tagDependency = new TagDependency($tagDependen... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Collecticons compile wrapped for use in the CLI tool. | [
"async function compileProgram (dirPath, command) {\n await validateDirPathForCLI(dirPath);\n const params = pick(command, [\n 'fontName',\n 'sassPlaceholder',\n 'cssClass',\n 'fontTypes',\n 'styleFormats',\n 'styleDest',\n 'styleName',\n 'fontDest',\n 'authorName',\n 'authorUrl',\n ... | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Computes the center of the viewport's Mandelbrot-space coordinates.
:param params: Current application parameters.
:type params: params.Params | [
"def update_position(params):\n \n cx = params.plane_x0 + params.plane_w / 2.0\n cy = params.plane_y0 + params.plane_h / 2.0\n params.mb_cx, params.mb_cy = get_coords(cx, cy, params)"
] | [
"def getPDF(self):\n '''\n '''\n\n if hasattr(self, '_qplot'):\n\n return self._qplot, self._hplot, self._tplot\n\n else:\n raise ValueError('''The metric has not been evaluated at any\n design point so the PDF cannot get obtained''')"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
// SetSnapshotDownloadUrl sets the SnapshotDownloadUrl field's value. | [
"func (s *GetDeployablePatchSnapshotForInstanceOutput) SetSnapshotDownloadUrl(v string) *GetDeployablePatchSnapshotForInstanceOutput {\n\ts.SnapshotDownloadUrl = &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 post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Check if `input` is a string and if so, either
refer to the global scope or `require` it. Then
call `loa` again in case the exported object
is a function.
@param {Mixed} input
@api private | [
"function str(input) {\n if (!is('String', input)) return;\n return root[input] || (root.require || require)(input);\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 Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
/*
(non-Javadoc)
@see org.mobicents.protocols.api.Management#start() | [
"@Override\n public void start() throws Exception {\n if (this.started) {\n logger.warn(String.format(\"management=%s is already started\", this.name));\n return;\n }\n\n synchronized (this) {\n this.persistFile.clear();\n\n if (persistDir != null)... | [
"private void addRestResourceClasses(Set<Class<?>> resources) {\n resources.add(pl.setblack.airomem.direct.banksample.rest.BankResource.class);\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetBeforePath sets the BeforePath field's value. | [
"func (s *GetDifferencesInput) SetBeforePath(v string) *GetDifferencesInput {\n\ts.BeforePath = &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:"
} |
// Force prune any (terminal) tasks that match the query. If no statuses are supplied with the
// query, it will default to all terminal task states. If statuses are supplied, they must be
// terminal states.
//
// Parameters:
// - Query | [
"func (p *AuroraAdminClient) PruneTasks(ctx context.Context, query *TaskQuery) (r *Response, err error) {\n var _args350 AuroraAdminPruneTasksArgs\n _args350.Query = query\n var _result351 AuroraAdminPruneTasksResult\n if err = p.Client_().Call(ctx, \"pruneTasks\", &_args350, &_result351); err != nil {\n ret... | [
"func (d *Docker) TOML() string {\n\treturn fmt.Sprintf(`[[inputs.%s]]\t\n ## Docker Endpoint\n ## To use TCP, set endpoint = \"tcp://[ip]:[port]\"\n ## To use environment variables (ie, docker-machine), set endpoint = \"ENV\"\n ## exp: unix:///var/run/docker.sock\n endpoint = \"%s\"\n\n ## Set to true ... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
// MonthNarrow returns the locales narrow month given the 'month' provided | [
"func (he *he_IL) MonthNarrow(month time.Month) string {\n\treturn he.monthsNarrow[month]\n}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Create an instance of {@link JAXBElement }{@code <}{@link StringOrRefType }{@code >}
@param value
Java instance representing xml element's value.
@return
the new instance of {@link JAXBElement }{@code <}{@link StringOrRefType }{@code >} | [
"@XmlElementDecl(namespace = \"http://www.opengis.net/gml\", name = \"LocationString\")\n public JAXBElement<StringOrRefType> createLocationString(StringOrRefType value) {\n return new JAXBElement<StringOrRefType>(_LocationString_QNAME, StringOrRefType.class, null, value);\n }"
] | [
"@XmlElementDecl(namespace = \"http://www.opengis.net/gml\", name = \"_Curve\", substitutionHeadNamespace = \"http://www.opengis.net/gml\", substitutionHeadName = \"_GeometricPrimitive\")\n public JAXBElement<AbstractCurveType> create_Curve(AbstractCurveType value) {\n return new JAXBElement<AbstractCurve... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Add clause to match the relationship we want to delete | [
"private function matchRelationship(\n Identity $identity,\n object $entity,\n Query $query\n ): Query {\n $meta = ($this->metadata)(\\get_class($entity));\n $name = $this->name->sprintf(\\md5($identity->value()));\n $this->variables = $this->variables->add((string) $nam... | [
"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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Creates a base custom element class.
@param {!Window} win The window in which to register the custom element.
@return {!Function} | [
"function createBaseCustomElementClass(win) {\n if (win.BaseCustomElementClass) {\n return win.BaseCustomElementClass;\n }\n const htmlElement = win.HTMLElement;\n /** @abstract @extends {HTMLElement} */\n class BaseCustomElement extends htmlElement {\n /**\n * @see https://github.com/WebReflection/d... | [
"function(name, extendee) { \n var info = {\n prototype: this.prototype\n }\n // native element must be specified in extends\n var typeExtension = this.findTypeExtension(extendee);\n if (typeExtension) {\n info.extends = typeExtension;\n }\n // register the prototype... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Generate the plugin resolver set. Optionally provide specification names (short or
full) that should be ignored
@param [Pathname] path to plugins
@param [Array<String>] gems to skip
@return [PluginSet] | [
"def generate_plugin_set(*args)\n plugin_path = args.detect{|i| i.is_a?(Pathname) } || plugin_gem_path\n skip = args.detect{|i| i.is_a?(Array) } || []\n plugin_set = PluginSet.new\n @logger.debug(\"Generating new plugin set instance. Skip gems - #{skip}\")\n Dir.glob(plugin_path.join('speci... | [
"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 sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Combines an arbitrary length list of ranges into a single slice. | [
"def _combine_lists_of_ranges_on_length(self, data_len, first, *range_list):\n '''\n \n '''\n current_range = first\n for next_range in range_list:\n current_range = self._combine_ranges_on_length(data_len, current_range, next_range)\n return current_range"
] | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github post about Text analysis:",
"pos": "Represent the Github code about Text analysis:",
"neg": "Represent the Github code:"
} |
// Reset resets the Buffer's slices len to 0 so that they can be re-used. | [
"func (b *Buffer) Reset() {\n\tb.Line = b.Line[:0]\n\tb.Val = b.Val[:0]\n}"
] | [
"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 text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about File management:"
} |
Creates new `Connection` object
@param uri URI of SyncSocket server (e.g. http://localhost:5579)
@constructor
@public | [
"function Connection(uri) {\n this.channels = {};\n let version = require('../package.json').version;\n let opts = {\n query: 'instanceId=' + 'js_cli_' + version,\n 'sync disconnect on unload': true,\n path: '/syncsocket'\n };\n this.socket = io.connect(uri, opts);\n this.bind... | [
"def do_initial_operations(self):\n \n if not self.request_hc_path_corresponds():\n # the http URI of the request is not the same of the one specified by the admin for the hc proxy,\n # so I do not answer\n # For example the admin setup the http proxy URI like: \"http:... | codesearchnet | {
"query": "Represent the sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Parses the query string looking for supplied request parameters. Places
anything useful into this object's Controller properties.
@param int $FolderDepth | [
"protected function AnalyzeRequest(&$Request) {\r\n \r\n // Here is the basic format of a request:\r\n // [/application]/controller[/method[.json|.xml]]/argn|argn=valn\r\n\r\n // Here are some examples of what this method could/would receive:\r\n // /application/controller/method/argn\r\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 Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Parse metafile and check pre-conditions. | [
"def parse(self):\n \n try:\n if not os.path.getsize(self.ns.pathname):\n # Ignore 0-byte dummy files (Firefox creates these while downloading)\n self.job.LOG.warn(\"Ignoring 0-byte metafile '%s'\" % (self.ns.pathname,))\n return\n sel... | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Get public url for the given path
@param string $path The path to expose
@param boolean $absolute Whether or not the url should be absolute
@return string | [
"public function getPublicUrl($path, $absolute = false)\n {\n return sprintf('%s/%s', $absolute ? $this->root : null, ltrim($path, '/'));\n }"
] | [
"public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key.... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
This is the core function to write an ssh node. Does not close src. | [
"public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {\n ChannelSftp sftp;\n\n try {\n sftp = alloc();\n try {\n sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);\n } finally {\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 writing:",
"pos": "Represent the code about writing:",
"neg": "Represent the code about programming:"
} |
Fetch the URL we want to redirect to, excluding query string parameters. This may
be the same URL (with a token to be added outside this method), or to a different
URL if the current one has been suppressed
@return string | [
"public function getRedirectUrlBase()\n {\n // URLConfirmationTokens may alter the URL to suppress the URL they're protecting,\n // so we need to ensure they're inspected last and therefore take priority\n $tokens = iterator_to_array($this->filteredTokens(), false);\n usort($tokens, f... | [
"def uri_from(url)\n # This will raise an InvalidURIError if the URL is very wrong. It will\n # still pass for strings like \"foo\", though.\n url = URI(url)\n\n # We need to check if the URL was either http://, https:// or ftp://,\n # because these are the only ones we can download from. o... | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Get a module instance
@param string type
@param string name
@return Module | [
"public static function get($type, $name)\n {\n\n return ModuleCompiler::get($type, $name) ?: static::where('type', $type)->where('name', $name)->first();\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
We use the string type hint as our default in templates
This method will then replace those with the updated type
@param string $filePath
@param string $type
@param string $dbalType
@param bool $isNullable | [
"public function replaceTypeHintsInFile(\n string $filePath,\n string $type,\n string $dbalType,\n bool $isNullable\n ): void {\n $contents = \\ts\\file_get_contents($filePath);\n\n $search = [\n ': string;',\n '(string $',\n ': string {'... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// NewHTTPHandler returns an HTTP handler that makes a set of endpoints
// available on predefined paths. | [
"func NewHTTPHandler(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) http.Handler {\n\t// Zipkin HTTP Server Trace can either be instantiated per endpoint with a\n\t// provided operation name or a global tracing service can be instantiated\n\t// without ... | [
"func NewHTTPCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command {\n\tcom, err := cobrafy.Command(http.NewMain())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcom.Use = `http`\n\tcom.Short = `listens for and indexes arbitrary JSON data in Pilosa`\n\tcom.Long = `\npdk http listens for and indexes arbitra... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Pass through to provider ResourceLookupSession.use_plenary_resource_view | [
"def use_plenary_resource_view(self):\n \"\"\"\"\"\"\n self._object_views['resource'] = PLENARY\n # self._get_provider_session('resource_lookup_session') # To make sure the session is tracked\n for session in self._get_provider_sessions():\n try:\n session.use_p... | [
"def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns <tt>true</tt> if this map contains a mapping for the specified
key.
@param key the key whose presence in this map is to be tested
@return <tt>true</tt> if this map contains a mapping for the specified
key | [
"public boolean containsKey(Object key) {\n return isValidKey(key) && vals[((Enum<?>)key).ordinal()] != null;\n }"
] | [
"@Override\n public void putAll(Map<? extends K, ? extends V> m) {\n\tfor (Map.Entry<? extends K, ? extends V> e: m.entrySet())\n\t put(e.getKey(), e.getValue());\n }\n\n /**\n * Removes the key (and its corresponding value) from this map. This method does nothing if the key\n * is not in the ma... | codesearchnet | {
"query": "Represent the sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Concatenates two DataTables together, as long as column names
are identical (ignoring order). The resulting DataTable's columns
are in the order of the table whose `concat` method was called. | [
"def concat(self, other_datatable, inplace=False):\n \n if not isinstance(other_datatable, DataTable):\n raise TypeError(\"`concat` requires a DataTable, not a %s\" %\n type(other_datatable))\n\n # if the self table is empty, we can just return the other ta... | [
"function createGraph(options) {\n // Graph structure is maintained as dictionary of nodes\n // and array of links. Each node has 'links' property which\n // hold all links related to that node. And general links\n // array is used to speed up all links enumeration. This is inefficient\n // in terms of memory,... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Run the Eclat algorithm
@param db Database to process
@param relation Bit vector relation
@return Frequent patterns found | [
"public FrequentItemsetsResult run(Database db, final Relation<BitVector> relation) {\n // TODO: implement with resizable arrays, to not need dim.\n final int dim = RelationUtil.dimensionality(relation);\n final VectorFieldTypeInformation<BitVector> meta = RelationUtil.assumeVectorField(relation);\n // ... | [
"def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Clear invalid parent.
The invalid state depends on which if parent id exists but it's corresponding
parent cannot be found.
@return boolean True if parent attribute is set null, False if parent valid. | [
"public function clearInvalidParent()\n {\n if ($this->getParentId() !== static::$nullParent && !$this->hasParent()) {\n $this->setNullParent();\n return true;\n }\n return false;\n }"
] | [
"def set_schema(self, schema_name, include_public=True):\n \n self.tenant = FakeTenant(schema_name=schema_name)\n self.schema_name = schema_name\n self.include_public_schema = include_public\n self.set_settings_schema(schema_name)\n self.search_path_set = False\n # C... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Given a front, converts it to an array of double values
@param front
@return A front as double[][] array | [
"public static double[][] convertFrontToArray(Front front) {\n if (front == null) {\n throw new NullFrontException();\n }\n\n double[][] arrayFront = new double[front.getNumberOfPoints()][] ;\n\n for (int i = 0; i < front.getNumberOfPoints(); i++) {\n arrayFront[i] = new double[front.getPoint(... | [
"def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Read a Duration from the current binary stream.
@throws \qtism\runtime\storage\binary\QtiBinaryStreamAccessException
@return \qtism\common\datatypes\Duration A Duration object. | [
"public function readDuration()\n {\n try {\n return new QtiDuration($this->readString());\n } catch (BinaryStreamAccessException $e) {\n $msg = \"An error occured while reading a duration.\";\n throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAc... | [
"protected function traceExpression(ExpressionProcessor $processor, $result)\n {\n $qtiClassName = $processor->getExpression()->getQtiClassName();\n $this->trace(\"${qtiClassName} [${result}]\");\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Creates a watch thread which listens to specified files' modification and reloads
configurations | [
"static void setupWatch(final Map<String, ParseConfigFile> configFileMap) throws IOException {\n Preconditions.checkNotNull(configFileMap);\n Preconditions.checkArgument(configFileMap.size() > 0);\n\n final WatchService watchService;\n try {\n watchService = FileSystems.getDefault().newWatchService... | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Set those settings needed for the detailed display
@return \Gems_Model_AppointmentModel | [
"public function applyDetailSettings()\n {\n $this->resetOrder();\n\n $agenda = $this->loader->getAgenda();\n $dbLookup = $this->util->getDbLookup();\n $empty = $this->util->getTranslated()->getEmptyDropdownArray();\n\n $this->setIfExists('gec_id_organization', 'label', $t... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Set the value of [reference_id] column.
@param int $v new value
@return $this|\gossi\trixionary\model\Video The current object (for fluent API support) | [
"public function setReferenceId($v)\n {\n if ($v !== null) {\n $v = (int) $v;\n }\n\n if ($this->reference_id !== $v) {\n $this->reference_id = $v;\n $this->modifiedColumns[VideoTableMap::COL_REFERENCE_ID] = true;\n }\n\n if ($this->aReference !... | [
"public function delete($id)\n {\n $this->innerHandler->delete($id);\n // Delete by primary key will remove the object, so we don't need to clear `ez-language-code-` here.\n $this->cache->deleteMulti(['ez-language-' . $id, 'ez-language-list']);\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
// newTimeval transforms a duration into a unix.Timeval struct.
// An error is returned in case of zero time value. | [
"func newTimeval(timeout time.Duration) (*unix.Timeval, error) {\n\tif timeout < time.Microsecond {\n\t\treturn nil, &timeoutError{}\n\t}\n\treturn &unix.Timeval{\n\t\tSec: int64(timeout / time.Second),\n\t\tUsec: int64(timeout % time.Second / time.Microsecond),\n\t}, nil\n}"
] | [
"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 Github comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Computer Science:"
} |
// New returns an initialized AWS Kinesis client using the canonical live “production” endpoint
// for AWS Kinesis, i.e. https://kinesis.{region}.amazonaws.com | [
"func New(auth Auth, region string) *Kinesis {\n\tendpoint := fmt.Sprintf(kinesisURL, region)\n\treturn NewWithEndpoint(auth, region, endpoint)\n}"
] | [
"def get_signer_hostname():\n \n region = os.getenv(\"AWS_REGION\", \"\")\n region = region if region and region in SUPPORTED_REGIONS else \"us-west-2\"\n return \"signer.{region}.iopipe.com\".format(region=region)"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about AWS Route 53:"
} |
/*
(non-Javadoc)
@see java.beans.PropertyEditorSupport#getAsText() | [
"public String getAsText() {\r\n\t\tObject theValue = getValue();\r\n\t\tif (theValue == null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn ((DistinguishedName) theValue).toString();\r\n\t\t}\r\n\t}"
] | [
"@SuppressWarnings(\"rawtypes\")\n\t@Override\n\tprotected Object convertToType(Class type, Object value) throws Throwable {\n\t\treturn KeyFactory.stringToKey(value.toString());\n\t}"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
/*
Method used to create the Session from a request
(non-Javadoc)
@see
com.ibm.wsspi.session.IGenericSessionManager#createSession(javax.servlet
.ServletRequest, javax.servlet.ServletResponse,
com.ibm.wsspi.session.SessionAffinityContext, boolean) | [
"@Override\n public Object createSession(ServletRequest req, ServletResponse res, SessionAffinityContext sac, boolean reuseTheId) {\n String id = _sam.getInUseSessionID(req, sac);\n int version = _sam.getInUseSessionVersion(req, sac); // sac.getRequestedSessionVersion();\n ISession isess = c... | [
"public void doInvocationCollaboratorsPreInvoke(IInvocationCollaborator[] webAppInvocationCollaborators,\n com.ibm.wsspi.webcontainer.metadata.WebComponentMetaData cmd) {\n\n }"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Emit the response using the PHP SAPI.
@param \Psr\Http\Message\ResponseInterface $response The response to emit
@param \Zend\Diactoros\Response\EmitterInterface|null $emitter The emitter to use.
When null, a SAPI Stream Emitter will be used.
@return void | [
"public function emit(ResponseInterface $response, EmitterInterface $emitter = null)\n {\n if (!$emitter) {\n $emitter = new ResponseEmitter();\n }\n $emitter->emit($response);\n }"
] | [
"public function tokenAction()\n {\n // Can't do anything if not HTTP request...\n if (!$this->request instanceof HttpRequest) {\n return null;\n }\n\n // Currently, ZF2 Http Request object is not PSR-7 compliant, therefore we need to create a new one from\n // globa... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Check if the given fingerprint or the default fingerprint
parameter matches the curent session fingerprint.
@param string $manager
@return string | [
"public static function valid_fingerprint( $fingerprint = null, $name = null )\n\t{\n\t\treturn Manager::create( $name )->valid_fingerprint( $fingerprint );\n\t}"
] | [
"private static function resource($resource)\n {\n exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \\''.$resource.'\\' is not supported by Vinala, only session or cookie');\n\n return Hash::make(config('auth.'.$resource));\n\n // F... | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Programming:"
} |
Runs a POST request.
@param string $uri The URI to post to.
@param string|null $body The body to post.
@param array $options The options.
@return \Psr\Http\Message\ResponseInterface | [
"protected function postRequest($uri, $body = null, $options = array())\n {\n if ($this->testMode) {\n $options['debug'] = true;\n }\n\n $headers = array(\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/jso... | [
"public function triggerHook()\n {\n $hookUrl = $this->getLink('#hook');\n $options = [];\n\n // The API needs us to send an empty JSON object.\n $options['json'] = new \\stdClass();\n\n // Switch off authentication for this request (none is required).\n $options['auth']... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Selects an example. If there is an error instantiating the component, an error message will be displayed.
@param example the ExampleData of the example to select. | [
"public void selectExample(final ExampleData example) {\n\t\ttry {\n\t\t\tStringBuilder exampleName = new StringBuilder();\n\t\t\tif (example.getExampleGroupName() != null && !example.getExampleGroupName().equals(\"\")) {\n\t\t\t\texampleName.append(example.getExampleGroupName()).append(\" - \");\n\t\t\t}\n\t\t\tex... | [
"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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Internal method used to convert the utf-8 encoded bytestring into unicode.
If the conversion fails, the socket will be closed. | [
"def _decode_bytes(self, bytestring):\n \n if not bytestring:\n return u''\n try:\n return bytestring.decode('utf-8')\n except UnicodeDecodeError:\n self.close(1007)\n raise"
] | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Generate ``mkdocs build`` command to build the site.
:param mkdocs_site_path: Path to the output directory for the site | [
"def _get_build_command(self, mkdocs_site_path: Path) -> str:\n '''\n '''\n\n components = [self._mkdocs_config.get('mkdocs_path', 'mkdocs')]\n components.append('build')\n components.append(f'-d \"{self._escape_control_characters(str(mkdocs_site_path))}\"')\n\n command = '... | [
"def on_page_markdown(self, markdown, page, config,\n site_navigation=None, **kwargs):\n \"\"\n\n # the site_navigation argument has been made optional\n # (deleted in post 1.0 mkdocs, but maintained here\n # for backward compatibility)\n\n if not self.var... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Return true if this package is an Amino Acid alignment package, otherwise
False i.e. it is a nucleotide package. Cache the result for speed. | [
"def is_protein_package(self):\n '''\n\n '''\n if not hasattr(self, '_is_protein_package'):\n self._is_protein_package = GraftMPackageVersion3.graftm_package_is_protein(self)\n return self._is_protein_package"
] | [
"def persistent_id(self, obj):\n \"\"\"\"\"\"\n if isinstance(obj, Element):\n # Here, our persistent ID is simply a tuple, containing a tag and\n # a key\n return obj.__class__.__name__, obj.symbol\n else:\n # If obj does not have a persistent ID, re... | codesearchnet | {
"query": "Represent the comment about software development:",
"pos": "Represent the code about software development:",
"neg": "Represent the code:"
} |
Handle a change in the weeks of month.
@param week the changed weeks checkbox's internal value.
@param value the new value of the changed checkbox. | [
"public void weeksChange(String week, Boolean value) {\n\n final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);\n boolean newValue = (null != value) && value.booleanValue();\n boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);\n if (newValue != currentValue) {\... | [
"@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// IDStr returns the ID as a string | [
"func (feature *Feature) IDStr() string {\n\tif feature.ID == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%v\", feature.ID)\n}"
] | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Convert this RequestedAttribute to XML.
@param \DOMElement $parent The element we should append this RequestedAttribute to.
@return \DOMElement | [
"public function toXML(DOMElement $parent) : DOMElement\n {\n $e = $this->toXMLInternal($parent, Constants::NS_MD, 'md:RequestedAttribute');\n\n if (is_bool($this->isRequired)) {\n $e->setAttribute('isRequired', $this->isRequired ? 'true' : 'false');\n }\n\n return $e;\n ... | [
"public function loadConfigurationByFilename($filename)\n {\n\n // initialize the DOMDocument with the configuration file to be validated\n $configurationFile = new \\DOMDocument();\n $configurationFile->load($filename);\n\n // substitute xincludes\n $configurationFile->xinclud... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software Development:"
} |
helper function used by singularize and pluralize | [
"function applyRules(_string, _ruleSet, _skip) {\n\n if(_skip.indexOf(_string.toLowerCase()) === -1) {\n var i = 0, rule;\n while(rule = _ruleSet[i++]) {\n if(_string.match(rule[0])) {\n return _string.replace(rule[0], rule[1]);\n }\n }\n }\n\n return... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
List tasks running in the background.
Usage:
running_tasks
Arguments: | [
"def do_running_tasks(self, arg):\n \n for task in asyncio.Task.all_tasks(loop=self.loop):\n _LOGGING.info(task)"
] | [
"public function run(array $args)\n {\n Index::info('Help Menu');\n Index::info('- `eve generate <schema*> <namespace>` Generates files based on schema');\n Index::info('- `eve database <schema*>` Generates database table/s schema');\n Index::info('- `eve install` ... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software Development:"
} |
Instantiate a Request object from the arguments in a
C{checkid_*} OpenID message | [
"def fromOpenIDRequest(cls, request):\n \n self = cls()\n args = request.message.getArgs(self.ns_uri)\n is_openid1 = request.message.isOpenID1()\n\n if args == {}:\n return None\n\n self.parseExtensionArgs(args, is_openid1)\n return self"
] | [
"def processRequest(cls, ps, **kw):\n \n resource = kw['resource']\n method = resource.getOperation(ps, None) # This getOperation method is valid for ServiceSOAPBinding subclass\n rsp = method(ps, **kw)[1] # return (request, response) but we only need response\n return rsp"
] | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Computer Science:"
} |
Retrieve a UUID field.
@param type field type
@return UUID instance | [
"public UUID getUUID(FastTrackField type)\n {\n String value = getString(type);\n UUID result = null;\n if (value != null && !value.isEmpty() && value.length() >= 36)\n {\n if (value.startsWith(\"{\"))\n {\n value = value.substring(1, value.length() - 1);\n }... | [
"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 instruction 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.