query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// getJob retrieves the job optionally at a particular version. | [
"func getJob(client *api.Client, jobID string, version *uint64) (*api.Job, error) {\n\tif version == nil {\n\t\tjob, _, err := client.Jobs().Info(jobID, nil)\n\t\treturn job, err\n\t}\n\n\tversions, _, _, err := client.Jobs().Versions(jobID, false, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, j := ... | [
"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 description about software development:",
"pos": "Represent the code about software development:",
"neg": "Represent the code:"
} |
Widgets routes implementations
@return void | [
"public static function routes()\n {\n $area = area();\n Route::post($area . '/notifications/notifications', NotificationController::class . '@index');\n Route::post($area . '/notifications/widgets/send', NotificationController::class . '@send');\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Process headers dict to return the format class
(not the instance) | [
"def negotiate(cls, headers):\n \n # set lower keys\n headers = {k.lower(): v for k, v in headers.items()}\n\n accept = headers.get('accept', \"*/*\")\n\n parsed_accept = accept.split(\";\")\n parsed_accept = [i.strip() for i in parsed_accept]\n\n # Protobuffer (only... | [
"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 instruction about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code about Technology:"
} |
@param Token $token
@param DateTime|null $at
@param array $information
@return ConsumeTokenEvent | [
"public function consumeToken(Token $token, DateTime $at = null, array $information = [])\n {\n $this->eventDispatcher->dispatch(\n TokenEvents::CONSUME_TOKEN,\n $event = new ConsumeTokenEvent($token, $at, $information)\n );\n\n return $event;\n }"
] | [
"public function execute($request)\n {\n RequestNotSupportedException::assertSupports($this, $request);\n $this->logger->info(\"Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid\");\n throw new HttpResponse('OK');\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
Counts the frequency of each token of an ngram array
@param string $sep
@param array $ngrams
@return array $frequencies Return an array of tokens with its frequencies by its positions | [
"static public function readFreq(string $sep, array $ngrams) : array\n {\n $ngrams = self::ngramsAsArray($sep, $ngrams);\n $frequencies = array();\n foreach ($ngrams as $ngram) {\n foreach ($ngram as $pos => $token) {\n if(isset($frequencies[$token][$pos])) { //chec... | [
"public static String getSummary(String document, int max_length, String sentence_separator)\n {\n // Parameter size in this method refers to the string length of the summary required;\n // The actual length of the summary generated may be short than the required length, but never longer;\n ... | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Check whether the given file should be included in the final Filelist
@param \SplFileInfo $file
@return boolean | [
"public function filter(\\SplFileInfo $file)\n {\n $filedate = new \\DateTime('@' . $file->{'get' . $this->compareType}());\n\n $diff = $this->compareDate->diff($filedate);\n $diffSign = $diff->format('%R');\n\n if ((int) $diff->format('%y%m%d%h%i%s') == 0 && $this->compareAction == s... | [
"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 post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about File management:"
} |
Called when an error occurs on this connection.
@param inVC
@param t | [
"@Override\n public void error(VirtualConnection inVC, Throwable t) {\n if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {\n Tr.debug(tc, \"error() called on \" + this + \" \" + inVC);\n }\n try {\n close(inVC, (Exception) t);\n } catch (ClassCast... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Converts hash keys to Pascal case and rejects invalid keys.
:sales_order_keys #=> 'SalesOrderKeys' | [
"def to_h\n details.reject do |key|\n !KEYS.include?(key)\n end.deep_transform_keys { |key| key.to_s.camelize }\n end"
] | [
"def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
创建 bucket
@param string $bucket (Required) bucket名称
@param string $acl (Optional) bucket权限设置,若为null,使用server分配的默认权限
@param array $opt (Optional)
@throws BCS_Exception
@return BCS_ResponseCore | [
"public function create_bucket($bucket, $acl = NULL, $opt = array()) {\n\t\t$this->assertParameterArray ( $opt );\n\t\t$opt [self::BUCKET] = $bucket;\n\t\t$opt [self::METHOD] = 'PUT';\n\t\t$opt [self::OBJECT] = '/';\n\t\tif (NULL !== $acl) {\n\t\t\tif (! in_array ( $acl, self::$ACL_TYPES )) {\n\t\t\t\tthrow new BCS... | [
"func (q Qiniu) Store(url string, option *media_library.Option, reader io.Reader) (err error) {\n\n\tvar ret qnio.PutRet\n\tpath := strings.Replace(url, \"//\"+getEndpoint(option), \"\", -1)\n\t// ret 变量用于存取返回的信息,详情见 io.PutRet\n\t// uptoken 为业务服务器端生成的上传口令\n\t// r 为io.Reader类型,用于从其读取数据\n\t// extra ... | codesearchnet | {
"query": "Represent the summarization about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code:"
} |
Return a dictionary of the worker stats.
Returns:
dict: Dictionary of the stats. | [
"def to_dict(self):\n \n return {\n 'name': self.name,\n 'broker': self.broker.to_dict(),\n 'pid': self.pid,\n 'process_pids': self.process_pids,\n 'concurrency': self.concurrency,\n 'job_count': self.job_count,\n 'queues': [... | [
"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 text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Returns the JavaScript code for calling the client-side module name id registration function
to register name ids for the transport synthetic modules.
@return the registration JavaScript or an empty string if no synthetic modules. | [
"protected String clientRegisterSyntheticModules() {\r\n\t\tfinal String methodName = \"clientRegisterSyntheticModules\"; //$NON-NLS-1$\r\n\t\tboolean traceLogging = log.isLoggable(Level.FINER);\r\n\t\tif (traceLogging) {\r\n\t\t\tlog.entering(sourceClass, methodName);\r\n\t\t}\r\n\t\tStringBuffer sb = new StringBu... | [
"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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Sets the system field.
@param system sets the system property.
@param <T> resource type to be returned.
@return this, as casted to a resource, for the ease of chaining. | [
"@SuppressWarnings(\"unchecked\")\n public <T extends CMAResource> T setSystem(CMASystem system) {\n this.system = system;\n return (T) this;\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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Render a Hail Article
@param HTTPRequest $request
@return array
@throws HTTPResponse_Exception | [
"public function article(HTTPRequest $request)\r\n {\r\n $params = $request->params();\r\n if ($params['ID']) {\r\n $article = Article::get()->filter(['HailID' => $params['ID']])->first();\r\n //Try to find the article with the database ID field, to be backward compatible with... | [
"public function beforeSend(\\Mmi\\Http\\Request $request)\n {\n //pobranie odpowiedzi\n $response = \\Mmi\\App\\FrontController::getInstance()->getResponse();\n //zmiana contentu\n $response->setContent((new \\Cms\\Model\\ContentFilter($response->getContent()))->getFilteredContent())... | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
Create a snapshot on the fly. | [
"def snapshot(gandi, name, resource, background):\n \n name = name or randomstring('snp')\n\n source_info = gandi.disk.info(resource)\n datacenter = source_info['datacenter_id']\n result = gandi.disk.create(name, None, None, None, datacenter, resource,\n 'snapshot', back... | [
"func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}"
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Will handle the current request and returns the correct response
@return JsonResponse the response that should be returned to the client. | [
"public function handleRequest()\n {\n $request = $this->prepareRequest();\n $version = $request['version'];\n $queryConfiguration = $request['queryConfiguration'];\n\n $data = $this->provider->process();\n return $version->createResponse($data, $queryConfiguration, $this->colu... | [
"public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Yield the messages in the queue in the order they should be sent. | [
"def prioritize():\n \n\n while True:\n hp_qs = Message.objects.high_priority().using('default')\n mp_qs = Message.objects.medium_priority().using('default')\n lp_qs = Message.objects.low_priority().using('default')\n while hp_qs.count() or mp_qs.count():\n while hp_qs.c... | [
"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 description about Technology:",
"pos": "Represent the code about Technology:",
"neg": "Represent the code about File management:"
} |
A small utility function for getting the current console window's width, in Windows.
:return: The current console window's width. | [
"def _get_windows_console_width() -> int:\n \n from ctypes import byref, windll\n import pyreadline\n\n out = windll.kernel32.GetStdHandle(-11)\n info = pyreadline.console.CONSOLE_SCREEN_BUFFER_INFO()\n windll.kernel32.GetConsoleScreenBufferInfo(out, byref(info))\n return info.dwSize.X"
] | [
"def _set_text(self, value):\n \n working_index = self.working_index\n working_lines = self._working_lines\n\n original_value = working_lines[working_index]\n working_lines[working_index] = value\n\n # Return True when this text has been changed.\n if len(value) != l... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
#line 353 "smarty_internal_templateparser.y" | [
"function yy_r37(){\n $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,array());\n }"
] | [
"function yy_accept()\n {\n if (self::$yyTraceFILE) {\n fprintf(self::$yyTraceFILE, \"%sAccept!\\n\", self::$yyTracePrompt);\n }\n while ($this->yyidx >= 0) {\n $stack = $this->yy_pop_parser_stack();\n }\n /* Here code is inserted which will be executed wh... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Rollback to migration. | [
"def down(self, migration_id):\n \"\"\"\"\"\"\n if not self.check_directory():\n return\n\n for migration in self.get_migrations_to_down(migration_id):\n logger.info('Rollback migration %s' % migration.filename)\n\n migration_module = self.load_migration_file(mi... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the comment about Database management:",
"pos": "Represent the code about Database management:",
"neg": "Represent the code about Software development:"
} |
Peek at the next message on the enumeration.
In the SingleLockedMessageEnumeration there is only one message.
If the nextLocked hasn't been called then the message will be returned,
otherwise a null will be returned. | [
"public SIBusMessage peek() \n \n throws SISessionUnavailableException, SIResourceException, SIIncorrectCallException\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(tc, \"peek\");\n \n checkValidState(\"peek\");\n \n _localConsumerPoint.checkNotClosed();\... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Enqueue Moment libs.
@since 160524 Moment libs.
@return array Library details. | [
"public function enqueueMomentLibs()\n {\n if (($data = $this->didEnqueueLibs(__METHOD__))) {\n return $data; // Did this already.\n } // We only need to enqueue once.\n\n $data = [\n 'scripts' => [\n 'moment' => [\n 'version' => '2.17... | [
"private function generateFrontEndRoutes()\n {\n $this->comment(\"Front End Routes...\");\n if (!$this->checkWilling('frontend')) {\n return $this->line(\"\\tskip\");\n }\n\n $moduleName = $this->starter->getModuleName();\n // 1. To generate the module route file if ... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
SLUGGER PLUGIN DEFINITION ========================= | [
"function Plugin(options) {\n this.each(function () {\n var $this = $(this);\n var data = $this.data('bui.slugger');\n\n if (!data) {\n data = new Slugger($this, options);\n $this.data('bui.slugger', data);\n }\n\n data.updateSlug();\n });\n\n return this;\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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// validateACRValues validates that we get an appropriate response for acr values. By default
// we expect the same value we send, but this function also handles Identity Provider specific
// forms of validation. | [
"func (a *AuthServer) validateACRValues(acrValue string, identityProvider string, claims jose.Claims) error {\n\tswitch identityProvider {\n\tcase teleport.NetIQ:\n\t\tlog.Debugf(\"Validating OIDC ACR values with '%v' rules.\", identityProvider)\n\n\t\ttokenAcr, ok := claims[\"acr\"]\n\t\tif !ok {\n\t\t\treturn tra... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Clear PinBoxes values | [
"public void clear() {\n\n for (int i = 0; i < mNumberPinBoxes; i++) {\n getPinBox(i).getText().clear();\n }\n checkPinBoxesAvailableOrder();\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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// convertProtoDeviceGroup converts between a proto and structs DeviceGroup | [
"func convertProtoDeviceGroup(in *proto.DeviceGroup) *DeviceGroup {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\treturn &DeviceGroup{\n\t\tVendor: in.Vendor,\n\t\tType: in.DeviceType,\n\t\tName: in.DeviceName,\n\t\tDevices: convertProtoDevices(in.Devices),\n\t\tAttributes: structs.ConvertProtoAttr... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Iterate through indices of all table entries that vary. | [
"def _iter_restrict(self, zeros, ones):\n \"\"\"\"\"\"\n inputs = list(self.inputs)\n unmapped = dict()\n for i, v in enumerate(self.inputs):\n if v in zeros:\n inputs[i] = 0\n elif v in ones:\n inputs[i] = 1\n else:\n ... | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// ACLUpdate PUTs an ACL. | [
"func ACLUpdate(\n\tctx context.Context,\n\tclient api.Client,\n\tpath string,\n\tacl *ACL) error {\n\n\tif err := client.Put(\n\t\tctx,\n\t\trealNamespacePath(client),\n\t\tpath,\n\t\taclQueryString,\n\t\tnil,\n\t\tacl,\n\t\tnil); err != nil {\n\n\t\treturn err\n\t}\n\n\treturn nil\n}"
] | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
/* Use the default SEARCH function
The EXECUTOR will "call" the Private function named
"function" + "Action". | [
"function (err, node, next) {\n var func = node.action + 'Action';\n var obj = eval(func + '(node.params)');\n logger.log('debug', 'M|actionQueue::execute|obj=%j', +obj, meta);\n return null;\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 Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Process a Link excerpt
@param array $excerpt
@param PageInterface $page
@param string $type
@return mixed | [
"public static function processLinkExcerpt($excerpt, PageInterface $page, $type = 'link')\n {\n $url = htmlspecialchars_decode(rawurldecode($excerpt['element']['attributes']['href']));\n\n $url_parts = static::parseUrl($url);\n\n // If there is a query, then parse it and build action calls.\... | [
"public function LinkingMode()\n {\n /** @var Page_Controller $controller */\n $controller = Controller::curr();\n $params = $controller->getURLParams();\n\n return $params['ID'] === $this->URLSegment ? 'current' : 'link';\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about text processing:"
} |
Generates a unique key/salt for the wp-config.php file.
@throws Exception
@return string | [
"private static function unique_key() {\n\t\tif ( ! function_exists( 'random_int' ) ) {\n\t\t\tthrow new Exception( \"'random_int' does not exist\" );\n\t\t}\n\n\t\t$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';\n\t\t$key = '';\n\n\t\tfor ( $i = 0; $i < 64... | [
"private static function resource($resource)\n {\n exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \\''.$resource.'\\' is not supported by Vinala, only session or cookie');\n\n return Hash::make(config('auth.'.$resource));\n\n // F... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Creates a setting of a custom defined field.
@param description the title of this setting
@param field custom Field object from FormsFX
@param property to be bound, saved / loaded and used for undo / redo
@return the constructed setting | [
"public static <F extends Field<F>, P extends Property> Setting of(\n String description, F field, P property) {\n return new Setting<>(\n description,\n field.label(description),\n property);\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 post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Create a Junction application.
@return {Function}
@api public | [
"function create() {\n function app(stanza) { app.handle(stanza); }\n utils.merge(app, application);\n app._stack = [];\n app._filters = [];\n for (var i = 0; i < arguments.length; ++i) {\n app.use(arguments[i]);\n }\n return app;\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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Adds a new XY entry to the gps table.
@param connection the db connection.
@param point the point to add.
@param gpslogId the id of the log the point is part of.
@throws IOException if something goes wrong | [
"public static void addGpsLogDataPoint( Connection connection, OmsGeopaparazziProject3To4Converter.GpsPoint point,\n long gpslogId ) throws Exception {\n Date timestamp = ETimeUtilities.INSTANCE.TIME_FORMATTER_LOCAL.parse(point.utctime);\n\n String insertSQL = \"INSERT INTO \" + TableDescri... | [
"def now(self):\n \n try:\n if self.now_id:\n return Chart(self.now_id)\n else:\n log.debug('attempted to get current chart, but none was found')\n return\n except AttributeError:\n #chart does not implement next poin... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
// Marshal encodes Raw to slice of bytes. Exists to fit gogoprotobuf custom
// type interface. | [
"func (r Raw) Marshal() ([]byte, error) {\n\tif len(r) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn []byte(r), nil\n}"
] | [
"func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Marshall the given parameter object. | [
"public void marshall(DeploymentConfig deploymentConfig, ProtocolMarshaller protocolMarshaller) {\n\n if (deploymentConfig == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(deploymentConfig.... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// DeletePipelineTemplateCommand handles the interaction between the cli flags and the action handler for
// delete-pipeline-template and checks a template-name is provided and that the response is a 2xx response. | [
"func deletePipelineTemplateCommand() *cli.Command {\n\treturn &cli.Command{\n\t\tName: DeletePipelineTemplateCommandName,\n\t\tUsage: DeletePipelineTemplateCommandUsage,\n\t\tCategory: \"Pipeline Templates\",\n\t\tFlags: []cli.Flag{\n\t\t\tcli.StringFlag{Name: \"template-name\", Usage: \"Pipeline Template 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 Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Create a new Path expression
@param type type of expression
@param parent parent path
@param property property name
@return path expression | [
"public static <T extends Comparable<?>> DatePath<T> datePath(Class<? extends T> type, Path<?> parent,\n String property) {\n return new DatePath<T>(type, PathMetadataFactory.forProperty(parent, property));\n }"
] | [
"def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Grabs media embbeded into the content within <iframe>, <object>,
<embed>, and other HTML methods for embedding media.
@since 5.0.0
@access protected
@return string | [
"protected function locatedEmbeddedMedia() {\n\n\t\t$embedded_media = get_media_embedded_in_content( $this->content );\n\n\t\tif ( $embedded_media ) {\n\t\t\treturn $this->original_media = array_shift( $embedded_media );\n\t\t}\n\n\t\treturn '';\n\t}"
] | [
"public function rejectInlineListTool(Errors &$errors, Meta &$meta)\n {\n if (stristr((string)$meta->getValue(), '://listtool') !== false) {\n $errors->reject('You cannot embed the List Tool inline, use the provided fields and input [[listtool]] into the contents instead.');\n }\n }"
... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
setter for documents - sets
@generated
@param v value to set into the feature | [
"public void setDocuments(FSArray v) {\n if (SourceFile_Type.featOkTst && ((SourceFile_Type)jcasType).casFeat_documents == null)\n jcasType.jcas.throwFeatMissing(\"documents\", \"de.julielab.jules.types.ace.SourceFile\");\n jcasType.ll_cas.ll_setRefValue(addr, ((SourceFile_Type)jcasType).casFeatCode_docu... | [
"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 description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// Min specifies the minimum value and inclusiveness for this range query. | [
"func (q *NumericRangeQuery) Min(min float32, inclusive bool) *NumericRangeQuery {\n\tq.options[\"min\"] = min\n\tq.options[\"inclusive_min\"] = inclusive\n\treturn q\n}"
] | [
"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 sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Disables DataTable UI.
@method disable | [
"function() {\n var elTable = this._elTable;\n var elMask = this._elMask;\n elMask.style.width = elTable.offsetWidth + \"px\";\n elMask.style.height = elTable.offsetHeight + \"px\";\n elMask.style.display = \"\";\n this.fireEvent(\"disableEvent\");\n}"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@return string
@throws InvalidPathException | [
"public function getTargetDirectory(): string\n {\n $directoryName = $this->getRootRelatedPath($this->getFactorySpecificConfig()['directory']);\n\n $this->assertDirectoryIsWriteable($directoryName);\n\n return $directoryName;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// setErr is a thread-safe setter for the error object | [
"func (d *downloader) setErr(e error) {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\n\td.err = e\n}"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// indent prepends a format string with the given number of spaces. | [
"func indent(prepend string, level int, append string) string {\n\treturn fmt.Sprintf(\"%s%*s%s\", prepend, level, \"\", append)\n}"
] | [
"def DocToHelp(doc):\n \"\"\"\"\"\"\n\n # Get rid of starting and ending white space. Using lstrip() or even\n # strip() could drop more than maximum of first line and right space\n # of last line.\n doc = doc.strip()\n\n # Get rid of all empty lines.\n whitespace_only_line = re.compile('^[ \\t]+$', re.M)\n ... | codesearchnet | {
"query": "Represent the sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Get a :class:`Page <pages.admin.forms.PageForm>` for the
:class:`Page <pages.models.Page>` and modify its fields depending on
the request. | [
"def get_form(self, request, obj=None, **kwargs):\n \"\"\"\"\"\"\n\n template = get_template_from_request(request, obj)\n\n #model = create_page_model(get_placeholders(template))\n\n form = make_form(self.model, get_placeholders(template))\n\n # bound the form\n language = ... | [
"def get_context_data(self,**kwargs):\n ''' '''\n context = self.get_listing()\n context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all'\n context.update(kwargs)\n\n # Update the site session data so that registration processes know to send retu... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Extends the module navigation with the advanced grading information
This function is called when the context for the page is an activity module with the
FEATURE_ADVANCED_GRADING.
@param global_navigation $navigation
@param navigation_node $modulenode | [
"public function extend_navigation(global_navigation $navigation, navigation_node $modulenode=null) {\n $this->ensure_isset(array('context', 'component'));\n\n $areas = $this->get_available_areas();\n foreach ($areas as $areaname => $areatitle) {\n $this->set_area($areaname);\n ... | [
"public static function data_for_user_evidence_list_page_returns() {\n return new external_single_structure(array (\n 'canmanage' => new external_value(PARAM_BOOL, 'Can the current user manage the user\\'s evidence'),\n 'userid' => new external_value(PARAM_INT, 'The user ID'),\n ... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
从队列中取出前面的一个元素
@return | [
"public QueueElement deQueue()\n {\n if (pHead == null)\n return null;\n\n QueueElement pRet = pHead;\n pHead = pHead.next;\n\n return pRet;\n }"
] | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about text processing:"
} |
// Convert_v1_GlusterfsPersistentVolumeSource_To_core_GlusterfsPersistentVolumeSource is an autogenerated conversion function. | [
"func Convert_v1_GlusterfsPersistentVolumeSource_To_core_GlusterfsPersistentVolumeSource(in *v1.GlusterfsPersistentVolumeSource, out *core.GlusterfsPersistentVolumeSource, s conversion.Scope) error {\n\treturn autoConvert_v1_GlusterfsPersistentVolumeSource_To_core_GlusterfsPersistentVolumeSource(in, out, s)\n}"
] | [
"func Convert_kops_KopeioNetworkingSpec_To_v1alpha2_KopeioNetworkingSpec(in *kops.KopeioNetworkingSpec, out *KopeioNetworkingSpec, s conversion.Scope) error {\n\treturn autoConvert_kops_KopeioNetworkingSpec_To_v1alpha2_KopeioNetworkingSpec(in, out, s)\n}"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Get parameter in Cozy configuration | [
"def get_cozy_param(param):\n '''\n \n '''\n try:\n req = curl_couchdb('/cozy/_design/cozyinstance/_view/all')\n rows = req.json()['rows']\n if len(rows) == 0:\n return None\n else:\n return rows[0].get('value', {}).get(param, None)\n except:\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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the names of all activities with routing constraints.
@return A set of all activities with routing constraints. | [
"public Set<String> getActivitiesWithRoutingConstraints(){\n\t\tSet<String> result = new HashSet<>();\n\t\tString propertyValue = getProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS);\n\t\tif(propertyValue == null)\n\t\t\treturn result;\n\t\tStringTokenizer activityTokens = StringUtils.splitArrayStrin... | [
"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 post about database:",
"pos": "Represent the code about database:",
"neg": "Represent the code:"
} |
Find any slots that overlap | [
"def find_overlapping_slots(all_slots):\n \"\"\"\"\"\"\n overlaps = set([])\n for slot in all_slots:\n # Because slots are ordered, we can be more efficient than this\n # N^2 loop, but this is simple and, since the number of slots\n # should be low, this should be \"fast enough\"\n ... | [
"func (rl *resignLeadership) Execute(state State) (*State, error) {\n\t// TODO(fwereade): this hits a lot of interestingly intersecting problems.\n\t//\n\t// 1) we can't yet create a sufficiently dumbed-down hook context for a\n\t// leader-deposed hook to run as specced. (This is the proximate issue,\n\t// an... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// Close session if session.IsAutoClose is true, and claimed any opened resources | [
"func (rows *Rows) Close() error {\n\tif rows.session.IsAutoClose {\n\t\tdefer rows.session.Close()\n\t}\n\n\tif rows.lastError == nil {\n\t\tif rows.rows != nil {\n\t\t\trows.lastError = rows.rows.Close()\n\t\t\tif rows.lastError != nil {\n\t\t\t\tdefer rows.stmt.Close()\n\t\t\t\treturn rows.lastError\n\t\t\t}\n\t... | [
"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:"
} |
{@inheritDoc}
@see org.jboss.shrinkwrap.api.container.WebContainer#addAsWebInfResources(java.lang.Package, java.lang.String[]) | [
"@Override\n public T addAsWebInfResources(final Package resourcePackage, final String... resourceNames)\n throws IllegalArgumentException {\n Validate.notNull(resourcePackage, \"ResourcePackage must be specified\");\n Validate.notNullAndNoNullValues(resourceNames,\n \"ResourceNam... | [
"public static ConfigurationOption factoryConfiguration(String pid) {\n return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).factory(true);\n }"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Publish file or folder and return public url | [
"def publish(self, path):\n \"\"\"\"\"\"\n \n def parseContent(content):\n root = ET.fromstring(content)\n prop = root.find(\".//d:prop\", namespaces=self.namespaces)\n return prop.find(\"{urn:yandex:disk:meta}public_url\").text.strip()\n \n data =... | [
"public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// New creates a new admin API client. | [
"func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {\n\treturn &Client{transport: transport, formats: formats}\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 sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Dom manipulation | [
"function toArray() {\n const arr = [];\n for (let i = 0; i < this.length; i += 1) {\n arr.push(this[i]);\n }\n return arr;\n}"
] | [
"def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
expr : expr BXOR expr | [
"def p_expr_BXOR_expr(p):\n \n p[0] = make_binary(p.lineno(2), 'BXOR', p[1], p[3], lambda x, y: x ^ y)"
] | [
"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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Create a curses pad and populate it with a line by stream | [
"def init_streams_pad(self, start_row=0):\n \n y = 0\n pad = curses.newpad(max(1,len(self.filtered_streams)), self.pad_w)\n pad.keypad(1)\n for s in self.filtered_streams:\n pad.addstr(y, 0, self.format_stream_line(s))\n y+=1\n self.offsets['streams'] ... | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Resets (= removes) fixed values for the specified {@link DataSet} key.
@param dataSetKey
The {@link DataSet} key. | [
"@Override\r\n\tpublic void resetFixedValues(final String dataSetKey) {\r\n\t\tfixedValues.remove(dataSetKey);\r\n\t\tDataSet dataSet = getCurrentDataSets().get(dataSetKey);\r\n\t\tif (dataSet != null) {\r\n\t\t\tdataSet.resetFixedValues();\r\n\t\t}\r\n\t}"
] | [
"@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 summarization about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Programming:"
} |
Returns {@code true} if each element in {@code iterable} after the first is
greater than or equal to the element that preceded it, according to this
ordering. Note that this is always true when the iterable has fewer than
two elements. | [
"public boolean isOrdered(Iterable<InternalKey> keys)\n {\n Iterator<InternalKey> iterator = keys.iterator();\n if (!iterator.hasNext()) {\n return true;\n }\n\n InternalKey previous = iterator.next();\n while (iterator.hasNext()) {\n InternalKey next = it... | [
"@Override\n public void putAll(Map<? extends K, ? extends V> m) {\n\tfor (Map.Entry<? extends K, ? extends V> e: m.entrySet())\n\t put(e.getKey(), e.getValue());\n }\n\n /**\n * Removes the key (and its corresponding value) from this map. This method does nothing if the key\n * is not in the ma... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Returns all the cp option categories matching the UUID and company.
@param uuid the UUID of the cp option categories
@param companyId the primary key of the company
@return the matching cp option categories, or an empty list if no matches were found | [
"@Override\n\tpublic java.util.List<com.liferay.commerce.product.model.CPOptionCategory> getCPOptionCategoriesByUuidAndCompanyId(\n\t\tString uuid, long companyId) {\n\t\treturn _cpOptionCategoryLocalService.getCPOptionCategoriesByUuidAndCompanyId(uuid,\n\t\t\tcompanyId);\n\t}"
] | [
"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 Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Generate a query set to use the current Model's table name & key.
@return \Parable\ORM\Query | [
"public function createQuery()\n {\n $query = \\Parable\\ORM\\Query::createInstance();\n $query->setTableName($this->getTableName());\n return $query;\n }"
] | [
"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 post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Filter the query by a list of primary keys
@param array $keys The list of primary key to use for the query
@return ChildPersonFunctionVersionQuery The current query, for fluid interface | [
"public function filterByPrimaryKeys($keys)\n {\n if (empty($keys)) {\n return $this->add(null, '1<>1', Criteria::CUSTOM);\n }\n foreach ($keys as $key) {\n $cton0 = $this->getNewCriterion(PersonFunctionVersionTableMap::ID, $key[0], Criteria::EQUAL);\n $cton1... | [
"public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software Development:"
} |
Atomically remove the highest-scoring item from the set, blocking until
an item becomes available or timeout is reached (0 for no timeout,
default).
Returns a 2-tuple of (item, score). | [
"def bpopmax(self, timeout=0):\n \n res = self.database.bzpopmax(self.key, timeout)\n if res is not None:\n return (res[1], res[2])"
] | [
"def _buffered_generation_process(source_gen, buffer_, sentinal):\n \n for data in source_gen:\n buffer_.put(data, block=True)\n # sentinel: signal the end of the iterator\n buffer_.put(sentinal)\n # unfortunately this does not suffice as a signal: if buffer_.get() was\n # called and subseq... | codesearchnet | {
"query": "Represent the sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Opposite of parse().
:param deps: list of Dependency()
:param separator: when joining dependencies, use this separator
:return: dict of {name: version spec} | [
"def compose_sep(deps, separator):\n \n result = {}\n for dep in deps:\n if dep.name not in result:\n result[dep.name] = separator.join([op + ver for op, ver in dep.spec])\n else:\n result[dep.name] += separator + separator.join([op + ver for ... | [
"def _extract_lookup(self, key):\n \"\"\"\"\"\"\n parts = key.split('__')\n # 'exact' is the default lookup if there was no explicit comparison op in `key`\n # Assume there is only one `__` in the key.\n # FIXME Change for child attribute query support\n op = 'exact' if... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
This constructor simplifies instantiation when using HTTPS (REQUIRED!) and asymmetric key encryption
based on RSA keys | [
"public static function fromAsymmetricKeyDefaults(\n string $privateRsaKey,\n string $publicRsaKey,\n int $expirationTime\n ) : self {\n return new self(\n new Signer\\Rsa\\Sha256(),\n $privateRsaKey,\n $publicRsaKey,\n SetCookie::create(sel... | [
"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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Return the currently configured jobs. | [
"def _jobs():\n '''\n \n '''\n response = salt.utils.http.query(\n \"{0}/scheduler/jobs\".format(_base_url()),\n decode_type='json',\n decode=True,\n )\n jobs = {}\n for job in response['dict']:\n jobs[job.pop('name')] = job\n return jobs"
] | [
"@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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
// next returns the next unread token and advances the internal cursor by one. | [
"func (t *Tree) next() token {\n\tvar tok token\n\tif len(t.unread) > 0 {\n\t\ttok, t.unread = t.unread[len(t.unread)-1], t.unread[:len(t.unread)-1]\n\t} else {\n\t\ttok = t.lex.nextToken()\n\t}\n\n\tt.read = append(t.read, tok)\n\n\treturn tok\n}"
] | [
"function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ... | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about File management:"
} |
// NewGroupChangeManagementTypeType returns a new GroupChangeManagementTypeType instance | [
"func NewGroupChangeManagementTypeType(Description string) *GroupChangeManagementTypeType {\n\ts := new(GroupChangeManagementTypeType)\n\ts.Description = Description\n\treturn s\n}"
] | [
"@Override\n public void perform() throws PortalException {\n // push the change into the PLF\n if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {\n // remove the parm edit\n ParameterEditManager.removeParmEditDirective(nodeId, name, person);\n }\n // pu... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// poll queries an agent for container-level metrics, such as
// CPU, memory, disk, and network usage. | [
"func (c *Collector) getContainerMetrics() error {\n\tu := url.URL{\n\t\tScheme: c.RequestProtocol,\n\t\tHost: net.JoinHostPort(c.nodeInfo.IPAddress, strconv.Itoa(c.Port)),\n\t\tPath: \"/containers\",\n\t}\n\n\tc.HTTPClient.Timeout = c.RequestTimeout\n\n\treturn client.Fetch(c.HTTPClient, u, &c.containerMetrics... | [
"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 description about Container management:",
"pos": "Represent the Github code about Container management:",
"neg": "Represent the Github code about Software development:"
} |
Convert WAV data to MP3 using the Lame MP3 encoder binary
@param string $data Contents of the WAV file to convert
@return string MP3 file data | [
"protected function wavToMp3($data)\n {\n if (!file_exists(self::$lame_binary_path) || !is_executable(self::$lame_binary_path)) {\n throw new Exception('Lame binary \"' . $this->lame_binary_path . '\" does not exist or is not executable');\n }\n\n // size of wav data input\n ... | [
"def tag_audio(filename, tracklisting):\n \"\"\"\"\"\"\n # TODO: maybe actually glob for files, then try tagging if present?\n if not(tag_audio_file(filename + '.m4a', tracklisting) or\n tag_audio_file(filename + '.mp3', tracklisting)):\n print(\"Cannot find or access any relevant M4A or M... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Override method for one in resource.py to check partition
The partition cannot be included as a parameter to create a guest.
Raise an exception if a consumer gives the partition parameter.
:raises: DisallowedCreationParameter | [
"def _check_create_parameters(self, **kwargs):\n \n\n if 'partition' in kwargs:\n msg = \"'partition' is not allowed as a create parameter. Vcmp \" \\\n \"guests are created with the 'name' at least.\"\n raise DisallowedCreationParameter(msg)\n super(Virtual... | [
"def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about AWS Auto Scaling:"
} |
Called from RpcClient, does not crash the Actor on errors.
@param [String] method
@param [Array] params
@raise [RuntimeError] not connected | [
"def send_notification(method, params)\n data = MessagePack.dump([2, method, params]).bytes\n ws.send(data)\n rescue => exc\n warn exc\n abort exc\n end"
] | [
"public DeviceData command_inout(TacoTangoDevice tacoDevice, String command, DeviceData argin) 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 post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about N/A:"
} |
Initialize configuration.
.. note:: If CairoSVG is installed then the configuration
``FORMATTER_BADGES_ENABLE`` is ``True``.
:param app: The Flask application. | [
"def init_config(app):\n \n try:\n get_distribution('CairoSVG')\n has_cairo = True\n except DistributionNotFound:\n has_cairo = False\n\n app.config.setdefault('FORMATTER_BADGES_ENABLE', has_cairo)\n\n for attr in dir(config):\n if attr.... | [
"def get_stack() -> Optional[str]:\n \n stack = SETTINGS.stack\n if not stack:\n require_test_mode_enabled()\n raise RunError('Missing stack name; for test mode, please set PULUMI_NODEJS_STACK')\n return stack"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Load tool consumer object.
@param ToolConsumer $consumer ToolConsumer object
@return boolean True if the tool consumer object was successfully loaded | [
"public function loadToolConsumer($consumer)\n {\n\n $ok = false;\n if (!empty($consumer->getRecordId())) {\n $sql = sprintf('SELECT consumer_pk, name, consumer_key256, consumer_key, secret, lti_version, ' .\n 'consumer_name, consumer_version, consumer_guid, ' .... | [
"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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// SecretRemove mocks base method | [
"func (m *MockCommonAPIClient) SecretRemove(ctx context.Context, id string) error {\n\tret := m.ctrl.Call(m, \"SecretRemove\", ctx, id)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}"
] | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
With this functionality you can query previously the Credit Cards Token.
Args:
payer_id:
credit_card_token_id:
start_date:
end_date:
Returns: | [
"def get_tokens(self, *, payer_id, credit_card_token_id, start_date, end_date):\n \n payload = {\n \"language\": self.client.language.value,\n \"command\": PaymentCommand.GET_TOKENS.value,\n \"merchant\": {\n \"apiLogin\": self.client.api_login,\n ... | [
"def to_array(self):\n \n array = super(PreCheckoutQuery, self).to_array()\n array['id'] = u(self.id) # py2: type unicode, py3: type str\n array['from'] = self.from_peer.to_array() # type User\n array['currency'] = u(self.currency) # py2: type unicode, py3: type str\n ar... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Optional[:class:`TextChannel`]: Returns the guild's channel used for system messages.
Currently this is only for new member joins. If no channel is set, then this returns ``None``. | [
"def system_channel(self):\n \n channel_id = self._system_channel_id\n return channel_id and self._channels.get(channel_id)"
] | [
"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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public EClass getLLERG() {\n\t\tif (llergEClass == null) {\n\t\t\tllergEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(409);\n\t\t}\n\t\treturn llergEClass;\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 sentence about Text generation:",
"pos": "Represent the Github code about Text generation:",
"neg": "Represent the Github code:"
} |
Creates a hash map from two index-aligned arrays of key-value pairs. | [
"public static <KType, VType> KTypeVTypeHashMap<KType, VType> from(KType[] keys, VType[] values) {\n if (keys.length != values.length) {\n throw new IllegalArgumentException(\"Arrays of keys and values must have an identical length.\");\n }\n\n KTypeVTypeHashMap<KType, VType> map = new KTypeVTypeHashM... | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Assemble the route.
@param array $params The route parameters
@throws \InvalidArgumentException
- If the value of required placeholder is not specified
- If a specified parameter not match with route constraints
@return string The route path | [
"public function assemble($params = [])\n {\n $params = array_merge($this->defaults, $params);\n $parts = $this->parts;\n\n $return = [];\n foreach ($parts as $part) {\n if (0 === strpos($part, '~') && 1 !== strpos($part, ':')) {\n continue;\n }\n... | [
"private function guardValidModelAndIdentifier($model, $identifier)\n {\n if (empty($model) || (!is_object($model) && (null === $identifier || '' === $identifier))) {\n throw new ResolveComponentDataException('Model has to be an object or (a scalar + an identifier in 2nd argument)');\n }... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Unserialize session data
http://www.php.net/manual/en/function.session-decode.php#56106 | [
"protected function unserialize($str)\n {\n $str = (string)$str;\n $endptr = strlen($str);\n $p = 0;\n\n $serialized = '';\n $items = 0;\n $level = 0;\n\n while ($p < $endptr) {\n $q = $p;\n while ($str[$q] != '|')\n ... | [
"private function writeFile($fileName, $value, $expires) {\n FS::mkDir(dirname($fileName));\n file_put_contents($fileName, serialize($value));\n\n // TODO: http://phpdevblog.niknovo.com/2009/11/serialize-vs-var-export-vs-json-encode.html\n return true;\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Inner function to assist LoadData. | [
"def _InnerAppendData(self, prev_col_values, data, col_index):\n \"\"\"\"\"\"\n # We first check that col_index has not exceeded the columns size\n if col_index >= len(self.__columns):\n raise DataTableException(\"The data does not match description, too deep\")\n\n # Dealing with the scalar case, ... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Template variable getter. Returns order remark
@return string | [
"public function getOrderRemark()\n {\n $config = \\OxidEsales\\Eshop\\Core\\Registry::getConfig();\n if ($this->_sOrderRemark === null) {\n // if already connected, we can use the session\n if ($this->getUser()) {\n $orderRemark = \\OxidEsales\\Eshop\\Core\\Reg... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github text about Text translation:",
"pos": "Represent the Github code about Text translation:",
"neg": "Represent the Github code about programming:"
} |
Add any previously skipped tokens to $parent.
@param ParentNode $parent | [
"private function addSkipped(ParentNode $parent) {\n $parent->addChildren($this->getSkipNodes($this->skipped));\n $this->skipped = [];\n $this->matchDocComment($this->skipParent ?: $parent, NULL);\n $this->skipParent = NULL;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
/* Instantiate a companion for the specified class. | [
"private function instantiate($model, $ctorArgs) {\n\t\tif (is_object($model)) {\n\t\t\t$className = get_class($model);\n\t\t} else {\n\t\t\t$className = $model;\n\t\t}\n\t\t$companionName = $this->getCompanionName($className);\n\n\t\t$psr4Prefix = $this->target->getPrefix()->rtrim('\\\\');\n\t\tif (!empty($psr4Pre... | [
"@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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Number -> Term Converts a JS number to a church-encoded nat. | [
"function fromNumber(num){\n return Lam(Lam((function go(n){return n===0?Var(0):App(Var(1),go(n-1))})(num)));\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Prepare content array.
@param array $data
@param ParameterBag $options
@param OutputInterface|null $output
@return array | [
"public function prepareContent($data, ParameterBag $options, OutputInterface $output = null)\n {\n if ($output === null) {\n $output = new NullOutput();\n }\n\n $content = array();\n\n foreach ($data as $contentTypeId => $items) {\n $progress = new ProgressBar($... | [
"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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Wrapper taking custom units and margins into account
@see \ZendPdf\Page::drawText() for documentation | [
"public function drawText($text, $x, $y, $charEncoding = 'WINDOWS-1252')\n {\n $this->convertCoordinatesFromUserSpace($x, $y);\n $y -= $this->getFontSize();\n return parent::drawText($text, $x, $y, $charEncoding);\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Adds invoice info if exists.
@param array $options | [
"protected function addInvoice($money, $options)\n {\n $this->xml->TxnDetails(null, 'Transaction')\n ->merchantreference($options['order_id'], 'TxnDetails')\n ->amount($this->amount($money), 'TxnDetails', array('currency'=> static::$default_currency));\n $captureMethod = stati... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
References:
https://developer.github.com/v3/issues/events/#list-events-for-an-issue | [
"def check_auto_merge_labeler(repo: GithubRepository, pull_id: int\n ) -> Optional[CannotAutomergeError]:\n \n url = (\"https://api.github.com/repos/{}/{}/issues/{}/events\"\n \"?access_token={}\".format(repo.organization,\n repo.name,\... | [
"public function all($username, $repository, $pullRequest, array $params = [])\n {\n return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', $params);\n }"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
// SetIdentityAttributeOrder sets the IdentityAttributeOrder field's value. | [
"func (s *GetTypedLinkFacetInformationOutput) SetIdentityAttributeOrder(v []*string) *GetTypedLinkFacetInformationOutput {\n\ts.IdentityAttributeOrder = v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// bind attempts to bind the connection. | [
"func bind(c Conn, p pdu.Body) (pdu.Body, error) {\n\tf := p.Fields()\n\tf.Set(pdufield.InterfaceVersion, 0x34)\n\terr := c.Write(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.Read()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th := resp.Header()\n\tif h.Status != 0 {\n\t\treturn nil, h.Statu... | [
"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 Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about programming:"
} |
Continuously process jobs
@param string $queueName
@param string $queueObjectName
@throws \Exception | [
"public function actionListen($queueName = null, $queueObjectName = 'queue')\r\n {\r\n while (true) {\r\n if ($this->timeout !==null) {\r\n if ($this->timeout<time()) {\r\n return true;\r\n }\r\n }\r\n if (!$this->process($q... | [
"public static function nPost(string $name, $data, $workerID = -1)\n {\n $task = TaskParser::getInstance()->getTask($name);\n $paramClass = $task['Task']->paramClass;\n return static::post(new TaskInfo(new $task['className'], new $paramClass($data)), $workerID);\n }"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
r"""Trace of :math:`\mathrm A \mathrm B^\intercal`.
Args:
A (array_like): Left-hand side.
B (array_like): Right-hand side.
Returns:
float: Trace of :math:`\mathrm A \mathrm B^\intercal`. | [
"def trace2(A, B):\n \n \"\"\"\n A = asarray(A, float)\n B = asarray(B, float)\n\n layout_error = \"Wrong matrix layout.\"\n\n if not (len(A.shape) == 2 and len(B.shape) == 2):\n raise ValueError(layout_error)\n\n if not (A.shape[1] == B.shape[0] and A.shape[0] == B.shape[1]):\n r... | [
"def gradient(self):\n \n functional = self\n\n if self.exponent == 1:\n class L1Gradient(Operator):\n\n \"\"\"The gradient operator of this functional.\"\"\"\n\n def __init__(self):\n \"\"\"Initialize a new instance.\"\"\"\n ... | codesearchnet | {
"query": "Represent the instruction about mathematics:",
"pos": "Represent the code about mathematics:",
"neg": "Represent the code:"
} |
// merge takes another TranslatorRules instance and safely merges its metadata
// into this instance. this replaces yaml marshalling directly into the same
// instance - as that doesn't do what we want for deep merging. | [
"func (t *TranslatorRules) merge(tNew *TranslatorRules) {\n\n\tt.Plural = stringMerge(t.Plural, tNew.Plural)\n\n\tif tNew.PluralRuleFunc != nil {\n\t\tt.PluralRuleFunc = tNew.PluralRuleFunc\n\t}\n\n\tt.Direction = stringMerge(t.Direction, tNew.Direction)\n\n\tt.Numbers.Symbols.Decimal = stringMerge(t.Numbers.Symbol... | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@Override\r\n\tpublic EClass getIfcSpace() {\r\n\t\tif (ifcSpaceEClass == null) {\r\n\t\t\tifcSpaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()\r\n\t\t\t\t\t.get(610);\r\n\t\t}\r\n\t\treturn ifcSpaceEClass;\r\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 description about Text generation:",
"pos": "Represent the Github code about Text generation:",
"neg": "Represent the Github code:"
} |
Views.
@throws \Throwable|\Orchid\Screen\Exceptions\TypeException
@return array | [
"public function fields(): array\n {\n $fields[] = Select::make('user.roles.')\n ->fromModel(Role::class, 'name')\n ->multiple()\n ->horizontal()\n ->title(__('Name role'));\n\n $permissionFields = $this->generatedPermissionFields($this->query->getContent... | [
"protected function CanCreate()\n {\n return self::Guard()->Allow(BackendAction::Create(), new Container())\n && self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());\n }"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// Evaluates script in the global context. | [
"func (t *Tab) EvaluateScript(scriptSource string) (*gcdapi.RuntimeRemoteObject, error) {\n\treturn t.evaluateScript(scriptSource, false)\n}"
] | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
returns all descendants in the taxonomy | [
"def descendants(self, cl=None, noduplicates=True):\n \n if not cl:\n cl = self\n if cl.children():\n bag = []\n for x in cl.children():\n if x.uri != cl.uri: # avoid circular relationships\n bag += [x] + self.descendants(x, no... | [
"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 comment:",
"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.