query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
creates the search result list
1. does the actual searching (fetches the results to $rows)
2. fills fluid variables for fluid templates to $this->fluidTemplateVariables
@return void | [
"public function getSearchResults()\n {\n // fetch the search results\n $limit = $this->db->getLimit();\n $rows = $this->db->getSearchResults();\n\n // TODO: Check how Sphinx handles this, seems to return full result set\n if (count($rows) > $limit[1]) {\n $rows = ar... | [
"def getSampleTypeTitles(self):\n \n sample_types = self.getSampleTypes()\n sample_type_titles = map(lambda obj: obj.Title(), sample_types)\n\n # N.B. This is used only for search purpose, because the catalog does\n # not add an entry to the Keywordindex for an empty list.\n ... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Helper function to parse OAuth responses (to save code duplication) | [
"function _ParseTokenResponse(err, body, callback)\n\t{\n\t\tif (err)\n\t\t{\n\t\t\tif (callback) callback(\"Request error: \" + err);\n\t\t\treturn;\n\t\t}\n\n\t\t// try to parse result\n\t\tvar responseJSON;\n\t\ttry\n\t\t{\n\t\t\tresponseJSON = JSON.parse(body);\n\t\t}\n\t\tcatch (JSONerror)\n\t\t{\n\t\t\tif (ca... | [
"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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Fetch a MemberInstance
:returns: Fetched MemberInstance
:rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance | [
"def fetch(self):\n \n params = values.of({})\n\n payload = self._version.fetch(\n 'GET',\n self._uri,\n params=params,\n )\n\n return MemberInstance(\n self._version,\n payload,\n account_sid=self._solution['accoun... | [
"def patched_fax_v1_init(self, domain):\n \n print(domain.__class__.__name__)\n super(TwilioV1, self).__init__(domain)\n self.version = \"2010-04-01/Accounts/\" + domain.account_sid\n self._faxes = None"
] | codesearchnet | {
"query": "Represent the Github comment about Twilio:",
"pos": "Represent the Github code about Twilio:",
"neg": "Represent the Github code about programming:"
} |
Obtains the background of the dialog's header from a specific theme.
@param themeResourceId
The resource id of the theme, the background should be obtained from, as an {@link
Integer} value | [
"private void obtainHeaderBackground(@StyleRes final int themeResourceId) {\n TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,\n new int[]{R.attr.materialDialogHeaderBackground});\n int resourceId = typedArray.getResourceId(0, 0);\n\n if (re... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Change the permissions of the path, like os.chmod(). | [
"def chmod(self, mode):\n \n if self._closed:\n self._raise_closed()\n self._accessor.chmod(self, mode)"
] | [
"def isdir(path):\n \n system = get_instance(path)\n\n # User may use directory path without trailing '/'\n # like on standard file systems\n return system.isdir(system.ensure_dir_path(path))"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
如果存在某子SQL字符串,则移除该子SQL字符串,常用于来消除'WHERE 1=1'或其他不需要的SQL字符串的场景.
注意该方法不会移除其对应的参数,所以,这里只应该移除静态SQL字符串,不应该移除包含占位符的SQL.
@param subSql 静态子SQL片段
@return SqlInfo实例 | [
"public SqlInfo removeIfExist(String subSql) {\n this.sql = subSql != null && sql.contains(subSql) ? sql.replaceAll(subSql, \"\") : sql;\n return this;\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 Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about text processing:"
} |
Get the image data of a thumbnail
@param string $size
@return string | [
"public function getThumbnail($size) {\n\t\tswitch ($size) {\n\t\t\tcase 'thumb':\n\t\t\t\t$thumb = $this->thumbnail;\n\t\t\t\tbreak;\n\t\t\tcase 'small':\n\t\t\t\t$thumb = $this->smallthumb;\n\t\t\t\tbreak;\n\t\t\tcase 'large':\n\t\t\t\t$thumb = $this->largethumb;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn ''... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// TagResourceWithContext mocks base method | [
"func (m *MockLambdaAPI) TagResourceWithContext(arg0 aws.Context, arg1 *lambda.TagResourceInput, arg2 ...request.Option) (*lambda.TagResourceOutput, error) {\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"TagResourceWithContext\"... | [
"@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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// Has queries whether a block or not is in the whitelist | [
"func (bf BlockFilter) Has(location BlockLocation) bool {\n\trow := bf[location.FileIndex]\n\tif row == nil {\n\t\treturn false\n\t}\n\treturn row[location.BlockIndex]\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
/*
Set the Guaranteed Delivery Value CompletedPrefix in the message.
Javadoc description supplied by JsMessage interface. | [
"public final void setGuaranteedValueCompletedPrefix(long value) {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(this, tc, \"setGuaranteedValueCompletedPrefix\", Long.valueOf(value));\n getHdr2().setLongField(JsHdr2Access.GUARANTEEDVALUE_SET_COMPLETEDPREFI... | [
"@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 summarization about Java programming:",
"pos": "Represent the Github code about Java programming:",
"neg": "Represent the Github code about programming:"
} |
// ListenAndServe HTTP on given addr.
// runs flag.Parse() if !flag.Parsed() to support
// --bind flag. | [
"func (app *App) ListenAndServe(addr ...string) error {\n\tvar bind string\n\tif len(addr) > 0 {\n\t\tbind = addr[0]\n\t} else {\n\t\tbind = os.Getenv(\"PORT\")\n\t\tif len(bind) > 0 && !strings.Contains(bind, \":\") {\n\t\t\tbind = \":\" + bind\n\t\t}\n\t\tif bind == \"\" && !app.flagsRegistered {\n\t\t\tapp.RegFl... | [
"func (f *Factory) BindFlags(flags *pflag.FlagSet) {\n\t// any flags defined by external projects (not part of pflags)\n\tflags.AddGoFlagSet(flag.CommandLine)\n\n\t// Merge factory's flags\n\tflags.AddFlagSet(f.flags)\n\n\t// Globally persistent flags across all subcommands.\n\t// TODO Change flag names to consts t... | codesearchnet | {
"query": "Represent the comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Returns the pattern to use for a particular item count.
@param count the item count.
@return the pattern with {0}, {1}, {2}, etc. For English,
getPatternForNumItems(3) == "{0}, {1}, and {2}"
@throws IllegalArgumentException when count is 0 or negative. | [
"public String getPatternForNumItems(int count) {\n if (count <= 0) {\n throw new IllegalArgumentException(\"count must be > 0\");\n }\n ArrayList<String> list = new ArrayList<String>();\n for (int i = 0; i < count; i++) {\n list.add(String.format(\"{%d}\", i));\n ... | [
"public static XmlOrderedResult childElementDiffers(String name, int originalSize, int newSize) {\n return new XmlOrderedResult(false, String.format(\n \"The xml element <%s> with %s child elements should be placed before element <%s> with %s child elements\",\n name, newSize, n... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Set.
@param i the
@param value the value | [
"public void set(int i, U value) {\n ensureCapacity((i + 1) * unitSize);\n ByteBuffer view = getView(i);\n try {\n factory.write(view, value);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }"
] | [
"def getValue(words):\n \"\"\"\"\"\"\n value = 0\n for word in words:\n for letter in word:\n # shared.getConst will evaluate to the dictionary broadcasted by\n # the root Future\n value += shared.getConst('lettersValue')[letter]\n return value"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Generate HTML output
See {@link \ValidFormBuilder\Element::__toHtml()}
@see \ValidFormBuilder\Element::__toHtml() | [
"public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0)\n {\n $blnError = ($submitted && ! $this->__validator->validate($intCount) && $blnDisplayErrors) ? true : false;\n\n if (! $blnSimpleLayout) {\n // *** We as... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@param mixed $data Could be object, array, or simple type
@param bool $prettyPrint
@return null|string | [
"public static function jsonEncode($data, $prettyPrint = false)\n {\n $data = static::export($data);\n\n if (version_compare(PHP_VERSION, '5.4', '>=')) {\n $options = JSON_UNESCAPED_SLASHES | (false !== $prettyPrint ? JSON_PRETTY_PRINT : 0) | JSON_NUMERIC_CHECK;\n\n return jso... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Wraps the given function as an AsyncFunction. | [
"private static <I, O> AsyncFunction<I, O> asAsyncFunction(\n final Function<? super I, ? extends O> function) {\n return new AsyncFunction<I, O>() {\n @Override public ListenableFuture<O> apply(I input) {\n O output = function.apply(input);\n return immediateFuture(output);\n }\n ... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Run runs the transaction produced by the provided factory function. | [
"func (sp statePersistence) Run(transactions jujutxn.TransactionSource) error {\n\tif err := sp.st.db().Run(transactions); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn nil\n}"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Helper method for wrapping a color (rgba).<p>
Used by JNI, do not modify!
@param red red component
@param green green component
@param blue blue component
@param alpha alpha component
@return the wrapped color | [
"static Object wrapColor4(float red, float green, float blue, float alpha) {\n ByteBuffer temp = ByteBuffer.allocate(4 * 4);\n temp.putFloat(red);\n temp.putFloat(green);\n temp.putFloat(blue);\n temp.putFloat(alpha);\n temp.flip();\n return s_wrapperProvider.wrapCol... | [
"function Graphics()\n{\n Container.call(this);\n\n /**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */\n this.fillAlpha = 1;\n\n /**\n * The width (thickness) of any lines drawn.\n *\n * @member {number}\n * @de... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Retrieve contents of each page of PDF | [
"def resources(self):\n \"\"\"\"\"\"\n return [self.pdf.getPage(i) for i in range(self.pdf.getNumPages())]"
] | [
"protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Data synchronization:"
} |
// AddDecisions adds decisions to a ContinueDecider outcome | [
"func AddDecisions(signalFn MultiDecisionFunc) Decider {\n\treturn func(ctx *FSMContext, h *swf.HistoryEvent, data interface{}) Outcome {\n\t\tdecisions := ctx.EmptyDecisions()\n\t\tds := signalFn(ctx, h, data)\n\t\tlogf(ctx, \"at=decide-many\")\n\t\tdecisions = append(decisions, ds...)\n\t\treturn ctx.ContinueDeci... | [
"public QueryContext with( Problems problems ) {\n return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata,\n indexDefns, nodeTypes, bufferManager, hints, problems, variables);\n }"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Go programming language:"
} |
Delete files in $destination that aren't in $source.
@param Filesystem $filesystem
@param Collection $folders_to_clean
@param Collection $files_to_keep
@return void | [
"public function cleanFiles(Filesystem $filesystem, Collection $folders_to_clean, Collection $files_to_keep): void\n {\n foreach ($folders_to_clean as $folder_to_clean) {\n foreach ($filesystem->listContents($folder_to_clean, true) as $path) {\n if ($path['type'] === 'file' && !$... | [
"public function execute($files)\n {\n $files = $files->filter_by(array(&$this, 'filter_by_type'));\n\n Application::db()->store('page_list', $files);\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// ImageSearch indicates an expected call of ImageSearch | [
"func (mr *MockImageAPIClientMockRecorder) ImageSearch(ctx, term, options interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ImageSearch\", reflect.TypeOf((*MockImageAPIClient)(nil).ImageSearch), ctx, term, options)\n}"
] | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Parses a token and returns a node.
@return Node
@throws SyntaxError | [
"public function parse(Token $token)\n {\n $lineno = $token->getLine();\n $stream = $this->parser->getStream();\n\n $count = null;\n $vars = new ArrayExpression([], $lineno);\n $domain = null;\n $locale = null;\n if (!$stream->test(Token::BLOCK_END_TYPE)) {\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:"
} |
Gets the duration for this assessment.
return: (osid.calendaring.Duration) - the duration
raise: IllegalState - ``has_duration()`` is ``false``
*compliance: mandatory -- This method must be implemented.* | [
"def get_duration(self):\n \n # Implemented from template for osid.assessment.AssessmentOffered.get_duration_template\n if not bool(self._my_map['duration']):\n raise errors.IllegalState()\n return Duration(**self._my_map['duration'])"
] | [
"def get_rating_id(self):\n \n # Implemented from template for osid.resource.Resource.get_avatar_id_template\n if not bool(self._my_map['ratingId']):\n raise errors.IllegalState('this Comment has no rating')\n else:\n return Id(self._my_map['ratingId'])"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
response handler which uses the custom properties we added to the xhr to retrieve information from the response headers | [
"function handleResponse() {\n\t\tif (this.readyState === 4 && this.pendingInteraction && !this.pendingInteraction.completed) {\n\t\t\t// enrich interaction with information\n\t\t\tvar sContentLength = this.getResponseHeader(\"content-length\"),\n\t\t\t\tbCompressed = this.getResponseHeader(\"content-encoding\") ==... | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Assigns ExceptionCallback into GearmanTask
@see http://www.php.net/manual/en/gearmanclient.setexceptioncallback.php | [
"public function assignExceptionCallback(GearmanTask $gearmanTask)\n {\n $event = new GearmanClientCallbackExceptionEvent($gearmanTask);\n $this->eventDispatcher->dispatch(\n GearmanEvents::GEARMAN_CLIENT_CALLBACK_EXCEPTION,\n $event\n );\n }"
] | [
"def cli(verbose):\n \n floyd.floyd_host = floyd.floyd_web_host = \"https://dev.floydhub.com\"\n floyd.tus_server_endpoint = \"https://upload-v2-dev.floydhub.com/api/v1/upload/\"\n configure_logger(verbose)\n check_cli_version()"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// Insert will add the provided keys to the tree. | [
"func (tree *tree) Insert(rects ...rtree.Rectangle) {\n\tia := newInsertAction(rects)\n\ttree.checkAndRun(ia)\n\tia.completer.Wait()\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 instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
TODO: Candidate util method | [
"private int computePixelSize(final SampleModel sampleModel) {\n int size = 0;\n\n for (int i = 0; i < sampleModel.getNumBands(); i++) {\n size += sampleModel.getSampleSize(i);\n }\n\n return size;\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Get value from storage
@param string $key
@return mixed | [
"public function get($key, $default = null) {\n\t\t$this->check();\n\t\t$value = $this->readValue($key);\n\t\treturn is_null($value) ? $default : $value;\n\t}"
] | [
"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 comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
method to update the component
@return boolean | [
"public static function update()\n\t{\n\t\t$results = array();\n\n\t\t$db = Factory::getDBO();\n\n\t\t/***\n\t\t * UPGRADES FOR 1.1.0 Patch 2\n\t\t ***/\n\t\t//see if the columns exists\n\t\t$query = 'SHOW COLUMNS FROM #__jfusion';\n\t\t$db->setQuery($query);\n\t\t$columns = $db->loadColumn();\n\n\t\t/**\n\t\t * fo... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Run the recorded chain of methods on `instance`.
Args:
instance: an object. | [
"def run(self, instance):\n \n\n last = instance\n\n for item in self.stack:\n if isinstance(item, str):\n last = getattr(last, item)\n else:\n last = last(*item[0], **item[1])\n\n self.stack = []\n return last"
] | [
"def __init_object(self):\n \"\"\"\"\"\"\n # Check to see if the user created a specific initalization function for this object.\n if self.init_function is not None:\n new_obj = self.init_function()\n self.__enqueue(new_obj)\n else:\n raise TypeError(\"Th... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Format the non-file images. | [
"public void transitionNonFileImages(StorageInfo nsInfo, boolean checkEmpty,\n Transition transition, StartupOption startOpt)\n throws IOException {\n for (ImageManager im : imageManagers) {\n if (!(im instanceof FileImageManager)) {\n if (checkEmpty && im.hasSomeImageData()) {\n L... | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
(non-PHPdoc)
@see \oat\tao\model\media\MediaBrowser::getFileInfo | [
"public function getFileInfo($link)\n {\n // get the media link from the resource\n $resource = $this->getResource(\\tao_helpers_Uri::decode($link));\n if (!$resource->exists()) {\n throw new \\tao_models_classes_FileNotFoundException($link);\n }\n\n $fileLink = $res... | [
"private function loadExtensions()\n {\n $this->getServiceLocator()->get(\\common_ext_ExtensionsManager::SERVICE_ID)->getExtensionById('taoOutcomeUi');\n $this->getServiceLocator()->get(\\common_ext_ExtensionsManager::SERVICE_ID)->getExtensionById('taoDeliveryRdf');\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about File management:",
"pos": "Represent the Github code about File management:",
"neg": "Represent the Github code:"
} |
Retrieves a field from the table by name
@param string $field_name - the name of the field we desire
@return DatabaseField $field - the fetched field
@throws Exception if the field does not exist in this table. | [
"public function getField($field_name)\n {\n $field = null;\n \n if (isset($this->m_fields[$field_name]))\n {\n $field = $this->m_fields[$field_name];\n }\n else\n {\n $err_msg = '[' . $field_name . '] does not exist in table ' .\n ... | [
"public function getPropertyValue($propertyName, $objectId = null)\n {\n\n //You can return this protected properties as objects too.\n if (in_array($propertyName, array(\"objectId\", \"objectType\", \"objectURI\")) && isset($this->$propertyName)) {\n return $this->$propertyName;\n ... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// SetStatus sets the Status field's value. | [
"func (s *BusinessReport) SetStatus(v string) *BusinessReport {\n\ts.Status = &v\n\treturn s\n}"
] | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// RefreshUnits overwrites local unit files with those requested.
// Downloading from the Deis project GitHub URL by tag or SHA is the only mechanism
// currently supported. | [
"func RefreshUnits(unitDir, tag, rootURL string) error {\n\tunitDir = utils.ResolvePath(unitDir)\n\tdecoratorDir := filepath.Join(unitDir, \"decorators\")\n\t// create the target dir if necessary\n\tif err := os.MkdirAll(decoratorDir, 0755); err != nil {\n\t\treturn err\n\t}\n\t// download and save the unit files t... | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Sets current thread tenant.
@param holder tenant contexts holder
@param tenantKey tenant key | [
"public static void setTenant(TenantContextHolder holder, TenantKey tenantKey) {\n holder.getPrivilegedContext().setTenant(buildTenant(tenantKey));\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 description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// ChainMiddlewaresWithPrefix chains middlewares if one of prefixes is present | [
"func ChainMiddlewaresWithPrefix(h http.Handler, prefixes []string, ms ...Middleware) http.Handler {\n\tfor _, m := range ms {\n\t\tif len(prefixes) == 0 {\n\t\t\th = m(h)\n\t\t} else {\n\t\t\tt := h\n\t\t\th = http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {\n\t\t\t\tfor _, prefix := range prefixes... | [
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Registers the users.
@return void | [
"protected function registerUsers()\n {\n $this->registerHasher();\n\n $this->app->singleton( 'sentinel.users', function ( $app )\n {\n return new IlluminateUserRepository(\n $app['sentinel.hasher'],\n $app['events'],\n User::class\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 instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Set table
@param \Cake\Datasource\RepositoryInterface|string $table Table name or instance
@return void | [
"public function setTable($table = '') : void\n {\n if ('' === $table) {\n $table = 'dummy';\n }\n\n if (is_string($table)) {\n $table = TableRegistry::get($table);\n }\n\n Assert::isInstanceOf($table, Table::class);\n\n $this->table = $table;\n ... | [
"final public function getArray()\n {\n $res = $this->getArrayInternal();\n if (!$this->isArray($res) && !$this->isArrayObject($res)) {\n $errorMessage = 'AbstractDriver method _getArray() must return array or ArrayObject.';\n $errorMessage .= ' Make sure you have provided a v... | codesearchnet | {
"query": "Represent the sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software Development:"
} |
// TxDifference returns a new set which is the difference between a and b. | [
"func TxDifference(a, b Transactions) Transactions {\n\tkeep := make(Transactions, 0, len(a))\n\n\tremove := make(map[common.Hash]struct{})\n\tfor _, tx := range b {\n\t\tremove[tx.Hash()] = struct{}{}\n\t}\n\n\tfor _, tx := range a {\n\t\tif _, ok := remove[tx.Hash()]; !ok {\n\t\t\tkeep = append(keep, tx)\n\t\t}\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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
<editor-fold desc="object"> | [
"public static boolean argEquals(LToIntFuncDelta the, Object that) {\n\t\treturn Null.<LToIntFuncDelta> equals(the, that, (one, two) -> {\n\t\t\tif (one.getClass() != two.getClass()) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tLToIntFuncDelta other = (LToIntFuncDelta) two;\n\n\t\t\treturn LBiObjIntTriple.argEquals(o... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the sentence about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Shuffles rows of a matrix using the provided random number generator.
@param matrix The matrix of which the rows will be shuffled.
@param randomGenerator The random number generator to be used.
@return The new shuffled matrix. | [
"public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) {\n // Create an index vector to be shuffled:\n int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1);\n MathArrays.shuffle(index, randomGenerator);\n\n // Create a new matrix:\n ... | [
"public String getDescriptiveName()\n {\n StringBuilder sb = new StringBuilder(getDistributionName());\n sb.append(\"(\");\n String[] vars = getVariables();\n double[] vals = getCurrentVariableValues();\n \n sb.append(vars[0]).append(\" = \").append(vals[0]);\n \n... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
// pushObject assembles a JSVM object wrapping a swappable memory and pushes it
// onto the VM stack. | [
"func (mw *memoryWrapper) pushObject(vm *duktape.Context) {\n\tobj := vm.PushObject()\n\n\t// Generate the `slice` method which takes two ints and returns a buffer\n\tvm.PushGoFunction(func(ctx *duktape.Context) int {\n\t\tblob := mw.slice(int64(ctx.GetInt(-2)), int64(ctx.GetInt(-1)))\n\t\tctx.Pop2()\n\n\t\tptr := ... | [
"@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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Run executes service named name by calling appropriate handler function.
// The process is running on console, unlike real service. Use Ctrl+C to
// send "Stop" command to your service. | [
"func Run(name string, handler svc.Handler) error {\n\tcmds := make(chan svc.ChangeRequest)\n\tchanges := make(chan svc.Status)\n\n\tsig := make(chan os.Signal)\n\tsignal.Notify(sig)\n\n\tgo func() {\n\t\tstatus := svc.Status{State: svc.Stopped}\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sig:\n\t\t\t\tcmds <- svc.Cha... | [
"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 text about Container management:",
"pos": "Represent the Github code about Container management:",
"neg": "Represent the Github code about programming:"
} |
populateFromObject
@param ApiPopulatableInterface $object
@param array $ignore
@return void | [
"public function populateFromObject(\n ApiPopulatableInterface $object,\n array $ignore = []\n ) {\n if ($object instanceof Domain) {\n $this->populate($object->toArray(['additionalDomains']), $ignore);\n }\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 description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Register the service provider. | [
"public function register()\n {\n // commands\n $this->registerStaplerFastenCommand();\n $this->registerStaplerRefreshCommand();\n\n // services\n $this->registerImageRefreshService();\n\n // msc\n $this->registerMigrationFolderPath();\n\n $this->commands('... | [
"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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Clears fragment manager backstack and the fragment manager itself. | [
"public void clear() {\n if (fm != null) {\n fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);\n }\n fm = null;\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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Description + Settings | [
"function getConstructorDescription(symbol) {\n\tvar description = symbol.description;\n\tvar tags = symbol.tags;\n\tif ( tags ) {\n\t\tfor (var i = 0; i < tags.length; i++) {\n\t\t\tif ( tags[i].title === \"ui5-settings\" && tags[i].text) {\n\t\t\t\tdescription += \"\\n</p><p>\\n\" + tags[i].text;\n\t\t\t\tbreak;\... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Get is a thread-safe, locking way to access the values of a PkgMap. | [
"func (pm PkgMap) Get(k string) *dt.Plugin {\n\tvar p *dt.Plugin\n\tpm.mutex.Lock()\n\tp = pm.plugins[k]\n\tpm.mutex.Unlock()\n\truntime.Gosched()\n\treturn p\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 instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Initializes the form
@return boolean | [
"protected function Init()\n {\n $this->page = new Page(Request::GetData('page'));\n $this->parent = Page::Schema()->ByID(Request::GetData('parent'));\n $this->previous = Page::Schema()->ByID(Request::GetData('previous'));\n $this->site = $this->page->Exists() ? $this->page->GetSite()... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
get instance
@param mixed $key
@param array $options
@return static | [
"static public function instance($key=null, $options=null)\n {\n $options = (array) $options;\n \n if ($key) {\n if ($key instanceof \\Wslim\\Db\\Model) {\n $obj = $key;\n if ($options) {\n $obj->setOption($options);\n ... | [
"def register_single(key, value, param=None):\n ''''''\n get_current_scope().container.register(key, lambda: value, param)"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Return an array containing the contacts from this Client | [
"def getContacts(self, only_active=True):\n \n contacts = self.objectValues(\"Contact\")\n if only_active:\n contacts = filter(api.is_active, contacts)\n return contacts"
] | [
"@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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
<p>
A list of instance IDs.
</p>
@return A list of instance IDs. | [
"public java.util.List<String> getInstancesList() {\n if (instancesList == null) {\n instancesList = new com.amazonaws.internal.SdkInternalList<String>();\n }\n return instancesList;\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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Return pcap device name for given Windows device name. | [
"def pcap_name(self, devname):\n \"\"\"\"\"\"\n\n try:\n pcap_name = self.data[devname].pcap_name\n except KeyError:\n raise ValueError(\"Unknown network interface %r\" % devname)\n else:\n return pcap_name"
] | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
This method clears all partitions currently residing (partially) in memory. It releases all memory
and deletes all spilled partitions.
<p>
This method is intended for a hard cleanup in the case that the join is aborted. | [
"protected void clearPartitions() {\n\t\tfor (int i = this.partitionsBeingBuilt.size() - 1; i >= 0; --i) {\n\t\t\tfinal HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(i);\n\t\t\ttry {\n\t\t\t\tp.clearAllMemory(this.availableMemory);\n\t\t\t} catch (Exception e) {\n\t\t\t\tLOG.error(\"Error during partition... | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \... | codesearchnet | {
"query": "Represent the summarization about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Software development:"
} |
Returns the current document type.
@return int | [
"public function getDocumentType()\n {\n if (!$this->version) {\n $version = (string) $this->VERSION;\n\n switch ($version) {\n case '2.1':\n $this->version = self::VCARD21;\n break;\n case '3.0':\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Add program options. | [
"def add_options(self):\n \n super(RtorrentMove, self).add_options()\n\n # basic options\n self.add_bool_option(\"-n\", \"--dry-run\",\n help=\"don't move data, just tell what would happen\")\n self.add_bool_option(\"-F\", \"--force-incomplete\",\n help=\"for... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add the given {@link TupleCombiner} instances to this generator. | [
"public TupleGeneratorBuilder combiners( Stream<TupleCombiner> combiners)\n {\n combiners.forEach( combiner -> tupleGenerator_.addCombiner( combiner));\n return this;\n }"
] | [
"@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@Override\n\tpublic void eSet(int featureID, Object newValue) {\n\t\tswitch (featureID) {\n\t\t\tcase BasePackage.TRIPLET__LABEL:\n\t\t\t\tsetLabel((String)newValue);\n\t\t\t\treturn;\n\t\t\tcase BasePackage.TRIPLET__CHARSET:\n\t\t\t\tsetCharset((Charset)newValue);\n\t\t\t\treturn;\n\t\t\tcase BasePackage.TRIPLET_... | [
"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 summarization about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Check if class that is rapresented by value has same typeName of entity parameter.
@param value
the value
@param kindOfParameter
the kind of parameter
@return true if value is equals to className. | [
"public static boolean isEquals(TypeName value, TypeName kindOfParameter) {\n\t\treturn value.toString().equals(kindOfParameter.toString());\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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
A generator for de-unsynchronizing a byte iterable. | [
"def gen_decode(iterable):\n \"\"\n sync = False\n for b in iterable:\n if sync and b & 0xE0:\n warn(\"Invalid unsynched data\", Warning)\n if not (sync and b == 0x00):\n yield b\n sync = (b == 0xFF)"
] | [
"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 description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Natural Language Processing:"
} |
// Convolve returns the convolution of x ∗ y. | [
"func Convolve(x, y []complex128) []complex128 {\n\tif len(x) != len(y) {\n\t\tpanic(\"arrays not of equal size\")\n\t}\n\n\tfft_x := FFT(x)\n\tfft_y := FFT(y)\n\n\tr := make([]complex128, len(x))\n\tfor i := 0; i < len(r); i++ {\n\t\tr[i] = fft_x[i] * fft_y[i]\n\t}\n\n\treturn IFFT(r)\n}"
] | [
"def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Callback function called when a connected event has been received.
It is executed in the baBLE working thread: should not be blocking.
Args:
device (dict): Information about the newly connected device | [
"def _on_connected(self, device):\n \n self._logger.debug(\"Device connected event: {}\".format(device))\n\n self.connected = True\n self._connection_handle = device['connection_handle']\n self.device.connected = True\n self._audit('ClientConnected')"
] | [
"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 Github comment about Data processing:",
"pos": "Represent the Github code about Data processing:",
"neg": "Represent the Github code:"
} |
// ReadByte implements io.ByteReader. | [
"func (cr ChainReader) ReadByte() (byte, error) {\n\td := []byte{0}\n\t_, err := cr.Read(d)\n\treturn d[0], err\n}"
] | [
"func (jsonFramer) NewFrameReader(r io.ReadCloser) io.ReadCloser {\n\t// we need to extract the JSON chunks of data to pass to Decode()\n\treturn framer.NewJSONFramedReader(r)\n}"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
@Route(
"/upload",
name="apiv2_transfer_upload_file"
)
@Method("POST")
@param Request $request | [
"public function uploadFileAction(Request $request)\n {\n $file = $this->uploadFile($request);\n\n $this->crud->create(\n 'Claroline\\CoreBundle\\Entity\\Import\\File',\n ['uploadedFile' => $file]\n );\n\n return new JsonResponse([$file], 200);\n }"
] | [
"public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {\n return oClient.post(\"/hr/v3/fp/submissions\", params);\n }"
] | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about PHP:"
} |
foreach_statement : statement
| COLON inner_statement_list ENDFOREACH SEMI | [
"def p_foreach_statement(p):\n ''''''\n if len(p) == 2:\n p[0] = p[1]\n else:\n p[0] = ast.Block(p[2], lineno=p.lineno(1))"
] | [
"Rule LocalVariableDeclarationStatement() {\n return Sequence(ZeroOrMore(FirstOf(FINAL, Annotation())), Type(), VariableDeclarators(), SEMI);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about language and writing:"
} |
// MarshalJSON implements json.Marshaler interface. | [
"func (p *PhysicalHashJoin) MarshalJSON() ([]byte, error) {\n\tleftChild := p.children[0].(PhysicalPlan)\n\trightChild := p.children[1].(PhysicalPlan)\n\teqConds, err := json.Marshal(p.EqualConditions)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tleftConds, err := json.Marshal(p.LeftConditions)\n\t... | [
"func (pl *Payload) Decode(data []byte) error {\n\t// Note that this method can't be named UnmarshalBinary, because the gob encoder would call\n\t// this method, resulting in infinite recursion.\n\treturn pl.ReadBinary(bytes.NewBuffer(data))\n}"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Stubs the HTTP PUT for an attachment using S3 storage.
@example
stub_paperclip_s3('user', 'avatar', 'png') | [
"def stub_paperclip_s3(model, attachment, extension)\n definition = model.gsub(\" \", \"_\").classify.constantize.\n attachment_definitions[attachment.to_sym]\n\n path = \"http://s3.amazonaws.com/:id/#{definition[:path]}\"\n path.gsub!(/:([^\\/\\.]+)/) do |match|\n \"([... | [
"def upload_profile_avatar filename\n # The Marketing API should be enabled for the APP to use this feature\n # A publish_pages permission is required.\n raise_not_provided_error unless switch_to_page\n\n media_info = page_client.put_picture filename\n picture_url = page_client.get_picture_... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Processes not allowed response
@param Request $request
@return \Illuminate\Http\Response | [
"protected function notAllowed(Request $request)\n {\n if ($request->ajax()) {\n return response('Unauthorized.', 401);\n } else {\n $action = $this->config->get('zendacl.action', 'redirect');\n if ($action == 'redirect') {\n $url = $this->config->get... | [
"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 PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code about Programming:"
} |
Return names, hall numbers, and the washers/dryers available for all
rooms in the system
>>> all_laundry = l.all_status() | [
"def all_status(self):\n \n laundry_rooms = {}\n for room in self.hall_to_link:\n laundry_rooms[room] = self.parse_a_hall(room)\n\n return laundry_rooms"
] | [
"def select_upstream(self, device: devicetools.Device) -> 'Selection':\n \n upstream = self.search_upstream(device)\n self.nodes = upstream.nodes\n self.elements = upstream.elements\n return self"
] | codesearchnet | {
"query": "Represent the comment about AWS Route 53:",
"pos": "Represent the code about AWS Route 53:",
"neg": "Represent the code:"
} |
Validates the JSON data.
@param object $schema The JSON schema.
@param mixed $json The JSON data.
@throws JSONException If the JSON data is invalid.
@api | [
"public function validate($schema, $json)\n {\n $validator = new Validator;\n\n $validator->check($json, $schema);\n\n if (false === $validator->isValid()) {\n $errors = array();\n\n foreach ($validator->getErrors() as $error) {\n $errors[] = (empty($erro... | [
"protected function performValidation()\n {\n $this->requireProperties(['name', 'in']);\n if ($this->in === 'path') {\n $this->requireProperties(['required']);\n if (!$this->required) {\n $this->addError(\"Parameter 'required' must be true for 'in': 'path'.\");\... | codesearchnet | {
"query": "Represent the description about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public EClass getIfcLibraryReference() {\r\n\t\tif (ifcLibraryReferenceEClass == null) {\r\n\t\t\tifcLibraryReferenceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(289);\r\n\t\t}\r\n\t\treturn ifcLibraryReferenceEClass;\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 comment about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Generate adapter.
@param <E> the element type
@param clazz the clazz
@return the e | [
"private static <E extends PreferenceTypeAdapter<?, ?>> E generateAdapter(Class<E> clazz) {\n\t\tE adapter;\n\t\ttry {\n\t\t\tlock.lock();\n\t\t\tadapter = clazz.newInstance();\n\t\t\tcache.put(clazz, adapter);\n\t\t} catch (Throwable e) {\n\t\t\tthrow (new KriptonRuntimeException(e));\n\t\t} finally {\n\t\t\tlock.... | [
"@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 Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Selects appropriate packer for existing archive depending on file contents.
@param string|stored_file $archivefile full pathname of zip file or stored_file instance
@return file_packer Suitable packer | [
"protected function get_packer_for_read_operation($archivefile) {\n global $CFG;\n require_once($CFG->dirroot . '/lib/filestorage/tgz_packer.php');\n\n if (tgz_packer::is_tgz_file($archivefile)) {\n return get_file_packer('application/x-gzip');\n } else {\n return g... | [
"function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(BatchDeleteImportDataError batchDeleteImportDataError, ProtocolMarshaller protocolMarshaller) {\n\n if (batchDeleteImportDataError == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshal... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
return all files under file_or_directory. | [
"def all_files(file_or_directory):\n ''\n if os.path.isdir(file_or_directory):\n return [os.path.join(dirname, filename)\n for dirname, dirnames, filenames in os.walk(file_or_directory)\n for filename in filenames]\n else:\n return [file_or_directory]"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(CreateRoleAliasRequest createRoleAliasRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (createRoleAliasRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Applies the given aggregation to the given column.
The apply and combine steps of a split-apply-combine. | [
"public Table aggregate(String colName1, AggregateFunction<?,?>... functions) {\n ArrayListMultimap<String, AggregateFunction<?,?>> columnFunctionMap = ArrayListMultimap.create();\n columnFunctionMap.putAll(colName1, Lists.newArrayList(functions));\n return aggregate(columnFunctionMap);\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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// AddUpdateStatusHookSettings adds the model settings
// to control how often to run the update-status hook
// if they are missing. | [
"func AddUpdateStatusHookSettings(pool *StatePool) error {\n\tst := pool.SystemState()\n\terr := applyToAllModelSettings(st, func(doc *settingsDoc) (bool, error) {\n\t\tsettingsChanged :=\n\t\t\tmaybeUpdateSettings(doc.Settings, config.UpdateStatusHookInterval, config.DefaultUpdateStatusHookInterval)\n\t\treturn se... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// NewTaskHandler returns a new instance of TaskHandler. | [
"func NewTaskHandler(b *TaskBackend) *TaskHandler {\n\th := &TaskHandler{\n\t\tRouter: NewRouter(),\n\t\tlogger: b.Logger,\n\n\t\tTaskService: b.TaskService,\n\t\tAuthorizationService: b.AuthorizationService,\n\t\tOrganizationService: b.OrganizationService,\n\t\tUserResourceMappingServic... | [
"@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 comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
set new weight for edge
@param float|int|NULL $weight new numeric weight of edge or NULL=unset weight
@return self $this (chainable)
@throws InvalidArgumentException if given weight is not numeric | [
"public function setWeight($weight)\n {\n if ($weight !== NULL && !is_float($weight) && !is_int($weight)) {\n throw new InvalidArgumentException('Invalid weight given - must be numeric or NULL');\n }\n $this->weight = $weight;\n\n return $this;\n }"
] | [
"function(c, i, array) {\n if (c === undefined || c === null) return;\n // c is the component, type is dimension|attribute,\n // level is dataset|series|observation, i is index,\n // array is the component array\n failed += !iterator.call(context, c, type, level, i, array);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// GetOK returns the values collection for the given key.
// When the key is present in the map it will return true for hasKey.
// When the value is not empty it will return true for hasValue. | [
"func (v Values) GetOK(key string) (value []string, hasKey bool, hasValue bool) {\n\tvalue, hasKey = v[key]\n\tif !hasKey {\n\t\treturn\n\t}\n\tif len(value) == 0 {\n\t\treturn\n\t}\n\thasValue = true\n\treturn\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 sentence about Redis command documentation:",
"pos": "Represent the Github code about Redis command documentation:",
"neg": "Represent the Github code:"
} |
Main method to parse the Sonata files and call the appropriate methods
in the handler | [
"def parse(self, handler):\n \n\n ########################################################################\n # load the main configuration scripts \n \n main_config_filename = os.path.abspath(self.parameters['filename'])\n \n config = load_json(main_config_filename)\... | [
"@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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// AddSeriesCreated increases the number of series created in the partition by n. | [
"func (t *seriesPartitionTracker) AddSeriesCreated(n uint64) {\n\tif !t.enabled {\n\t\treturn\n\t}\n\n\tlabels := t.Labels()\n\tt.metrics.SeriesCreated.With(labels).Add(float64(n))\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:"
} |
Set the bit value at the given offset (in bits).
:param int offset: bit offset
:param int value: new value for bit, 1 or 0
:returns: previous value at bit offset, 1 or 0 | [
"def set_bit(self, offset, value):\n \n return self.database.setbit(self.key, offset, value)"
] | [
"def set_digit_raw(self, pos, bitmask):\n \"\"\"\"\"\"\n if pos < 0 or pos > 3:\n # Ignore out of bounds digits.\n return\n # Jump past the colon at position 2 by adding a conditional offset.\n offset = 0 if pos < 2 else 1\n\n # Calculate the correct position... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Parses the xs:any payload elements nested in message element.
@param messageElement | [
"private PayloadTemplateMessageBuilder parsePayloadElement(Element messageElement) {\n PayloadTemplateMessageBuilder messageBuilder = null;\n \n // parse payload with xs-any element\n Element payloadElement = DomUtils.getChildElementByTagName(messageElement, \"payload\");\n if (pa... | [
"public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Returns the content type of the POST or PUT body. | [
"public String getBodyContentType() {\n if (networkRequest != null && networkRequest.contentType != null) {\n return networkRequest.contentType.toString();\n }\n return null;\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 text about Web development:",
"pos": "Represent the code about Web development:",
"neg": "Represent the code:"
} |
Computes the histogram of intensity values for the image.
@param input (input) Image.
@param minValue (input) Minimum possible intensity value
@param histogram (output) Storage for histogram. Number of elements must be equal to max value. | [
"public static void histogram( GrayU8 input , int minValue , int histogram[] ) {\n\t\tif( BoofConcurrency.USE_CONCURRENT ) {\n\t\t\tImplImageStatistics_MT.histogram(input,minValue,histogram);\n\t\t} else {\n\t\t\tImplImageStatistics.histogram(input,minValue,histogram);\n\t\t}\n\t}"
] | [
"@Override\n\tprotected void processImage(ImageBase image) {\n\t\t// The data type of 'image' was specified in onCreate() function\n\t\t// The line below will compute the gradient and store it in two images. One for the\n\t\t// gradient along the x-axis and the other along the y-axis\n\t\tgradient.process((GrayU8)i... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Time is like Timestamp, except that it returns a time.Time. | [
"func (u UUID) Time() time.Time {\n\tif u.Version() != 1 {\n\t\treturn time.Time{}\n\t}\n\tt := u.Timestamp()\n\tsec := t / 1e7\n\tnsec := (t % 1e7) * 100\n\treturn time.Unix(sec+timeBase, nsec).UTC()\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
to delete the model from database
in case of Kept deleted just hide it.
@return bool | [
"public function delete()\n {\n if (!$this->_canKept) {\n $this->forceDelete();\n } else {\n Query::table(static::$table)\n ->set('deleted_at', Time::current())\n ->where($this->_keyName, '=', $this->_keyValue)\n ->update();\n }\n }"
... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
フィールドの配列をCSVの行として書き出します。
@param \SplFileObject $file
@param string[] $fields | [
"protected function putCSVRecord(\\SplFileObject $file, array $fields)\n {\n $file->fputcsv(array_map(function (string $field): string {\n return preg_replace(\n '/[\\\\x00-\\\\x09\\\\x11\\\\x7F]+/u',\n '',\n strtr($field, [\"\\r\\n\" => \"\\r\\n\", ... | [
"public static function Connect (array $options, $name = self::DEFAULT_CONNECTION_NAME) {\n\t\tforeach (['server_key', 'server_salt', 'client_key', 'client_salt'] as $key) {\n\t\t\tif (!isset($options[$key])) {\n\t\t\t\tthrow CoreException::RaiseSystemError('クッキー認証の%sが設定されていません。CookieAuth::Connect([\\'%s\\' => 任意のパ... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Reverse geocodes by the provided place id.
@param $placeId
@return array | [
"public function reverseByPlaceId($placeId)\n {\n $query = $this->buildQuery('place_id', $placeId);\n\n $response = $this->validateResponse(\n $this->getResponse($query)\n );\n\n return $this->buildResults($response['results']);\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 instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Bind the FBO. Anything drawn afterward will be stored in the FBO's texture. | [
"def bind(self):\n \"\"\"\"\"\"\n # This is called simply to deal with anything that might be currently bound (for example, Pyglet objects),\n gl.glBindTexture(gl.GL_TEXTURE_2D, 0)\n\n # Store current viewport size for later\n self._old_viewport = get_viewport()\n\n # Bind ... | [
"def post_process(*shaders)\n raise ArgumentError, \"Block required\" unless block_given?\n raise TypeError, \"Can only process with Shaders\" unless shaders.all? {|s| s.is_a? Ashton::Shader }\n\n # In case no shaders are passed, just run the contents of the block.\n unless shaders.size > 0\n ... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Auto registers the "pbj-schema-store" repos with the SchemaStore.
@param PackageEvent $event | [
"public static function writePbjSchemaStoresFile(PackageEvent $event)\n {\n if (!$event->isDevMode()) {\n return;\n }\n\n $dirs = [];\n /** @var PackageInterface $package */\n foreach ($event->getInstalledRepo()->getPackages() as $package) {\n if (!$packag... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Create a snapper pre snapshot | [
"def _snapper_pre(opts, jid):\n '''\n \n '''\n snapper_pre = None\n try:\n if not opts['test'] and __opts__.get('snapper_states'):\n # Run the snapper pre snapshot\n snapper_pre = __salt__['snapper.create_snapshot'](\n config=__opts__.get('snapper_state... | [
"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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Retrieves the number of password login attempts so that we can automatically lock users out of they attempt a brute force attack
@return UserMetadata | [
"protected function getPasswordAttempts()\n {\n if ($this->_user == NULL)\n return false;\n\n $this->_attempts = UserMetadata::model()->getPrototype('UserMetadata', array(\n 'user_id' => $this->getUser()->id,\n 'key' => 'passwordAttempts'\n ), arr... | [
"func (p *provisioningIdentityMapper) UserFor(info authapi.UserIdentityInfo) (kuser.Info, error) {\n\t// Retrying up to three times lets us handle race conditions with up to two conflicting identity providers without returning an error\n\t// * A single race is possible on user creation for every conflicting identit... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
@param $color
@param $count
@param $colorsCount
@return float | [
"protected function getColorScore($color, $count, $colorsCount)\n\t {\n\t $sRGBComponents = $this->getSRGBComponents($this->getRGBComponents($color));\n\t $max \t\t\t= max($sRGBComponents);\n\t $min \t\t\t= min($sRGBComponents);\n\t $diff \t\t\t= $max - $min;\n\t $sum \t\t\t= $... | [
"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 programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Removes any orphaned recipes, i.e. recipes no longer used by any combination. | [
"public function removeOrphans(): void\n {\n $recipeIds = $this->findOrphanedIds();\n if (count($recipeIds) > 0) {\n $this->removeIds($recipeIds);\n }\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Returns the number of words in the given text string | [
"def word_count(ctx, text, by_spaces=False):\n \n text = conversions.to_string(text, ctx)\n by_spaces = conversions.to_boolean(by_spaces, ctx)\n return len(__get_words(text, by_spaces))"
] | [
"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.