query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Return an array representation of the object Useful for turning the array of entities into a nested array, which is then ready to be JSON encoded in a REST response. @return array
[ "public function getArrayCopy()\n {\n $results = array_map(function ($entity) {\n return $entity->getArrayCopy();\n }, $this->entities);\n\n if (! $this->paginationData) {\n return $results;\n } else {\n $data = $this->paginationData->getArrayCopy();\n...
[ "function _parseVertex(line) {\n var vertex = JSON.parse(line);\n assert.ok(_smellsLikeAnElement(vertex));\n // A vertex is an object, i.e. a key,value map.\n // We don't sort the keys of the object, leaving that to jsonStableStringify below.\n // But a vertex values contain `prop...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
train model on each epoch in trainset
[ "def train(epoch):\n \n\n global trainloader\n global testloader\n global net\n global criterion\n global optimizer\n\n logger.debug(\"Epoch: %d\", epoch)\n net.train()\n train_loss = 0\n correct = 0\n total = 0\n\n for batch_idx, (inputs, targets) in enumerate(trainloader):\n ...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Format as detached DNS information as text.
[ "def to_text_format(self):\n ''''''\n return '\\n'.join(itertools.chain(\n (self.fetch_date.strftime('%Y%m%d%H%M%S'), ),\n (rr.to_text() for rr in self.resource_records),\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:" }
Creates a UrlAlias object from database row data. @param mixed[] $data @return \eZ\Publish\SPI\Persistence\Content\UrlAlias
[ "public function extractUrlAliasFromData($data)\n {\n $urlAlias = new UrlAlias();\n\n list($type, $destination) = $this->matchTypeAndDestination($data['action']);\n $urlAlias->id = $data['parent'] . '-' . $data['text_md5'];\n $urlAlias->pathData = $this->normalizePathData($data['raw_p...
[ "public static function getDescription()\n {\n $pdoDriver = \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriverFactory::getDescription();\n $pdoDriver->getConfig()->response('dsn', \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriver::POSTGRESQL);\n\n $dataObject = new MetaDataSource();\n ...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Returns the shape of the region as (x, y, w, h)
[ "def getTuple(self):\n \n return (self.x, self.y, self.w, self.h)" ]
[ "def resolution(self, values):\n \n values = np.asanyarray(values, dtype=np.int64)\n if values.shape != (2,):\n raise ValueError('resolution must be (2,) float')\n # assign passed values to focal length\n self._resolution = values" ]
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
:return: A list of :class:`Processor` or its children classes grouped by each cid, [(cid, [:class:`Processor`)]]
[ "def list_by_cid(self):\n \n prs = self._processors\n return sorted(((cid, [prs[cid]]) for cid in sorted(prs.keys())),\n key=operator.itemgetter(0))" ]
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// GetNotaryRepository returns a NotaryRepository which stores all the // information needed to operate on a notary repository. // It creates an HTTP transport providing authentication support.
[ "func GetNotaryRepository(in io.Reader, out io.Writer, userAgent string, repoInfo *registry.RepositoryInfo, authConfig *types.AuthConfig, actions ...string) (client.Repository, error) {\n\tserver, err := Server(repoInfo.Index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar cfg = tlsconfig.ClientDefault()\n\t...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Set From String [code:] fromString('bRWB'); fromString('bw+'); [code] - reset object @param string $modStr @throws \InvalidArgumentException @return $this
[ "function fromString($modStr)\n {\n $this->_reset();\n\n if (strpos($modStr, 'b') !== false) {\n $this->asBinary();\n $modStr = str_replace('b', '', $modStr); // remove binary sign\n }\n\n // default modes (r+):\n $modXXX = array_search(strtolower($modStr)...
[ "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 programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Emit a status update event. This can result in data being sent to the user's browser in realtime via socket.io.
[ "function updateStatus(evType, opts) {\n var t2 = new Date()\n var elapsed = (t2.getTime() - t1.getTime()) / 1000\n var msg = {\n timeElapsed:elapsed,\n stdout: opts.stdout || \"\",\n stderr: opts.stderr || \"\",\n stdmerged: opts.stdmerged || \"\",\n info: opts.info,\n step: ...
[ "function startDeamon () {\n // ps aux | grep yourscript\n // kill -s SIGINT [process_id]\n process.stdin.resume()\n process.on('SIGINT', function (err) {\n // An easy way to send the SIGINT signal is with Control-C in most terminal programs.\n // Note:\n // SIGUSR1 is reserved by node.js to start th...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add a slide to the slideshow. @param Slide $slide
[ "public function addSlide(Slide $slide)\n {\n if (!$this->slides->contains($slide)) {\n $this->slides->add($slide);\n $slide->setSlideshow($this);\n }\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Finish coverage reporting in kernel. The coverage should previously have been started with setup_coverage.
[ "def teardown_coverage(config, kernel, output_loc=None):\n \n language = kernel.language\n if language.startswith('python'):\n # Teardown code does not require any input, simply execute:\n msg_id = kernel.kc.execute(_python_teardown)\n kernel.await_idle(msg_id, 60) # A minute should b...
[ "def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ...
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:" }
Hydrate $object with the provided $data. @param array $data @param object $object @return object
[ "public function hydrate(array $data, $object)\n {\n if (!isset($data['album'])) {\n return $object;\n }\n\n $hydrators = new AggregateHydrator();\n $hydrators->add(new AlbumHydrator());\n $hydrators->add(new ImageCollectionAwareHydrator());\n\n $object->setAl...
[ "public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
### .init() Initializes the widget.
[ "public function init()\n\t{\n\t\tif (isset($this->htmlOptions['class'])) {\n\t\t\t$this->htmlOptions['class'] .= ' hero-unit';\n\t\t} else {\n\t\t\t$this->htmlOptions['class'] = 'hero-unit';\n\t\t}\n\n\t\techo CHtml::openTag('div', $this->htmlOptions);\n\n\t\tif ($this->encodeHeading) {\n\t\t\t$this->heading = CHt...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Adds the XML digester rules for pre-processing a single import file.<p> @param digester the digester to add the rules to
[ "public void addXmlPreprocessingDigesterRules(Digester digester) {\n\n digester.addCallMethod(CmsImportExportManager.N_EXPORT + \"/\" + N_FILES + \"/\" + N_FILE, \"increaseTotalFiles\");\n digester.addCallMethod(\n CmsImportExportManager.N_EXPORT\n + \"/\"\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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
This method is called when the cache is created. This will initialize ExpirationMetaData for specified cache @param cache The cache instance.
[ "public void createExpirationMetaData(DCache cache) {\n //final String methodName = \"createExpirationMetaData()\";\n ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache);\n if (expirationMetaData == null) {\n int initialTableSize = DEFAULT_SIZE_...
[ "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:" }
__________________________
[ "function encode() {\n\t\tvar p = [0, 0, 0, 0];\n\n\t\tfor (var i = 12; i >= 0; i--) {\n\t\t\tvar fb = codeword[i] ^ p[3];\n\n\t\t\tp[3] = p[2] ^ gmult(30, fb);\n\t\t\tp[2] = p[1] ^ gmult(6, fb);\n\t\t\tp[1] = p[0] ^ gmult(9, fb);\n\t\t\tp[0] = gmult(17, fb);\n\t\t}\n\n\t\tcodeword[13] = p[0];\n\t\tcodeword[14] = p...
[ "public static function protect()\n\t{\n\t\t$eye = \\Cli::color(\"*\", 'green');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"PROTECT ALL HUMANS\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli:...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
// Encode returns a packed slice of the values from src. If a value is over // 1 << 60, an error is returned. The input src is modified to avoid extra // allocations. If you need to re-use, use a copy.
[ "func EncodeAll(src []uint64) ([]uint64, error) {\n\ti := 0\n\n\t// Re-use the input slice and write encoded values back in place\n\tdst := src\n\tj := 0\n\nNEXTVALUE:\n\tfor i < len(src) {\n\t\tremaining := src[i:]\n\n\t\t// try to pack run of 240 or 120 1s\n\t\tif len(remaining) >= 120 {\n\t\t\t// Invariant: len(...
[ "func estimateUnknownSize(unk *runtime.Unknown, byteSize uint64) uint64 {\n\tsize := uint64(unk.Size())\n\t// protobuf uses 1 byte for the tag, a varint for the length of the array (at most 8 bytes - uint64 - here),\n\t// and the size of the array.\n\tsize += 1 + 8 + byteSize\n\treturn size\n}" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// DeleteInstance removes all health checks per instance.
[ "func (cache *HealthStatusCache) DeleteInstance(serviceID string, instanceID int) {\n\tcache.mu.Lock()\n\tdefer cache.mu.Unlock()\n\tfor key := range cache.data {\n\t\tif key.ServiceID == serviceID && key.InstanceID == instanceID {\n\t\t\tcache.delete(key)\n\t\t}\n\t}\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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Technology:" }
----------------- support functions -----------------
[ "function mapSeries(arr, iterator) {\n\t\tvar self = this,\n\t\t\tlength = arr.length,\n\t\t\tindex = 0;\n\n\t\treturn Promise.reduce(arr, function(values, item) {\n\t\t return Promise.resolve(iterator.call(self, item, index, length))\n\t\t\t.then(function(value) {\n\t\t values[index] = value;\n\t\t\t\tin...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Less returns true if the point with index i is less then the // one with index j. It first looks for X, then for Y.
[ "func (ps Points) Less(i, j int) bool {\n\t// Check X first.\n\tswitch {\n\tcase ps[i].x < ps[j].x:\n\t\treturn true\n\tcase ps[i].x > ps[j].x:\n\t\treturn false\n\t}\n\t// Now check Y.\n\tswitch {\n\tcase ps[i].y < ps[j].y:\n\t\treturn true\n\tcase ps[i].y > ps[j].y:\n\t\treturn false\n\t}\n\treturn false\n}" ]
[ "def check_next_match(self, match, new_relations, subject_graph, one_match):\n \"\"\"\"\"\"\n # only returns true for ecaxtly one set of new_relations from all the\n # ones that are symmetrically equivalent\n if not (self.criteria_sets is None or one_match):\n for check in sel...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Merge returns the vector containing the maximum indexes from v and b. If it // is possible, the vector v is updated and returned. If it is not, a copy // will be created, updated and returned.
[ "func (v Vector) Merge(b Vector) Vector {\n\tvar vi, bi int\n\tfor bi < len(b.Counters) {\n\t\tif vi == len(v.Counters) {\n\t\t\t// We've reach the end of v, all that remains are appends\n\t\t\treturn Vector{Counters: append(v.Counters, b.Counters[bi:]...)}\n\t\t}\n\n\t\tif v.Counters[vi].ID > b.Counters[bi].ID {\n...
[ "def check_next_match(self, match, new_relations, subject_graph, one_match):\n \"\"\"\"\"\"\n # only returns true for ecaxtly one set of new_relations from all the\n # ones that are symmetrically equivalent\n if not (self.criteria_sets is None or one_match):\n for check in sel...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Check if the timestamp has expired @param string $timestamp A valid timestamp @return boolean
[ "private function timestampHasExpired($timestamp) {\n $year = substr($timestamp, 0, 4);\n $month = substr($timestamp, 5, 2);\n $day = substr($timestamp, 8, 2);\n $hour = substr($timestamp, 11, 2);\n $minute = substr($timestamp, 14, 2);\n $second = substr($timestamp,...
[ "final public function create()\n {\n\n $self = $this;\n\n $splash = $self->getSplash();\n $sessId = $this->generateId($splash);\n\n session_id($sessId); //Must be called before the sesion start to generate the Id\n session_cache_limiter('none');\n\n session_name(md5($se...
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Parameters ---------- data : `PIL.Image` Image to parse. part : `bool`, optional True if data is partial (default: `False`). dataset : `str`, optional Dataset key prefix (default: '').
[ "def data(self, data, part=False, dataset=''):\n \n #if self.parser is None:\n # raise ValueError('no parser')\n imgs = self.imgtype.convert(data)\n for channel, data in zip(self.imgtype.channels, imgs):\n key = dataset + channel\n data = self.scanner(data...
[ "def _process_cmap(cmap):\n '''\n \n '''\n option = {}\n if isinstance(cmap, str):\n option['scheme'] = cmap\n elif isinstance(cmap, list):\n option['colors'] = cmap\n else:\n raise ValueError('''`cmap` must be a string (name of a color scheme)\n or ...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Rotate the plane around the given pivot point. @param rotation the rotation to apply. @param pivot the pivot point.
[ "public void rotate(Quaternion rotation, Point3D pivot) {\n\t\tPoint3D currentPivot = getPivot();\n \t// Update the plane equation according\n \t// to the desired normal (computed from\n \t// the identity vector and the rotations).\n \tTransform3D m = new Transform3D();\n \tm.setRotation(rotation);\n...
[ "public static AffineTransformation axisProjection(int dim, int ax1, int ax2) {\n // setup a projection to get the data into the interval -1:+1 in each\n // dimension with the intended-to-see dimensions first.\n AffineTransformation proj = AffineTransformation.reorderAxesTransformation(dim, ax1, ax2);\n ...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Takes an object and uses Java serialization to generate the byte[] buffer which is set in the message. Parameter 'obj' has to be serializable (e.g. implementing Serializable, Externalizable or Streamable, or be a basic type (e.g. Integer, Short etc)).
[ "public Message setObject(Object obj) {\n if(obj == null) return this;\n if(obj instanceof byte[])\n return setBuffer((byte[])obj);\n if(obj instanceof Buffer)\n return setBuffer((Buffer)obj);\n try {\n return setBuffer(Util.objectToByteBuffer(obj));\n ...
[ "public static boolean isClassesCompatible(Class<?> memberClass,\n Class<?> injectClass)\n {\n // If the class of the field or method is the injection\n // type or a parent of it, then the injection may occur. d433391\n if (memberClass.i...
codesearchnet
{ "query": "Represent the Github post about Java programming:", "pos": "Represent the Github code about Java programming:", "neg": "Represent the Github code about Software development:" }
Populate authentication metadata attributes. @param builder the builder @param transaction the transaction
[ "protected void populateAuthenticationMetadataAttributes(final AuthenticationBuilder builder,\n final AuthenticationTransaction transaction) {\n LOGGER.debug(\"Invoking authentication metadata populators for authentication transaction\");\n va...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Mutator for giving permissions. @param mixed $permissions @return array $_permissions
[ "public function getPermissionsAttribute($permissions)\n\t{\n\t\tif ( ! $permissions)\n\t\t{\n\t\t\treturn array();\n\t\t}\n\n\t\tif (is_array($permissions))\n\t\t{\n\t\t\treturn $permissions;\n\t\t}\n\n\t\tif ( ! $_permissions = json_decode($permissions, true))\n\t\t{\n\t\t\tthrow new \\InvalidArgumentException(\"...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Initialize the configuration file
[ "private void loadLanguage() {\n languageManager.addLanguageEntry(\"metric_start_error\", \"Unable to load Metrics! The error is: %s\");\n languageManager.addLanguageEntry(\"checking_new_version\", \"Checking if there's a new version.\");\n languageManager.addLanguageEntry(\"running_old_version...
[ "@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 about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
// assembleClouds
[ "func assembleClouds() ([]string, error) {\n\tpublic, _, err := jujucloud.PublicCloudMetadata(jujucloud.JujuPublicCloudsPath())\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tpersonal, err := jujucloud.PersonalCloudMetadata()\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tbuiltin, ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Initialise relative classes
[ "private function initDelegates()\n {\n // start event dispatching\n $this->eventDispatcher = new EventDispatcher;\n \n // create operator\n $this->operator = $this->getCollection()->operator();\n\n // attach behaviors\n $this->attachBehaviors($this->behaviors());...
[ "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 instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
create an ec2 reservation if one doesn't already exist and call start_instance. Update instance attributes to the newly created instance attributes
[ "def start(self):\n \n if self.instance is None:\n reservation = self.ec2_backend.add_instances(\n image_id=self.ami_id,\n count=1,\n user_data=\"\",\n security_group_names=[],\n security_group_ids=self.security_grou...
[ "def exit_if_failures!(resp)\n return if resp[:failures].nil? || resp[:failures].empty?\n\n puts \"There was a failure running the ECS task.\".color(:red)\n puts \"This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED.\"\n puts \"This cryptic error als...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Deserialize the data into it's original python object. :param bytes data: The serialized object to load. :return: The original python object.
[ "def loads(self, data):\n\t\t\n\t\tif not isinstance(data, bytes):\n\t\t\traise TypeError(\"loads() argument 1 must be bytes, not {0}\".format(type(data).__name__))\n\t\tif self._compression == 'zlib':\n\t\t\tdata = zlib.decompress(data)\n\t\tif sys.version_info[0] == 3 and self.name.startswith('application/'):\n\t...
[ "def _objectify(self, json_data=None, data={}):\n ''''''\n if json_data:\n # Parse the data\n try:\n data = json.loads(json_data)\n except ValueError:\n # If parsing failed, then raise the string which likely contains an error message inst...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Parses the given CLI arguments to get a run configuration. :param args: CLI arguments :return: run configuration derived from the given CLI arguments
[ "def _parse_args(args: List[str]) -> _SetArgumentsRunConfig:\n \n parser = argparse.ArgumentParser(\n prog=\"gitlab-set-variables\", description=\"Tool for setting a GitLab project's build variables\")\n add_common_arguments(parser, project=True)\n parser.add_argument(\"source\", nargs=\"+\", typ...
[ "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:" }
Adds enumerable to an enumerable :param enumerable: An iterable object :return: new Enumerable object
[ "def concat(self, enumerable):\n \n if not isinstance(enumerable, Enumerable):\n raise TypeError(\n u\"enumerable argument must be an instance of Enumerable\"\n )\n return Enumerable(itertools.chain(self._data, enumerable.data))" ]
[ "def Validate(self, value, **_):\n \"\"\"\"\"\"\n # Assigning from same kind can allow us to skip verification since all\n # elements in a RepeatedFieldHelper already are coerced to the delegate\n # type. In that case we just make a copy. This only works when the value\n # wraps the same type as us.\...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Render the meta tags @return string
[ "public function render() {\n\t\t$parts = [];\n\t\t\n\t\tif (empty($this->elements)) {\n\t\t\treturn '';\n\t\t}\n\t\t\n\t\t// Elements\n\t\tforeach ($this->elements as $element) {\n\t\t\tif (! $element->isEmpty()) {\n\t\t\t\t$parts[] = $element->assemble();\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn implode(PHP_EOL, $parts)...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
map/collect on a given property
[ "def map(input, property)\n InputIterator.new(input).map do |e|\n e = e.call if e.is_a?(Proc)\n\n if property == \"to_liquid\".freeze\n e\n elsif e.respond_to?(:[])\n r = e[property]\n r.is_a?(Proc) ? r.call : r\n end\n end\n rescue TypeError\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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get object. @param int|string $enum from internal enum @return object @throws \InvalidArgumentException
[ "public static function get($enum)\n {\n if (null === self::$ClassNames) {\n self::generateNamespace();\n self::generateClassNamesArray();\n }\n\n if (!isset(self::$ClassNames[$enum])) {\n throw new \\InvalidArgumentException('Invalid enum \"'.$enum.'\".');\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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Retrieve an array of role types across all taxonomies @return array
[ "public function getAllRoleTypes()\r\n\t{\r\n\t\t// Gather all role types\r\n\t\treturn array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )\r\n\t\t{\r\n\t\t\t$rts = $taxonomy->getRoleTypes();\r\n\t\t\t$taxonomy->normalizeUsedOn( $rts, $taxonomy );\r\n\r\n\t\t\tif...
[ "def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Natural Language Processing:" }
Perform the given search on the engine. @param Builder $builder @param int $perPage @param int $page @return mixed
[ "public function paginate(Builder $builder, $perPage, $page)\n {\n $result = $this->performSearch($builder, [\n 'numericFilters' => $this->filters($builder),\n 'from' => (($page * $perPage) - $perPage),\n 'size' => $perPage,\n ]);\n\n $result['nbPages'] = $res...
[ "abstract public function __construct(DataAccessInterface $dataSource);\n \n /**\n * Returns an array with all entities for the given data request.\n * \n * @param \\Zepi\\DataSource\\Core\\DataRequest $dataRequest\n * @return false|array\n */\n public function find(DataRequest $dataReq...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Finds a record by the specified attribute and value. If no record is found an exception is thrown. @param string $attribute @param string $value @param array|string $columns @throws ModelNotFoundException @return Model|array
[ "public function findByOrFail($attribute, $value, $columns = [])\n {\n return $this->whereEquals($attribute, $value)->firstOrFail($columns);\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Reset tab state, dropping active classes @private
[ "function() {\n\t\tfor (var k = 0; k < this.tabs_.length; k++) {\n\t\t\tu.removeClass(this.tabs_[k],this._CssClasses.ACTIVE_CLASS)\n\t\t}\n\t}" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
@Route("/like/list/{page}", name="icap_socialmedia_likelist", defaults={"page" = "1"}) @Method({"GET"}) @param Request $request @Template() @param $page @return array
[ "public function likeListAction(Request $request, $page)\n {\n $likesQB = $this->getLikeActionManager()->getLikesForPagination($request);\n $pager = $this->paginateQuery($likesQB, $page);\n $parameters = $request->query->all();\n $parameters['page'] = ($pager->hasNextPage()) ? $pager-...
[ "public function show($id)\n {\n $request = $this->makeRequest('show');\n $model = $this->service->get($id);\n return $this->maybeMakeResource('single', $model);\n\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
// goodFunc checks that the function or method has the right result signature.
[ "func goodFunc(typ reflect.Type) bool {\n\t// We allow functions with 1 result or 2 results where the second is an error.\n\tswitch {\n\tcase typ.NumOut() == 1:\n\t\treturn true\n\tcase typ.NumOut() == 2 && typ.Out(1) == errorType:\n\t\treturn true\n\t}\n\treturn false\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// IncrCounter increments a counter metric
[ "func (s *CirconusSink) IncrCounter(key []string, val float32) {\n\tflatKey := s.flattenKey(key)\n\ts.metrics.IncrementByValue(flatKey, uint64(val))\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
@inheritDoc This override adds sanitation to the values and already combines some of the values to retrieve a Source object
[ "protected function setSubmittedValues()\n {\n parent::setSubmittedValues();\n\n // Get the targeted source.\n $this->setSubmittedSource();\n // Sanitise service: lowercase ascii characters, numbers, _ and -.\n $this->submittedValues['service'] = preg_replace('/[^a-z0-9_\\-]/',...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Takes an unencoded string and produces a string encoded according to RFC 2231 from it.
[ "public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string\n {\n $lines = [];\n $lineCount = 0;\n $lines[] = '';\n $currentLine = &$lines[$lineCount++];\n\n if (0 >= $maxLineLength) {\n $maxLine...
[ "public static String pathEncode(String path, Charset charset) {\n return encodeReserved(path, FragmentType.PATH_SEGMENT, charset);\n\n /*\n * path encoding is not equivalent to query encoding, there are few differences, namely dealing\n * with spaces, !, ', (, ), and ~ characters. we will need to man...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Normalizes the value if a normalization transformer is set. @param mixed $value The value to transform @return string @throws TransformationFailedException If the value cannot be transformed to "normalized" format
[ "protected function modelToNorm($value)\n {\n try {\n /* @var DataTransformerInterface $transformer */\n foreach ($this->config->getModelTransformers() as $transformer) {\n $value = $transformer->transform($value);\n }\n } catch (TransformationFailedE...
[ "protected function makeKeyString($key): string {\n //convert numbers to strings.\n $stringValue = (string)$key;\n $length = strlen( $stringValue );\n if( $length == 0 ){\n throw new \\Exception(\"Key values must be string values of at least 1 character. Empty strings cannot b...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about AWS S3:" }
Get an iterator of items similar but not equal to the base. @param base: base item to perform comparison against @param items: list of items to compare to the base @return: generator of items sorted by similarity to the base
[ "def duplicates(base, items):\n \n for item in items:\n if item.similarity(base) and not item.equality(base):\n yield item" ]
[ "def reflect_filter(sources, model, cache=None):\n '''\n '''\n targets = [reflect(source, model, cache=cache) for source in sources]\n # Some objects may not be available in target DB (not published), so we\n # have to exclude None from the list.\n return [target for target in targets if target is...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
:param api: :param str vcenter_name: :rtype: VMwarevCenterResourceModel
[ "def get_vcenter_data_model(self, api, vcenter_name):\n \n if not vcenter_name:\n raise ValueError('VMWare vCenter name is empty')\n vcenter_instance = api.GetResourceDetails(vcenter_name)\n vcenter_resource_model = self.resource_model_parser.convert_to_vcenter_model(vcenter_i...
[ "def get_pointer_mapping(self):\n \"\"\"\"\"\"\n r = request.GetPointerMapping(display = self.display)\n return r.map" ]
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Writes a review.
[ "public function WriteReview()\n {\n //validate user input...\n $oGlobal = TGlobal::instance();\n $aUserData = array();\n if ($this->AllowWriteReview()) {\n $aUserData = $this->GetReviewWriteData();\n $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME);\...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
+ Jonas Raoni Soares Silva @ http://jsfromhell.com/array/shuffle [rev. #1]
[ "function shuffle(v) {\n for (var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x);\n return v;\n}" ]
[ "def _init_prtfmt(self, key=\"fmta\"):\n \"\"\"\"\"\"\n prtfmt = self.gosubdag.prt_attr[key]\n return prtfmt.replace(\"{NS}\", \"{NS} {hdr1usr01:2} {num_usrgos:>4} uGOs\")" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param string|array|Expression $foreign @param array|Statement\Where $on @param string $joinType @return $this
[ "public function join($foreign, $on, $joinType = Joins::INNER)\n {\n $builder = $this->getJoinStatement()->getBuilder();\n $foreign = is_array($foreign) ? $foreign : [$foreign];\n $foreign[0] = !($foreign[0] instanceof Expression) ? new Table($foreign[0]) : $foreign[0];\n \n $f...
[ "public final function orField($fieldName, $tableName = null)\n {\n return new QueryHelper\\QueryField($this, $this->_prepareField($fieldName, $tableName), 'OR');\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Called when MonitoringPluginConfig source changed at runtime.
[ "public static void reconfigureMonitor(MonitoringPluginConfig config) {\n for (GenericMonitor monitor : MONITORS) {\n if (monitor.config == config) {\n monitor.stop();\n monitor.setup();\n }\n }\n }" ]
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Sort class and id groups alphabetically @param {Object} selector - postcss selector node
[ "function sortGroups(selector) {\n selector.each((subSelector) => {\n subSelector.nodes.sort((a, b) => {\n // different types cannot be sorted\n if (a.type !== b.type) {\n return 0;\n }\n\n // sort alphabetically\n return a.value < b.value ? -1 : 1;\n });\n });\n\n selector....
[ "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:" }
Execute the SQL statement. @param mixed $query The SQL statement to set either as a Query object or a string. @return resource|false Return Resource to do more or false if query failure. @since 2.0 @throws \RuntimeException
[ "public function execute($query = null)\n {\n $prepare = true;\n\n if ($query !== null) {\n $this->setQuery($query);\n\n $prepare = false;\n }\n\n $this->connect();\n\n if (!$this->connection) {\n throw new \\RuntimeException('Database disconnec...
[ "public static function insert(array $data)\n {\n $self = static::getInstance();\n\n $data = static::filterColumns($data);\n\n if (!\\count($data)) {\n throw new DbException(\n \"Invalid field names of table `{$self->name}`. Please check use of `insert()` method\"\n...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
ajax 请求,简单实现,可以修改成使用 jQuery.ajax 如果已经依赖了的话。
[ "function ajax(url, cb, data) {\n var xhr = new(window.XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');\n\n xhr.onreadystatechange = function () {\n if (this.readyState == 4) {\n if (this.status !== 200) {\n cb(this.responseText);\n }\n...
[ "function redirectToIndex() {\n var baseURL = window.DEBUG\n ? 'index-debug.html'\n : 'index.html';\n location.href = baseURL + location.hash;\n // 在`Promise`中,抛出异常会使其进入失败状态,\n // 一般来说跳转了就不会有下面的代码执行,这里就是防止进入成功状态\n throw new Error('...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Create a new Domain with the given Name. @param string $name The name of the Domain. @param string $returnPathDomain The custom Return-Path domain for the Sender Signature. @return DynamicResponseModel
[ "function createDomain($name, $returnPathDomain = NULL) {\n\t\t$body = array();\n\t\t$body['name'] = $name;\n\t\t$body['returnPathDomain'] = $returnPathDomain;\n\n\t\treturn new DynamicResponseModel($this->processRestRequest('POST', '/domains/', $body));\n\t}" ]
[ "@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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
// allocateIP attempts to allocate the requested ip, and if that is // not possible, allocates the next available address.
[ "func (ic *IngressIPController) allocateIP(requestedIP string) (net.IP, error) {\n\tif len(requestedIP) == 0 {\n\t\t// Specific ip not requested\n\t\treturn ic.ipAllocator.AllocateNext()\n\t}\n\tvar ip net.IP\n\tif ip = net.ParseIP(requestedIP); ip == nil {\n\t\t// Invalid ip\n\t\treturn ic.ipAllocator.AllocateNext...
[ "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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Get a packing plan using First Fit Decreasing @return packing plan
[ "@Override\n public PackingPlan pack() {\n PackingPlanBuilder planBuilder = newPackingPlanBuilder(null);\n\n // Get the instances using FFD allocation\n try {\n planBuilder = getFFDAllocation(planBuilder);\n } catch (ConstraintViolationException e) {\n throw new PackingException(\"Could not a...
[ "def getPostStates(self):\n '''\n \n '''\n self.aNrmNow = self.mNrmNow - self.cNrmNow\n self.aLvlNow = self.aNrmNow*self.pLvlNow # Useful in some cases to precalculate asset level\n return None" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get temperature of a specific sensor
[ "def get(id_, hwid, type_, unit, precision, as_json):\n \"\"\"\"\"\"\n if id_ and (hwid or type_):\n raise click.BadOptionUsage(\n \"If --id is given --hwid and --type are not allowed.\"\n )\n\n if id_:\n try:\n sensor = W1ThermSensor.get_available_sensors()[id_ -...
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Print a {@link String} into the stream @param sText the {@link String} @return this
[ "@Nonnull\n public JSFormatter plain (@Nonnull final String sText)\n {\n _spaceIfNeeded ();\n m_aPW.print (sText);\n return this;\n }" ]
[ "public void writeOut(Writer out) throws IOException {\n\t if (writer == null) {\n\t out.write(strBuffer.toString()); // PK33136\n\t // Flush not called as the writer passed could be a BodyContent and\n\t // it doesn't allow to flush.\n\t }\n }" ]
codesearchnet
{ "query": "Represent the Github text about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about writing:" }
Standardize the layout of the table into grids
[ "def get_grid(self):\n \n mentions, lines = _split_text_n_lines(self.elems)\n # Sort mentions in reading order where y values are snapped to half\n # height-sized grid\n mentions.sort(key=lambda m: (m.yc_grid, m.xc))\n\n grid = Grid(mentions, lines, self)\n return gr...
[ "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 instruction about data processing:", "pos": "Represent the Github code about data processing:", "neg": "Represent the Github code:" }
See: https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki
[ "def create_BIP122_uri(\n chain_id: str, resource_type: str, resource_identifier: str\n) -> URI:\n \n if resource_type != BLOCK:\n raise ValueError(\"Invalid resource_type. Must be one of 'block'\")\n elif not is_block_or_transaction_hash(resource_identifier):\n raise ValueError(\n ...
[ "func IsNotFoundError(err error) bool {\n\tes := err.Error()\n\tif strings.Contains(es, \"does not exist\") {\n\t\t// set with the same name already exists\n\t\t// xref: https://github.com/Olipro/ipset/blob/master/lib/errcode.c#L32-L33\n\t\treturn true\n\t}\n\tif strings.Contains(es, \"element is missing\") {\n\t\t...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Add an accordion section. You can add static View within your section or pass a callback for dynamic content. @param string $title @param null|callable $callback @param string $icon @throws Exception @return AccordionSection
[ "public function addSection($title, $callback = null, $icon = 'dropdown')\n {\n $section = $this->add(['AccordionSection', 'title' => $title, 'icon' => $icon]);\n\n // if there is callback action, then use VirtualPage\n if ($callback) {\n $section->virtualPage = $section->add(['Vi...
[ "protected function configureFormer()\n {\n // Use Bootstrap 3\n Config::set('former.framework', 'TwitterBootstrap3');\n\n // Reduce the horizontal form's label width\n Config::set('former.TwitterBootstrap3.labelWidths', []);\n\n // Change Former's required field HTML\n ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Return true if there is already an owl:Class with the old id
[ "def alreadyHasEntry(oldClassString, og):\n \n namespace = oldClassString.split(':')[0]\n if namespace == 'http':\n target = rdflib.URIRef(oldClassString)\n print('OLD CLASS ID IS A URL', oldClassString)\n else:\n try:\n og.add_known_namespaces(namespace)\n tar...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param string $path @return array
[ "protected function parsePath(string $path): array\n {\n $parts = explode(DIRECTORY_SEPARATOR, $path);\n\n $file = array_pop($parts);\n\n return [\n 'root' => implode(DIRECTORY_SEPARATOR, $parts),\n 'file' => $file,\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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// GetPolicy gets all rules in a policy.
[ "func (model Model) GetPolicy(sec string, ptype string) [][]string {\n\treturn model[sec][ptype].Policy\n}" ]
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Makes a GET request to the API with parameters for page size, page number, filtering and order values. Returns the API response. @param int $pageNumber @return mixed
[ "private function makeQuery($pageNumber = 1)\n {\n $params = array(\n 'page_size' => $this->pageSize,\n 'page' => $pageNumber\n );\n $params = array_merge($params, $this->filter);\n $params = array_merge($params, $this->order);\n $response = $this->api->ge...
[ "@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 Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
// ErrorIsNotFound checks if the error is a "ErrNotFound" // (possibly wrapped)
[ "func ErrorIsNotFound(err error) bool {\n\t_, ok := errors.Cause(err).(*ErrNotFound)\n\treturn ok\n}" ]
[ "async def get_object_proxy_location(self, client, pid):\n \n try:\n return (await client.describe(pid)).get(\"DataONE-Proxy\")\n except d1_common.types.exceptions.DataONEException:\n # Workaround for older GMNs that return 500 instead of 404 for describe()\n pa...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Computer Science:" }
creates a XML tag with serialized attributes @see SerializedAttributes#serialized_attributes
[ "def serialized_tag(tagname, str, additional_attributes = {}, &block)\n str << \"<#{tagname} \"\n serialized_attributes(str, additional_attributes)\n if block_given?\n str << '>'\n yield\n str << \"</#{tagname}>\"\n else\n str << '/>'\n end\n end" ]
[ "public void buildSignature(XMLNode node, Content constructorDocTree) {\n constructorDocTree.addContent(\n writer.getSignature(\n (ConstructorDoc) constructors.get(currentConstructorIndex)));\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Set page. @param int $page
[ "public function page($page)\n {\n if (! $this->limit) return;\n $offset = $this->limit * ($page - 1);\n $this->offset($offset);\n return $this;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Construct DataFrames from list of PDB lines.
[ "def _construct_df(pdb_lines):\n \"\"\"\"\"\"\n valids = tuple(pdb_records.keys())\n line_lists = {r: [] for r in valids}\n line_lists['OTHERS'] = []\n for line_num, line in enumerate(pdb_lines):\n if line.strip():\n if line.startswith(valids):\n ...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github summarization about Data Science:", "pos": "Represent the Github code about Data Science:", "neg": "Represent the Github code:" }
## Transaction Signing This function shows how to use a compliant private key to sign an æternity transaction and turn it into an RLP-encoded tuple ready for mining
[ "function signTx (tx, privKey) {\n if (!tx.match(/^tx\\_.+/)) {\n throw Error('Not a valid transaction')\n }\n\n const binaryKey = (() => {\n if (program.file) {\n return fs.readFileSync(program.file)\n } else if (privKey) {\n return Buffer.from(privKey, 'hex')\n } else {\n throw Error...
[ "@Override\n public Message deserialize(ByteBuffer in) throws ProtocolException, IOException {\n // A Bitcoin protocol message has the following format.\n //\n // - 4 byte magic number: 0xfabfb5da for the testnet or\n // 0xf9beb4d9 for production\n //...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Set property values for Polygon.
[ "def set_contourf_properties(stroke_width, fcolor, fill_opacity, contour_levels, contourf_idx, unit):\n \"\"\"\"\"\"\n return {\n \"stroke\": fcolor,\n \"stroke-width\": stroke_width,\n \"stroke-opacity\": 1,\n \"fill\": fcolor,\n \"fill-opacity\": fill_opacity,\n \"t...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Print the header info, such as title, keywords and meta-desc. @param out The http output stream. @param reg Local resource bundle.
[ "public void printXMLParams(PrintWriter out, ResourceBundle reg)\n {\n String PARAMS = \"params\";\n \n out.println(Utility.startTag(PARAMS));\n \n ServletTask task = (ServletTask)this.getTask();\n Map<String,Object> properties = task.getRequestProperties(task.getServlet...
[ "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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Add a POST body to the request @param string $body body to add @return void @throws CAS_OutOfSequenceException If called after the Request has been sent.
[ "public function setPostBody ($body)\n {\n if ($this->_sent) {\n throw new CAS_OutOfSequenceException(\n 'Request has already been sent cannot '.__METHOD__\n );\n }\n if (!$this->isPost) {\n throw new CAS_OutOfSequenceException(\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 post about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Programming:" }
RGBで初期化しインスタンスを取得する。 16進数の場合は引数が1つ。 R,G,Bを個別で指定する場合は引数が3つ。 @param int R 0-255(0x00-0xFF) @param int G 0-255(0x00-0xFF) or null @param int B 0-255(0x00-0xFF) or null @return self
[ "public static function rgb($v1,$v2=null,$v3=null)\n\t{\n\t\tif(is_null($v2)){\n\t\t\t$rgb = $v1;\n\t\t\t$r = ($rgb >> 16) & 0xFF;\n\t\t\t$g = ($rgb >> 8) & 0xFF;\n\t\t\t$b = $rgb & 0xFF;\n\t\t\t$self = new self();\n\t\t\treturn $self->r($r)->g($g)->b($b);\n\t\t}else{\n\t\t\t$r = $v1 & 0xFF;\n\t\t\t$g = $v2 & 0xFF;...
[ "def special2csa(str)\n {\n \"中断\" => \"CHUDAN\",\n \"投了\" => \"TORYO\",\n \"持将棋\" => \"JISHOGI\",\n \"千日手\" => \"SENNICHITE\",\n \"詰み\" => \"TSUMI\",\n \"不詰\" => \"FUZUMI\",\n \"切れ負け\" => \"TIME_UP\",\n \"反則勝ち\" => \"ILLEGAL_ACTION\", # 直前の手が反則(先頭に+か-で反則...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the evalutead menu item whether from the childOf property or set from the setter method. @return Item @throws Exception
[ "public function getItem()\n {\n if ($this->_item === null) {\n $this->_item = Yii::$app->menu->find()->where(['id' => $this->childOf])->with('hidden')->one();\n \n if (!$this->_item) {\n throw new Exception(\"Unable to find item with id \" . $this->childOf)...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Process Essay Questions Parse an essay rawquestion and add the result to the array of questions already parsed. @param object $quest rawquestion @param array $questions array of Moodle questions already done.
[ "public function process_essay($quest, &$questions) {\n\n $question = $this->process_common($quest);\n $question->qtype = 'essay';\n\n $question->feedback = array();\n // Not sure where to get the correct answer from?\n foreach ($quest->feedback as $feedback) {\n // Add...
[ "def getSampleTypeTitles(self):\n \n sample_types = self.getSampleTypes()\n sample_type_titles = map(lambda obj: obj.Title(), sample_types)\n\n # N.B. This is used only for search purpose, because the catalog does\n # not add an entry to the Keywordindex for an empty list.\n ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Checks the permission for the given module and action name @param string $module @param string $action @param User $user @return bool
[ "public function hasPermission($module, $action, User $user = null) {\n\t\t$module = $this->service->getModuleManager()->load($module);\n\t\t$action = $module->getActionModel($action);\n\t\treturn $this->hasActionPermission($action, $user);\n\t}" ]
[ "static function AjaxUrl(ModuleBase $module, array $args = array())\n {\n $allArgs = array('module'=> ClassFinder::ModuleType($module)) + $args;\n $guard = new UserGuard();\n $user = $guard->GetUser();\n if (!$user)\n {\n throw new \\Exception('Security breach on aja...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Generate a transformer object based off the input params @param name @param transformerFns @param templateDir @param pluginOptions
[ "function generateTransformer(name, transformerFns, templateDir, pluginOptions) {\n\n var Transformer = function () {};\n var transformer = new Transformer();\n\n // add function mixins to the transformer\n _.extend(transformer, transformerFns, baseTransformer, annotationHelper, utensils, pluginOptions)...
[ "def _get_result_paths(self, data):\n \n\n # Swarm OTU map (mandatory output)\n return {'OtuMap': ResultPath(Path=self.Parameters['-o'].Value,\n IsWritten=True)}" ]
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Helper to extract the preferred locale value from MultiLocaleString https://docs.microsoft.com/en-us/linkedin/shared/references/v2/object-types#multilocalestring. @param $path @return mixed
[ "protected function getPreferredLocaleValue($path)\n {\n $multiLocaleString = $this->getValueForPath($path);\n\n $locale = '';\n if (isset($multiLocaleString['preferredLocale'])) {\n $locale = $multiLocaleString['preferredLocale']['language'];\n if (!empty($multiLocaleS...
[ "def unused(self):\n \n self._params.update(\n href=self._resource.get('search_unused'))\n return self" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// StartPhoneVerification starts the phone verification process.
[ "func (authy *Authy) StartPhoneVerification(countryCode int, phoneNumber string, via string, params url.Values) (*PhoneVerificationStart, error) {\n\tparams.Set(\"country_code\", strconv.Itoa(countryCode))\n\tparams.Set(\"phone_number\", phoneNumber)\n\tparams.Set(\"via\", via)\n\n\tpath := fmt.Sprintf(\"/protected...
[ "function(providerId, opt_email) {\n // If popup flow enabled, this will fail and fallback to redirect.\n // TODO: Optimize to force redirect mode only.\n // For non-Google providers (not supported yet). This may end up signing the\n // user with a provider using different email. Even for Google, a user...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about accounts.authinfo:" }
Schedules a document for being updated. @param object $document The document to schedule for being updated. @throws \InvalidArgumentException
[ "public function scheduleForUpdate($document)\n {\n $oid = spl_object_hash($document);\n if ( ! isset($this->documentIdentifiers[$oid])) {\n throw new \\InvalidArgumentException(\"Document has no identity.\");\n }\n if (isset($this->documentDeletions[$oid])) {\n ...
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about PHP:" }
Returns the tokens for the next assigned (key/value) value. @return array The tokens.
[ "private function getAssignedValue()\n {\n $this->match(DocLexer::T_IDENTIFIER);\n\n $tokens = array(\n array(DocLexer::T_IDENTIFIER, $this->lexer->token['value']),\n array(DocLexer::T_EQUALS),\n );\n\n $this->match(DocLexer::T_EQUALS);\n\n return array_me...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// hasMatchingChild runs matcher against each child and returns true as soon as // there is a match, of false if none of them is a match.
[ "func (c *DirConstraint) hasMatchingChild(ctx context.Context, s *search, children map[blob.Ref]struct{},\n\tmatcher func(context.Context, *search, blob.Ref, camtypes.BlobMeta) (bool, error)) (bool, error) {\n\t// TODO(mpl): See if we're guaranteed to be CPU-bound (i.e. all resources are in\n\t// corpus), and if no...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
///////////////////////////////////////////////////////////////////////////////////////////////////
[ "function clear() {\n showHandlers.splice( 0, showHandlers.length );\n hideHandlers.splice( 0, hideHandlers.length );\n return api;\n }" ]
[ "private void readPacket(Results results) throws SQLException {\n Buffer buffer;\n try {\n buffer = reader.getPacket(true);\n } catch (IOException e) {\n throw handleIoException(e);\n }\n\n switch (buffer.getByteAt(0)) {\n\n //***********************************************************...
codesearchnet
{ "query": "Represent the summarization about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code:" }
// Clone returns a copy of this disk source, suitable for fan-in
[ "func (ds *DiskSource) Clone() Source {\n\tdsc := &DiskSource{\n\t\tBasePath: ds.BasePath,\n\t\tBlockAddresses: ds.BlockAddresses,\n\n\t\tContainer: ds.Container,\n\t}\n\n\tif ds.Decompressor != nil {\n\t\tdsc.Decompressor = ds.Decompressor.Clone()\n\t}\n\n\treturn dsc\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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Reports whether the struct field "f" with value "v" should be included in JSON output.
[ "func includeField(v reflect.Value, f reflect.StructField, mustInclude map[string]struct{}) bool {\n\t// The regular JSON encoding of a nil pointer is \"null\", which means \"delete this field\".\n\t// Therefore, we could enable field deletion by honoring pointer fields' presence in the mustInclude set.\n\t// Howev...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Configures the converter with the options provided by the Input options. @param ToLatexInterface $converter @param InputInterface $input @throws \InvalidArgumentException if the provided converter is not derived from ToLatexInterface
[ "protected function configureConverterFromInputOptions($converter, $input)\n {\n if (!$converter instanceof ToLatexInterface) {\n throw new \\InvalidArgumentException(\n 'The converter used to process '\n . $input->getOption('input-format') . ' should implement the...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
@param string $filePath @throws \LogicException Error loading file contents @return bool
[ "private static function isMessageHandler(string $filePath): bool\n {\n $fileContent = \\file_get_contents($filePath);\n\n if (false !== $fileContent)\n {\n return false !== \\strpos($fileContent, '@CommandHandler') ||\n false !== \\strpos($fileContent, '@EventListe...
[ "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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Load a class, e.g. the JDBC driver. @param driver The class name.
[ "private void loadDriver(String driver) throws IOException {\n if (driver != null) {\n try {\n Class.forName(driver);\n } catch (ClassNotFoundException e) {\n throw new IOException(driver + \" cannot be loaded, skipping scan of schema.\", e);\n }...
[ "static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {\n // notice we send in 'Service.class' for the 'value' attribute, this is\n // because only service type injections are possible with the @Resource\n // anno...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
@param string $service @return TokenInterface @throws TokenNotFoundException
[ "public function retrieveAccessToken($service)\n {\n $service = $this->normalizeServiceName($service);\n\n if ($this->hasAccessToken($service)) {\n $tokens = $this->sessionScope->get(self::SESSION_TOKEN);\n return unserialize($tokens[$service]);\n }\n\n throw new...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
create paragraph node from TxtNodes @param {[TxtNode]} nodes @returns {TxtNode} Paragraph node
[ "function createParagraph(nodes) {\n const firstNode = nodes[0];\n const lastNode = nodes[nodes.length - 1];\n return {\n type: Syntax.Paragraph,\n raw: nodes\n .map(function(node) {\n return node.raw;\n })\n .join(\"\"),\n range: [firstN...
[ "func (tag *Tag) AddUserDefinedTextFrame(udtf UserDefinedTextFrame) {\n\ttag.AddFrame(tag.CommonID(\"User defined text information frame\"), udtf)\n}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set the weekdays at which the event should take place. @param weekDays the weekdays at which the event should take place.
[ "public void setWeekDays(SortedSet<WeekDay> weekDays) {\n\n final SortedSet<WeekDay> newWeekDays = null == weekDays ? new TreeSet<WeekDay>() : weekDays;\n SortedSet<WeekDay> currentWeekDays = m_model.getWeekDays();\n if (!currentWeekDays.equals(newWeekDays)) {\n conditionallyRemoveEx...
[ "function(terria) {\n CatalogMember.call(this, terria);\n\n this._enabledDate = undefined;\n this._shownDate = undefined;\n this._loadForEnablePromise = undefined;\n this._lastLoadInfluencingValues = undefined;\n\n // The catalog item to show in the Now Viewing when this item is enabled, instead of this item....
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
pad @param string $string @param int $length @param string $substring @param string|null $encoding @return string
[ "public static function pad(\n $string,\n $length = 0,\n $substring = ' ',\n $encoding = null\n ) {\n $encoding = $encoding === null ? mb_internal_encoding() : $encoding;\n $strLength = Mbstring::strlen($string, $encoding);\n $padding = $length - $strLength;\n\n ...
[ "protected static function parsePrintableString(&$data, &$result)\n {\n // Printable string type\n $data = self::parseCommon($data, $stringData);\n $result[] = [\n 'Printable String (' . self::$len . ')',\n $stringData, ];\n }" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
/* 插入数据 $table:数据表 $data:插入数据
[ "public function insert($table = '', $data = array())\n {\n if (empty($data)) {\n die('数据不能为空!');\n }\n\n //字段名处理\n foreach ($data as $k => $v) {\n $fields[] = $k;\n $values[] = $v;\n $this->bindParam($k, $v);\n }\n\n //insert的...
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Store the footer caption BIFF record. @access private
[ "function _storeFooter()\r\n {\r\n $record = 0x0015; // Record identifier\r\n\r\n $str = $this->_footer; // Footer string\r\n $cch = strlen($str); // Length of footer string\r\n if ($this->_BIFF_version == 0x0600) {\r\n $encoding = 0x0...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Read @return char
[ "protected function Read()\r\n\t{\r\n\t\t$ch;\r\n\t\tif ( count( $this->m_buffer ) > 0 )\r\n\t\t{\r\n\t\t $ch = array_shift( $this->m_buffer );\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t $c = $this->m_reader->read();\r\n\t\t if ( $c == -1 )\r\n\t\t return '\\0';\r\n\t\t else\r\n\t\t $ch = $c;\r...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// FindGroup returns a group object that satisfy conditions specified.
[ "func (sl *Slack) FindGroup(cb func(*Group) bool) (*Group, error) {\n\tgroups, err := sl.GroupsList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, group := range groups {\n\t\tif cb(group) {\n\t\t\treturn group, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"No such group.\")\n}" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }