query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Filter for fetching assets
Writes static file to asset_dir and returns absolute file path | [
"def fridge_asset(input)\n return input unless input\n if input.respond_to?('first')\n input = input.first['name']\n end\n site = @context.registers[:site]\n asset_dir = site.config['fridge'].config['asset_dir']\n dest_path = File.join(site.dest, asset_dir, input)\n path = ... | [
"function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Print txt by coding GBK.
*args
list, list of printing contents | [
"def _print(*args):\n \n if not CFG.debug:\n return\n if not args:\n return\n encoding = 'gbk'\n args = [_cs(a, encoding) for a in args]\n f_back = None\n try:\n raise Exception\n except:\n f_back = sys.exc_traceback.tb_frame.f_back\n f_name = f_back.f_code.co_... | [
"def t_ATOM(self, t):\n '\n t.type = PLLexer.reserved.get(t.value, 'ATOM') # Check for reserved words\n return t"
] | codesearchnet | {
"query": "Represent the Github description about computer science:",
"pos": "Represent the Github code about computer science:",
"neg": "Represent the Github code about Regular expressions:"
} |
Returns a LifecycleProvider that delegates to an existing provider instance. | [
"public static <U> LifecycleProvider<U> of(@Nonnull final Provider<U> delegate)\n {\n return new DelegatingLifecycleProvider<U>(null, delegate);\n }"
] | [
"@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
// SetTimestamp sets the Timestamp field's value. | [
"func (s *TelemetryRecord) SetTimestamp(v time.Time) *TelemetryRecord {\n\ts.Timestamp = &v\n\treturn s\n}"
] | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
parse arguments
the first element in the array is treated as script name
@param array $inputArgs
@throws UsageException | [
"public function parse($inputArgs = null) {\r\n $args = $this->getCommandLineArgs($inputArgs);\r\n if (count($args)) {\r\n $this->scriptName = array_shift($args);\r\n }\r\n\r\n // build help option\r\n $helpOpt = false;\r\n if ($this->helpLong) {\r\n $... | [
"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 Github summarization about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Get page's metadatas.
@param Page $page the page we want to get its metadatas
@return \Symfony\Component\HttpFoundation\Response
@Rest\ParamConverter(name="page", class="BackBee\NestedNode\Page") | [
"public function getMetadataAction(Page $page)\n {\n $metadata = null !== $page->getMetaData() ? $page->getMetaData()->jsonSerialize() : array();\n if (empty($metadata)) {\n $metadata = $this->application->getContainer()->get('nestednode.metadata.resolver')->resolve($page);\n }\n\... | [
"public static function getDescription()\n {\n $pdoDriver = \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriverFactory::getDescription();\n $pdoDriver->getConfig()->response('dsn', \\CrudGenerator\\Metadata\\Driver\\Pdo\\PdoDriver::POSTGRESQL);\n\n $dataObject = new MetaDataSource();\n ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Helper function to run osquery queries | [
"def _osquery_cmd(table, attrs=None, where=None, format='json'):\n '''\n \n '''\n ret = {\n 'result': True,\n }\n\n if attrs:\n if isinstance(attrs, list):\n valid_attrs = _table_attrs(table)\n if valid_attrs:\n for a in attrs:\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Create new customer
@link https://cheddargetter.com/developers#add-customer
@see setMarketingCookie
@param array $data
@return CheddarGetter_Response
@throws CheddarGetter_Response_Exception | [
"public function newCustomer(array $data)\n {\n $requestAdapter = self::getRequestAdapter();\n if ($requestAdapter->hasCookie($this->getMarketingCookieName())) {\n // if there's marketing cookie information, add it to the data\n $marketingFields = array(\n 'firs... | [
"public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }"
] | codesearchnet | {
"query": "Represent the Github description about e-commerce:",
"pos": "Represent the Github code about e-commerce:",
"neg": "Represent the Github code about Software development:"
} |
// SetIncludeAllLinksToEachParent sets the IncludeAllLinksToEachParent field's value. | [
"func (s *ListObjectParentsInput) SetIncludeAllLinksToEachParent(v bool) *ListObjectParentsInput {\n\ts.IncludeAllLinksToEachParent = &v\n\treturn s\n}"
] | [
"public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Translate and replace Point within boundary (@see translate())
@param integer $pointIndex Index of the point
@param integer $x First vector's coordinate
@param integer $y Second vector's coordinate | [
"public function pointTranslate($pointIndex, $x, $y)\r\n {\r\n if($x || $y)\r\n {\r\n $this->points[$pointIndex] = $this->points[$pointIndex]->translate($x, $y);\r\n }\r\n\r\n return $this;\r\n }"
] | [
"def map_pixel(self, point_x, point_y):\n '''\n \n '''\n row, col = map_pixel(point_x, point_y,\n self.x_cell_size, self.y_cell_size, self.xmin, self.ymax)\n try:\n return self.raster[row, col]\n except:\n raise RasterGeoErr... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Computer Science:"
} |
// UnsupportedMediaType writes a response with status code 415. | [
"func UnsupportedMediaType(w http.ResponseWriter, response interface{}) {\n\tRespond(w, http.StatusUnsupportedMediaType, response)\n}"
] | [
"private boolean isCloudantAuthError(Response response) {\n String server = response.header(\"Server\");\n // Cloudant could send `CouchDB/ad97a06 (Erlang OTP/17)` as Server header value\n // Another cloudant server value example: `CouchDB/1.0.2`\n if (server == null || server.indexOf(\"... | codesearchnet | {
"query": "Represent the Github summarization about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
// Convert_v1_SecretList_To_core_SecretList is an autogenerated conversion function. | [
"func Convert_v1_SecretList_To_core_SecretList(in *v1.SecretList, out *core.SecretList, s conversion.Scope) error {\n\treturn autoConvert_v1_SecretList_To_core_SecretList(in, out, s)\n}"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Creates an hashed fingerprint based on the defined session configuration
which might include client's ip address and/or client's user agent.
@return string | [
"private function createFingerprint()\n {\n $fingerprint = '';\n if ($this->ipAddressFingerprinted) {\n $fingerprint .= $this->request->getClientIp();\n }\n if ($this->userAgentFingerprinted) {\n $fingerprint .= $this->request->getUserAgent();\n }\n ... | [
"def new_device(self, name, type):\n \n # at least android client also includes a \"cid\" with is derived from the unique device id\n # and encrypted with a public key in the apk. The field appears to be optional\n url = posixpath.join(self.rootpath, name)\n r = self.post(url, {'... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Function to create appeals (Requires login).
Parameters:
post_id (int): The id of the appealed post.
reason (str) The reason of the appeal. | [
"def post_appeals_create(self, post_id, reason):\n \n params = {'post_appeal[post_id]': post_id,\n 'post_appeal[reason]': reason}\n return self._get('post_appeals.json', params, 'POST', auth=True)"
] | [
"def clean(self):\n \n super().clean()\n\n # At least a poster (user) or a session key must be associated with\n # the post.\n if self.poster is None and self.anonymous_key is None:\n raise ValidationError(\n _('A user id or an anonymous key must be assoc... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Handles exception logging
@param \Exception $exception Exception instance.
@return bool | [
"protected function _logException(Exception $exception)\n {\n $config = $this->_options;\n $unwrapped = $exception instanceof PHP7ErrorException ?\n $exception->getError() :\n $exception;\n\n if (empty($config['log'])) {\n return false;\n }\n\n ... | [
"public function onReflectError(GenericEvent $event)\n {\n $context = $event->getArguments();\n $this->logger->error('Parser has detected an error on file \"{file}\". {error}', $context);\n }"
] | 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:"
} |
fetch sequence for URI/CURIE of the form namespace:alias, such as
NCBI:NM_000059.3. | [
"def fetch_uri(self, uri, start=None, end=None):\n \n\n namespace, alias = uri_re.match(uri).groups()\n return self.fetch(alias=alias, namespace=namespace, start=start, end=end)"
] | [
"def prt_qualifiers(self, prt=sys.stdout):\n \"\"\"\"\"\"\n # 13 not colocalizes_with (TBD: CHK - Seen in gene2go, but not gafs)\n # 4 not contributes_to (TBD: CHK - Seen in gene2go, but not gafs)\n self._prt_qualifiers(self.associations, prt)"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Make a POST request.
To make a POST request pass, ``url``
:param url: ``str``
:param headers: ``dict``
:param body: ``object``
:param kwargs: ``dict`` | [
"def post(self, url, headers=None, body=None, kwargs=None):\n \n return self._request(\n method='post',\n url=url,\n headers=headers,\n body=body,\n kwargs=kwargs\n )"
] | [
"def __store_config(self, args, kwargs):\n \n signature = (\n 'schema',\n 'ignore_none_values',\n 'allow_unknown',\n 'require_all',\n 'purge_unknown',\n 'purge_readonly',\n )\n for i, p in enumerate(signature[: len(args)])... | codesearchnet | {
"query": "Represent the Github post about software development:",
"pos": "Represent the Github code about software development:",
"neg": "Represent the Github code about Programming:"
} |
// DrawLines draws a series of connected lines on the current rendering target.
// (https://wiki.libsdl.org/SDL_RenderDrawLines) | [
"func (renderer *Renderer) DrawLines(points []Point) error {\n\treturn errorFromInt(int(\n\t\tC.SDL_RenderDrawLines(\n\t\t\trenderer.cptr(),\n\t\t\tpoints[0].cptr(),\n\t\t\tC.int(len(points)))))\n}"
] | [
"func (rgc *RasterGraphicContext) DrawImage(img image.Image) {\n\tDrawImage(img, rgc.img, rgc.current.Tr, draw.Over, BilinearFilter)\n}"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Shortcut method to line method
@param string $text]
@return void | [
"protected function line($text)\n {\n if($this->console) {\n $this->console->line($text);\n }\n\n if($this->logger) {\n $this->logger->line($text);\n }\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the summarization about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
} |
Removes user account key by user hash.
@param string $hash | [
"public function removeByHash(string $hash): void\n {\n $results = $this->findBy(['hashKey' => $hash]);\n\n foreach ($results as $result) {\n $this->getEntityManager()->remove($result);\n }\n\n $this->getEntityManager()->flush();\n }"
] | [
"def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence"
] | codesearchnet | {
"query": "Represent the description about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
// newLineData creates the struct that wraps a log message and will capture the
// source of the logging message from the stack. | [
"func (logger *Logger) newLineData(logClass LogClass, message string) *LineData {\n\tld := &LineData{\n\t\tMessage: message,\n\t\tClass: logClass,\n\t\tTimeStamp: time.Now(),\n\t}\n\n\tld.Fields = make(map[string]interface{}, len(logger.Fields))\n\tfor k, v := range logger.Fields {\n\t\tld.Fields[k] = v\n\t}\... | [
"func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
// Unmount the provided mount path with the flags | [
"func Unmount(target string, flags int) error {\n\tif err := unmount(target, flags); err != nil && err != unix.EINVAL {\n\t\treturn err\n\t}\n\treturn nil\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Sets up the stream connection
@throws \PhpAmqpLib\Exception\AMQPRuntimeException
@throws \Exception | [
"public function connect()\n {\n $sock = new Swoole\\Coroutine\\Client(SWOOLE_SOCK_TCP);\n if (!$sock->connect($this->host, $this->port, $this->connection_timeout))\n {\n throw new AMQPRuntimeException(\n sprintf(\n 'Error Connecting to server(%s)... | [
"public function getContext(): Interfaces\\JavaObject\n {\n try {\n return $this->pjbProxyClient::getClient()->getContext();\n } catch (Pjb62BrokenConnectionException | Exception\\InvalidUsageException $e) {\n PjbProxyClient::unregisterInstance();\n throw new Broken... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Recoursively creates new item tree structures based on a provided
ItemConfiguration object
@param {Object} config ItemConfig
@param {[ContentItem]} parent The item the newly created item should be a child of
@returns {lm.items.ContentItem} | [
"function( config, parent ) {\n\t\tvar typeErrorMsg, contentItem;\n\n\t\tif( typeof config.type !== 'string' ) {\n\t\t\tthrow new lm.errors.ConfigurationError( 'Missing parameter \\'type\\'', config );\n\t\t}\n\n\t\tif( !this._typeToItem[ config.type ] ) {\n\t\t\ttypeErrorMsg = 'Unknown type \\'' + config.type + '\... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Return the name of the current fallback locale. If it has changed since this was
last accessed, the service cache is cleared. | [
"public String validateFallbackLocale() {\n ULocale loc = ULocale.getDefault();\n if (loc != fallbackLocale) {\n synchronized (this) {\n if (loc != fallbackLocale) {\n fallbackLocale = loc;\n fallbackLocaleName = loc.getBaseName();\n ... | [
"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 comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Language and programming:"
} |
get dc node data from solved power flow | [
"def get_nodedata(self, sort_names=False):\n \n if not self.Node.n:\n return\n if not self.pflow.solved:\n logger.error('Power flow not solved when getting bus data.')\n return tuple([False] * 7)\n idx = self.Node.idx\n names = self.Node.name\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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
Apply the given scope on the current builder instance.
@param callable $scope
@param array $parameters
@return mixed | [
"protected function callScope( callable $scope, $parameters = [] )\n\t{\n\t\tarray_unshift( $parameters, $this );\n\n\t\t$query = $this->getQuery();\n\n\t\t// We will keep track of how many wheres are on the query before running the\n\t\t// scope so that we can properly group the added scope constraints in the\n\t\... | [
"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 Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Return a query to filter kb by type.
:param kbtype: type to filter (e.g: taxonomy)
:return: query to filter kb | [
"def query_get_kb_by_type(kbtype):\n \n return models.KnwKB.query.filter_by(\n kbtype=models.KnwKB.KNWKB_TYPES[kbtype])"
] | [
"def add_reference(self, reftype: str, label: str, target):\n \n\n # The self.data[reftype] dict springs into being during the\n # register_references event handler at startup, which looks in the\n # kb registry for all registered reference names.\n self.data[reftype][label] = tar... | codesearchnet | {
"query": "Represent the Github comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
-------------------------------------------------------------------- CLASS
Creates a new class in the schema. | [
"def create_class(name, options={})\n raise ArgumentError, \"class name is blank\" if blank?(name)\n opt_pattern = {\n :extends => :optional, :cluster => :optional, :force => false, :abstract => false,\n :properties => :optional\n }\n verify_options(options, opt_pattern)\n\n ... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Create query builder. | [
"public function createQueryBuilder()\n\t{\n\t\t$q = $this->flupdo->select();\n\t\t$this->queryAddFrom($q);\n\t\t$this->queryAddAccessPolicyCondition($this->read_access_policy, $q);\n\t\treturn $q;\n\t}"
] | [
"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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// SetEndpointDetails sets the EndpointDetails field's value. | [
"func (s *CreateServerInput) SetEndpointDetails(v *EndpointDetails) *CreateServerInput {\n\ts.EndpointDetails = 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 instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// NewDefaultsCommand wraps defaultsCommand with sane model settings. | [
"func NewDefaultsCommand() cmd.Command {\n\tdefaultsCmd := &defaultsCommand{\n\t\tnewCloudAPI: func(caller base.APICallCloser) cloudAPI {\n\t\t\treturn cloudapi.NewClient(caller)\n\t\t},\n\t\tnewDefaultsAPI: func(caller base.APICallCloser) defaultsCommandAPI {\n\t\t\treturn modelmanager.NewClient(caller)\n\t\t},\n\... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Creates actions for the given build.
@param target for which the action objects are requested. Never null.
@return Can be empty but must not be null. | [
"public Collection<? extends Action> createFor(Run target) {\n if (target instanceof AbstractBuild)\n return createFor((AbstractBuild)target);\n else\n return Collections.emptyList();\n }"
] | [
"function DefaultChangeRequestInterceptor(saveContext, saveBundle) {\n /**\n Prepare and return the save data for an entity change-set.\n\n The adapter calls this method for each entity in the change-set,\n after it has prepared a \"change request\" for that object.\n\n The method can do anything... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
an updated version of pygments.formatter.format_unencoded | [
"def get_marked_up_list(self, tokensource):\n \"\"\"\"\"\"\n # import ipdb; ipdb.set_trace()\n source = self._format_lines(tokensource)\n if self.hl_lines:\n source = self._highlight_lines(source)\n if not self.nowrap:\n if self.linenos == 2:\n ... | [
"def je(self):\n \n \"\"\"\n text = self._process()\n return self.make_string(text,join_str='',return_if_none='')"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software Engineering:"
} |
A rewrap of json.dumps done for one reason - to inject a custom `cls` kwarg
:param obj:
:param kwargs:
:return:
:rtype: str | [
"def json_dumps(cls, obj, **kwargs):\n \n if 'cls' not in kwargs:\n kwargs['cls'] = cls.json_encoder\n return json.dumps(obj, **kwargs)"
] | [
"def _process_function(chaining, routine):\n \n\n def processing(*args, **kwargs):\n \"\"\"Execute routine with input args and kwargs and add reuslt in\n chaining.___.\n\n :param tuple args: routine varargs.\n :param dict kwargs: routine kwargs.\n :return: chaining chaining.... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
add a callback to the execution chain | [
"function(cb) {\n cb = this.wrap(cb);\n this._callbacks.push(cb);\n if (!this._isQueueRunning) {\n if (this.start) {\n this.start();\n } else this.next();\n // this.start();\n }\n return this;\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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
增加邮费模板
@param array $deliveryemplate 邮费信息
~~~
wip.
~~~
@return int|bool | [
"public function addDeliveryTemplate(array $deliveryTemplate)\n {\n $result = $this->httpRaw(self::WECHAT_SHOP_DELIVERY_TEMPLATE_ADD_URL . 'access_token=' . $this->getAccessToken(), [\n 'delivery_template' => $deliveryTemplate\n ]);\n return isset($result['errmsg']) && $result['er... | [
"public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Simplified method form for invoking the ListStreams operation with an AsyncHandler.
@see #listStreamsAsync(ListStreamsRequest, com.amazonaws.handlers.AsyncHandler) | [
"@Override\n public java.util.concurrent.Future<ListStreamsResult> listStreamsAsync(\n com.amazonaws.handlers.AsyncHandler<ListStreamsRequest, ListStreamsResult> asyncHandler) {\n\n return listStreamsAsync(new ListStreamsRequest(), asyncHandler);\n }"
] | [
"public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) {\n return connection.execute(new Log(logRequest), apiKey);\n }"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// File Loading
// GdkPixbuf * gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height); | [
"func NewPixbuf(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) *Pixbuf {\n\tgpixbuf := C.gdk_pixbuf_new(\n\t\tC.GdkColorspace(colorspace),\n\t\tgbool(hasAlpha),\n\t\tC.int(bitsPerSample),\n\t\tC.int(width),\n\t\tC.int(height),\n\t)\n\n\treturn &Pixbuf{\n\t\tGdkPixbuf: &GdkPixbuf{gpixbuf},\n... | [
"public static byte[] getPixelsBGR(BufferedImage img, int y, int w, byte[] array, int[] temp) {\n final int x = 0;\n final int h = 1;\n\n assert array.length == temp.length * nrChannels(img);\n assert (temp.length == w);\n\n int imageType = img.getType();\n Raster raster;\n switch (imageType) {... | codesearchnet | {
"query": "Represent the Github comment about File management:",
"pos": "Represent the Github code about File management:",
"neg": "Represent the Github code:"
} |
Extract a statistical summary of edge weights present in
the graph.
:return: A dict with an 'all_weights' list, 'minimum',
'maximum', 'median', 'mean', 'std_dev' | [
"def weight_statistics(self):\n \n\n all_weights = [d.get('weight', None) for u, v, d\n in self.graph.edges(data=True)]\n stats = describe(all_weights, nan_policy='omit')\n\n return {\n 'all_weights': all_weights,\n 'min': stats.minmax[0],\n ... | [
"def frequencies_plot(self, xmin=0, xmax=200):\n \n\n helptext = '''\n A possible way to assess the complexity of a library even in\n absence of a reference sequence is to look at the kmer profile of the reads.\n The idea is to count all the kmers (_i.e._, sequence of ... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
method now in superclass | [
"private boolean matches7000( ApiDifference apiDiff )\n {\n throwIfMissing( false, true, false, false );\n return SelectorUtils.matchPath( method, removeVisibilityFromMethodSignature( apiDiff ) );\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 Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Defines enhanced snake_case method and (optionally) aliases to it.
Both instance method and module-level method with the same name is defined | [
"def define_snake_method(snake_name, aliases, api, options, &def_block)\n # Generate body for snake_case method\n method_body = generate_snake_method_body(api, options, &def_block)\n\n # Define snake_case as both instance and module-level method\n define_method snake_name, &method_body\n mo... | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the role (active or passive) of an object
in this aspect. | [
"def getRole(self, ID):\n \n if self.active.id == ID:\n return {\n 'role': 'active',\n 'inOrb': self.active.inOrb,\n 'movement': self.active.movement\n }\n elif self.passive.id == ID:\n return {\n 'role... | [
"def _reflex_rule_process(self, wf_action):\n \n # Check out if the analysis has any reflex rule bound to it.\n # First we have get the analysis' method because the Reflex Rule\n # objects are related to a method.\n a_method = self.getMethod()\n if not a_method:\n ... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Gets the prefixed key and parse it to an float-value.
@param key
key value
@return float-representation of value | [
"public float getFloat(final String key) {\n\t\tfinal String value = getProperty(key);\n\t\tif (value == null) {\n\t\t\tthrow new NumberFormatException(\"Couldn't parse property to float.\");\n\t\t}\n\t\treturn Float.parseFloat(value);\n\t}"
] | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// BucketKeyHashByKey returns the MD5 hash of the bucket storage key | [
"func (s *StoragePacker) BucketKeyHashByKey(bucketKey string) string {\n\thf := md5.New()\n\thf.Write([]byte(bucketKey))\n\treturn hex.EncodeToString(hf.Sum(nil))\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 instruction about AWS S3:",
"pos": "Represent the Github code about AWS S3:",
"neg": "Represent the Github code:"
} |
// Swap swaps two elements. | [
"func (t Ticks) Swap(i, j int) {\n\tt[i], t[j] = t[j], t[i]\n}"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Calculate and return total standard deviation for rock sites.
Implements formulae from table 3. | [
"def _get_stddev_rock(self, mag, imt):\n \n C = self.COEFFS_ROCK_STDDERR[imt]\n if mag > C['maxmag']:\n return C['maxsigma']\n else:\n return C['sigma0'] + C['magfactor'] * mag"
] | [
"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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetNextToken sets the NextToken field's value. | [
"func (s *ListModelPackagesInput) SetNextToken(v string) *ListModelPackagesInput {\n\ts.NextToken = &v\n\treturn s\n}"
] | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Displays a form to create a new Family entity.
@return array
@Route("/new")
@Method("GET")
@Template() | [
"public function newAction()\n {\n $entity = new Family();\n $form = $this->createForm(new FamilyType(), $entity);\n\n return array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }"
] | [
"public function routes(RouteCollector $route)\n {\n $route->group(function(RouteCollector $route){\n // Home\n $route('/', controller(Controller\\FrontPage::class, 'get'));\n\n // Pages\n $route('/install/{page}', controller('@controller', '@method'), ['GET', '... | codesearchnet | {
"query": "Represent the Github sentence about Symfony:",
"pos": "Represent the Github code about Symfony:",
"neg": "Represent the Github code about Programming:"
} |
// SetProcessingTargets sets the ProcessingTargets field's value. | [
"func (s *JobProcessDetails) SetProcessingTargets(v []*string) *JobProcessDetails {\n\ts.ProcessingTargets = 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 instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// RetrieveAsValue get the concrete generator result as reflect value.
// If the result is invalid or does not pass the sieve there is no concrete
// value and the property using the generator should be undecided. | [
"func (r *GenResult) RetrieveAsValue() (reflect.Value, bool) {\n\tif r.Result != nil && (r.Sieve == nil || r.Sieve(r.Result)) {\n\t\treturn reflect.ValueOf(r.Result), true\n\t} else if r.Result == nil && r.Sieve != nil && r.Sieve(r.Result) {\n\t\treturn reflect.Zero(r.ResultType), true\n\t}\n\treturn reflect.Zero(r... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
@param $index
@return IndexerInterface
@throws \InvalidArgumentException When index not defined | [
"protected function getIndexer($index)\n {\n if (!isset($this->indexers[$index])) {\n throw new \\InvalidArgumentException('Unknown index');\n }\n\n return $this->container->get($this->indexers[$index]);\n }"
] | [
"function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
return the tile position corresponding to the specified pixel
@ignore | [
"function pixelToTileCoords(x, y, v) {\n var q, r;\n var ret = v || new me.Vector2d();\n\n if (this.staggeraxis === \"x\") {\n //flat top\n x = x - (this.staggerindex === \"odd\" ? this.sideoffsetx : this.tilewidth);\n } else {\n //pointy top\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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
>>> package = yarg.get('yarg')
>>> package.maintainer
Maintainer(name=u'Kura', email=u'kura@kura.io') | [
"def maintainer(self):\n \n maintainer = namedtuple('Maintainer', 'name email')\n return maintainer(name=self._package['maintainer'],\n email=self._package['maintainer_email'])"
] | [
"def forwards(self, orm):\n \"\"\n from avocado.core import backup\n backup.safe_load(u'0002_avocado_metadata', backup_path=None,\n using='default')"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetClientRequestToken sets the ClientRequestToken field's value. | [
"func (s *CreateSimulationJobOutput) SetClientRequestToken(v string) *CreateSimulationJobOutput {\n\ts.ClientRequestToken = &v\n\treturn s\n}"
] | [
"function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Helper method to create an instance.
@param PdfDictionary $dictionary
@param string $stream
@return self | [
"public static function create(PdfDictionary $dictionary, $stream)\n {\n $v = new self;\n $v->value = $dictionary;\n $v->stream = (string) $stream;\n\n return $v;\n }"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Initialize a CatDict object, checking for errors. | [
"def _init_cat_dict(self, cat_dict_class, key_in_self, **kwargs):\n \n # Catch errors associated with crappy, but not unexpected data\n try:\n new_entry = cat_dict_class(self, key=key_in_self, **kwargs)\n except CatDictError as err:\n if err.warn:\n s... | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the Github text about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
Return true if a named type exists
@param string $name
@param string $prefix
@return boolean | [
"public function hasType( $name, $prefix = null )\r\n\t{\r\n\t\treturn isset( $this->types[ is_null( $prefix ) ? $name : \"$prefix:$name\" ] );\r\n\t}"
] | [
"public function setMustPass($ref)\n {\n if (null!==$this->getMask($ref)) {\n $this->must_pass = $ref;\n } else {\n throw new \\Exception(sprintf(\"Unknown standard [%s] in Hostname validation!\", $ref));\n }\n }"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Calculate the area of each label divided by the area of its convex hull
labels - a label matrix
indexes - the indexes of the labels to measure | [
"def calculate_solidity(labels,indexes=None):\n \n if indexes is not None:\n \"\"\" Convert to compat 32bit integer \"\"\"\n indexes = np.array(indexes,dtype=np.int32)\n areas = scind.sum(np.ones(labels.shape),labels,indexes)\n convex_hull_areas = calculate_convex_hull_areas(labels, indexe... | [
"def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// WatchCharmConfig returns a watcher for observing changes to the
// application's charm configuration settings. The returned watcher will be
// valid only while the application's charm URL is not changed. | [
"func (a *Application) WatchCharmConfig() (NotifyWatcher, error) {\n\tconfigKey := a.charmConfigKey()\n\treturn newEntityWatcher(a.st, settingsC, a.st.docID(configKey)), nil\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 post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// PuppetAIOCmd looks up a command in the AIO paths, if it's not there
// it will try PATH and finally return a default if not in PATH | [
"func (fw *Framework) PuppetAIOCmd(command string, def string) string {\n\treturn PuppetAIOCmd(command, def)\n}"
] | [
"def get_root_path(self, name):\n \n module = modules.get(name)\n if module is not None and hasattr(module, '__file__'):\n return dirname(abspath(module.__file__))\n\n # Flask keeps looking at this point. We instead set the root path to None,\n # assume that the user do... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Load context object.
@param Context $context Context object
@return boolean True if the context object was successfully loaded | [
"public function loadContext($context)\n {\n\n $now = time();\n $context->created = $now;\n $context->updated = $now;\n\n return true;\n\n }"
] | [
"def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in mo... | codesearchnet | {
"query": "Represent the Github comment about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code:"
} |
Close all windows.
@param ignoredWindows The windows to ignore | [
"public static void closeWindows(Window... ignoredWindows) {\n Window[] ws = Window.getWindows();\n for (Window w : ws) {\n if (!contains(ignoredWindows, w)) w.dispose();\n }\n }"
] | [
"def set_form form\n raise \"Form is nil in set_form\" if form.nil?\n @form = form\n @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget\n # 2009-10-29 15:04 use form.window, unless buffer created\n # should not use form.window so explicitly everywhere.\n # added... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Clean-up when the create has been canceled. | [
"function cleanUp() {\n\t\t\t_Helper.removeByPath(that.mPostRequests, sPath, oEntityData);\n\t\t\taCollection.splice(aCollection.indexOf(oEntityData), 1);\n\t\t\taCollection.$created -= 1;\n\t\t\taddToCount(that.mChangeListeners, sPath, aCollection, -1);\n\t\t\tdelete aCollection.$byPredicate[sTransientPredicate];\... | [
"private void removeContext(final String contextID) {\n\n synchronized (this.contextStack) {\n\n if (!contextID.equals(this.contextStack.peek().getIdentifier())) {\n throw new IllegalStateException(\"Trying to close context with id `\" + contextID +\n \"`. But the top context has id `\" +\... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Marshall the given parameter object. | [
"public void marshall(UpdateVirtualRouterRequest updateVirtualRouterRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (updateVirtualRouterRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshal... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Update existing organization by id
@param integer $orgId
@param OrgBuilder $input
@param array $queryParams
@return OrgResponse | [
"public function update($orgId, OrgBuilder $input, array $queryParams = [])\n {\n $response = $this->api->orgs()->update($orgId, $input->toArray(), $queryParams);\n\n return new OrgResponse($response);\n }"
] | [
"public function update( models\\Call\\ContactNumber $ContactNumber){\n $rest = $this->getService( self::API_NUMBER . $ContactNumber->getId());\n $rest->PUT( $ContactNumber);\n\n return $rest->getResult( models\\Call\\ContactNumber::class);\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// actionPrint prints out available endpoints by unmarshalling the Targets struct
// from JSON at the given path. This is used by external tools to see which attaching
// modes are available for an application (eg. `rkt attach --mode=list`) | [
"func actionPrint(path string, out io.Writer) error {\n\tvar endpoints Targets\n\tstatusFile, err := os.OpenFile(path, os.O_RDONLY, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.NewDecoder(statusFile).Decode(&endpoints)\n\t_ = statusFile.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//... | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Technology:"
} |
Serves /update/:session/commit | [
"async def commit(\n request: web.Request, session: UpdateSession) -> web.Response:\n \n if session.stage != Stages.DONE:\n return web.json_response(\n data={'error': 'not-ready',\n 'message': f'System is not ready to commit the update '\n f'(currentl... | [
"def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
checks if the expected count is given
triggers an error if getMaxEntries Returns a number
and this number is not equal to the count of elements. | [
"private function checkCount(){\n $cnt = (int) $this->getMaxEntries();\n if ($cnt !== NULL && count($this->values) !== $cnt){\n trigger_error(\"Wrong count of Elements. Expected are $cnt. But right now there are \". count($this->values));\n }\n\n }"
] | [
"def output(ret, bar, **kwargs): # pylint: disable=unused-argument\n '''\n \n '''\n if 'return_count' in ret:\n val = ret['return_count']\n # Avoid to fail if targets are behind a syndic. In this case actual return count will be\n # higher than targeted by MoM itself.\n # TO... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// BeforeNotify adds a callback function which is run before a notice is
// reported to Honeybadger. If any function returns an error the notification
// will be skipped, otherwise it will be sent. | [
"func (client *Client) BeforeNotify(handler func(notice *Notice) error) {\n\tclient.beforeNotifyHandlers = append(client.beforeNotifyHandlers, handler)\n}"
] | [
"function errorAndExit(msg, logMe) {\n // @todo Only trigger if `verbosity > 1`\n if (logMe) {\n // Adding some empty lines before error message for readability\n console.log();\n console.log();\n console.log(logMe);\n }\n error(`Error: ${msg}`);\n\n // There's a few ways to handle exiting\n\n // ... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
---------------------------------------------------------------------- Application Lifecycle ----------------------------------------------------------------------
Initializes the application
@param {Object} [params] Configuration object
@returns {void} | [
"function(params) {\n\t\t\t$.extend(globalConfig, params || {});\n\n\t\t\tthis.startAll(document.documentElement);\n\n\t\t\tthis.fire('init');\n\t\t\tinitialized = true;\n\t\t}"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Implements the table structure decomposition step
@param cc
the number of the table columns
@param tc
the object of the table candidate
@param wordsOfAPage
the list of all the words in a document page | [
"public void getTableStructure (int cc, TableCandidate tc, ArrayList<TextPiece> wordsOfAPage) {\r\n \tfloat minGapBtwColumns = 1000.0f;\r\n\t\tfloat[] leftX_tableColumns = tc.getLeftX_tableColumns();\r\n\t\tfloat[] rightX_tableColumns = tc.getRightX_tableColumns();\r\n\t\tint YNum = tc.getRows().size();\r\n\t\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Check if the element has resized, and broadcast the resize event if so
@returns {void}
@private | [
"function checkResize() {\n var newOffsetHeight = element.offsetHeight,\n newOffsetWidth = element.offsetWidth;\n\n // check if we're in a frame\n if (inIframe) {\n // firefox has an issue where styles aren't calculated in hidden iframes\n // if the iframe was h... | [
"function(element, options) {\n\n var $el = $(element);\n // React on every server/socket.io message.\n // If the element is defined with a data-react-on-event attribute\n // we take that as an eventType the user wants to be warned on this\n // element and we forward the event via jQuery events on $(... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
*
Execute Hive queries using {@link HiveJdbcConnector} and validate results.
@param queries Queries to execute. | [
"@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = \"SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE\", justification = \"Temporary fix\")\n private List<Long> getValidationOutputFromHive(List<String> queries) throws IOException {\n\n if (null == queries || queries.size() == 0) {\n log.warn(\"No queries s... | [
"@Override\n protected List<SuperColumn> loadSuperColumns(String keyspace, String columnFamily, String rowId,\n String... superColumnNames) {\n throw new UnsupportedOperationException(\n \"Support for super columns is not available with DS java driver. Either use Thrift or pelops for the... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Try to detect the server's preferred cipher suite among all cipher suites supported by SSLyze. | [
"def _get_preferred_cipher_suite(\n cls,\n server_connectivity_info: ServerConnectivityInfo,\n ssl_version: OpenSslVersionEnum,\n accepted_cipher_list: List['AcceptedCipherSuite']\n ) -> Optional['AcceptedCipherSuite']:\n \n if len(accepted_cipher_list) <... | [
"def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Executes the app
@param InputInterface $oInput The Input Interface provided by Symfony
@param OutputInterface $oOutput The Output Interface provided by Symfony
@throws \Exception
@return int | [
"protected function execute(InputInterface $oInput, OutputInterface $oOutput)\n {\n parent::execute($oInput, $oOutput);\n\n $oOutput->writeln('');\n $oOutput->writeln('<info>----------------------</info>');\n $oOutput->writeln('<info>Nails Database Rebuild </info>');\n $oOutput... | [
"public function run()\n {\n // Load routing user config file\n $this->routes();\n // Launch routage\n Router::resolve();\n // Load databases user config file\n $this->databases();\n // Load Bootstrap\n $this->bootstrap();\n // Launch Controller defi... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
// ServeAPI serves the API for this record store | [
"func ServeAPI(host, basePath string, schemes []string) error {\n\n\t// swagger:route GET /pets pets users listPets\n\t//\n\t// Lists pets filtered by some parameters.\n\t//\n\t// This will show all available pets by default.\n\t// You can get the pets that are out of stock\n\t//\n\t// Consumes:\n\t// application/j... | [
"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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// First is used to return the first matching object for
// the given constraints on the index | [
"func (txn *Txn) First(table, index string, args ...interface{}) (interface{}, error) {\n\t_, val, err := txn.FirstWatch(table, index, args...)\n\treturn val, err\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Install registers the request token endpoints into a mux. It is expected that the
// provided prefix will serve all operations | [
"func (e *endpointDetails) Install(mux oauthserver.Mux, paths ...string) {\n\tfor _, prefix := range paths {\n\t\tmux.HandleFunc(path.Join(prefix, urls.RequestTokenEndpoint), e.readyHandler(e.requestToken))\n\t\tmux.HandleFunc(path.Join(prefix, urls.DisplayTokenEndpoint), e.readyHandler(e.displayToken))\n\t\tmux.Ha... | [
"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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
returns whether the current item is valid when iterating with foreach | [
"public function valid()\n {\n if ($this->_index == count($this->_items) && $this->_batchIndex < count($this->_ids)) {\n $this->_getNextPage();\n }\n\n if ($this->_index < count($this->_items)) {\n return true;\n } else {\n return false;\n }\n ... | [
"function parsePointer(pointer) {\n // Let's split pointer string by tokens' separator character.\n // Also we will reverse resulting array to simplify it's further usage.\n var tokens = pointer.split(tokenSeparator).reverse();\n // Last item in resulting array is always an empty string, we don't need it.\n to... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
// services: This function should be returning logical state instead of driver state | [
"func (d *MasterDaemon) services(id string) ([]core.State, error) {\n\tvar (\n\t\terr error\n\t\tsvc *mastercfg.CfgServiceLBState\n\t)\n\n\tsvc = &mastercfg.CfgServiceLBState{}\n\tif svc.StateDriver, err = utils.GetStateDriver(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif id == \"all\" {\n\t\treturn svc.ReadAll... | [
"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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Create a new Language instance from a name as string
:param name: name as string
:return: Language instance with instance.name() == name if name is valid else instance of UnknownLanguage | [
"def from_name(cls, name):\n \n name = str(name).lower()\n if name is 'unknown' or name is _('unknown'):\n return UnknownLanguage(name)\n try:\n return cls._from_xyz('LanguageName', name)\n except NotALanguageException:\n log.warning('Unknown Langu... | [
"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 summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Run support 1-line LetsEncrypt HTTPS servers | [
"func Run(r http.Handler, domain ...string) error {\n\treturn http.Serve(autocert.NewListener(domain...), r)\n}"
] | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// getConffromURL retrieves the json containing the TLS configurations from the specified URL. | [
"func getConffromURL(url string) error {\n\n\tr, err := http.Get(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Body.Close()\n\n\terr = json.NewDecoder(r.Body).Decode(&sstls)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\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 summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Technology:"
} |
Process text, writing it to the virtual screen while handling
ANSI escape codes. | [
"def write (self, s):\n \n if isinstance(s, bytes):\n s = self._decode(s)\n for c in s:\n self.process(c)"
] | [
"def handle_key ch\n $log.debug \" KeyDispatcher GOT KEY #{ch} \"\n @keyint = ch\n @keychr = nil\n chr = nil\n chr = ch.chr if ch > 32 and ch < 127\n @keychr = chr\n\n ret = process_key ch\n # revert to the basic handling of key_map and refreshing pad.\n #####\n # ... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// checkLease takes a clusterName and determines if there is an available lease | [
"func checkLease(clusterMap *Map, leaseMap *leases.Map, clusterName string) (*container.Cluster, error) {\n\tcluster, _ := clusterMap.ClusterByName(clusterName)\n\t_, isLeased := leaseMap.LeaseByClusterName(clusterName)\n\tif !isLeased {\n\t\treturn cluster, nil\n\t}\n\treturn nil, errUnusedGKEClusterNotFound\n}"
] | [
"func (p *provisioningIdentityMapper) UserFor(info authapi.UserIdentityInfo) (kuser.Info, error) {\n\t// Retrying up to three times lets us handle race conditions with up to two conflicting identity providers without returning an error\n\t// * A single race is possible on user creation for every conflicting identit... | 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:"
} |
// Stop kills the editor's server. | [
"func (e *Editor) Stop() {\n\tif e.process != nil {\n\t\terr := e.process.Kill()\n\t\tif err != nil {\n\t\t\te.log(\"error while trying to terminate the Editor,please kill this process by yourself, process id: %d\", e.process.Pid)\n\t\t}\n\t}\n}"
] | [
"function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag... | codesearchnet | {
"query": "Represent the Github comment about Container management:",
"pos": "Represent the Github code about Container management:",
"neg": "Represent the Github code:"
} |
--------------------- WebSocketMessageReader Implementation ----------- | [
"@Override\n public ByteBuffer getBinary() throws IOException {\n if (_messageType == null) {\n return null;\n }\n\n if (_messageType == WebSocketMessageType.EOS){\n String s = \"End of stream has reached as the connection has been closed\";\n throw new WebSo... | [
"@Override\r\n public void doPushProfileRequest(ClientCxDxSession appSession, JPushProfileRequest request) throws InternalException,\r\n IllegalDiameterStateException, RouteException, OverloadException {\r\n logger.info(\"Diameter Cx/Dx Session Factory :: doPushProfileRequest :: appSession[{}], Request[{}]\", ... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Show times relative to now
e.g. "4 hours ago"
Credit goes to: http://byteinn.com/res/426/Fuzzy_Time_function/
@param int optional $Timestamp, otherwise time() is used
@return string | [
"public static function FuzzyTime($Timestamp = NULL, $MorePrecise = FALSE) {\n if (is_null($Timestamp))\n $Timestamp = time();\n elseif (!is_numeric($Timestamp))\n $Timestamp = self::ToTimestamp($Timestamp);\n \n $time = $Timestamp;\n\n $NOW = time();\n if (!defined('ON... | [
"def normalize(self, timestamp, steps=0):\n '''\n \n '''\n # So far, the only commonality with RelativeTime\n return self.from_bucket( self.to_bucket(timestamp, steps) )"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
-- configuration | [
"public void setCredentials(String username, String password) {\n this.username = username;\n this.password = password;\n \tauthorization = \"Basic \" + Base64.getEncoder().encodeToString(filesystem.getWorld().getSettings().bytes(username + \":\" + password));\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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Determine which lookup func to use based on inpt files and type option. | [
"def __get_lookup(in_fn, selected_type=None):\n \"\"\"\"\"\"\n lookup_func = None\n if selected_type is not None:\n lookup_func = get_lookup_by_filetype(selected_type)\n else:\n extension = os.path.splitext(in_fn)[1]\n lookup_func = get_lookup_by_file_extension(extension)\n assert(lookup_func is not N... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Fetches the document pointed to by a database reference
@link http://www.php.net/manual/en/mongodb.getdbref.php
@param array $ref A database reference.
@return array Returns the document pointed to by the reference. | [
"public function getDBRef(array $ref)\n {\n $db = (isset($ref['$db']) && $ref['$db'] !== $this->name) ? $this->connection->selectDB($ref['$db']) : $this;\n return MongoDBRef::get($db, $ref);\n }"
] | [
"public function execute(Server $server)\n {\n $cmd = ['listDatabases' => 1];\n\n if ( ! empty($this->options['filter'])) {\n $cmd['filter'] = (object) $this->options['filter'];\n }\n\n if (isset($this->options['maxTimeMS'])) {\n $cmd['maxTimeMS'] = $this->option... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Adds lines stores for root node.
@param string $content A php file content. | [
"protected function _initLines($content)\n {\n if (!$this->_states['lines']) {\n return;\n }\n $lines = explode(\"\\n\", $content);\n $nbLines = count($lines);\n if ($this->_states['lines']) {\n for ($i = 0; $i < $nbLines; $i++) {\n $this->_... | [
"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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Autocomplete name.
@param Request $request
@return Response | [
"public function autocompleteNameAction(Request $request)\n {\n /* @var $response JsonResponse */\n $response = $this->getCacheTimeKeeper()\n ->getResponse('AnimeDbCatalogBundle:Item', -1, new JsonResponse());\n // response was not modified for this request\n if ($response-... | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Schema for event items. | [
"def schema_event_items():\n \"\"\"\"\"\"\n return {\n 'timestamp': And(int, lambda n: n > 0),\n Optional('information', default={}): {\n Optional(Regex(r'([a-z][_a-z]*)')): object\n }\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Removes an object. The remote end of the ObjectSpace's connections will no longer be able to access it. | [
"public void remove (Object object) {\n\t\tif (!idToObject.containsValue(object, true)) return;\n\t\tint objectID = idToObject.findKey(object, true, -1);\n\t\tidToObject.remove(objectID);\n\t\tobjectToID.remove(object, 0);\n\t\tif (TRACE) trace(\"kryonet\", \"Object \" + objectID + \" removed from ObjectSpace: \" +... | [
"@Override\n public void destroy() // PK20881\n {\n if (tc.isEntryEnabled())\n Tr.entry(tc, \"destroy\");\n\n // Dummy transactionWrappers may not be in any table and so\n // will not have a resourceCallback registered to remove them.\n if (_resourceCallback != null)\n ... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Database management:"
} |
Initialize a configuration file.
@param string $file | [
"protected function initConfig($file) {\n\t\tif(file_exists($this->dir.'/'.$file)) {\n\t\t\tif(!$this->confirm('Do you want to override \"'.$file.'\"?'))\n\t\t\t\treturn;\n\t\t}\n\n\t\t$config = file_get_contents(__DIR__.'/stubs/'.$file.'.stub');\n\t\t$key = \\Asgard\\Common\\Tools::randStr(10);\n\t\t$config = str_... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the text about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Handle incoming API frame, return True if this was the expected frame. | [
"async def handle_frame(self, frame):\n \"\"\"\"\"\"\n if not isinstance(frame, FrameHouseStatusMonitorDisableConfirmation):\n return False\n self.success = True\n return True"
] | [
"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 Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about File management:"
} |
Get the currency code from ISO.
@param string $iso
@return string | [
"public function getCurrency($iso)\n {\n if ($this->currencies === null && $this->config('include_currency', false)) {\n $this->currencies = include(__DIR__ . '/Support/Currencies.php');\n }\n\n return Arr::get($this->currencies, $iso);\n }"
] | [
"public static function getEquityLinkCount($url = false)\n {\n $data = static::getCols('2048', $url);\n return (parent::noDataDefaultValue() == $data) ? $data :\n $data['uid'];\n }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Create new instance of sharding CTL backend handler.
@param sql SQL to be executed
@param backendConnection backend connection
@return instance of sharding CTL backend handler | [
"public static TextProtocolBackendHandler newInstance(final String sql, final BackendConnection backendConnection) {\n if (sql.toUpperCase().startsWith(SCTL_SET)) {\n return new ShardingCTLSetBackendHandler(sql, backendConnection);\n }\n if (sql.toUpperCase().startsWith(SCTL_SHOW)) {... | [
"def get_cursor(self, instance, db_key, db_name=None):\n '''\n \n '''\n conn_key = self._conn_key(instance, db_key, db_name)\n try:\n conn = self.connections[conn_key]['conn']\n except KeyError:\n # We catch KeyError to avoid leaking the auth info used... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.