query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
/*Line 88 - 'Atom.js'
[ "function (start, end, step) {\n/*Line 89 - 'Atom.js' */ var a = [];\n/*Line 90 - 'Atom.js' */ step = step || 1;\n/*Line 91 - 'Atom.js' */ for (var i = start; i <= end; i+=step) {\n/*Line 92 - 'Atom.js' */ a.push({ label: i, value: i });\n/*Line 93 - 'Atom.js' */ }\n/*Line 94 ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
--------------------------------------------------------------------------------------------
[ "protected static void checkSameExecutionContext(DataSet<?> set1, DataSet<?> set2) {\n\t\tif (set1.context != set2.context) {\n\t\t\tthrow new IllegalArgumentException(\"The two inputs have different execution contexts.\");\n\t\t}\n\t}" ]
[ "public static function run($speech = null)\n\t{\n\t\tif ( ! isset($speech))\n\t\t{\n\t\t\t$speech = 'KILL ALL HUMANS!';\n\t\t}\n\n\t\t$eye = \\Cli::color(\"*\", 'red');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"{$speech}\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::col...
codesearchnet
{ "query": "Represent the Github comment about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code about programming:" }
Finds connection lost type notifications. @param connectionNotification @return
[ "private boolean connectionLost(JMXConnectionNotification connectionNotification) {\n return connectionNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST)\n || connectionNotification.getType().equals(JMXConnectionNotification.CLOSED)\n || connectionNotification....
[ "def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])" ]
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// NewMain gets a new Main with the default configuration.
[ "func NewMain() *Main {\n\treturn &Main{\n\t\tBucket: \"pdk-test-bucket\",\n\t\tRegion: \"us-east-1\",\n\t\tPilosaHosts: []string{\"localhost:10101\"},\n\t\tIndex: \"pdk\",\n\t\tBatchSize: 1000,\n\t\tSubjectAt: \"#@!pdksubj\",\n\t\tSubjectPath: []string{},\n\t\tProxy: \":13131\",\n\t}\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:" }
Flush the callback queue. Invokes callbacks which were on the queue when tick() was called and newly added ones.
[ "public function tick()\n {\n while (!$this->queue->isEmpty() && $this->loop->isRunning())\n {\n $this->callback = $this->queue->dequeue();\n $callback = $this->callback; // without this proxy PHPStorm marks line as fatal error.\n $callback($this->loop);\n }\...
[ "def cancel(self, *args, **kwargs):\n \"\"\"\"\"\"\n # Because remove all futures will trigger `set_result`,\n # we cancel itself first.\n super().cancel()\n for future in self.traverse():\n # All cancelled futures should have callbacks to removed itself\n # ...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Returns the first header value based on the given internal list value.
[ "private <T> T getFirstHeaderValue(List<T> internalValue) {\n return internalValue == null ? null : internalValue.get(0);\n }" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github sentence about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
// decodeStructObjectMethods is a decodeStructGetter that reads values from // an object by calling methods.
[ "func decodeStructObjectMethods(mrb *Mrb, v *MrbValue) decodeStructGetter {\n\treturn func(key string) (*MrbValue, error) {\n\t\treturn v.Call(key)\n\t}\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Issues an API request to create a new account transaction.
[ "public function createTransaction(Transaction $transaction, array $params = [])\n {\n $this->getClient()->createAccountTransaction($this, $transaction, $params);\n }" ]
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Gets the SQL statement used for deleting a row from the collection. @param \Doctrine\ORM\PersistentCollection $collection @return string[]|string[][] ordered tuple containing the SQL to be executed and an array of types for bound parameters
[ "protected function getDeleteRowSQL(PersistentCollection $collection)\n {\n $mapping = $collection->getMapping();\n $class = $this->em->getClassMetadata($mapping['sourceEntity']);\n $targetClass = $this->em->getClassMetadata($mapping['targetEntity']);\n $columns = array(...
[ "public function compileUpdate(Builder $query, $values)\n {\n // Each one of the columns in the update statements needs to be wrapped in the\n // keyword identifiers, also a place-holder needs to be created for each of\n // the values in the list of bindings so we can make the sets statement...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Parses the JSON object stored at GPJob.info and assigns its metadata to properties of this GPJob object. Primarily intended to be called from GPJob.get_info().
[ "def load_info(self):\n \n self.task_name = self.info['taskName']\n self.task_lsid = self.info['taskLsid']\n self.user_id = self.info['userId']\n self.job_number = int(self.info['jobId'])\n self.status = self.get_status_message()\n self.date_submitted = self.info['da...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the description about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code:" }
MethodNotAllowed (405) The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.
[ "public static function MethodNotAllowed($body = NULL, \\Exception $previous = NULL) {\n return self::code(405, $body, $previous);\n }" ]
[ "function mkcol($path) {\n $this->_path = $this->translate_uri($path);\n $this->header_unset();\n $this->create_basic_request('MKCOL');\n $this->send_request();\n $this->get_respond();\n $response = $this->process_respond();\n // validate the response ...\n //...
codesearchnet
{ "query": "Represent the text about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about Software development:" }
// GetTiDBInfo returns the git hash and build time of this tidb-server binary.
[ "func GetTiDBInfo() string {\n\treturn fmt.Sprintf(\"Release Version: %s\\n\"+\n\t\t\"Git Commit Hash: %s\\n\"+\n\t\t\"Git Branch: %s\\n\"+\n\t\t\"UTC Build Time: %s\\n\"+\n\t\t\"GoVersion: %s\\n\"+\n\t\t\"Race Enabled: %v\\n\"+\n\t\t\"TiKV Min Version: %s\\n\"+\n\t\t\"Check Table Before Drop: %v\",\n\t\tmysql.TiDB...
[ "function Cli(opts) {\n _.extend(this, {\n logger: require('./logger'),\n Interview: require('./interview'),\n service: Service,\n rimraf: require('rimraf'),\n yargs: require('yargs'), // overridable parsed arguments.\n takenFlags: [],\n commands: {\n 'install': \"ask user about environme...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Computer Science:" }
Add a cdata section to a StringBuffer. If the buffer is null, a new one is created. @param buffer StringBuffer to fill @param cdataContent the cdata content @return the buffer
[ "public static StringBuffer appendCdataSection(StringBuffer buffer, String cdataContent)\n\t{\n\t\tStringBuffer _buffer = initStringBufferIfNecessary(buffer);\n\t\treturn doAppendCdataSection(_buffer, cdataContent);\n\t}" ]
[ "private void appendParamValue(StringBuilder param, StringBuilder result) {\n if (param == null)\n throw UncheckedTemplateException.invalidArgumentName(param);\n\n // Object name is the parameter that should be found in the map.\n // If it's followed by points, the points remain in t...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
(see Timezone#transitions_up_to)
[ "def transitions_up_to(to, from = nil)\n raise ArgumentError, 'to must be specified' unless to\n to_timestamp = Timestamp.for(to)\n from_timestamp = from && Timestamp.for(from)\n\n begin\n info.transitions_up_to(to_timestamp, from_timestamp)\n rescue ArgumentError => e\n raise...
[ "def _getFromTime(self, atDate=None):\n \n return getLocalTime(self.except_date, self.time_from, self.tz)" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
You can modify the container here before it is dumped to PHP code. @param ContainerBuilder $container @api
[ "public function process(ContainerBuilder $container)\n {\n if ($container->hasDefinition('twig')) {\n $twig = $container->getDefinition('twig');\n $twig->addMethodCall('addGlobal', array('context', new Reference('open_orchestra_backoffice.context_backoffice_manager')));\n\n ...
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Updates the cp option category in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. @param cpOptionCategory the cp option category @return the cp option category that was updated
[ "@Override\n\tpublic com.liferay.commerce.product.model.CPOptionCategory updateCPOptionCategory(\n\t\tcom.liferay.commerce.product.model.CPOptionCategory cpOptionCategory) {\n\t\treturn _cpOptionCategoryLocalService.updateCPOptionCategory(cpOptionCategory);\n\t}" ]
[ "private function getColumnFromName($name)\n {\n foreach ($this->columnConfiguration as $i => $col) {\n if ($col->getName() == $name) {\n return $col;\n }\n }\n\n // This exception should never happen. If it does, something is\n // wrong w/ the rel...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Marshall the given parameter object.
[ "public void marshall(CrawlerTargets crawlerTargets, ProtocolMarshaller protocolMarshaller) {\n\n if (crawlerTargets == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(crawlerTargets.getS3Tar...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Adds or updates an order base item in the storage. @param MShop_Common_Item_Interface $item Order base object (sub-items are not saved) @param boolean $fetch True if the new ID should be returned in the item
[ "public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )\n\t{\n\t\t$iface = 'MShop_Order_Item_Base_Interface';\n\t\tif( !( $item instanceof $iface ) ) {\n\t\t\tthrow new MShop_Order_Exception( sprintf( 'Object is not of required type \"%1$s\"', $iface ) );\n\t\t}\n\n\t\tif( !$item->isModified()...
[ "public function run()\n\t{\n\t\t$total = $errors = 0;\n\t\t$context = $this->getContext();\n\t\t$config = $context->getConfig();\n\t\t$logger = $context->getLogger();\n\t\t$domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' );\n\t\t$mappings = $this->getDefaultMapping();\n\n\n\t\...
codesearchnet
{ "query": "Represent the sentence about Aimeos:", "pos": "Represent the code about Aimeos:", "neg": "Represent the code:" }
计算缓存名称 @param string $key @access private @return string
[ "private function _filename($key)\n {\n if (true == ($dir_pos = strrpos($key, '/'))) {\n // 有子目录,也可能有多层子目录。\n $cache_name = substr($key, $dir_pos + 1);\n\n // 缓存目录\n $cache_dir = APP_PATH . '/' . Config::get('cache_dir') . substr($key, 0, $dir_pos) . '/';\n\n ...
[ "public void addSharedFunctionByString(String content) {\r\n\t\t// content 中的内容被解析后会存放在 Env 之中,而 StringSource 所对应的\r\n\t\t// Template 对象 isModified() 始终返回 false,所以没有必要对其缓存\r\n\t\tStringSource stringSource = new StringSource(content, false);\r\n\t\tdoAddSharedFunction(stringSource, null);\r\n\t}" ]
codesearchnet
{ "query": "Represent the text about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
Parse docstring into a dict :rtype: data.FDocstring
[ "def _doc_parse(doc, module=None, qualname=None):\n \n\n # Build the rex\n known_tags = {\n 'param': 'arg',\n 'type': 'arg-type',\n 'return': 'ret',\n 'returns': 'ret',\n 'rtype': 'ret-type',\n 'exception': 'exc',\n 'except': 'exc',\n 'raise': 'exc',\...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github text about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
// AddIfNotPresent adds a pod to the active queue if it is not present in any of // the queues. If it is present in any, it doesn't do any thing.
[ "func (p *PriorityQueue) AddIfNotPresent(pod *v1.Pod) error {\n\tp.lock.Lock()\n\tdefer p.lock.Unlock()\n\tif p.unschedulableQ.get(pod) != nil {\n\t\treturn nil\n\t}\n\n\tpInfo := p.newPodInfo(pod)\n\tif _, exists, _ := p.activeQ.Get(pInfo); exists {\n\t\treturn nil\n\t}\n\tif _, exists, _ := p.podBackoffQ.Get(pInf...
[ "protected WsMessageRouterImpl getMessageRouter() {\n if (msgRouter == null) {\n // First activation.\n msgRouter = MessageRouterSingleton.singleton;\n\n // Pass the MessageRouter to the TrService via the TrConfigurator.\n TrConfigurator.setMessageRouter(msgRouter)...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// GetZoneByProviderID implements Zones.GetZoneByProviderID // This is particularly useful in external cloud providers where the kubelet // does not initialize node data.
[ "func (f *FakeCloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) {\n\tf.addCall(\"get-zone-by-provider-id\")\n\treturn f.Zone, f.Err\n}" ]
[ "func (p *Provider) ValidateDataSourceConfig(providers.ValidateDataSourceConfigRequest) providers.ValidateDataSourceConfigResponse {\n\t// FIXME: move the backend configuration validate call that's currently\n\t// inside the read method into here so that we can catch provider configuration\n\t// errors in terrafor...
codesearchnet
{ "query": "Represent the text about API documentation:", "pos": "Represent the code about API documentation:", "neg": "Represent the code about Software development:" }
// SetPlayerData sets the PlayerData field's value.
[ "func (s *DesiredPlayerSession) SetPlayerData(v string) *DesiredPlayerSession {\n\ts.PlayerData = &v\n\treturn s\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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Creates a new form. @param string $type @param mixed $data @param array $options @return FormInterface
[ "public function createForm($type, $data = null, array $options = [])\n {\n return $this->application['form.factory']->create($type, $data, $options);\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code:" }
get @param string $name @return mixed|null
[ "public function get($name)\n {\n if (empty($this->data[$name])) {\n return null;\n }\n\n return $this->data[$name];\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Play media from an URL on the device. Note: This method will not yield until the media has finished playing. The Apple TV requires the request to stay open during the entire play duration.
[ "async def play_url(self, url, **kwargs):\n \n # If credentials have been loaded, do device verification first\n if self.identifier:\n await self.verify_authenticated()\n\n position = 0 if 'position' not in kwargs else int(kwargs['position'])\n return await self.player....
[ "function (message) {\n if ('string' !== typeof message) {\n callFunc(WebViewBridge.onError, \"message is type '\" + typeof message + \"', and it needs to be string\");\n return;\n }\n\n //we queue the messages to make sure that native can collects all of them in one shot.\n sendQu...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Gets one transformed image based on source image and transform @param LocalSourceImageModel $sourceModel @param array $transform @return CraftTransformedImageModel|null @throws ImagerException
[ "private function getTransformedImage($sourceModel, $transform)\n {\n /** @var ConfigModel $settings */\n $config = ImagerService::getConfig();\n\n if ($config->getSetting('noop', $transform)) {\n // todo : just return source image unmodified\n }\n\n if ($this->imagi...
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// AddInt16KeyOmitEmpty adds an int16 to be encoded and skips it if its value is 0. // Must be used inside an object as it will encode a key.
[ "func (enc *Encoder) AddInt16KeyOmitEmpty(key string, v int16) {\n\tenc.Int64KeyOmitEmpty(key, int64(v))\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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Injects targets into the graph for the given `Specs` object. Yields the resulting addresses.
[ "def _inject_specs(self, specs):\n \n if not specs:\n return\n\n logger.debug('Injecting specs to %s: %s', self, specs)\n with self._resolve_context():\n thts, = self._scheduler.product_request(TransitiveHydratedTargets,\n [specs])\n\n self._inde...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
method to validate and prepare data-dependent parameters Parameters --------- X : array-like Input dataset verbose : bool whether to show warnings Returns ------- None
[ "def compile(self, X, verbose=False):\n \n super(FactorTerm, self).compile(X)\n\n self.n_splines = len(np.unique(X[:, self.feature]))\n self.edge_knots_ = gen_edge_knots(X[:, self.feature],\n self.dtype,\n ...
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the summarization about Software Engineering:", "pos": "Represent the code about Software Engineering:", "neg": "Represent the code about programming:" }
Get the Cmd main method from the click command :param command: The click Command object :return: the do_* method for Cmd :rtype: function
[ "def get_invoke(command):\n \n\n assert isinstance(command, click.Command)\n\n def invoke_(self, arg): # pylint: disable=unused-argument\n try:\n command.main(args=shlex.split(arg),\n prog_name=command.name,\n standalone_mode=False,\n ...
[ "def _type_description(self):\n \"\"\"\"\"\"\n #This is a little tricker because the docstring is housed\n #inside of the module that contains the actual executable.\n #These TypeExecutables are just pointers.\n iexec = self._element.target\n if iexec is not None:\n ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the Dimension instance of this report's subtable report. @return Dimension|null The subtable report's dimension or null if there is subtable report or no dimension for the subtable report. @api
[ "public function getSubtableDimension()\n {\n if (empty($this->actionToLoadSubTables)) {\n return null;\n }\n\n list($subtableReportModule, $subtableReportAction) = $this->getSubtableApiMethod();\n\n $subtableReport = ReportsProvider::factory($subtableReportModule, $subtabl...
[ "private function getColumnFromName($name)\n {\n foreach ($this->columnConfiguration as $i => $col) {\n if ($col->getName() == $name) {\n return $col;\n }\n }\n\n // This exception should never happen. If it does, something is\n // wrong w/ the rel...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Get the token. @return \Tymon\JWTAuth\Token|false
[ "public function getToken()\n {\n if (! $this->token) {\n try {\n $this->parseToken();\n } catch (JWTException $e) {\n return false;\n }\n }\n\n return $this->token;\n }" ]
[ "protected function createAccessToken(array $response, AbstractGrant $grant)\n {\n return new \\Stevenmaguire\\OAuth2\\Client\\Token\\AccessToken($response);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Print the available plugins.
[ "def print_plugins(self):\n \"\"\"\"\"\"\n width = console_width()\n line = Style.BRIGHT + '=' * width + '\\n'\n middle = int(width / 2)\n if self.available_providers:\n print(line + ' ' * middle + 'PROVIDERS')\n for provider in sorted(self.available_provider...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the description about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code:" }
// parsePackageDir parses the package residing in the directory.
[ "func (g *GoParser) parsePackageDir(directory string) {\n\tpkg, err := build.Default.ImportDir(directory, 0)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot process directory %s: %s\", directory, err)\n\t}\n\tvar names []string\n\tnames = append(names, pkg.GoFiles...)\n\t//names = append(names, pkg.CgoFiles...)\n\t//na...
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
渲染模板 如果$tpl 不为空 则应该输入全局路径
[ "public function show($tpl = \"\")\n {\n if (!empty($tpl)) {\n $this->display($tpl);\n } else {\n $this->display(strtolower($this->apiClassName) .'/'.strtolower($this->action) . '.tpl');\n }\n exit();\n }" ]
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
<p> Information about the TagOptions associated with the resource. </p> @param tagOptions Information about the TagOptions associated with the resource.
[ "public void setTagOptions(java.util.Collection<TagOptionSummary> tagOptions) {\n if (tagOptions == null) {\n this.tagOptions = null;\n return;\n }\n\n this.tagOptions = new java.util.ArrayList<TagOptionSummary>(tagOptions);\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 Github summarization about document management:", "pos": "Represent the Github code about document management:", "neg": "Represent the Github code about Software development:" }
// JSONAPIRelationshipLinks implements the RelationshipLinkable interface for a blog
[ "func (blog Blog) JSONAPIRelationshipLinks(relation string) *jsonapi.Links {\n\tif relation == \"posts\" {\n\t\treturn &jsonapi.Links{\n\t\t\t\"related\": fmt.Sprintf(\"https://example.com/blogs/%d/posts\", blog.ID),\n\t\t}\n\t}\n\tif relation == \"current_post\" {\n\t\treturn &jsonapi.Links{\n\t\t\t\"related\": fm...
[ "public void removeLinks(ServiceReference<D> declarationSRef) {\n D declaration = getDeclaration(declarationSRef);\n for (ServiceReference serviceReference : declaration.getStatus().getServiceReferencesBounded()) {\n // FIXME : In case of multiples Linker, we will remove the link of all the...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Converts the value to upper case. @param value value to put in upper case. @return value in capital letters.
[ "public String convertToUpperCase(String value) {\n String result = null;\n if (value != null) {\n result = value.toUpperCase();\n }\n return result;\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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Get takes name of the daemonSet, and returns the corresponding daemonSet object, and an error if there is any.
[ "func (c *daemonSets) Get(name string) (result *extensions.DaemonSet, err error) {\n\tresult = &extensions.DaemonSet{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"daemonsets\").\n\t\tName(name).\n\t\tDo().\n\t\tInto(result)\n\treturn\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:" }
// buildSampTask returns tow variables, the first bool is whether the task meets region error // and need to rebuild.
[ "func (e *AnalyzeFastExec) buildSampTask() (needRebuild bool, err error) {\n\t// Do get regions row count.\n\tbo := tikv.NewBackoffer(context.Background(), 500)\n\te.rowCount = 0\n\tneedRebuildForRoutine := make([]bool, e.concurrency)\n\terrs := make([]error, e.concurrency)\n\tsampTasksForRoutine := make([][]*Analy...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Match serializer by query arg.
[ "def _match_serializers_by_query_arg(self, serializers):\n \"\"\"\"\"\"\n # if the format query argument is present, match the serializer\n arg_name = current_app.config.get('REST_MIMETYPE_QUERY_ARG_NAME')\n if arg_name:\n arg_value = request.args.get(arg_name, None)\n\n ...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// ExpectErrorf checks if the given error object is non-nil and if it is // not then it will Fatalf the test with a message formed by *f formatting.
[ "func (t *T) ExpectErrorf(err error, spec string, args ...interface{}) {\n\tif err != nil {\n\t\treturn\n\t}\n\tprefix := fmt.Sprintf(spec, args...) + \": \"\n\tt.Fatalf(\"%sError not returned when one was expected.\", prefix)\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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Computer Science:" }
// WatchLXDProfileUpgradeNotifications mocks base method
[ "func (m *MockLXDProfileMachine) WatchLXDProfileUpgradeNotifications(arg0 string) (state.StringsWatcher, error) {\n\tret := m.ctrl.Call(m, \"WatchLXDProfileUpgradeNotifications\", arg0)\n\tret0, _ := ret[0].(state.StringsWatcher)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}" ]
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Walk through all rules, and replace each themify occurrence with the corresponding CSS variable. @example background-color: themify(primary-300, 0.5) => background-color: rgba(var(--primary-300),0.6) @param root
[ "function processRules(root) {\n root.walkRules(rule => {\n if (!hasThemify(rule.toString())) {\n return;\n }\n\n let aggragatedSelectorsMap = {};\n let aggragatedSelectors = [];\n\n let createdRules = [];\n const variationRules = {\n [defaultVariation]: rule,\n };\n\n rule.walkDe...
[ "function bg_w_grad($el, url){\n var c = '230,230,230';//'231,229,224';\n var s = 'linear-gradient(-90deg, rgba('+c+',1) 10%, rgba('+c+',.55) 70%, rgba('+c+',0) 90%, rgba('+c+',0) 100%)';\n $el.css({'background-image': vendor_prefix.css+s+'', 'background-repeat':'no-repeat'}); //, url('+url+')\n}" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Create the underlying widget. A dialog is not a subclass of view, hence we don't set name as widget or children will try to use it as their parent.
[ "def create_widget(self):\n \n d = self.declaration\n self.dialog = Dialog(self.get_context(), d.style)" ]
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Start a node. CLI Example: .. code-block:: bash salt-cloud -a start mymachine
[ "def start(name, vmid=None, call=None):\n '''\n \n '''\n if call != 'action':\n raise SaltCloudSystemExit(\n 'The start action must be called with -a or --action.'\n )\n\n log.debug('Start: %s (%s) = Start', name, vmid)\n if not set_vm_status('start', name, vmid=vmid):\n ...
[ "def docker(gandi, vm, args):\n \n if not [basedir for basedir in os.getenv('PATH', '.:/usr/bin').split(':')\n if os.path.exists('%s/docker' % basedir)]:\n gandi.echo(\"\"\"'docker' not found in $PATH, required for this command \\\nto work\nSee https://docs.docker.com/installation/#installat...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Escapes string for statement usage @param string $data @return string
[ "public function escape($data) {\r\n\r\n\t\tif(null === $data) {\r\n\t\t\treturn $data;\r\n\t\t}\r\n\r\n\t\tif(false === is_string($data) && false === is_numeric($data)) {\r\n\t\t\treturn trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, float or int, \"%s\" given', __METHOD__, gettype($d...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Helper method used to load the correct plugin.
[ "public function loadProcessorPlugins(&$values, $item, $entity_type) {\n $manager = \\Drupal::service('plugin.manager.import_processor');\n $import_processors = $manager->getDefinitions();\n foreach ($import_processors as $plugin_id => $import_processor) {\n if ($import_processor['type'] == $entity_ty...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Converts an array of Integer objects into an equivalent array of int primitives. @param ints the array of Integer objects @return the primitive ints array
[ "protected int[] convert( final Integer[] ints) {\n\t\tint[] array = new int[ ints.length];\n\t\tint count = 0;\n\t\tfor ( int i : ints) array[ count++] = i;\n\t\treturn array;\n\t}" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// ResponseError returns an empty Response with the ResponseError set from the // given error.
[ "func ResponseError(err error) *Response {\n\treturn &Response{ResponseError: err, BodyClosed: true, Response: &http.Response{}}\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code:" }
Compiles lookup methods for marked bindings. @param array<string, array<string, Binding>> $marked @return string
[ "protected function compileMarkerLookup(array $marked)\n\t{\n\t\t$code = '';\n\t\t\n\t\tforeach($marked as $markerType => $markedBindings)\n\t\t{\n\t\t\t$code .= \"\\tpublic function markedBindings_\" . str_replace('\\\\', '_', $markerType) . \"() {\\n\";\n\t\t\t$code .= \"\\t\\tstatic \\$bindings;\\n\";\n\t\t\t$co...
[ "final static function f($op) {return dfcf(function(OP $op) {\n\t\t$c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */\n\t\treturn new $c($m);\n\t}, [dfp($op)]);}" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Sends the output to browser.
[ "public function sendOutput()\n {\n // check environment to see what and how to do the output\n $prettyPrint = false;\n if ($this->env == 'development') {\n $prettyPrint = true;\n unset($this->outputArray['debug']);\n }\n\n // if there is an error, we alwa...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Encode single 6-bit digit as base64. @param integer $number @return string @throws \Exception If the number is invalid
[ "public function base64Encode($number)\n {\n if ($number < 0 || $number > 63) {\n throw new \\Exception(sprintf('Invalid number \"%s\" given. Must be between 0 and 63.', $number));\n }\n\n return $this->intToCharMap[$number];\n }" ]
[ "function BinaryPacker_pack(source, // @arg Any - source data\n formatID) { // @arg Integer - 0x0001 - 0xffff\n // @ret Uint8Array|null\n//{@dev\n $valid(_isValidFormatID(formatID), BinaryPacker_pack, \"formatID\");\n//}@dev\n var moduleID = ...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Java programming:" }
@param Point $min @param Point $max @return Point
[ "public function getRandomPoint(Point $min, Point $max)\n {\n $point = $this->newPoint(array_fill(0, $this->dimension, null));\n\n for ($n = 0; $n < $this->dimension; ++$n) {\n $point[$n] = random_int($min[$n], $max[$n]);\n }\n\n return $point;\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:" }
Process the request and return either a modified request or the original one @param \Illuminate\Http\Request $request @return \Illuminate\Http\Request
[ "public function processRequest(Request $request)\n {\n $contentType = $request->header('content-type') ?: '';\n\n if (mb_stripos($contentType, 'multipart/form-data') !== false) {\n $this->validateParsedBody($request);\n $request = $this->parseUploadedFiles($request);\n ...
[ "public function boot()\n {\n $manager = new Manager;\n\n // If you have to customize the manager instance, like setting a custom serializer,\n // I strongly suggest you to create your own service provider and add you manager configuration action here\n // Here some example if you wan...
codesearchnet
{ "query": "Represent the sentence about Laravel:", "pos": "Represent the code about Laravel:", "neg": "Represent the code about Software development:" }
hand form-encodes all characters, even '/' which we do not want.
[ "private String encodeIllegalCharacters(String relativeURI) {\n try {\n return new URI(null, null, relativeURI, null).toString();\n } catch (URISyntaxException e) {\n throw new LocationException(e);\n }\n }" ]
[ "def generate_optimized_y_move_down_x_SOL(y_dist):\n \n\n # Optimization to move N lines and go to SOL in one command. Note that some terminals \n # may not support this so we might have to remove this optimization or make it optional \n # if that winds up mattering for terminals we care about. If we ha...
codesearchnet
{ "query": "Represent the text about Writing:", "pos": "Represent the code about Writing:", "neg": "Represent the code:" }
Converts a well-formed URI containing a hostname and port into string which allows for lookups in the Security Domain table @param uri URI to convert @return A string with "host:port" concatenated @throws URISyntaxException
[ "public String formatKey(URI uri) throws URISyntaxException\n\t{\n\t\tif (uri == null) {\n\t\t\tthrow new URISyntaxException(\"\",\"URI specified is null\");\n\t\t}\n\t\treturn formatKey(uri.getHost(), uri.getPort());\n\t}" ]
[ "def url(self):\n \n if self._href is not None:\n return self._href\n if self.identifier:\n # for some reason atlas does not use classifications here in the path when considering one classification\n path = '/'.join([self.parent.url.replace('classifications/', ...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Reset proxy object and notify close event listener === Parameters thread_name(String):: execution thread name or default === Return true:: Always return true
[ "def close(thread_name)\n close_callback = @close_callbacks[thread_name]\n close_callback.call if close_callback\n true\n ensure\n @auditors[thread_name] = nil\n @close_callbacks[thread_name] = nil\n end" ]
[ "def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Splits this path into a pair (drive, location). Note that, because all paths are normalized, a root of ``'.'`` will be returned for relative paths.
[ "def split_root(self):\n \n if not PY3 and hasattr(self._lib, 'splitunc'):\n root, rest = self._lib.splitunc(self.path)\n if root:\n if rest.startswith(self._sep):\n root += self._sep\n rest = rest[1:]\n return 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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
POST /incline/login
[ "def create\n if (@user = Incline::UserManager.authenticate(params[:session][:email], params[:session][:password], request.remote_ip))\n if @user.activated?\n # log the user in.\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n\n ...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Initialize. @param entityMetadata the entity metadata @return the map
[ "private Map<String, Object> initialize(EntityMetadata entityMetadata)\n {\n Map<String, Object> relationMap = null;\n if (entityMetadata.getRelationNames() != null && !entityMetadata.getRelationNames().isEmpty())\n {\n relationMap = new HashMap<String, 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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Method to checks whether the value of certain inaccessible properties has been set or is it null. @param string $name The property name. @return boolean True if the value is set, false otherwise. @since __DEPLOY_VERSION__
[ "public function __isset($name)\n\t{\n\t\t// These properties aren't directly accessible, so always return true\n\t\tif ($name == 'input' || $name == 'label')\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\t// Check if a property has an assigned value\n\t\tif ($this->$name !== null)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t...
[ "function () {\n __objCount++;\n /**\n * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object.\n * @protected\n * @type Number\n */\n this._nextIndex = 0;\n /**\n ...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Merge the collection with the given items. :param items: The items to merge :type items: list or Collection :rtype: Collection
[ "def merge(self, items):\n \n if isinstance(items, BaseCollection):\n items = items.all()\n\n if not isinstance(items, list):\n raise ValueError('Unable to merge uncompatible types')\n\n self._items += items\n\n return self" ]
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
XOR ciphering with a PBKDF2 checksum
[ "def encrypt(self, txt, key):\n \n # log.debug(\"encrypt(txt='%s', key='%s')\", txt, key)\n assert isinstance(txt, six.text_type), \"txt: %s is not text type!\" % repr(txt)\n assert isinstance(key, six.text_type), \"key: %s is not text type!\" % repr(key)\n\n if len(txt) != len(ke...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
// ListPapertrails returns the list of papertrails for the configuration version.
[ "func (c *Client) ListPapertrails(i *ListPapertrailsInput) ([]*Papertrail, error) {\n\tif i.Service == \"\" {\n\t\treturn nil, ErrMissingService\n\t}\n\n\tif i.Version == 0 {\n\t\treturn nil, ErrMissingVersion\n\t}\n\n\tpath := fmt.Sprintf(\"/service/%s/version/%d/logging/papertrail\", i.Service, i.Version)\n\tresp...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Transforms a singular form to the plural form, based on these rules: http://www.edufind.com/english-grammar/plural-nouns/ Only some irregular nouns are respected in this implementation. @param singular @return
[ "private String transformToPluralForm(String singular) {\n String lowercaseSingular = singular.toLowerCase();\n if (IRREGULAR_NOUNS.containsKey(lowercaseSingular)) {\n // e.g. \"Woman\" -> \"Women\", \"Ox\" -> \"Oxen\" …\n String plural = IRREGULAR_NOUNS.get(lowercaseSingular);\n...
[ "def check_decade_apostrophes_short(text):\n \"\"\"\"\"\"\n err = \"dates_times.dates\"\n msg = u\"Apostrophes aren't needed for decades.\"\n\n regex = \"\\d0\\'s\"\n\n return existence_check(\n text, [regex], err, msg, excluded_topics=[\"50 Cent\"])" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
/*! Returns the content for this event.
[ "function content()\n {\n if ( $this->Content === null )\n {\n $eventType = $this->eventType();\n $this->Content = $eventType->eventContent( $this );\n }\n return $this->Content;\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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Accepts a StreamSegmentTruncateOperation in the metadata. @param operation The operation to accept.
[ "void acceptOperation(StreamSegmentTruncateOperation operation) {\n ensureSegmentId(operation);\n this.startOffset = operation.getStreamSegmentOffset();\n this.isChanged = true;\n }" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
@Route( "/subscribe/forum/{forum}", name="claro_forum_subscribe" ) @EXT\ParamConverter("user", options={"authenticatedUser" = true}) @param Forum $forum @param User $user
[ "public function subscribeAction(Forum $forum, User $user)\n {\n $this->manager->subscribe($forum, $user);\n\n return new RedirectResponse(\n $this->generateUrl('claro_forum_categories', array('forum' => $forum->getId()))\n );\n }" ]
[ "public function update($request, $match)\n {\n $currentUser = $request->user;\n $user = Pluf_Shortcuts_GetObjectOr404('User', $match['userId']);\n if($currentUser->getId() === $user->getId() || User_Precondition::ownerRequired($request)){\n $profileDoc = User_Views_CProfile::get_...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
start by reading the end of the last block. this must always be kept in memory.
[ "function readInteger(width, reader) {\n return function (start, cb) {\n var i = Math.floor(start/block_size)\n var _i = start%block_size\n\n //if the UInt32BE aligns with in a block\n //read directly and it's 3x faster.\n if(_i < block_size - width)\n get(i, function (err, block)...
[ "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:" }
// Upsert specifies the document to use for upserts. It will be used for // create if the original document does not exist.
[ "func (r *BulkUpdateRequest) Upsert(doc interface{}) *BulkUpdateRequest {\n\tr.upsert = doc\n\tr.source = nil\n\treturn r\n}" ]
[ "function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Given the name of a registered service, return its service definition.
[ "def get_service(self, service_name):\n \n service = self.services.get(service_name)\n if not service:\n raise KeyError('Service not registered: %s' % service_name)\n return service" ]
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// Implements the logic to compute the key of a given field’s entry
[ "func getFieldEntryKey(node *ast.Field) string {\n\n\tif node.Alias != nil && node.Alias.Value != \"\" {\n\t\treturn node.Alias.Value\n\t}\n\tif node.Name != nil && node.Name.Value != \"\" {\n\t\treturn node.Name.Value\n\t}\n\treturn \"\"\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Fetch the connection, create if necessary @return \resource
[ "protected function connection()\n\t{\n\t\t// If no a protocol in URL, assume its a local link\n\t\t! preg_match('!^\\w+://! i', $this->resource) and $this->resource = Uri::create($this->resource);\n\n\t\treturn curl_init($this->resource);\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 text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
Pass through to provider ResourceBinSession.use_plenary_bin_view
[ "def use_plenary_bin_view(self):\n \"\"\"\"\"\"\n self._bin_view = PLENARY\n # self._get_provider_session('resource_bin_session') # To make sure the session is tracked\n for session in self._get_provider_sessions():\n try:\n session.use_plenary_bin_view()\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Load the file attributes submitted by form and return the updated file model. @param File $file @param string $name @return File - after loading from request url
[ "public static function loadFile( $file, $name ) {\n\n\t\tif( !isset( $file ) ) {\n\n\t\t\t$file\t= new File();\n\t\t}\n\n\t\t$file->load( Yii::$app->request->post(), $name );\n\n\t\treturn $file;\n\t}" ]
[ "public function reduceFilePath($varValue, \\DataContainer $dc)\n {\n $doc = $dc->activeRecord;\n\n $path = \\FilesModel::findByUuid($varValue)->path;\n\n $arrFileNameParts = \\Document::splitFileName(substr($path, strlen(\\DmsConfig::getBaseDirectory(true))));\n\n // TODO (#33): reset the new fileType...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Compare the priority of two items. @param array $item1, @param array $item2 @return int
[ "protected function compare(array $item1, array $item2)\n {\n return ($item1['priority'] === $item2['priority'])\n ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO\n : ($item1['priority'] > $item2['priority'] ? -1 : 1);\n }" ]
[ "public function getDetail($name)\n {\n Assert::oneOf($name, array_keys($this->details), 'ParsedKey::getDetail() expected one of: %2$s. Got: %s');\n\n return $this->details[$name];\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about PHP programming:" }
Returns true if this is the currently active page being used to handle this request. @return bool
[ "public function isCurrent()\n {\n $currentPage = Director::get_current_page();\n if ($currentPage instanceof ContentController) {\n $currentPage = $currentPage->data();\n }\n if ($currentPage instanceof SiteTree) {\n return $currentPage === $this || $currentPage...
[ "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 description about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code:" }
Changes server parameters and status at runtime @param string $host @param int $port @param int $timeout @param int $retry_interval @param bool $status @param callable $failure_callback @return bool
[ "public function setServerParams($host, $port = 11211, $timeout = NULL, $retry_interval = false, $status = NULL, $failure_callback = NULL)\n {\n }" ]
[ "public function location(String $url = NULL, Int $time = 0, Array $data = NULL, Bool $exit = true, $type = 'location')\n {\n return Response::redirect($url, $time, $data, $exit, $type);\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about PHP:" }
// SetUseCallerCredentials sets the UseCallerCredentials field's value.
[ "func (s *DynamodbDataSourceConfig) SetUseCallerCredentials(v bool) *DynamodbDataSourceConfig {\n\ts.UseCallerCredentials = &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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
List all available services. :param namespace: str, if not specified list services for all namespaces :return: collection of instances of :class:`conu.backend.k8s.service.Service`
[ "def list_services(self, namespace=None):\n \n\n if namespace:\n return [Service(name=s.metadata.name,\n ports=k8s_ports_to_metadata_ports(s.spec.ports),\n namespace=s.metadata.namespace,\n labels=s.metadata.la...
[ "def search(self, query):\n \n logger.info(\"Catalog query={}\".format(query))\n\n # Support to set the catalog as a request parameter\n catalogs = _.to_list(req.get(\"catalog\", None))\n if catalogs:\n return senaiteapi.search(query, catalog=catalogs)\n # Delega...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:346:1: typeList : type ( ',' type )* ;
[ "public final void typeList() throws RecognitionException {\n\t\tint typeList_StartIndex = input.index();\n\n\t\ttry {\n\t\t\tif ( state.backtracking>0 && alreadyParsedRule(input, 18) ) { return; }\n\n\t\t\t// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:347:5: ( type ( ',' type )* )\n\t\t\t/...
[ "Rule LocalVariableDeclarationStatement() {\n return Sequence(ZeroOrMore(FirstOf(FINAL, Annotation())), Type(), VariableDeclarators(), SEMI);\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about language and writing:" }
// NewDNSProviderConfig return a DNSProvider instance configured for Exoscale.
[ "func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {\n\tif config == nil {\n\t\treturn nil, errors.New(\"the configuration of the DNS provider is nil\")\n\t}\n\n\tif config.APIKey == \"\" || config.APISecret == \"\" {\n\t\treturn nil, fmt.Errorf(\"exoscale: credentials missing\")\n\t}\n\n\tif config.E...
[ "@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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Returns the IP address and port of the remote end of the TCP connection, or null if this connection is not connected.
[ "public InetSocketAddress getRemoteAddressTCP () {\n\t\tSocketChannel socketChannel = tcp.socketChannel;\n\t\tif (socketChannel != null) {\n\t\t\tSocket socket = tcp.socketChannel.socket();\n\t\t\tif (socket != null) {\n\t\t\t\treturn (InetSocketAddress)socket.getRemoteSocketAddress();\n\t\t\t}\n\t\t}\n\t\treturn n...
[ "def connectTo(self, remoteRouteName):\n \n self.remoteRouteName = remoteRouteName\n # This route must not be started before its router is started. If\n # sender is None, then the router is not started. When the router is\n # started, it will start this route.\n if self.r...
codesearchnet
{ "query": "Represent the text about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Return the serialization format for a case node.
[ "def _case_format(self, occur):\n \"\"\"\"\"\" \n if self.occur == 1:\n self.attr[\"nma:implicit\"] = \"true\"\n ccnt = len(self.rng_children())\n if ccnt == 0: return \"<empty/>%s\"\n if ccnt == 1 or not self.interleave:\n return self.start_tag(\"group\") + ...
[ "@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 summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Convert array of given parameters to sting.
[ "public static String getParametersAsString(final Object... parameters) {\n if (parameters == null || parameters.length == 0) {\n return \"\";\n }\n final StringBuilder builder = new StringBuilder();\n builder.append('[');\n for (int i = 0; i < parameters.length; i++) {...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Get info and attributes for each S.M.A.R.T. device
[ "func (m *Smart) getAttributes(acc telegraf.Accumulator, devices []string) {\n\n\tvar wg sync.WaitGroup\n\twg.Add(len(devices))\n\n\tfor _, device := range devices {\n\t\tgo gatherDisk(acc, m.UseSudo, m.Attributes, m.Path, m.Nocheck, device, &wg)\n\t}\n\n\twg.Wait()\n}" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github description about Data parsing:", "pos": "Represent the Github code about Data parsing:", "neg": "Represent the Github code:" }
@param array $parameters @return ImageManager
[ "public function addWatermark(array $parameters): self\n {\n $this->image = $this->addImageWatermark($this->image, $parameters);\n return $this;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get a list of docker services. Only the manager nodes can retrieve all the services Returns: list, all the ids of the services in swarm
[ "def get_service_list(self) -> list:\n \n # Initialising empty list\n services = []\n\n # Raise an exception if we are not a manager\n if not self._manager:\n raise RuntimeError('Only the Swarm manager node can retrieve'\n ' all the service...
[ "func (c StatusSetCmd) Info() *cmd.Info {\n\treturn jujucmd.Info(&cmd.Info{\n\t\tName: StatusSetCmdName,\n\t\tArgs: \"<class> <id> <status>\",\n\t\tPurpose: \"update the status of a payload\",\n\t\tDoc: `\n\"payload-status-set\" is used to update the current status of a registered payload.\nThe <class> and <i...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns the EPSG:4326 bounding of the specified tile coordinate @param tx The tile x coordinate @param ty The tile y coordinate @param zoomLevel The tile zoom level @return the EPSG:4326 bounding box
[ "public Envelope tileBboxLngLat(int tx, int ty, int zoomLevel) {\n Coordinate topLeft = metersToLngLat(tileTopLeft(tx, ty, zoomLevel));\n Coordinate lowerRight = metersToLngLat(tileTopLeft(tx + 1, ty + 1, zoomLevel));\n Envelope result = new Envelope(topLeft, lowerRight);\n return result...
[ "public static Geometry computeShadow(Geometry geometry, Geometry sunPosition, double height) {\n if (sunPosition != null) {\n if (sunPosition instanceof Point) {\n return computeShadow(geometry, sunPosition.getCoordinate().x, sunPosition.getCoordinate().y, height, true);\n ...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set the filter strategy @param string $strategy alias or FQN @param array $options options specific for the strategy @return ListFilter|$this
[ "public function strategy(string $strategy, array $options = []): ListFilter\n {\n $this->main['strategy'] = $strategy;\n\n if (count($options)) {\n $this->main['options'] = $options;\n }\n\n return $this;\n }" ]
[ "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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software Development:" }
<p> The elastic inference accelerator associated with the instance. </p> @return The elastic inference accelerator associated with the instance.
[ "public java.util.List<ElasticInferenceAcceleratorAssociation> getElasticInferenceAcceleratorAssociations() {\n if (elasticInferenceAcceleratorAssociations == null) {\n elasticInferenceAcceleratorAssociations = new com.amazonaws.internal.SdkInternalList<ElasticInferenceAcceleratorAssociation>();\n...
[ "function (parameters) {\n\n /**\n * Job identifier.\n * @type {string}\n */\n this.hash = parameters.hash;\n\n /**\n * Array of hashes to {@link Artifact}s containing each requested result.\n * @type {string[]}\n */\n this.resultHashes = p...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Replaces the macros in the given message.<p> @param msg the message in which the macros are replaced @param recipient the recipient in the message @return the message with the macros replaced
[ "private String replaceMacros(String msg, I_CmsNewsletterRecipient recipient) {\n\n CmsMacroResolver resolver = CmsMacroResolver.newInstance();\n resolver.addMacro(MACRO_USER_FIRSTNAME, recipient.getFirstname());\n resolver.addMacro(MACRO_USER_LASTNAME, recipient.getLastname());\n resolv...
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// handleresponse takes the rethink response and turn it into something we can consume elsewhere
[ "func handleResponse(resp *r.WriteResponse, confirms chan struct{}) error {\n\tif resp.Errors != 0 {\n\t\tif !strings.Contains(resp.FirstError, \"Duplicate primary key\") { // we don't care about this error\n\t\t\treturn fmt.Errorf(\"%s\\n%s\", \"problem inserting docs\", resp.FirstError)\n\t\t}\n\t}\n\tif confirms...
[ "function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Requests and stores the NOMIS API client token from mtp-api
[ "def get_client_token():\n \n if getattr(settings, 'NOMIS_API_CLIENT_TOKEN', ''):\n return settings.NOMIS_API_CLIENT_TOKEN\n global client_token\n if not client_token or client_token['expires'] and client_token['expires'] - now() < datetime.timedelta(days=1):\n session = None\n try:...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Retrieve all translations for the provided ids (within the provided locale and domain) @param string $locale @param string $domain @param array $ids @return array
[ "private function getTranslationsForDomainAndIds($locale, $domain, $ids)\n {\n /** @var Translator $translator */\n $translator = $this->container->get('translator');\n\n $translations = [];\n foreach ($ids as $id) {\n $translations[$id] = $translator->trans($id, [], $domai...
[ "function Api(config) {\n // config\n this._config = config || {};\n this._config.transforms = _.merge(this._config.transforms || {},{\n defaults: {\n serialize: JSON.stringify,\n deserialize: JSON.parse\n }\n });\n\n this._config.headers = this._config.headers || {};\n\n // stack of [('one' |...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
This method initializes a database connection @param null @return object Instance of this database connection @throws DbException If the database type provided is not defined for this system
[ "public function initialize()\n\t{\n\t\t//throw exception if no database type has been set\n\t\tif( ! $this->type )\n\t\t{\n\t\t\t//Throw exception\n\t\t\tthrow new DbException(\"Invalid database type provided\");\n\t\t\t\n\t\t}\n\n\t\t//check the type of database provided returning instance\n\t\t//set the paramet...
[ "private function getColumnFromName($name)\n {\n foreach ($this->columnConfiguration as $i => $col) {\n if ($col->getName() == $name) {\n return $col;\n }\n }\n\n // This exception should never happen. If it does, something is\n // wrong w/ the rel...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
@param $entity @return string
[ "public function defaultRender($entity)\n {\n $value = (string) $this->getPropertyValue($entity);\n return $this->safeHtml ? $value : htmlspecialchars($value);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// SetScheduledAuditArn sets the ScheduledAuditArn field's value.
[ "func (s *CreateScheduledAuditOutput) SetScheduledAuditArn(v string) *CreateScheduledAuditOutput {\n\ts.ScheduledAuditArn = &v\n\treturn s\n}" ]
[ "func (b *backend) handleRoleTagLogin(ctx context.Context, s logical.Storage, roleName string, roleEntry *awsRoleEntry, instance *ec2.Instance) (*roleTagLoginResponse, error) {\n\tif roleEntry == nil {\n\t\treturn nil, fmt.Errorf(\"nil role entry\")\n\t}\n\tif instance == nil {\n\t\treturn nil, fmt.Errorf(\"nil ins...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }