query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Construct a transformation object | [
"def get_transformation(self, coordinates):\n \"\"\"\"\"\"\n atom1, atom2, atom3 = self.hinge_atoms\n center = coordinates[atom2]\n a = coordinates[atom1] - coordinates[atom2]\n b = coordinates[atom3] - coordinates[atom2]\n axis = np.cross(a, b)\n norm = np.linalg.no... | [
"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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Iterate through marshmallow schema fields.
Generates: name, field pairs | [
"def iter_fields(self, schema: Schema) -> Iterable[Tuple[str, Field]]:\n \n for name in sorted(schema.fields.keys()):\n field = schema.fields[name]\n yield field.dump_to or name, field"
] | [
"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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
{@inheritdoc}
@deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter | [
"public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)\n {\n if ($this->translator instanceof TranslatorInterface) {\n $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale);\n }\n\n $trans = $this... | [
"public function loadEnvironmentConfigurations($app, RepositoryContract $repository)\n {\n $configPath = realpath($app->environmentPath());\n\n $files = $this->getConfigurationFilesInPath($configPath);\n\n foreach ($files as $scope => $path) {\n $items = require $path;\n\n ... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
If no messages can be fetched, returns None.
If get_partition_info is None, it defaults to self.partition_info
If get_partition_info is True, returns (partition, message)
If get_partition_info is False, returns message | [
"def _get_message(self, block=True, timeout=0.1, get_partition_info=None,\n update_offset=True):\n \n start_at = time.time()\n while self.queue.empty():\n # We're out of messages, go grab some more.\n log.debug('internal queue empty, fetching more messa... | [
"def _send_request_to_controller(self, request):\n \n tries = 2 # in case our cached self._controller_id is outdated\n while tries:\n tries -= 1\n response = self._send_request_to_node(self._controller_id, request)\n # In Java, the error fieldname is inconsiste... | codesearchnet | {
"query": "Represent the description about Software Engineering:",
"pos": "Represent the code about Software Engineering:",
"neg": "Represent the code about Software development:"
} |
// IsASCII check if the string contains ASCII chars only. Empty string is valid. | [
"func IsASCII(str string) bool {\n\tif IsNull(str) {\n\t\treturn true\n\t}\n\treturn rxASCII.MatchString(str)\n}"
] | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
/*
(non-Javadoc)
@see
com.fs.commons.desktop.validation.Validator#validate(com.fs.commons.desktop.
validation.Problems, java.lang.String, java.lang.Object) | [
"@Override\n\tpublic boolean validate(final Problems problems, final String compName, final String model) {\n\t\ttry {\n\t\t\tInteger.parseInt(model);\n\t\t} catch (final NumberFormatException e) {\n\t\t\tproblems.add(ValidationBundle.getMessage(IsAnIntegerValidator.class, \"ERR_NOT_INTEGER\", model)); // NOI18N\n\... | [
"@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// FuncGet gets a function from registry if it exists. | [
"func (m *FuncRegistry) FuncGet(name string) (Func, bool) {\n\tm.mu.RLock()\n\tfn, ok := m.funcs[name]\n\tm.mu.RUnlock()\n\treturn fn, ok\n}"
] | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Returns the sheets from the given Excel XLSX file.
@param stream The input stream with the XLSX file
@return The sheet names from the XLSX file
@throws IOException if the file cannot be opened | [
"public static String[] getXlsxWorksheets(InputStream stream) \n throws IOException\n {\n XlsxWorkbook workbook = XlsxWorkbook.getWorkbook(stream);\n String[] sheets = workbook.getSheetNames();\n workbook.close();\n return sheets;\n }"
] | [
"private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {\n // Get default form\n in.defaultReadObject();\n\n // Create new Archive\n final String name = this.name;\n final ZipImporter archive = ShrinkWrap.create(ZipImporter.class, name);\n\... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Decorator to explicitly mark functions that are exposed in a lib. | [
"def export(defn):\n \"\"\"\"\"\"\n globals()[defn.__name__] = defn\n __all__.append(defn.__name__)\n return defn"
] | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Add a new review at once | [
"protected function submitAddReview()\n {\n $this->setSubmitted(null, $this->getParam());\n $this->validateComponent('review');\n $this->addReview();\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:"
} |
Get the full SQL statement.
@param bool $usePlaceholders optional use ? placeholders, default true
@return string full SQL statement | [
"public function getStatement($usePlaceholders = true)\n {\n $statement = \"\";\n if ($this->isSelect()) {\n $statement = $this->getSelectStatement($usePlaceholders);\n } elseif ($this->isInsert()) {\n $statement = $this->getInsertStatement($usePlaceholders);\n }... | [
"public function compileUpdateLabels(Builder $query, $labels, $operation = 'add' )\n {\n if(trim(strtolower($operation)) == 'add')\n {\n $updateType = 'SET';\n } else\n {\n $updateType = 'REMOVE';\n }\n // Each one of the columns in the update state... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Convenience function: Returns node.id, or node.name, or None | [
"def node_name(node):\n \n return hasattr(node, 'id') and node.id or hasattr(node, 'name') and node.name"
] | [
"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:"
} |
Set the preferred public key algorithm.
@param name
@throws SshException | [
"public void setPreferredPublicKey(String name) throws SshException {\n\n\t\tif (name == null)\n\t\t\treturn;\n\n\t\tif (publicKeys.contains(name)) {\n\t\t\tprefPublicKey = name;\n\t\t\tsetPublicKeyPreferredPosition(name, 0);\n\t\t} else {\n\t\t\tthrow new SshException(name + \" is not supported\",\n\t\t\t\t\tSshEx... | [
"public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }"
] | codesearchnet | {
"query": "Represent the instruction about Encryption:",
"pos": "Represent the code about Encryption:",
"neg": "Represent the code about N/A:"
} |
Translate the exists querry
@return string | [
"protected function translateExists()\n {\n $translator = new static;\n\n // translate the subselect\n list($subQuery, $subQueryParameters) = $translator->translate($this->attr('select'));\n\n // merge the parameters\n foreach($subQueryParameters as $parameter)\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:"
} |
Drains the buffers up to the amortized threshold and applies the pending
operations. | [
"void drainBuffers() {\n // A mostly strict ordering is achieved by observing that each buffer\n // contains tasks in a weakly sorted order starting from the last drain.\n // The buffers can be merged into a sorted array in O(n) time by using\n // counting sort and chaining on a collisio... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about File management:"
} |
Handler for all the calls so every remaining event listener is removed
removed properly before we call the callback.
@api private | [
"function handle() {\n for (\n var i = 0\n , length = args.length;\n\n i < length;\n self.removeListener(args[i++], handle)\n ){}\n\n // call the function as last as the function might be calling on of\n // events that where in our ei... | [
"function(list){\n localStorage.setItem(localStorageKey, JSON.stringify(list));\n // if we used a real database, we would likely do the below in a callback\n this.list = list;\n this.trigger(list); // sends the updated list to all listening components (TodoApp)\n }... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// UnmarshalYAML implements the Unmarshaller interface. | [
"func (n *External) UnmarshalYAML(unmarshal func(interface{}) error) error {\n\tif err := unmarshal(&n.External); err == nil {\n\t\treturn nil\n\t}\n\tvar dummyExternal struct {\n\t\tName string\n\t}\n\n\terr := unmarshal(&dummyExternal)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn.Name = dummyExternal.Name\n\tn.Ex... | [
"func (ev *ChangeWatchResp) GetValue(val proto.Message) error {\n\treturn json.Unmarshal(ev.message.Content, val) //TODO use contentType...\n}"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Creates a new UpdateableSegmentMetadata for the given Segment and registers it. | [
"private UpdateableSegmentMetadata createSegmentMetadata(String segmentName, long segmentId) {\n UpdateableSegmentMetadata metadata = new StreamSegmentMetadata(segmentName, segmentId, this.containerId);\n this.newSegments.put(metadata.getId(), metadata);\n this.newSegmentNames.put(metadata.getN... | [
"@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 about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// listenAndproxy listens, locally, on the prxy's specified Port. For each
// incoming connection a goroutine running the prxy method is created. | [
"func (p *proxy) listenAndproxy() {\n\n\tconnections := make(chan net.Conn)\n\tgo func(lsocket net.Listener, conns chan net.Conn) {\n\t\tfor {\n\t\t\tconn, err := lsocket.Accept()\n\t\t\tif err != nil {\n\t\t\t\tglog.Fatal(\"Error (net.Accept): \", err)\n\t\t\t}\n\t\t\tconns <- conn\n\t\t}\n\t}(p.listener, connecti... | [
"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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Use this method to send point on the map.
:param chat_id:
:param latitude:
:param longitude:
:param live_period
:param reply_to_message_id:
:param reply_markup:
:return: API reply. | [
"def send_location(self, chat_id, latitude, longitude, live_period=None, reply_to_message_id=None, reply_markup=None,\n disable_notification=None):\n \n return types.Message.de_json(\n apihelper.send_location(self.token, chat_id, latitude, longitude, live_period, reply_... | [
"def to_array(self):\n \n array = super(InlineQueryResultVoice, self).to_array()\n array['type'] = u(self.type) # py2: type unicode, py3: type str\n\n array['id'] = u(self.id) # py2: type unicode, py3: type str\n\n array['voice_url'] = u(self.voice_url) # py2: type unicode, py3... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Returns the item values as array.
@return Associative list of item properties and their values | [
"public function toArray()\n\t{\n\t\t$list = parent::toArray();\n\n\t\t$list['order.base.coupon.baseid'] = $this->getBaseId();\n\t\t$list['order.base.coupon.productid'] = $this->getProductId();\n\t\t$list['order.base.coupon.code'] = $this->getCode();\n\n\t\treturn $list;\n\t}"
] | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Applies the given expiry to the cookie.
@param \DateTimeInterface $date
@return self Cloned instance with the specified operation applied.
@see self::withMaxAge()
@see self::withoutExpiry()
@link https://tools.ietf.org/html/rfc6265#section-5.2.1 | [
"public function withExpiry(\\DateTimeInterface $date): self\n {\n $new = clone $this;\n\n if ($date instanceof \\DateTimeImmutable) {\n $new->expiry = $date;\n } elseif ($date instanceof \\DateTime) {\n $new->expiry = \\DateTimeImmutable::createFromMutable($date);\n ... | [
"private boolean checkActionMethod(AppController controller, String actionMethod) {\n HttpMethod method = HttpMethod.getMethod(RequestContext.getHttpRequest());\n if (!controller.actionSupportsHttpMethod(actionMethod, method)) {\n DirectResponse res = new DirectResponse(\"\");\n ... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
Removes the element at the specified index of the SortedList.
@param {Number} index The zero-based index of the element to remove. | [
"function (index) {\n assertType(index, Number);\n\n if (index < 0 || index >= this.slot.size) {\n error(ERROR_ARGUMENT_OUT_OF_RANGE);\n }\n\n this.slot.size--;\n this.slot.keys.splice(index, 1);\n this.slot.values.splice(index, 1);\n this.slot.keys.length... | [
"public function containsValue($value): bool {\n\n /**\n * @var string $arrayIndex\n * @var SinglyLinkedList $list\n */\n foreach ($this->bucket as $arrayIndex => $list) {\n /* $list is the first element in the bucket. The bucket\n * can contain max $maxS... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Returns the last n lines of a file.
@param int $len Num chars to read.
@return mixed The filtered buffer or -1 if EOF. | [
"public function read($len = null)\n {\n if (!$this->getInitialized()) {\n $this->initialize();\n $this->setInitialized(true);\n }\n\n while (($buffer = $this->in->read($len)) !== -1) {\n // Remove the last \"\\n\" from buffer for\n // prevent expl... | [
"def set_stream(source, options)\n # Are we going to read from a file, or read from a binary string?\n if options[:bin]\n # Read from the provided binary string:\n @str = source\n else\n # Read from file:\n open_file(source)\n # Read the initial header of the file:\... | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Pod spec to be used to create pods for project: tensorboard, notebooks. | [
"def get_project_pod_spec(volume_mounts,\n volumes,\n image,\n command,\n args,\n ports,\n env_vars=None,\n env_from=None,\n ... | [
"def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
------------------------------------------------------ worker methods | [
"public void launchAddWorkerDialog() {\n if (addWorkerDialog == null) {\n addWorkerDialog = new AddResourceDialog(\n securityFramework.getSecurityContext(getProxy().getNameToken()),\n resourceDescriptionRegistry.lookup(workerAddressTemplate),\n ... | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Returns a copy of this LocalDateTime with the date altered.
@param LocalDate $date
@return LocalDateTime | [
"public function withDate(LocalDate $date) : LocalDateTime\n {\n if ($date->isEqualTo($this->date)) {\n return $this;\n }\n\n return new LocalDateTime($date, $this->time);\n }"
] | [
"public static <T extends Comparable<?>> DateExpression<T> asDate(T value) {\n return asDate(constant(value));\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// cloneRequest returns a clone of the provided *http.Request.
// The clone is a shallow copy of the struct and its Header map. | [
"func cloneRequest(r *http.Request, body []byte) *http.Request {\n\t// shallow copy of the struct\n\tr2 := new(http.Request)\n\t*r2 = *r\n\t// deep copy of the Header\n\tr2.Header = make(http.Header, len(r.Header))\n\tfor k, s := range r.Header {\n\t\tr2.Header[k] = append([]string(nil), s...)\n\t}\n\tif len(body) ... | [
"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 post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Software development:"
} |
{@inheritdoc}
In case, when the [[value]] property is `null`, the value of [[defaultValue]] will be used as the value. | [
"protected function getValue($event)\n {\n if ($this->value === null && Yii::getApp()->has('user')) {\n $userId = Yii::getApp()->get('user')->id;\n if ($userId === null) {\n return $this->getDefaultValue($event);\n }\n\n return $userId;\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 sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
// StringWidth return width as you can see | [
"func (c *Condition) StringWidth(s string) (width int) {\n\tif c.ZeroWidthJoiner {\n\t\treturn c.stringWidthZeroJoiner(s)\n\t}\n\treturn c.stringWidth(s)\n}"
] | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Closes all pooled tracers. | [
"public void closePoolTracer() {\r\n this.poolWriteLock.lock();\r\n try {\r\n for (AbstractTracer tracer : this.tracerPool.values()) {\r\n tracer.close();\r\n }\r\n }\r\n finally {\r\n this.poolWriteLock.unlock();\r\n }\r\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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add billing params.
@param string[] $params
@param string[] $options
@return array | [
"protected function addBilling(array $params, array $options)\n {\n if ($address = Arr::get($options, 'billing_address')) {\n $params['payer']['payer_info']['billing_address'] = [\n 'line1' => Arr::get($address, 'address1', ''),\n 'line2' => Arr::get(... | [
"private function preconfigured() {return dfc($this, function() {\n\t\t$s = $this->s(); /** @var S $s */\n\t\t/** @var string $key */\n\t\t$key = 'actionFor' . (df_customer_is_new($this->o()->getCustomerId()) ? 'New' : 'Returned');\n\t\t/** @var string $result */\n\t\treturn $s->v($key, null, function() use($s) {re... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Process an uncompressed packet of data.
@param o {RawDataToSample} - Used to hold data and configuration settings
@private | [
"function processUncompressedData (o) {\n // Resets the packet counter back to zero\n o.lastSampleNumber = k.OBCIGanglionByteIdUncompressed; // used to find dropped packets\n\n for (let i = 0; i < 4; i++) {\n o.decompressedSamples[0][i] = utilitiesModule.interpret24bitAsInt32(o.rawDataPacket.slice(1 + (i * 3... | [
"@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// SetResolverEndpointId sets the ResolverEndpointId field's value. | [
"func (s *DeleteResolverEndpointInput) SetResolverEndpointId(v string) *DeleteResolverEndpointInput {\n\ts.ResolverEndpointId = &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:"
} |
Evaluate strings. | [
"def evaluate_strings(self, string, temp=False):\n \"\"\"\"\"\"\n\n value = ''\n if self.strings:\n if self.decode_escapes:\n value = RE_SURROGATES.sub(\n self.replace_surrogates,\n (RE_TEMP_ESC if temp else RE_ESC).sub(self.replac... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Home handles the request and returns the user home | [
"func Home() echo.HandlerFunc {\n\n\t// swagger:route GET /me/home me post home getMeHome\n\t//\n\t// Shows the homepage of the current user, mixing projects and users posts\n\t//\n\t// You can personalize the request via query string parameters\n\t//\n\t//\tProduces:\n\t//\t- application/json\n\t//\n\t//\tSecurity... | [
"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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Sets the Returns token
@param string $return | [
"public function returns($returns)\n {\n //check if the Return clause is even supported\n $returnTypes = $this->getValidReturnTypes();\n if (count($returnTypes) <= 0) {\n throw new LogicException(\"Return clause not supported for this statement\");\n }\n\n $returns =... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
@param Link[] $pluginRequirements
@return Link[] | [
"private function checkComposerDependencies(\n array $pluginRequirements,\n RequirementExceptionStack $exceptionStack,\n Composer $pluginComposer\n ): array {\n $packages = $pluginComposer->getRepositoryManager()->getLocalRepository()->getPackages();\n foreach ($packages as $pa... | [
"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 text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
} |
The current session will be authenticated using this token_auth.
It will overwrite the previous Auth object.
@param string $tokenAuth
@return void | [
"private static function forceReloadAuthUsingTokenAuth($tokenAuth)\n {\n /**\n * Triggered when authenticating an API request, but only if the **token_auth**\n * query parameter is found in the request.\n *\n * Plugins that provide authentication capabilities should subscri... | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
Parse an existing crontab
@param Crontab $crontab
@return CrontabFileHandler | [
"public function parseExistingCrontab(Crontab $crontab)\n {\n // parsing cron file\n $process = new Process($this->crontabCommand($crontab).' -l');\n $process->run();\n\n foreach ($this->parseString($process->getOutput()) as $item) {\n $crontab->addItem($item);\n }\n... | [
"def changeTo(self, path):\n '''\n '''\n dictionary = DictSingle(Pair('PATH', StringSingle(path)))\n self.value = [dictionary]"
] | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
creates a scan for flow data
@param rowPrefix - start row prefix
@param limit - limit on scanned results
@param version - version to match
@return Scan | [
"private Scan createFlowScan(byte[] rowPrefix, int limit, String version) {\n Scan scan = new Scan();\n scan.setStartRow(rowPrefix);\n\n // using a large scanner caching value with a small limit can mean we scan a\n // lot more data than necessary, so lower the caching for low limits\n scan.setCachin... | [
"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 summarization about Data parsing:",
"pos": "Represent the Github code about Data parsing:",
"neg": "Represent the Github code:"
} |
Store a new ambush function. Validates id doesn't exist already, etc.
@param {Ambush} object Ambush function data.
@returns {void} Nothing. | [
"function add(object) {\n\tif (!_isValidAmbush(object)) {\n\t\treturn false;\n\t}\n\n\tobject.description = _cleanDescription(object.description);\n\n\tif (!_belongToAStoredAmbush(object.id)) {\n\t\tconst newObject = Object.assign({}, object);\n\t\tgoblin.ambush.push(newObject);\n\t\tgoblin.ambushEmitter.emit('chan... | [
"function initCreate (args) {\n // method name is moduleNameCreate\n var methodName = `${this.name}Create`\n // method signature is moduleName.methodname\n var methodSignature = `${this.moduleName}.${methodName}`\n // capture model to pass to function\n var model = this\n // add create method t... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// exitChroot exits chroot | [
"func (p *PNSExecutor) exitChroot() error {\n\tif err := p.rootFS.Chdir(); err != nil {\n\t\treturn errors.InternalWrapError(err)\n\t}\n\terr := syscall.Chroot(\".\")\n\tif err != nil {\n\t\treturn errors.InternalWrapError(err)\n\t}\n\treturn nil\n}"
] | [
"func UninstallMountDir(runMode libkb.RunMode, log Log) error {\n\t// We need the installer to remove the mount directory (since it's in the root, only the helper tool can do it)\n\treturn execNativeInstallerWithArg([]string{\"--uninstall-mountdir\"}, runMode, log)\n}"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
customError
return an object forming a custom error message
@param {String} name
@param {Object} error
@return {Object} | [
"function customError(name, error) {\n return {\n error: error,\n message: error.message,\n name: name\n };\n}"
] | [
"function function_ (options) {\n options.hash.kind = 'function'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find function.'\n}"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// HandlerPath returns the handler path | [
"func HandlerPath(h interface{}) string {\n\tv := reflect.ValueOf(h)\n\tt := v.Type()\n\tswitch t.Kind() {\n\tcase reflect.Func:\n\t\treturn runtime.FuncForPC(v.Pointer()).Name()\n\tcase reflect.Ptr:\n\t\tt = t.Elem()\n\t\tfallthrough\n\tcase reflect.Struct:\n\t\treturn t.PkgPath() + `.` + t.Name()\n\t}\n\treturn `... | [
"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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
This makes sure that:
All supervisors have a status that is a hash
If it has something else for whatever reason, the real object is put in a hash under the 'status' key | [
"def normalize_status_data!\n self.status ||= {} \n self.status['workers'] ||= {}\n \n self.status['workers'].each do |k,v|\n unless v.is_a?(Hash)\n v = {'state' => v.inspect }\n end\n end\n \n self.databag ||= {}\n self.databag['workers'] ||= {}\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Replaces a value within the cache.
@param string $key
@param mixed $content
@param int $expiry
@return bool | [
"public function replace($key, $content, $expiry = 0)\n {\n if (!$this->get($key)) {\n return false;\n }\n\n return $this->set($key, $content, $expiry);\n }"
] | [
"public function update($id, $model)\n {\n // arguments for private method\n $args = func_get_args();\n\n // proxy call\n $result = $this->proxy('_update', $args);\n\n // if($this->shouldUseCache())\n // {\n // \t// Cache::put($this->type . ':' . $result->id, $res... | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
/*
Implementation to remove an item from the storage engine.
@see YAHOO.util.Storage._setItem | [
"function(key, value) {\n\t\t\tvar _this = this;\n\t\t\t\n\t\t\ttry {\n\t\t\t\t_beginTransaction(_this._engine);\n\t\t\t\t_this._engine.setItem(key, value);\n\t\t\t\t_commitTransaction(_this._engine);\n\t\t\t\t_this.length = _this._engine.length;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\treturn fal... | [
"function resolve(){\n\t\tLRState::clear_index();\n\t\tLRStation::clear_index();\n\t\t// create Root Set\n\t\t// we SHOULD have a single etransition to an intial state\n\t\treturn LRStateSet::init( $this->etransitions[0], $this->Grammar );\n\t}"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Computer Science:"
} |
Add an xsd:element represented as an array to the schema.
@param array $element An xsd:element represented as an array.
@return string | [
"public function addElement(array $element)\n {\n $elementXml = $this->parseElement($element);\n $this->schema->appendChild($elementXml);\n return 'tns:' . $element['name'];\n }"
] | [
"@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }"
] | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Returns a list of all :class:`~plexapi.myplex.MyPlexUser` objects connected to your account.
This includes both friends and pending invites. You can reference the user.friend to
distinguish between the two. | [
"def users(self):\n \n friends = [MyPlexUser(self, elem) for elem in self.query(MyPlexUser.key)]\n requested = [MyPlexUser(self, elem, self.REQUESTED) for elem in self.query(self.REQUESTED)]\n return friends + requested"
] | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
See: http://tools.ietf.org/html/rfc5988 | [
"def links\n @_links ||= {}.tap do |links|\n Array(headers[\"Link\"] || headers[\"link\"]).map do |link|\n link.match %r{\\A<([^>]+)>;\\s*rel=\"([^\"]+)\"\\z}\n end.compact.each do |match|\n links[match[2].downcase.to_sym] = match[1]\n end\n end\n end"
] | [
"async def text(self, *, encoding: Optional[str]=None) -> str:\n \"\"\"\"\"\"\n data = await self.read(decode=True)\n # see https://www.w3.org/TR/html5/forms.html#multipart/form-data-encoding-algorithm # NOQA\n # and https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttpreques... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Generate header names for the whole structure. | [
"public function generateHeaderNames()\n {\n foreach ($this->data as $baseType => &$baseArray) {\n foreach ($baseArray as $nodeName => &$nodeData) {\n if (is_array($nodeData)) {\n $nodeName = $this->decodeNodeName($nodeName);\n $this->generat... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github text about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Get a single child tag from an XML element.
Similar to "elem.find(tag)", but warns if there are multiple child tags with the given name. | [
"def get_single_child_from_xml(elem, tag):\n \n children = elem.findall(tag)\n if not children:\n return None\n if len(children) > 1:\n logging.warning('Tag \"%s\" has more than one child tags with name \"%s\" in input file, '\n 'ignoring all but the first.',\n ... | [
"def lookup_key(self):\n \n parts = set()\n for node in self.simple_selectors:\n for token in node.tokens:\n if token[0] not in ':[':\n parts.add(token)\n\n if not parts:\n # Should always have at least ONE key; selectors with no el... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Wrap wraps an existing Configuration structure and ties it to a file on
// disk. | [
"func Wrap(path string, cfg Configuration) Wrapper {\n\tw := &wrapper{\n\t\tcfg: cfg,\n\t\tpath: path,\n\t\tmut: sync.NewMutex(),\n\t}\n\treturn w\n}"
] | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the Github post about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
create BreakNode next to StrNode
@param {TxtNode} prevNode previous node from BreakNode | [
"function createEndedBRNode(prevNode) {\n return {\n type: Syntax.Break,\n raw: \"\\n\",\n value: \"\\n\",\n range: [prevNode.range[1], prevNode.range[1] + 1],\n loc: {\n start: {\n line: prevNode.loc.end.line,\n column: prevNode.loc.end... | [
"AtomSymbol alignTo(SymbolAlignment alignment) {\n return new AtomSymbol(element, adjuncts, annotationAdjuncts, alignment, hull);\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param IRoute $route
@return mixed | [
"public function supports(IRoute $route) {\n list($controller, $method) = $this->extractControllerAndMethod(\n $route->getAction()\n );\n\n if ($controller !== null && $method !== null) {\n return true;\n }\n\n return false;\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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Sets a maximum and a default limit for GET requests
@param DispatcherContext $context The active command context
@return void | [
"protected function _beforeGet(DispatcherContext $context)\n {\n $controller = $this->getController();\n\n if($controller instanceof ControllerModellable)\n {\n $controller->getModel()->getState()->setProperty('limit', 'default', $this->getConfig()->default);\n\n $limit... | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
// Validate inspects the fields of the type to determine if they are valid. | [
"func (s *ContentTypeProfileConfig) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ContentTypeProfileConfig\"}\n\tif s.ForwardWhenContentTypeIsUnknown == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ForwardWhenContentTypeIsUnknown\"))\n\t}\n\tif s.ContentTypeProfiles != nil... | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
:type batch:
:class:`~opencensus.ext.jaeger.trace_exporter.gen.jaeger.Batch`
:param batch: Object to emit Jaeger spans. | [
"def emit(self, batch):\n \n udp_socket = None\n try:\n self.client._seqid = 0\n # truncate and reset the position of BytesIO object\n self.buffer._buffer.truncate(0)\n self.buffer._buffer.seek(0)\n self.client.emitBatch(batch)\n ... | [
"def start_workunit(self, workunit):\n \"\"\"\"\"\"\n if workunit.has_label(WorkUnitLabel.GOAL):\n service_name = \"pants goal\"\n elif workunit.has_label(WorkUnitLabel.TASK):\n service_name = \"pants task\"\n else:\n service_name = \"pants workunit\"\n\n # Check if it is the first wor... | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// StringToDurationValueFunc is a mapstructure hook that looks for an incoming
// string mapped to a DurationValue and does the translation. | [
"func StringToDurationValueFunc() mapstructure.DecodeHookFunc {\n\treturn func(\n\t\tf reflect.Type,\n\t\tt reflect.Type,\n\t\tdata interface{}) (interface{}, error) {\n\t\tif f.Kind() != reflect.String {\n\t\t\treturn data, nil\n\t\t}\n\n\t\tval := DurationValue{}\n\t\tif t != reflect.TypeOf(val) {\n\t\t\treturn d... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
Send responses for first number of {@code permits} namespaces and remove them from the list. | [
"private void sendOperationsForNamespaces(int permits) {\n InternalPartitionServiceImpl partitionService = getService();\n try {\n PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex());\n Iterator<ServiceNamespace> iterator = namespa... | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Auto Generated Code | [
"def copy_config_input_with_defaults(self, **kwargs):\n \n config = ET.Element(\"config\")\n copy_config = ET.Element(\"copy_config\")\n config = copy_config\n input = ET.SubElement(copy_config, \"input\")\n with_defaults = ET.SubElement(input, \"with-defaults\", xmlns=\"ur... | [
"public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }"
] | codesearchnet | {
"query": "Represent the Github description about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code about File management:"
} |
// GetByGrant returns all SavedGrants where the given grant is in the list of grants | [
"func (m *Manager) GetByGrant(grant Grant, globalID string) ([]SavedGrants, error) {\n\tvar usersWithGrant []SavedGrants\n\n\tif err := m.collection.Find(bson.M{\"grants\": grant, \"globalid\": globalID}).All(&usersWithGrant); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn usersWithGrant, nil\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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
refresh the token from the API
then call a Wallabag instance
then store the token
:return: wall instance | [
"def wall(self):\n \n us = UserService.objects.get(user=self.user, name='ServiceWallabag')\n params = {\n 'client_id': us.client_id,\n 'client_secret': us.client_secret,\n 'username': us.username,\n 'password': us.password,\n }\n try:\n ... | [
"def webhook_handler(request):\n \n body = request.stream.read().decode('utf8')\n print('webhook handler saw:', body)\n api.notify_webhook_received(payload=body)\n\n # nb. protected references are not part of the API.\n # this is just to demonstrate that the asyncid is stored\n print('key store... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Процесс отправки формы
@return array | [
"public function actionSubmit()\n {\n if (\\Yii::$app->request->isAjax && !\\Yii::$app->request->isPjax) {\n \\Yii::$app->response->format = Response::FORMAT_JSON;\n\n $response = [\n 'success' => false,\n 'message' => 'Произошла ошибка',\n ];... | [
"private function processA(array $result) {\n\t\ttry {\n\t\t\t$result = $this->processI($result);\n\t\t}\n\t\t/**\n\t\t * 2016-08-02\n\t\t * Исключительная ситуация может быть не только типа @see \\Df\\Core\\Exception,\n\t\t * но и типа @see \\Exception,\n\t\t * потому что чтение некорректных данных может приводить... | codesearchnet | {
"query": "Represent the post about software development:",
"pos": "Represent the code about software development:",
"neg": "Represent the code about Programming:"
} |
Compute the hyperbolic tangent of a number.
@param x number on which evaluation is done
@return hyperbolic tangent of x | [
"public static double tanh(double x) {\n boolean negate = false;\n\n if (x != x) {\n return x;\n }\n\n // tanh[z] = sinh[z] / cosh[z]\n // = (exp(z) - exp(-z)) / (exp(z) + exp(-z))\n // = (exp(2x) - 1) / (exp(2x) + 1)\n\n // for magnitude > 20, sinh[z] == cosh[z] in doubl... | [
"def dihedral(array_of_xyzs):\n \n p1 = array_of_xyzs[0]\n p2 = array_of_xyzs[1]\n p3 = array_of_xyzs[2]\n p4 = array_of_xyzs[3]\n\n vector1 = -1.0 * (p2 - p1)\n vector2 = p3 - p2\n vector3 = p4 - p3\n\n # Normalize vector so as not to influence magnitude of vector\n # rejections\n ... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
concat(trg,src..) log | [
"public void logConcat(String trg, String [] srcs, long timestamp) {\n ConcatDeleteOp op = ConcatDeleteOp.getInstance();\n op.set(trg, srcs, timestamp);\n logEdit(op);\n }"
] | [
"final static function sn(M $m) {return dfcf(function(M $m) {return df_new(\n\t\tdf_con_heir($m, __CLASS__), $m\n\t);}, [$m]);}"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
CheckBox constructor
@param {aria.widgets.CfgBeans:CheckBoxCfg} cfg the widget configuration
@param {aria.templates.TemplateCtxt} ctxt template context
@param {Number} lineNumber Line number corresponding in the .tpl file where the widget is created | [
"function (cfg, ctxt, lineNumber) {\n this.$Input.constructor.apply(this, arguments);\n this._setSkinObj(this._skinnableClass);\n this._setInputType();\n this._setIconPrefix();\n this._setState();\n if (!this._skinObj.simpleHTML) {\n /**\n * Instance ... | [
"function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Parse a css file
@param string $file
@return \Customize\Model\Sheet\Structure | [
"public function parse( $file )\n {\n if ( ! is_file( $file ) || ! is_readable( $file ) )\n {\n return null;\n }\n\n $sheet = new Sheet\\Structure();\n $this->buffer = @ file_get_contents( $file );\n $this->acceptBom();\n\n while ( ! empty( $this->buff... | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
I parse arguments in sys.argv and return the args object. The parser
itself is available as args.parser.
Adds the following members to args:
parser = the parser object
store_opt = the StoreOpt object | [
"def parseArguments(argv=None): # pragma: no cover\n \n store_opt = StoreOpt()\n parser = argparse.ArgumentParser(\n prog='green',\n usage='%(prog)s [options] [target [target2 ...]]',\n add_help=False,\n description=dedent(\n \"\"\"\n ... | [
"def _env(self, line):\n '''\n \n '''\n line = self._setup('ENV', line)\n\n # Extract environment (list) from the line\n environ = parse_env(line)\n\n # Add to global environment, run during install\n self.install += environ\n\n # Also define for global envi... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public String convertMFCMedCollToString(EDataType eDataType, Object instanceValue) {\n\t\treturn instanceValue == null ? null : instanceValue.toString();\n\t}"
] | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the Github text about Text generation:",
"pos": "Represent the Github code about Text generation:",
"neg": "Represent the Github code:"
} |
Extract a region of the image defined by corners (x1, y1) and
(x2, y2) and resample it to fit dimensions (new_wd, new_ht).
`method` describes the method of interpolation used, where the
default "basic" is nearest neighbor. | [
"def get_scaled_cutout_wdht(self, x1, y1, x2, y2, new_wd, new_ht,\n method='basic'):\n \n\n if method in ('basic', 'view'):\n shp = self.shape\n\n (view, (scale_x, scale_y)) = \\\n trcalc.get_scaled_cutout_wdht_view(shp, x1, y1, x2, y2... | [
"def _create_features(self, constraints):\n \"\"\"\"\"\"\n affine_warp_constraints = constraints\n if not isinstance(affine_warp_constraints, AffineWarpConstraints):\n affine_warp_constraints = AffineWarpConstraints(affine_warp_constraints)\n mask = affine_warp_constraints.mask\n psi = _create_a... | codesearchnet | {
"query": "Represent the summarization about Image processing:",
"pos": "Represent the code about Image processing:",
"neg": "Represent the code:"
} |
// GenerateNetplan renders a netplan file for one or more network
// interfaces, using the given non-empty list of interfaces. | [
"func GenerateNetplan(interfaces []network.InterfaceInfo) (string, error) {\n\tif len(interfaces) == 0 {\n\t\treturn \"\", errors.Errorf(\"missing container network config\")\n\t}\n\tlogger.Debugf(\"generating netplan from %#v\", interfaces)\n\tvar netPlan netplan.Netplan\n\tnetPlan.Network.Ethernets = make(map[str... | [
"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 description about network configuration:",
"pos": "Represent the code about network configuration:",
"neg": "Represent the code about Technology:"
} |
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
@return \Twilio\Rest\Video\V1\CompositionContext Context for this
CompositionInstance | [
"protected function proxy() {\n if (!$this->context) {\n $this->context = new CompositionContext($this->version, $this->solution['sid']);\n }\n\n return $this->context;\n }"
] | [
"@Override\n public Broadcastable openChannel(String ccid, Integer cacheIndex, String atmosphereTrackingId) {\n throw new JoynrCommunicationException(\"No channels can't be opened on bounce proxy controller, only on bounce proxies.\");\n }"
] | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
atom ::= NUMBER | '(' expr ')' | [
"def n_atom(self, node):\n \n length = len(node)\n if length == 1:\n self.preorder(node[0])\n node.value = node[0].value\n self.prune()\n elif length == 3:\n self.preorder(node[1])\n node.value = node[1].value\n self.prune... | [
"def t_ATOM(self, t):\n '\n t.type = LDLfLexer.reserved.get(t.value, 'ATOM') # Check for reserved words\n return t"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Regular expressions:"
} |
// chainMiddleware build middlewares to stack with recursion | [
"func chainMiddleware(el *list.Element) http.HandlerFunc {\n\t// The last element of the middlewares chain is nil.\n\tif el == nil {\n\t\treturn func(rw http.ResponseWriter, r *http.Request) {}\n\t}\n\treturn func(rw http.ResponseWriter, r *http.Request) {\n\t\tel.Value.(Middleware).ServeHTTP(rw, r, chainMiddleware... | [
"function transformer (selection) {\n const type = quantum.isSelection(selection) ? selection.type() : undefined\n const entityTransform = transformMap[type] || defaultTransform\n return entityTransform(selection, transformer, meta) // bootstrap to itself to make the transformer accessible to children\n ... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Replace the state of this object with the same object in some other
state. Used for to restore the before image if a transaction rolls back
or is read from the log during restart.
@param other
is the object this object is to become a clone of. | [
"public void becomeCloneOf(ManagedObject other)\n {\n if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())\n trace.entry(this, cclass,\n \"becomeCloneOf\",\n \"Other=\"\n + other);\n\n super.beco... | [
"@Override\n public void destroy() // PK20881\n {\n if (tc.isEntryEnabled())\n Tr.entry(tc, \"destroy\");\n\n // Dummy transactionWrappers may not be in any table and so\n // will not have a resourceCallback registered to remove them.\n if (_resourceCallback != null)\n ... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Database management:"
} |
Return instance
@return \BEAR\Resource\SchemeCollection | [
"public function get()\n {\n $schemeCollection = new SchemeCollection();\n $pageAdapter = new AppAdapter($this->injector, $this->appName, 'Resource\\Page', $this->resourceDir . '/Page');\n $appAdapter = new AppAdapter($this->injector, $this->appName, 'Resource\\App', $this->resourceDir . '/A... | [
"public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Add a custom service class.
@param string $serviceClass
@throws InvalidArgumentException | [
"public function addServiceClass($serviceClass)\n {\n if (!is_subclass_of($serviceClass, ManagerInterface::class)) {\n throw new InvalidArgumentException(sprintf('The service class \"%s\" should implement \"ManagerInterface\"', $serviceClass));\n }\n $this->serviceClass[] = $servi... | [
"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 post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Set the state field depending on what PayPal requires for that country. | [
"function setStateAndCountry(&$info) {\n global $db, $messageStack;\n switch ($info['country']['iso_code_2']) {\n case 'AU':\n case 'US':\n case 'CA':\n // Paypal only accepts two character state/province codes for some countries.\n if (strlen($info['state']) > 2) {\n $sql = \"... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Language and programming:"
} |
renderJsonAction
@param string $view the view to render
@param string $layout the layout to render
@return \FrontendBridge\Lib\ServiceResponse | [
"public function renderJsonAction($view, $layout): ServiceResponse\n {\n $layout = $this->getLayout($layout);\n if ($this->RequestHandler) {\n // Make sure the view is rendered as HTML, even if it is an AJAX request\n // jsonActionResponse() will make sure the JSON response is... | [
"public function initializeObject()\n {\n parent::initializeObject();\n\n $this->setPathsFromOptions();\n $this->setFormat('html');\n\n // Doesn't work without setting rendering context.\n // Even if StandaloneView works and we just extend it.\n $renderingContent = new R... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
return a context dict of the desired state | [
"def get_context_dict(self):\n \n context_dict = {}\n for s in self.sections():\n for k, v in self.manifest.items(s):\n context_dict[\"%s:%s\" % (s, k)] = v\n for k, v in self.inputs.values().items():\n context_dict[\"config:{0}\".format(k)] = v\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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// WithDetail will return a new Error, based on the current one, but with
// some Detail info added | [
"func (e Error) WithDetail(detail interface{}) Error {\n\treturn Error{\n\t\tCode: e.Code,\n\t\tMessage: e.Message,\n\t\tDetail: detail,\n\t}\n}"
] | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is... | codesearchnet | {
"query": "Represent the sentence about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code about programming:"
} |
Accept a connection.
@param resource $socket
@return void | [
"public function acceptConnection($socket)\n {\n // Accept a connection on server socket.\n set_error_handler(function(){});\n $new_socket = stream_socket_accept($socket, 0, $remote_address);\n restore_error_handler();\n\n // Thundering herd.\n if (!$new_socket) {\n ... | [
"private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Programming:"
} |
Checks if there is a job in queue which the worker (identified by id) can handle.
@param string $workerId
@return array Job data or empty array if no suitable job in queue. | [
"protected function getJobFromQueue(string $workerId) : array\n {\n $workerJobCapabilities = $this->workerJobCapabilities[$workerId];\n foreach ($workerJobCapabilities as $jobName) {\n if (!isset($this->jobQueues[$jobName])) {\n continue;\n }\n if (em... | [
"def reset(self):\n \n self.getsCounter = 0\n\n # dictionary of processed requests for each client. Value for each\n # client is a dictionary with request id as key and transaction id as\n # value\n self.processedRequests = {} # type: Dict[str, Dict[int, str]]\n\n #... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// Record structured Trace log line with a message | [
"func (l *Logger) TraceMsg(message string, keyvals ...interface{}) error {\n\treturn Msg(l.Trace, message, keyvals...)\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Returns an element at seqno
@param seqno
@return | [
"public T get(long seqno) {\n lock.lock();\n try {\n if(seqno - low <= 0 || seqno - hr > 0)\n return null;\n int row_index=computeRow(seqno);\n if(row_index < 0 || row_index >= matrix.length)\n return null;\n T[] row=matrix[row_... | [
"def ref(self):\n \n\n sds_ref = _C.SDidtoref(self._id)\n _checkErr('idtoref', sds_ref, 'illegal SDS identifier')\n return sds_ref"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Enable hook.
@param $name
@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException
@throws \Larapack\Hooks\Exceptions\HookAlreadyEnabledException | [
"public function enable($name)\n {\n // Check if exists\n if (!$this->downloaded($name)) {\n throw new Exceptions\\HookNotFoundException(\"Hook [{$name}] not found.\");\n }\n\n if (!$this->installed($name)) {\n throw new Exceptions\\HookNotInstalledException(\"Ho... | [
"protected function registerModelInformationInterfaceBindings()\n {\n $this->app->singleton(RepositoriesContracts\\ModelInformationRepositoryInterface::class, Repositories\\ModelInformationRepository::class);\n $this->app->singleton(ModelInfoContracts\\Collector\\ModelInformationFileReaderInterface... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Find RSeQC junction_saturation frequency reports and parse their data | [
"def parse_reports(self):\n \n\n # Set up vars\n self.junction_saturation_all = dict()\n self.junction_saturation_known = dict()\n self.junction_saturation_novel = dict()\n\n # Go through files and parse data\n for f in self.find_log_files('rseqc/junction_saturation'):\n parsed = dict()\... | [
"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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Resolves the specified parameters from a container.
@param \ReflectionFunctionAbstract $reflection
@param array $parameters
@return array | [
"protected function arguments(\\ReflectionFunctionAbstract $reflection, $parameters = array())\n {\n $arguments = array();\n\n foreach ($reflection->getParameters() as $key => $parameter)\n {\n $name = $parameter->getName();\n\n if ($class = $parameter->getClass())\n ... | [
"static function parseWith($optionsResource, array $_ = null)\n {\n if (!static::isConfigurableWith($optionsResource))\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid Configuration Resource provided on (%s); given: (%s).'\n , static::class, \\Poirot\\Std... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Check results from batch response, if any of the results is failure throw exception.
@param response
@throws IOException
@throws UnexpectedResponseException | [
"private void processBatchRequestResponse(CloseableHttpResponse response) throws IOException,\n UnexpectedResponseException {\n String entityStr = EntityUtils.toString(response.getEntity());\n int statusCode = response.getStatusLine().getStatusCode();\n if (statusCode >= 400) {\n throw new Runtim... | [
"public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }"
] | codesearchnet | {
"query": "Represent the instruction about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code about N/A:"
} |
Retrieve the command input validator
@return \Illuminate\Contracts\Validation\Validator | [
"protected function validator() : Validator\n {\n if (isset($this->validator)) {\n return $this->validator;\n }\n\n return $this->validator = $this->laravel['validator']->make(\n $this->getDataToValidate(),\n $this->rules(),\n $this->messages(),\n ... | [
"public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\... | codesearchnet | {
"query": "Represent the Github sentence about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
This method carries out validation on the priority field.
@param x | [
"private void validatePriority(int x) throws JMSException {\n // Priority must be in the range 0-9\n if ((x < 0) || (x > 9)) {\n throw (JMSException) JmsErrorUtils.newThrowable(\n JMSException.class,\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Returns the subnetwork ID for the specified nodeId or 0 if non is associated e.g. because the
subnetwork is too small. | [
"public int getSubnetwork(int nodeId) {\n byte[] bytes = new byte[1];\n da.getBytes(nodeId, bytes, bytes.length);\n\n return (int) bytes[0];\n }"
] | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// CloseInConnection closes the queue in the associated connection by removing all related keys | [
"func (queue *redisQueue) CloseInConnection() {\n\tqueue.redisClient.Del(queue.unackedKey)\n\tqueue.redisClient.Del(queue.consumersKey)\n\tqueue.redisClient.SRem(queue.queuesKey, queue.name)\n}"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github instruction about Computer Networking:",
"pos": "Represent the Github code about Computer Networking:",
"neg": "Represent the Github code about programming:"
} |
// GetAllAWSWAFByteMatchSetResources retrieves all AWSWAFByteMatchSet items from an AWS CloudFormation template | [
"func (t *Template) GetAllAWSWAFByteMatchSetResources() map[string]*resources.AWSWAFByteMatchSet {\n\tresults := map[string]*resources.AWSWAFByteMatchSet{}\n\tfor name, untyped := range t.Resources {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSWAFByteMatchSet:\n\t\t\tresults[name] = resource\n\... | [
"public static List<InstanceStateChange> startInstances(final List<String> instanceIDs) {\n // pass any credentials as aws-mock does not authenticate them at all\n AWSCredentials credentials = new BasicAWSCredentials(\"foo\", \"bar\");\n AmazonEC2Client amazonEC2Client = new AmazonEC2Client(cre... | codesearchnet | {
"query": "Represent the Github comment about AWS S3:",
"pos": "Represent the Github code about AWS S3:",
"neg": "Represent the Github code about programming:"
} |
// Sum3rand returns a value from a gaussian-like random distribution between in and zero. | [
"func (as ArraySpec) Sum3rand() Input {\n\treturn as.proc(func(i Input) Input {\n\t\treturn i.Sum3rand()\n\t})\n}"
] | [
"def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]"
] | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
@param RouteHandlerInterface $handler
@param ServerRequestInterface $request
@param Closure|null $next
@return ResponseInterface | [
"protected function dispatchRoute(\n RouteHandlerInterface $handler,\n ServerRequestInterface $request,\n Closure $next = null\n ): ResponseInterface {\n // callback that will be passed to the route handler call, as last argument.\n $handlerNext = $next ? function ($newRequest ... | [
"public function attributeUseHandler(\n string $attribute,\n Type\\HandlerDeserializerInterface $deserialize,\n Type\\HandlerSerializerInterface $serialize\n ): ObjectInterface {\n return $this;\n }"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Draws the precision-recall curves computed in score on the axes. | [
"def draw(self):\n \n if self.iso_f1_curves:\n for f1 in self.iso_f1_values:\n x = np.linspace(0.01, 1)\n y = f1 * x / (2 * x - f1)\n self.ax.plot(x[y>=0], y[y>=0], color='#333333', alpha=0.2)\n self.ax.annotate('$f_1={:0.1f}$'.for... | [
"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 instruction about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
Modal container for theme code form
@return ViewModel | [
"public function toolModalCodeContainerAction()\n {\n $id = $this->params()->fromRoute('id', $this->params()->fromQuery('id', ''));\n\n $melisKey = $this->getMelisKey();\n\n $view = new ViewModel();\n $view->setTerminal(false);\n $view->melisKey = $melisKey;\n $view->id ... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.