query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// Info returns detailed configuration information about the selected server.
[ "func (s *ServerMethods) Info() (*Server, error) {\n\tr := &Server{}\n\tif _, err := s.ExecCmd(NewCmd(\"serverinfo\").WithResponse(&r)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}" ]
[ "def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get parameter from a form for creating a pager URL. @param Form $form @return array
[ "public function getPrmForUrl(Form $form)\n {\n $ret = array();\n foreach ($form->getData() as $k => $data) {\n if (isset($data['value'])) {\n $data['value'] = $this->prepareDataForUrl($data['value'], $form->get($k)->get('value'));\n $ret[$k] = $data;\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// AddParser adds DagParser under give input encoding and format
[ "func (iep InputEncParsers) AddParser(ienc, format string, f DagParser) {\n\tm, ok := iep[ienc]\n\tif !ok {\n\t\tm = make(FormatParsers)\n\t\tiep[ienc] = m\n\t}\n\n\tm[format] = f\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@Override\n\tpublic void eUnset(int featureID) {\n\t\tswitch (featureID) {\n\t\t\tcase AfplibPackage.GBOX__RES:\n\t\t\t\tsetRES(RES_EDEFAULT);\n\t\t\t\treturn;\n\t\t\tcase AfplibPackage.GBOX__XPOS0:\n\t\t\t\tsetXPOS0(XPOS0_EDEFAULT);\n\t\t\t\treturn;\n\t\t\tcase AfplibPackage.GBOX__YPOS0:\n\t\t\t\tsetYPOS0(YPOS0_E...
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github text about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
Saves extracted strings from the project to locale mo and po files.
[ "private function saveStringToLocales()\n {\n $gettextEntries = $this->extractGettextStrings();\n\n $root = Strata::getRootPath();\n\n foreach ($gettextEntries as $translation) {\n $references = $translation->getReferences();\n $translation->deleteReferences();\n\n ...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Derive q home from the environment
[ "def get_q_home(env):\n \"\"\"\"\"\"\n q_home = env.get('QHOME')\n if q_home:\n return q_home\n for v in ['VIRTUAL_ENV', 'HOME']:\n prefix = env.get(v)\n if prefix:\n q_home = os.path.join(prefix, 'q')\n if os.path.isdir(q_home):\n return q_home\...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Finds all documents which match with the given example, then apply the given sort to results @param example example object to construct query with @param sort sort object to sort results @param <S> @return sorted iterable of all matching documents
[ "@Override\n\tpublic <S extends T> Iterable<S> findAll(final Example<S> example, final Sort sort) {\n\t\tfinal ArangoCursor cursor = findAllInternal(sort, example, new HashMap());\n\t\treturn cursor;\n\t}" ]
[ "def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// Readdir creates FileInfo entries by calling Lstat if possible.
[ "func (l *languageFile) Readdir(c int) (ofi []os.FileInfo, err error) {\n\tnames, err := l.File.Readdirnames(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfis := make([]os.FileInfo, len(names))\n\n\tfor i, name := range names {\n\t\tfi, _, err := l.fs.LstatIfPossible(filepath.Join(l.Name(), name))\n\n\t\tif ...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about programming:" }
Create AuthController.
[ "public function createAuthController()\n {\n $authController = $this->directory.'/Controllers/AuthController.php';\n $contents = $this->getStub('AuthController');\n\n $this->laravel['files']->put(\n $authController,\n str_replace('DummyNamespace', Admin::controllerName...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Use up()/down() to run migration code without a transaction.
[ "public function up()\n {\n $table = file_get_contents(dirname(__FILE__) . '/media.sql');\n return $this->db->createCommand($table)->execute();\n }" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
handle a message and return an gif
[ "def on_message(msg, server):\n \"\"\"\"\"\"\n text = msg.get(\"text\", \"\")\n match = re.findall(r\"!gif (.*)\", text)\n if not match:\n return\n\n res = gif(match[0])\n if not res:\n return\n\n attachment = {\n \"fallback\": match[0],\n \"title\": match[0],\n ...
[ "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 comment about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code:" }
Output a string @param string $str String to output @param false|int $row The optional row to output to @param false|int $col The optional column to output to
[ "public static function string( $str, $row = null, $col = null ) {\n\t\tif( $col !== null || $row !== null ) {\n\t\t\tCursor::rowcol($row, $col);\n\t\t}\n\t\tfwrite(self::$stream, $str);\n\t}" ]
[ "protected function outputMultipleValues(array $output, $key, $value, $longKey)\n {\n // remove the key from the value and remove whitespace\n $newValue = str_replace($longKey.' ', '', trim($value));\n\n // check if there was a key to remove\n if (trim($value) !== $newValue) {\n ...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Get a list of parsed recipes from BeerXML input
[ "def parse(self, xml_file):\n \"\"\n\n recipes = []\n\n with open(xml_file, \"rt\") as f:\n tree = ElementTree.parse(f)\n\n for recipeNode in tree.iter():\n if self.to_lower(recipeNode.tag) != \"recipe\":\n continue\n\n recipe = Recipe()\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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Clean up the child procress and socket. @throws IOException
[ "void cleanup() throws IOException {\n serverSocket.close();\n try {\n downlink.close();\n } catch (InterruptedException ie) {\n Thread.currentThread().interrupt();\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 Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Remove a logger by passing in its instance. @param LoggerInterface $logger @param bool $trigger @return AggregateLogger
[ "public function removeLoggerByInstance($logger, $trigger = true) {\n foreach ($this->loggers as $key => $addedLogger) {\n if ($addedLogger[0] === $logger) {\n unset($this->loggers[$key]);\n return $this;\n }\n }\n\n if ($trigger) {\n ...
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Clean the user data. @param stdClass|array $user the user data to be validated against properties definition. @return stdClass $user the cleaned user data.
[ "public static function clean_data($user) {\n if (empty($user)) {\n return $user;\n }\n\n foreach ($user as $field => $value) {\n // Get the property parameter type and do the cleaning.\n try {\n $user->$field = core_user::clean_field($value, $fie...
[ "public function getSection($key)\n {\n if (false === $this->hasSection($key)) {\n throw new ConfigException(sprintf('\"%s\" is not a section', $key));\n }\n\n // do not return the parent object if we were subclassed, but an actual\n // \"Config\" object to avoid copying in...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Set owner for an existing file. @throws IOException
[ "public void setOwner(String src, String username, String group\n ) throws IOException {\n INode[] inodes = null;\n writeLock();\n try {\n if (isInSafeMode()) {\n throw new SafeModeException(\"Cannot set permission for \" + src, safeMode);\n }\n inodes = dir.getExistingPathINodes(src...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Init implements Command.Init.
[ "func (c *deleteImageMetadataCommand) Init(args []string) (err error) {\n\tif len(args) == 0 {\n\t\treturn errors.New(\"image ID must be supplied when deleting image metadata\")\n\t}\n\tif len(args) != 1 {\n\t\treturn errors.New(\"only one image ID can be supplied as an argument to this command\")\n\t}\n\tc.ImageId...
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set the detected keyword text. @param keyword detected keyword text
[ "public void setKeyword(String keyword) {\n if(keyword != null) {\n keyword = keyword.trim();\n }\n this.keyword = keyword;\n }" ]
[ "def _enter(self):\n \"\"\"\"\"\"\n command = self.command\n logger.log(5, \"Snippet keystroke `Enter`.\")\n # NOTE: we need to set back the actions (mode_off) before running\n # the command.\n self.mode_off()\n self.run(command)" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Retrieve prev node. @return NodeContract|null
[ "public function prev()\n {\n return $this->getParent() !== null ? $this->getParent()->getChildByIndex($this->getIndex() - 1) : null;\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:" }
Convert content to CSV. @param array $data @param array $config @return \Orchestra\Support\Collection
[ "protected function convertToExcel(array $data, array $config): Collection\n {\n $uses = $config['uses'] ?? 'data';\n $content = $data[$uses] ?? [];\n\n if ($content instanceof Arrayable) {\n $content = $content->toArray();\n }\n\n return Collection::make(\\array_map...
[ "public static function backwardsCompatibility(&$oBindTo)\n {\n // @todo (Pablo - 2017-06-07) - Remove these\n $oBindTo->db = Factory::service('Database');\n $oBindTo->encrypt = Factory::service('Encrypt');\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
Return an object as a dictionary of its attributes.
[ "def get_as_dict(x):\n \"\"\"\"\"\"\n if isinstance(x, dict):\n return x\n else:\n try:\n return x._asdict()\n except AttributeError:\n return x.__dict__" ]
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
split a json-reference into (url, json-pointer)
[ "def jr_split(s):\n \n p = six.moves.urllib.parse.urlparse(s)\n return (\n normalize_url(six.moves.urllib.parse.urlunparse(p[:5]+('',))),\n '#'+p.fragment if p.fragment else '#'\n )" ]
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get the children of each element in the set of matched elements, optionally filtering by selector.
[ "function children(selector) {\n var arr = [], slice = this.slice, nodes, matches;\n this.each(function(el) {\n nodes = slice.call(el.childNodes);\n // only include elements\n nodes = nodes.filter(function(n) {\n if(n instanceof Element) { return n;}\n })\n // filter direct descendants by sele...
[ "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:" }
Asserts that the next token in the stream matches the specified token. @param token expected token @throws ParseException
[ "public void assertToken(final int token) throws ParseException {\n try {\n if (nextToken() != token) {\n throw new ParseException(\"Expected [\" + token + \"], read [\" +\n ttype + \"] at \" + lineno());\n }\n\n if (debug()) {\n if (token > 0) {\n ...
[ "public StringAssert isString() {\n Node node = assertType(STRING);\n return new StringAssert((String) node.getValue()).as(\"Different value found in node \\\"%s\\\"\", path);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Heatmap Chart @class
[ "function Heatmap() {\n var canvas = zrUtil.createCanvas();\n this.canvas = canvas;\n\n this.blurSize = 30;\n this.pointSize = 20;\n\n this.maxOpacity = 1;\n this.minOpacity = 0;\n\n this._gradientPixels = {};\n}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Caches the value into redis with errors suppressed. @param string $key The key. @param string $value The value. @param int $cacheTime The optional cache time @return void
[ "private function cache(string $key, string $value, int $cacheTime = null)\n {\n try {\n $this->client->set($key, $value);\n\n if ($cacheTime !== null) {\n $this->client->expire($key, $cacheTime);\n }\n } catch (\\Exception $e) {\n // We do...
[ "public function acquireLock( $key, $waitTime, $maxTime )\n {\n if ( strlen( $key ) > self::MAX_KEY_LENGTH )\n {\n throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );\n }\n\n // add() does not replace and returns true on success. $maxTim...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
A method (exposed on return object for external use) that mimics onload by polling document.styleSheets until it includes the new sheet.
[ "function( cb ){\n\t\t\tvar resolvedHref = ss.href;\n\t\t\tvar i = sheets.length;\n\t\t\twhile( i-- ){\n\t\t\t\tif( sheets[ i ].href === resolvedHref ){\n\t\t\t\t\treturn cb();\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetTimeout(function() {\n\t\t\t\tonloadcssdefined( cb );\n\t\t\t});\n\t\t}" ]
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Retrieves a list of entries after a given index as well as the term of the // index provided. A nil list of entries is returned if the index no longer // exists because a snapshot was made.
[ "func (l *Log) getEntriesAfter(index uint64, maxLogEntriesPerRequest uint64) ([]*LogEntry, uint64) {\n\tl.mutex.RLock()\n\tdefer l.mutex.RUnlock()\n\n\t// Return nil if index is before the start of the log.\n\tif index < l.startIndex {\n\t\ttraceln(\"log.entriesAfter.before: \", index, \" \", l.startIndex)\n\t\tret...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about File management:" }
Create an equivalent signature string for a NumPy gufunc. Unlike __str__, handles dimensions that don't map to Python identifiers.
[ "def to_gufunc_string(self):\n \n all_dims = self.all_core_dims\n dims_map = dict(zip(sorted(all_dims), range(len(all_dims))))\n input_core_dims = [['dim%d' % dims_map[dim] for dim in core_dims]\n for core_dims in self.input_core_dims]\n output_core_dims ...
[ "def save(self, obj):\n \n if isinstance(obj, self.np.ndarray) and not obj.dtype.hasobject:\n # Compute a hash of the object\n # The update function of the hash requires a c_contiguous buffer.\n if obj.shape == ():\n # 0d arrays need to be flattened beca...
codesearchnet
{ "query": "Represent the comment about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about programming:" }
Pushes a new item into the jiterator. The new item will be added to the end of the jiterator. @param item the item to be added @throws IllegalStateException an attempt was made to push an item on a jiterator marked complete
[ "public synchronized void push(@Nullable T item) {\n if( waiting == null ) {\n throw new IllegalStateException(\"Invalid attempt to add an item to a completed list.\");\n }\n if( filter != null ) {\n try {\n if( !filter.filter(item) ) {\n ...
[ "private void removeContext(final String contextID) {\n\n synchronized (this.contextStack) {\n\n if (!contextID.equals(this.contextStack.peek().getIdentifier())) {\n throw new IllegalStateException(\"Trying to close context with id `\" + contextID +\n \"`. But the top context has id `\" +\...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns the sorted xml as an OutputStream. @return the sorted xml
[ "public String getSortedXml(Document newDocument) {\n try (ByteArrayOutputStream sortedXml = new ByteArrayOutputStream()) {\n BufferedLineSeparatorOutputStream bufferedLineOutputStream =\n new BufferedLineSeparatorOutputStream(lineSeparatorUtil.toString(), sortedXml);\n\n ...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// This is a courtesy helper function, which in some cases may not work as expected!
[ "func (s *FirewallService) GetPortForwardingRuleByID(id string, opts ...OptionFunc) (*PortForwardingRule, int, error) {\n\tp := &ListPortForwardingRulesParams{}\n\tp.p = make(map[string]interface{})\n\n\tp.p[\"id\"] = id\n\n\tfor _, fn := range append(s.cs.options, opts...) {\n\t\tif err := fn(s.cs, p); err != nil ...
[ "function isSafeProperty (object, prop) {\n if (!object || typeof object !== 'object') {\n return false\n }\n // SAFE: whitelisted\n // e.g length\n if (hasOwnProperty(safeNativeProperties, prop)) {\n return true\n }\n // UNSAFE: inherited from Object prototype\n // e.g constructor\n if (prop in Obje...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
获取当前的关联模型类的实例 @access public @return Model
[ "public function getModel()\n {\n $morphType = $this->morphType;\n $model = $this->parseModel($this->parent->$morphType);\n\n return (new $model);\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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Read file by handle and verify if content is expired @param resource $handle file handle @param string $file file path @return false|array false or file content array
[ "protected function readAndVerify($handle, $file)\n {\n // Read all content\n $content = fread($handle, filesize($file));\n $content = @unserialize($content);\n\n // Check if content is valid\n if ($content && is_array($content) && time() < $content[0]) {\n return $c...
[ "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 summarization about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about programming:" }
:return AudioPortBuilder
[ "def generate_builder(self, json, audio_port):\n \n if 'effect' in json[audio_port]:\n return Lv2AudioPortBuilder(self.pedalboard)\n else:\n return SystemAudioPortBuilder(self.system_effect)" ]
[ "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:" }
Returns curent fate time in RFC1123 format, using UTC time zone @return string
[ "private function getRFC1123DateString() {\n $date = new \\DateTime(null, new \\DateTimeZone(\"UTC\"));\n return str_replace(\"+0000\", \"GMT\", $date->format(\\DateTime::RFC1123));\n }" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// appendUpdate appends a new update to the tip of the updateLog. The entry is // also added to index accordingly.
[ "func (u *updateLog) appendUpdate(pd *PaymentDescriptor) {\n\tu.updateIndex[u.logIndex] = u.PushBack(pd)\n\tu.logIndex++\n}" ]
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github description about software development:", "pos": "Represent the Github code about software development:", "neg": "Represent the Github code about File management:" }
Find file file. @param callingFrame the calling frame @return the file
[ "@javax.annotation.Nonnull\n public static File findFile(@javax.annotation.Nonnull final StackTraceElement callingFrame) {\n @javax.annotation.Nonnull final String[] packagePath = callingFrame.getClassName().split(\"\\\\.\");\n @javax.annotation.Nonnull final String path = Arrays.stream(packagePath).limit(pa...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Sets the data of a node at the given path, or creates it.
[ "def set_or_create(self, path, *args, **kwargs):\n \"\"\"\"\"\"\n\n d = self.set(path, *args, **kwargs)\n\n @d.addErrback\n def _error(result):\n return self.create(path, *args, **kwargs)\n\n return d" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
read config from confingPath @param confingFilename like axu4j.xml
[ "public static void load(String confingFilename) {\n\t\ttry {\n\t\t\tif (config == null) {\n\t\t\t\tconfig = new AXUConfig();\n\t\t\t\tlogger.debug(\"create new AXUConfig instance\");\n\t\t\t}\n\n // DEV 모드인 경우 각 태그마다 config를 요청하므로 3초에 한 번씩만 설정을 로딩하도록 한다.\n long nowTime = (new Date()).getTime(...
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the Github instruction about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// needsUpdate returns true if the given row needs to be updated to match the given config.
[ "func (*RackKVMsTable) needsUpdate(row, cfg *RackKVM) bool {\n\treturn row.KVMId != cfg.KVMId\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:" }
see all of these messages and control their transmission.
[ "public void handleInitiateResponseMessage(InitiateResponseMessage message)\n {\n final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.MPI);\n if (traceLog != null) {\n traceLog.add(() -> VoltTrace.endAsync(\"initmp\", message.getTxnId()));\n }\n\n Du...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Reduce the strings. @param int $start Position of first character. @param int $length Maximum number of characters. @return self
[ "public function reduce($start, $length = null)\n {\n $this->_string = \\mb_substr($this->_string, $start, $length);\n\n return $this;\n }" ]
[ "protected function makeKeyString($key): string {\n //convert numbers to strings.\n $stringValue = (string)$key;\n $length = strlen( $stringValue );\n if( $length == 0 ){\n throw new \\Exception(\"Key values must be string values of at least 1 character. Empty strings cannot b...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about AWS S3:" }
Creates a connection manager from a <code>.kkdb.php</code> config file. @param string $file @return ConnectionManager @throws \RuntimeException When the config file could not be found.
[ "public static function fromConfigFile($file)\n\t{\n\t\tif(!is_file($file))\n\t\t{\n\t\t\tthrow new \\RuntimeException(sprintf('Config file \"%s\" does not exist', $file));\n\t\t}\n\t\t\n\t\t$config = new Configuration(static::processConfigFileData(require $file));\n\t\t\n\t\treturn new ConnectionManager($config->g...
[ "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 description about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software Development:" }
The first two time delay weighted statistical moments of the MA coefficients.
[ "def moments(self):\n \"\"\"\"\"\"\n moment1 = statstools.calc_mean_time(self.delays, self.coefs)\n moment2 = statstools.calc_mean_time_deviation(\n self.delays, self.coefs, moment1)\n return numpy.array([moment1, moment2])" ]
[ "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 Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Registers a callback to be invoked when the RDFValue named is declared.
[ "def RegisterLateBindingCallback(target_name, callback, **kwargs):\n \"\"\"\"\"\"\n _LATE_BINDING_STORE.setdefault(target_name, []).append((callback, kwargs))" ]
[ "@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:", "pos": "Represent the code:", "neg": "Represent the code:" }
Is authenticating at a public workstation? @param ctx the ctx @return true if the cookie value is present
[ "public static boolean isAuthenticatingAtPublicWorkstation(final RequestContext ctx) {\n if (ctx.getFlowScope().contains(PUBLIC_WORKSTATION_ATTRIBUTE)) {\n LOGGER.debug(\"Public workstation flag detected. SSO session will be considered renewed.\");\n return true;\n }\n ret...
[ "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 post about Go programming language:", "pos": "Represent the code about Go programming language:", "neg": "Represent the code about programming:" }
Accept url @param string $until @return string
[ "protected function acceptUrl( $until = ';' )\n {\n if ( 'url' == strtolower( substr( $this->buffer, 0, 3 ) ) )\n {\n $this->buffer = substr( $this->buffer, 3 );\n $this->acceptWhiteSpace();\n\n if ( '(' == $this->buffer[0] )\n {\n $this->b...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns aliased value or default value if requested alias does not exists. @param string $name @param string|null $default @return string|null
[ "public function get($name, $default = null)\n {\n if (array_key_exists($name, $this->aliases)) {\n return $this->aliases[$name];\n } else {\n return $default;\n }\n }" ]
[ "function typecastPropertyValue ($name, $v)\n {\n if ($this->isScalar ($name) && $this->isEnum ($name))\n $this->validateEnum ($name, $v);\n\n $type = $this->getTypeOf ($name);\n if ($type && !type::validate ($type, $v))\n throw new ComponentException ($this->component,\n sprintf (\n ...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Initializes the status list.
[ "def init_with_context(self, context):\n \n super(CacheStatusGroup, self).init_with_context(context)\n\n if 'dashboardmods' in settings.INSTALLED_APPS:\n import dashboardmods\n memcache_mods = dashboardmods.get_memcache_dash_modules()\n\n try:\n v...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Needs to be called to allocate the GPIO pin
[ "func (op *DTGPIOModuleOpenPin) gpioUnexport() error {\n\ts := strconv.FormatInt(int64(op.gpioLogical), 10)\n\te := WriteStringToFile(\"/sys/class/gpio/unexport\", s)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\treturn nil\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Renders the HTML head @param $custom_head_markup string A string of data to include in the HTML head, right before </head>
[ "public function htmlHead($custom_head_markup = '')\n {\n\n if (!empty($custom_head_markup)) {\n $this->custom_head_markup = $custom_head_markup;\n }\n\n $html = $this->doc_type . \"\\n\";\n $html .= $this->opening_html_tag . \"\\n\";\n $html .= '<head>' . \"\\n\";\n...
[ "def reset(self):\n \n\n # Use first matching element as title (0 or more xpath expressions)\n self.title = OrderedSet()\n\n # Use first matching element as body (0 or more xpath expressions)\n self.body = OrderedSet()\n\n # Use first matching element as author (0 or more x...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Create a new Date. To the last day.
[ "public static java.sql.Date newDate() {\n return new java.sql.Date((System.currentTimeMillis() / DAY_MILLIS) * DAY_MILLIS);\n }" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Drops the database indices relating to n-grams.
[ "def _drop_indices(self):\n \"\"\"\"\"\"\n self._logger.info('Dropping database indices')\n self._conn.execute(constants.DROP_TEXTNGRAM_INDEX_SQL)\n self._logger.info('Finished dropping database indices')" ]
[ "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 Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Retrieve object metadata only.
[ "def head_object(self, bucket, object_name):\n \n details = self._details(\n method=b\"HEAD\",\n url_context=self._url_context(bucket=bucket, object_name=object_name),\n )\n d = self._submit(self._query_factory(details))\n d.addCallback(lambda (response, body...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
set the self link on the resource @param string $href @param array $meta optional
[ "public function setSelfLink($href, array $meta=[], $level=Document::LEVEL_RESOURCE) {\n\t\t$this->ensureResourceObject();\n\t\t\n\t\tif ($level === Document::LEVEL_RESOURCE) {\n\t\t\t$this->resource->setSelfLink($href, $meta);\n\t\t}\n\t\telse {\n\t\t\tparent::setSelfLink($href, $meta, $level);\n\t\t}\n\t}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// * Check if user passphrase matches argument. Launches SecretUI prompt if // * passphrase argument is empty. Returns `true` if passphrase is correct, // * false if not, or an error if something else went wrong.
[ "func (c AccountClient) PassphraseCheck(ctx context.Context, __arg PassphraseCheckArg) (res bool, err error) {\n\terr = c.Cli.Call(ctx, \"keybase.1.account.passphraseCheck\", []interface{}{__arg}, &res)\n\treturn\n}" ]
[ "function callback(unknown) {\n // returns the cb if a cb\n // returns a noop function if undefined\n // throws an error if neither\n // -------------------------\n // assume it is a function to be returned\n var returnFunction = unknown;\n // check if it's undefined\n if (unknown === undefi...
codesearchnet
{ "query": "Represent the Github instruction about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Sanitize Naughty HTML Callback method for xss_clean() to remove naughty HTML elements. @used-by XSS::clean() @param array $matches @return string
[ "protected static function sanitizeNaughtyHTML($matches)\r\n {\r\n // First, escape unclosed tags\r\n if (empty($matches[ 'closeTag' ])) {\r\n return '&lt;' . $matches[ 1 ];\r\n } // Is the element that we caught naughty? If so, escape it\r\n elseif (in_array(strtolower($ma...
[ "public static function insertTemplatePF ($parser, $template, $spot=''){\n //process additional arguments into a usable array\n $params = array();\n //sanitize the template name\n $template = preg_replace('/[^A-Za-z0-9_\\-]/', '_', $template);\n //this will be stripped out, assuming the skin is based...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// Drive is called from simra. // This is used to update sprites position. // This will be called 60 times per sec.
[ "func (s *sample) Drive() {\n\tdegree++\n\tif degree >= 360 {\n\t\tdegree = 0\n\t}\n\n\tp := s.ball.GetPosition()\n\tswitch s.buttonState {\n\tcase ctrlUp:\n\t\ts.ball.SetPositionY(p.Y + 1)\n\tcase ctrlDown:\n\t\ts.ball.SetPositionY(p.Y - 1)\n\t}\n\n\ts.ball.SetRotate(degree * math.Pi / 180)\n}" ]
[ "function startServo(timeOffset, timeInterval, angle)\n{\n // Start running this instance after timeOffset milliseconds\n setTimeout(function()\n {\n // run this instance every timeInterval milliseconds\n setInterval(function()\n {\n servo.setAngle(angle);\n conso...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// SetPlatform sets the Platform field's value.
[ "func (s *ADMChannelResponse) SetPlatform(v string) *ADMChannelResponse {\n\ts.Platform = &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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// SetRenderTarget sets a texture as the current rendering target. // (https://wiki.libsdl.org/SDL_SetRenderTarget)
[ "func (renderer *Renderer) SetRenderTarget(texture *Texture) error {\n\treturn errorFromInt(int(\n\t\tC.SDL_SetRenderTarget(renderer.cptr(), texture.cptr())))\n\n}" ]
[ "func (texture *Texture) GLUnbind() error {\n\treturn errorFromInt(int(\n\t\tC.SDL_GL_UnbindTexture(texture.cptr())))\n}" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Allows the ability to override the Inmage's Pretty name stored in cache @param string $name
[ "public function setImagePrettyName($name)\n {\n $this->set('prettyname', $name);\n if ($this->image) {\n $this->image->setPrettyName($name);\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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Assert value is not a bool (boolean). @param mixed $actual @param string $message
[ "public static function assertNotBool($actual, string $message = '')\n {\n self::assertTypeOfScalar($actual, $message, 'assertNotBool', new LogicalNot(new ScalarConstraint(ScalarConstraint::TYPE_BOOL)));\n }" ]
[ "public StringAssert isString() {\n Node node = assertType(STRING);\n return new StringAssert((String) node.getValue()).as(\"Different value found in node \\\"%s\\\"\", path);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Programming:" }
// Encode encodes the parameters into "URL encoded" form ("bar=baz&foo=quux") // sorted by key.
[ "func (p Parameters) Encode() string {\n\tvar buf bytes.Buffer\n\tkeys := make([]string, 0, len(p))\n\tfor k := range p {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tif buf.Len() > 0 {\n\t\t\tbuf.WriteByte('&')\n\t\t}\n\t\tbuf.WriteString(url.QueryEscape(k) + \"=\")\n\t\t...
[ "def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Lookup (Section 3.4) matches a language priority list consisting of basic language ranges to sets of language tags to find the one exact language tag that best matches the range.
[ "function lookup(tag, range) {\n var pos\n\n tag = lower(tag)\n range = lower(range)\n\n while (true) {\n if (range === asterisk || tag === range) {\n return true\n }\n\n pos = range.lastIndexOf(dash)\n\n if (pos === -1) {\n return false\n }\n\n if (pos > 3 && range.charAt(pos - 2) =...
[ "def get_render_language(contentitem):\n \n plugin = contentitem.plugin\n\n if plugin.render_ignore_item_language \\\n or (plugin.cache_output and plugin.cache_output_per_language):\n # Render the template in the current language.\n # The cache also stores the output under the current lang...
codesearchnet
{ "query": "Represent the Github sentence about Language and programming:", "pos": "Represent the Github code about Language and programming:", "neg": "Represent the Github code about Language and programming:" }
判断日志级别 @param logger Logger @param l Level @return boolean
[ "public boolean isLoggable(Logger logger, Level l) {\r\n return logger.isLoggable(l) && l.intValue() >= this.logLevel;\r\n }" ]
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Delete all publications @param int $advertised search for advertised courses @param int $shared search for shared courses @throws moodle_exception
[ "public static function delete_all_publications($advertised = true, $shared = true) {\n global $DB;\n\n if (!$advertised && !$shared) {\n // Nothing to do.\n return true;\n }\n\n $params = ['huburl' => HUB_MOODLEORGHUBURL];\n if (!$advertised || !$shared) {\n...
[ "public function validate() {\n foreach ($this->requiredfields as $key) {\n if (empty($this->{$key})) {\n throw new portfolio_format_leap2a_exception('leap2a_missingfield', 'portfolio', '', $key);\n }\n }\n if ($this->type == 'selection') {\n if (...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Retrieves (and caches) the locale @param string $locale @return int|null null if language was not found for locale
[ "public function lookUpLanguageIdForLocale($locale)\n {\n $locale = $this->normalizeLocale($locale);\n\n /** @var Model $languageModel */\n $languageModel = static::$cmsLanguageModel;\n\n $language = $languageModel::where(config('pxlcms.translatable.locale_code_column'), $locale)\n ...
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// SetFilters sets the Filters field's value.
[ "func (s *ListResolverRuleAssociationsInput) SetFilters(v []*Filter) *ListResolverRuleAssociationsInput {\n\ts.Filters = v\n\treturn s\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:" }
Get all strips from a scraper.
[ "def _getStrips(self, scraperobj):\n \"\"\"\"\"\"\n if self.options.all or self.options.cont:\n numstrips = None\n elif self.options.numstrips:\n numstrips = self.options.numstrips\n else:\n # get current strip\n numstrips = 1\n try:\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Utility method to create a single header instance with the given information. If elements already exist, this will delete secondary ones and overlay the value on the first element. @param key @param value @param offset @param length
[ "private void createSingleHeader(HeaderKeys key, byte[] value, int offset, int length) {\n HeaderElement elem = findHeader(key);\n if (null != elem) {\n // delete all secondary instances first\n if (null != elem.nextInstance) {\n HeaderElement temp = elem.nextInsta...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
This will give a boolean list corresponding to whether each individual is homozygous for the alternative allele.
[ "def is_homozygous(self, individual=None):\n \n if individual is not None:\n if isinstance(individual, str):\n individual = self.individuals[individual]\n alts = self.genotype[individual]\n return [sum(alts) == len(alts)] if sum(alts) > 0 else [False]\n ...
[ "def set_prop(self, prop, value, ef=None):\n \n if ef:\n # prop should be restricted to n_decoys, an int, the no. of decoys corresponding to a given FPF.\n # value is restricted to the corresponding enrichment factor and should be a float\n self.ef[prop] = value\n ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Imports a field by its dotted class path, prepending "django.db.models" to raw class names and raising an exception if the import fails.
[ "def import_field(field_classpath):\n \n if '.' in field_classpath:\n fully_qualified = field_classpath\n else:\n fully_qualified = \"django.db.models.%s\" % field_classpath\n try:\n return import_dotted_path(fully_qualified)\n except ImportError:\n raise ImproperlyConfigu...
[ "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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
build a new timer and add it to the set of running timers.
[ "public Timer newTimer(String opType, int sampleCount)\n {\n final Timer timer = new Timer(sampleCount);\n\n if (!timers.containsKey(opType))\n timers.put(opType, new ArrayList<Timer>());\n\n timers.get(opType).add(timer);\n return timer;\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Set the rules of this Validator. @param string $lang @param string $langDir @return Validator
[ "public function setLanguage($lang = 'en', $langDir = __DIR__ . '/lang/')\n {\n $this->lang = $lang;\n $this->langDir = $langDir;\n\n $langFile = realpath($langDir . $lang . '.php');\n if (!file_exists($langFile)) {\n throw new \\InvalidArgumentException('No such file: '...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get all fields defined in custom modules. @return array All fields defined in custom modules.
[ "private function getAllCustomFields() {\n $fields = [];\n\n $this->moduleHandler->alter('acm_sku_base_field_additions', $fields);\n\n foreach ($fields as $field_code => $field) {\n $fields[$field_code] = $this->applyDefaults($field_code, $field);\n }\n\n return $fields;\n }" ]
[ "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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Update folder. Updates a folder
[ "def update_folder(self, id, hidden=None, lock_at=None, locked=None, name=None, parent_folder_id=None, position=None, unlock_at=None):\r\n \r\n path = {}\r\n data = {}\r\n params = {}\r\n\r\n # REQUIRED - PATH - id\r\n \"\"\"ID\"\"\"\r\n path[\"id\"] = id\r\n\r\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ "func (in *ObjectReference) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}" ]
[ "function customizer(destination, source) {\n // If we're not working with a plain object, copy the value as is\n // If source is an array, for instance, it will replace destination\n if (!isPlain(source)) {\n return source;\n }\n\n // If the new value is a plain object but the first object value is not\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the node's class identifier @return string|bool|string|null
[ "public function classIdentifier()\n {\n if ( $this->ClassIdentifier === null )\n {\n $object = $this->object();\n $this->ClassIdentifier = $object->contentClassIdentifier();\n }\n\n return $this->ClassIdentifier;\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 post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Parse from a byte array (containing utf-8 encoded string with the Python literal expression in it)
[ "public Ast parse(byte[] serialized) throws ParseException\n\t{\n\t\ttry {\n\t\t\treturn parse(new String(serialized, \"utf-8\"));\n\t\t} catch (UnsupportedEncodingException e) {\n\t\t\tthrow new ParseException(e.toString());\n\t\t}\n\t}" ]
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Check a parsed packet and figure out if it is an Eddystone Beacon. If it is , return the relevant data as a dictionary. Return None, it is not an Eddystone Beacon advertising packet
[ "def decode(self, packet):\n \"\"\"\"\"\"\n\n ssu=packet.retrieve(\"Complete uuids\")\n found=False\n for x in ssu:\n if EDDY_UUID in x:\n found=True\n break\n if not found:\n return None\n\n found=False\n adv=packe...
[ "def sanitize(self):\n '''\n \n '''\n super(MapRegisterMessage, self).sanitize()\n\n # P: This is the proxy-map-reply bit, when set to 1 an ETR sends a Map-\n # Register message requesting for the Map-Server to proxy Map-Reply.\n # The Map-Server will send non-author...
codesearchnet
{ "query": "Represent the comment about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code:" }
Append an integer index array of values to this XML document @param array $data @param string $elementName @param string|null $nsPrefix @param string|null $nsUri @return bool
[ "public function appendList(array $data, $elementName, $nsPrefix = null, $nsUri = null)\n {\n if (null === $nsPrefix) {\n foreach ($data as $value) {\n $this->writeElement($elementName, $value);\n }\n } else {\n foreach ($data as $value) {\n ...
[ "function typecastPropertyValue ($name, $v)\n {\n if ($this->isScalar ($name) && $this->isEnum ($name))\n $this->validateEnum ($name, $v);\n\n $type = $this->getTypeOf ($name);\n if ($type && !type::validate ($type, $v))\n throw new ComponentException ($this->component,\n sprintf (\n ...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
/* Get a Uint8 array of pixel values: [r, g, b, a, r, g, b, a, ...] Length of the array will be width * height * 4.
[ "function getPixelArray() {\n var gl = store.get('gl')\n var w = this._.texture.width;\n var h = this._.texture.height;\n var array = new Uint8Array(w * h * 4);\n this._.texture.drawTo(function() {\n gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, array);\n });\n return array;\n}" ]
[ "def getPixelValue(self, x, y):\n \"\"\"\"\"\"\n assert x < self.size, \"x: %d<%d\" % (x, self.size)\n assert y < self.size, \"y: %d<%d\" % (y, self.size)\n # Same as calcOffset, inlined for performance reasons\n offset = x + self.size * (self.size - y - 1)\n #print offset\...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
Marshall the given parameter object.
[ "public void marshall(ListOfferingsRequest listOfferingsRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (listOfferingsRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(listO...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns the considered object.
[ "def get_object(self, queryset=None):\n \n profile, dummy = ForumProfile.objects.get_or_create(user=self.request.user)\n return profile" ]
[ "@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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Converts a sequence of indices into their corresponding labels.
[ "def indices_to_labels(self, indices: Sequence[int]) -> List[str]:\n \n\n return [(self.INDEX_TO_LABEL[index]) for index in indices]" ]
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetDomainName sets the DomainName field's value.
[ "func (s *CertificateDetail) SetDomainName(v string) *CertificateDetail {\n\ts.DomainName = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - allow writing per character, auto flush per line
[ "function chars(target, splitExp) {\n\t\tvar inst = core.base();\n\t\tinst.textBuffer = '';\n\t\tinst.enabled = true;\n\t\tinst.splitExp = (splitExp || /(.*?)\\r?\\n/g);\n\n\t\tinst.useTarget = function (target) {\n\t\t\tinst.target = (target || {\n\t\t\t\t// dummy\n\t\t\t\twriteln: function () {\n\t\t\t\t\t//nothi...
[ "def new_station(self, _id, callSign, name, affiliate, fccChannelNumber):\n \"\"\"\"\"\"\n\n if self.__v_station:\n # [Station: 11440, WFLX, WFLX, Fox Affiliate, 29]\n # [Station: 11836, WSCV, WSCV, TELEMUNDO (HBC) Affiliate, 51]\n # [Station: 11867, TBS, Turner Broadc...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Private constructor: create graph from the given Python objects. The constructor examines the referents of each given object to build up a graph showing the objects and their links.
[ "def _from_objects(cls, objects):\n \n vertices = ElementTransformSet(transform=id)\n out_edges = KeyTransformDict(transform=id)\n in_edges = KeyTransformDict(transform=id)\n for obj in objects:\n vertices.add(obj)\n out_edges[obj] = []\n in_edges[...
[ "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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
==================================================================================================
[ "public static void main(String[] args)\n {\n if (args.length != 2)\n {\n System.err.println(\"Usage: StyleImport <url> <output_file>\");\n System.exit(0);\n }\n \n try\n {\n StyleImport si = new StyleImport(args[0]);\n FileOut...
[ "def closeEvent(self, event):\n \n\n self.save_config(self.gui_settings['gui_settings'])\n self.script_thread.quit()\n self.read_probes.quit()\n event.accept()\n\n print('\\n\\n======================================================')\n print('================= Closin...
codesearchnet
{ "query": "Represent the Github sentence about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code:" }
Validates sortable list @param SS_List $list @throws Exception
[ "public function validateSortField(SS_List $list)\n {\n $field = $this->getSortField();\n\n // Check extra fields on many many relation types\n if ($list instanceof ManyManyList) {\n $extra = $list->getExtraFields();\n\n if ($extra && array_key_exists($field, $extra)) {...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
clean the given source from space, comments, etc... @private
[ "function minify(src) {\n // remove comments\n src = src.replace(/\\/\\*[\\s\\S]*?\\*\\/|([^\\\\:]|^)\\/\\/.*$/gm, \"$1\"); // Remove leading and trailing whitespace from lines\n\n src = src.replace(/(\\\\n\\s+)|(\\s+\\\\n)/g, \"\"); // Remove line breaks\n\n src = src.replace(/(\\\\r|\\\\n)...
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
=========================================================================
[ "public function init()\n {\n parent::init();\n self::$plugin = $this;\n\n $this->setComponents([\n 'campaignmonitor' => \\clearbold\\cmservice\\services\\CampaignMonitorService::class,\n ]);\n\n Craft::info(\n Craft::t(\n 'cm-service',\n ...
[ "public static function protect()\n\t{\n\t\t$eye = \\Cli::color(\"*\", 'green');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"PROTECT ALL HUMANS\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli:...
codesearchnet
{ "query": "Represent the text about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code about Programming:" }
Internal implementation of adding a single model to the set, updating hash indexes for `id` and `cid` lookups. Returns the model, or 'false' if validation on a new model fails.
[ "function(model, options) {\n options || (options = {});\n model = this._prepareModel(model, options);\n if (!model) return false;\n var already = this.getByCid(model) || this.get(model);\n if (already) throw new Error([\"Can't add the same model to a set twice\", already.id]);\n this....
[ "def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
--------------------------------------------------------------------------------------------
[ "public static DeploymentEntry create(Map<String, Object> config) {\n\t\treturn new DeploymentEntry(ConfigUtil.normalizeYaml(config));\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 text about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code about programming:" }
// GetSize will return the terminal window size. // // We prefer environ $LINES/$COLUMNS, then fall back to tty-held information. // We do not support use of termcap/terminfo to derive default size information.
[ "func GetSize() (*Size, error) {\n\tenvSize := GetEnvWindowSize()\n\tif envSize != nil && envSize.Lines != 0 && envSize.Columns != 0 {\n\t\treturn envSize, nil\n\t}\n\n\tfh, err := os.Open(\"/dev/tty\")\n\tif err != nil {\n\t\t// no tty, no point continuing; we only let the environ\n\t\t// avoid an error in this ca...
[ "def menuconfig(kconf):\n \n global _kconf\n global _conf_filename\n global _conf_changed\n global _minconf_filename\n global _show_all\n\n _kconf = kconf\n\n # Load existing configuration and set _conf_changed True if it is outdated\n _conf_changed = _load_config()\n\n # Filename to s...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
/* Settings related methods.
[ "@Override\n protected void createSharedPreferences() {\n super.createSharedPreferences();\n\n this.sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n\n // problem that the first call to getAll() returns nothing, apparently the\n // following two calls have to ...
[ "@Override\n public void init(ApplicationConfig config) \n \tthrows ServletException {\n\n // The ApplicationConfig is used by the Application to configure itself.\n mConfig = config;\n\n // A log for keeping track of events specific to this application\n mLog = config.getLog();\n\...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Generate a single module that is produced by accumulating and overriding each module with the next. <pre> {@code Guice.createInjector(ModuleUtils.combineAndOverride(moduleA, moduleAOverrides, moduleB)); } </pre> @param modules @return
[ "public static Module combineAndOverride(List<? extends Module> modules) {\n Iterator<? extends Module> iter = modules.iterator();\n Module current = Modules.EMPTY_MODULE;\n if (iter.hasNext()) {\n current = iter.next();\n if (iter.hasNext()) {\n current = M...
[ "private SomeCommandAnnotatedObject create(final String name, ExecutionContext executionContext) {\n return executionContext.add(this, someCommandAnnotatedObjects.create(name));\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Language and Writing:" }
// Delete removes an item. It doesn't add it to the queue, because // this implementation assumes the consumer only cares about the objects, // not the order in which they were created/added.
[ "func (f *FIFO) Delete(obj interface{}) error {\n\tid, err := f.keyFunc(obj)\n\tif err != nil {\n\t\treturn KeyError{obj, err}\n\t}\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\tf.populated = true\n\tdelete(f.items, id)\n\treturn err\n}" ]
[ "public long appendEntry(JournalEntry entry) {\n // TODO(gpang): handle bounding the queue if it becomes too large.\n\n /**\n * Protocol for appending entries\n *\n * This protocol is lock free, to reduce the overhead in critical sections. It uses\n * {@link AtomicLong} and {@link ConcurrentLi...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about text processing:" }