query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Gets all the project permissions granted to user for the specified project. @return the project permissions. An empty list is returned if project or user do not exist.
[ "public List<String> selectProjectPermissionsOfUser(DbSession dbSession, int userId, long projectId) {\n return mapper(dbSession).selectProjectPermissionsOfUser(userId, projectId);\n }" ]
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the Github post about permissions:", "pos": "Represent the Github code about permissions:", "neg": "Represent the Github code about Software development:" }
setPageDeleted - A way of making pages appear deleted without deleting the DB entries @param PageEntity $page @param string $modifiedByUserId @param string $modifiedReason @return bool
[ "public function setPageDeleted(\n PageEntity $page,\n string $modifiedByUserId,\n string $modifiedReason = Tracking::UNKNOWN_REASON\n ) {\n $pageType = $page->getPageType();\n\n if (strpos($pageType, self::PAGE_TYPE_DELETED) !== false) {\n return;//This page is alre...
[ "public function onDelete()\n {\n $this->validateRequestTheme();\n\n $type = Request::input('templateType');\n\n $this->loadTemplate($type, trim(Request::input('templatePath')))->delete();\n\n /*\n * Extensibility - documented above\n */\n $this->fireSystemEvent...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
// Generates the tree nodes
[ "func (self *Tree) Generate(blocks [][]byte, hashf hash.Hash) error {\n\tblockCount := uint64(len(blocks))\n\tif blockCount == 0 {\n\t\treturn errors.New(\"Empty tree\")\n\t}\n\theight, nodeCount := CalculateHeightAndNodeCount(blockCount)\n\tlevels := make([][]Node, height)\n\tnodes := make([]Node, nodeCount)\n\n\t...
[ "@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:" }
Get all key-value pair that the key is not directory. @param string $root @param boolean $recursive @param string $key @return array
[ "public function getKeyValueMap($root = '/', $recursive = true, $key = null)\n {\n $this->listSubdirs($root, $recursive);\n if (isset($this->values[ $key ])) {\n return $this->values[ $key ];\n }\n\n return $this->values;\n }" ]
[ "public function help()\n {\n $style = new Eurekon\\Style(' *** RUN - HELP ***');\n Eurekon\\Out::std($style->color('fg', Eurekon\\Style::COLOR_GREEN)->get());\n Eurekon\\Out::std('');\n\n $help = new Eurekon\\Help('...', true);\n $help->addArgument('', 'directory', 'Config dir...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about NLP:" }
generates real LockedObjects for the resource at path and its parent folders. does not create new LockedObjects if they already exist @param path path to the (new) LockedObject @return the LockedObject for path.
[ "private LockedObject generateLockedObjects( String path ) {\n if (!locks.containsKey(path)) {\n LockedObject returnObject = new LockedObject(this, path, !temporary);\n String parentPath = getParentPath(path);\n if (parentPath != null) {\n LockedObject parentLo...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get a **killCursors** message.
[ "def kill_cursors(cursor_ids):\n \n num_cursors = len(cursor_ids)\n pack = struct.Struct(\"<ii\" + (\"q\" * num_cursors)).pack\n op_kill_cursors = pack(0, num_cursors, *cursor_ids)\n return __pack_message(2007, op_kill_cursors)" ]
[ "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 summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Basically returns everything after ";charset=". If no charset specified, uses the HTTP default (ASCII) character set. @param type The content type to extract the charset from. @return The charset encoding.
[ "public static String getCharsetFromContentType(String type) {\n \tinit();\n if (type == null) {\n return null;\n }\n\n int semi = type.indexOf(\";\");\n\n if (semi == -1) {\n return null;\n }\n\n String afterSemi = type.substring(semi + 1);\n\n ...
[ "public static String pathEncode(String path, Charset charset) {\n return encodeReserved(path, FragmentType.PATH_SEGMENT, charset);\n\n /*\n * path encoding is not equivalent to query encoding, there are few differences, namely dealing\n * with spaces, !, ', (, ), and ~ characters. we will need to man...
codesearchnet
{ "query": "Represent the Github post about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Programming:" }
Executes the query, gets the samples @return ArrayList
[ "public function execute() {\n\t\t$results = ArrayList::create();\n\t\tforeach($this->classes as $c) {\n\n\t\t\tif($this->isOmitted($c)) continue;\n\n\t\t\t$list = DataList::create($c)\n\t\t\t\t\t\t->filter('ClassName', $c)\n\t\t\t\t\t\t->limit($this->getLimitFor($c))\n\t\t\t\t\t\t->sort(\"RAND()\");\n\n\t\t\tforea...
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// forward dials the remote host specific in req, upgrades the request, starts // listeners for each port specified in ports, and forwards local connections // to the remote host via streams.
[ "func (pf *PortForwarder) forward() error {\n\tvar err error\n\n\tlistenSuccess := false\n\tfor i := range pf.ports {\n\t\tport := &pf.ports[i]\n\t\terr = pf.listenOnPort(port)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\tlistenSuccess = true\n\t\tdefault:\n\t\t\tif pf.errOut != nil {\n\t\t\t\tfmt.Fprintf(pf.errOut, ...
[ "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 comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Determine the current usage for each limit of this service, and update corresponding Limit via :py:meth:`~.AwsLimit._add_current_usage`.
[ "def find_usage(self):\n \n logger.debug(\"Checking usage for service %s\", self.service_name)\n self.connect()\n for lim in self.limits.values():\n lim._reset_usage()\n\n self.limits['Auto Scaling groups']._add_current_usage(\n len(\n paginate...
[ "def SaveResourceUsage(self, client_id, status):\n \"\"\"\"\"\"\n # Per client stats.\n self.hunt_obj.ProcessClientResourcesStats(client_id, status)\n # Overall hunt resource usage.\n self.UpdateProtoResources(status)" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
====================
[ "protected boolean hasAnnotation(MethodInvocation invocation, Class<? extends Annotation> annoType) {\n if (hasAnnotationOnClass(invocation, annoType)) {\n return true;\n }\n if (hasAnnotationOnMethod(invocation, annoType)) {\n return true;\n }\n return false...
[ "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 text about Language and Writing:", "pos": "Represent the code about Language and Writing:", "neg": "Represent the code:" }
For fast length comparison
[ "def dist_sq(self, other=None):\n \n v = self - other if other else self\n return sum(map(lambda a: a * a, v))" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Get the previously saved simulation period.
[ "def GET_savedtimegrid(self) -> None:\n \"\"\"\"\"\"\n try:\n self._write_timegrid(state.timegrids[self._id])\n except KeyError:\n self._write_timegrid(hydpy.pub.timegrids.init)" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Calls the registered config scope modifiers to give them an opportunity to prepare the scope object prior to evaluating the config JavaScript @param scope The object representing the execution scope for the evaluation.
[ "protected void callConfigScopeModifiers(Scriptable scope) {\r\n\t\tif( aggregator.getPlatformServices() != null){\r\n\t\t\tIServiceReference[] refs = null;\r\n\t\t\ttry {\r\n\t\t\t\trefs = aggregator.getPlatformServices().getServiceReferences(IConfigScopeModifier.class.getName(), \"(name=\"+getAggregator().getNam...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// checkStructure compares the provided config to the empty config.CloudConfig // structure. Each node is checked to make sure that it exists in the known // structure and that its type is compatible.
[ "func checkStructure(cfg node, report *Report) {\n\tg := NewNode(config.CloudConfig{}, NewContext([]byte{}))\n\tcheckNodeStructure(cfg, g, report)\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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get all ID's from the sounds pool. @param {Number} id Only return one ID if one is passed. @return {Array} Array of IDs.
[ "function(id) {\n var self = this;\n\n if (typeof id === 'undefined') {\n var ids = [];\n for (var i=0; i<self._sounds.length; i++) {\n ids.push(self._sounds[i]._id);\n }\n\n return ids;\n } else {\n return [id];\n }\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// ObjectOperand converts x to an object. If the cast fails, a descriptive // error is returned.
[ "func ObjectOperand(x ast.Value, pos int) (ast.Object, error) {\n\to, ok := x.(ast.Object)\n\tif !ok {\n\t\treturn nil, NewOperandTypeErr(pos, x, \"object\")\n\t}\n\treturn o, nil\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the comment about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
@inheritdoc @param mixed $entityObject @throws Exception\InvalidEntityObjectException
[ "public function saveEntityObject($entityObject, $flagFlush = self::FLAG_PERSIST)\n {\n if (!is_object($entityObject)) {\n $errMsg = sprintf('Entity type %s is invalid.', gettype($entityObject));\n throw new Exception\\InvalidEntityObjectException($errMsg);\n }\n\n $cla...
[ "protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Replaces liquid tag highlight directives with prettyprint HTML tags. @param {String} The text for a post @return {String}
[ "function(data) {\n data = data.replace(/{% highlight ([^ ]*) %}/g, '<pre class=\"prettyprint lang-$1\">');\n data = data.replace(/{% endhighlight %}/g, '</pre>');\n return data;\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 post about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code about programming:" }
// Contains tests whether a given port falls within the PortRange.
[ "func (pr *PortRange) Contains(p int) bool {\n\treturn (p >= pr.Base) && ((p - pr.Base) < pr.Size)\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:" }
A plugin for generating showing ascii artz
[ "def icanhazascii(client, channel, nick, message, found):\n \n global FLOOD_RATE, LAST_USED\n now = time.time()\n\n if channel in LAST_USED and (now - LAST_USED[channel]) < FLOOD_RATE:\n return\n\n LAST_USED[channel] = now\n return found" ]
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
// newEndpointImpl creates a new endpoint for the given resourceName. // This is to be used during normal device plugin registration.
[ "func newEndpointImpl(socketPath, resourceName string, callback monitorCallback) (*endpointImpl, error) {\n\tclient, c, err := dial(socketPath)\n\tif err != nil {\n\t\tklog.Errorf(\"Can't create new endpoint with path %s err %v\", socketPath, err)\n\t\treturn nil, err\n\t}\n\n\treturn &endpointImpl{\n\t\tclient: ...
[ "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 about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param param1 the sole parameter
[ "public void tracev(String format, Object param1) {\n if (isEnabled(Level.TRACE)) {\n doLog(Level.TRACE, FQCN, format, new Object[] { param1 }, null);\n }\n }" ]
[ "public final String trace() {\n // TODO(lukes): textifier has support for custom label names by overriding appendLabel.\n // Consider trying to make use of (using the Label.info field? adding a custom NamedLabel\n // sub type?)\n Textifier textifier =\n new Textifier(Opcodes.ASM7) {\n {...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Writes data to tempfile and sets -infile parameter data -- list of lines, ready to be written to file
[ "def _input_as_lines(self,data):\n \n if data:\n self.Parameters['--in']\\\n .on(super(Clearcut,self)._input_as_lines(data))\n return ''" ]
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Recurse child options concat to string. @private @memberof Compare @param {object} obj - the child object. @returns {string}
[ "function recurseChildOptions(obj, level){\n var child = '',\n len = Object.keys(obj).length,\n ctr = 0,\n prefix;\n level = level || 1;\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop)){\n var tab ...
[ "function function_ (options) {\n options.hash.kind = 'function'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find function.'\n}" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// Int32Field adds a single int32 field to the event.
[ "func Int32Field(name string, value int32) FieldOpt {\n\treturn func(em *eventMetadata, ed *eventData) {\n\t\tem.writeField(name, inTypeInt32, outTypeDefault, 0)\n\t\ted.writeInt32(value)\n\t}\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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// DeleteCollection deletes a collection of objects.
[ "func (c *FakeLimitRanges) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {\n\taction := testing.NewDeleteCollectionAction(limitrangesResource, c.ns, listOptions)\n\n\t_, err := c.Fake.Invokes(action, &corev1.LimitRangeList{})\n\treturn err\n}" ]
[ "function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Return a thumbnail filename for the given ``thumbnail_options`` dictionary and ``source_name`` (which defaults to the File's ``name`` if not provided).
[ "def get_thumbnail_name(self, thumbnail_options, transparent=False,\n high_resolution=False):\n \n thumbnail_options = self.get_options(thumbnail_options)\n path, source_filename = os.path.split(self.name)\n source_extension = os.path.splitext(source_filename)[1...
[ "def _get_metadata_path_for_display(self, name):\n \n try:\n # We need to access _get_metadata_path() on the provider object\n # directly rather than through this class's __getattr__()\n # since _get_metadata_path() is marked private.\n path = self._provider...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Direct connection, with given |handler| and random URL. @param handler the statement handler @return the configured connection @throws IllegalArgumentException if handler is null
[ "public static acolyte.jdbc.Connection connection(StatementHandler handler) {\n return connection(handler, (Properties) null);\n }" ]
[ "@Override\n protected <T1, R extends Completes<?>> R dispatchQuery(BiFunction<P, T1, R> query, T1 routable1) {\n throw new UnsupportedOperationException(\"query protocols are not supported by this router by default\");\n }" ]
codesearchnet
{ "query": "Represent the comment about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about Software development:" }
Enable blade optimisations. @return void
[ "protected function enableBladeOptimisations()\n {\n $app = $this->app;\n\n $app->view->getEngineResolver()->register('blade', function () use ($app) {\n $compiler = $app['htmlmin.compiler'];\n\n return new CompilerEngine($compiler);\n });\n\n $app->view->addExte...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Verifica Se a string encontrada diz respeito a uma hora, minuto ou segundo @param string $time
[ "private function checkNameHour(string $time)\n {\n if (preg_match('/\\s*\\d{1,2}\\s*(h|hour|hora|hs|hr|hrs)\\s*/i', $time)) {\n $this->setCerteza(\"h\", $time);\n }\n\n if (preg_match('/\\s*\\d{1,2}\\s*(m|min|minuto)\\s*/i', $time)) {\n $this->setCerteza(\"i\", $time);...
[ "def associar_assinatura(self, sequencia_cnpj, assinatura_ac):\n \n retorno = super(ClienteSATLocal, self).\\\n associar_assinatura(sequencia_cnpj, assinatura_ac)\n # (!) resposta baseada na redação com efeitos até 31-12-2016\n return RespostaSAT.associar_assinatura(retorn...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// initOriginAndBound sets the origin containment for the given point and then calls // the initialization for the bounds objects and the internal index.
[ "func (l *Loop) initOriginAndBound() {\n\tif len(l.vertices) < 3 {\n\t\t// Check for the special \"empty\" and \"full\" loops (which have one vertex).\n\t\tif !l.isEmptyOrFull() {\n\t\t\tl.originInside = false\n\t\t\treturn\n\t\t}\n\n\t\t// This is the special empty or full loop, so the origin depends on if\n\t\t//...
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
http://stackoverflow.com/questions/1175208/ elegant-python-function-to-convert-camelcase-to-camel-case
[ "def camel_to_snake(name):\n \n s1 = FIRST_CAP_RE.sub(r'\\1_\\2', name)\n return ALL_CAP_RE.sub(r'\\1_\\2', s1).lower()" ]
[ "def get_mode(self):\n \n # http://stackoverflow.com/questions/10797819/finding-the-mode-of-a-list-in-python\n return max(set(self._entry_scores), key=self._entry_scores.count)" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Mathematics:" }
Factory method to use in order to get a {@link RemoteOracle} instance. @param suggest_type The type of suggestion wanted. @param textbox The text box to wrap to provide suggestions to.
[ "public static SuggestBox newSuggestBox(final String suggest_type,\n final TextBoxBase textbox) {\n final RemoteOracle oracle = new RemoteOracle(suggest_type);\n final SuggestBox box = new SuggestBox(oracle, textbox);\n oracle.requester = box;\n return box;\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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Set new translations to the dictionary. @param array $translations
[ "protected function addTranslations(array $translations)\n {\n $domain = $translations['domain'] ?? '';\n\n //Set the first domain loaded as default domain\n if ($this->domain === null) {\n $this->domain = $domain;\n }\n\n if (isset($this->dictionary[$domain])) {\n ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Checks if any element in the set contains the term. @param set set to check @param term term to search for @return true if any element contains the term
[ "protected boolean setContainsGeneralTerm(Set<String> set, String term)\n\t{\n\t\tfor (String s : set)\n\t\t{\n\t\t\tif (s.contains(term)) return true;\n\t\t}\n\t\treturn false;\n\t}" ]
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
m.summary() -- Return a text string one-line summary of motif and its metrics
[ "def summary(self):\n \n m = self\n txt = \"%-34s (Bits: %5.2f MAP: %7.2f D: %5.3f %3d) E: %7.3f\"%(\n m, m.totalbits, m.MAP, m.seeddist, m.seednum, nlog10(m.pvalue))\n if m.binomial!=None: txt = txt + ' Bi: %6.2f'%(nlog10(m.binomial))\n if m.church != None: txt...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the description about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
Add the requested post parameters to the Request. @param request Request to add post params to
[ "private void addPostParams(final Request request) {\n if (assetVersions != null) {\n for (String prop : assetVersions) {\n request.addPostParam(\"AssetVersions\", prop);\n }\n }\n\n if (functionVersions != null) {\n for (String prop : functionVer...
[ "@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
// Init is not implemented.
[ "func (d *VppDriver) Init(info *core.InstanceInfo) error {\n\tlog.Infof(\"Initializing vppdriver\")\n\n\treturn nil\n}" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github instruction about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Software development:" }
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
[ "@Override\n public Request<DeleteKeyPairRequest> getDryRunRequest() {\n Request<DeleteKeyPairRequest> request = new DeleteKeyPairRequestMarshaller().marshall(this);\n request.addParameter(\"DryRun\", Boolean.toString(true));\n return request;\n }" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github instruction about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Software development:" }
Convenience method for resolving name schema. @param \eZ\Publish\API\Repository\Values\Content\Content $content @param array $fieldMap @param array $languageCodes @return array
[ "protected function mergeFieldMap(Content $content, array $fieldMap, array $languageCodes)\n {\n if (empty($fieldMap)) {\n return $content->fields;\n }\n\n $mergedFieldMap = array();\n\n foreach ($content->fields as $fieldIdentifier => $fieldLanguageMap) {\n fore...
[ "private function getContentType(Content $content): EzContentType\n {\n if (method_exists($content, 'getContentType')) {\n return $content->getContentType();\n }\n\n // @deprecated Remove when support for eZ kernel < 7.4 ends\n\n return $this->contentTypeService->loadConten...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Java programming:" }
//add by xtlx2000
[ "func EventBoxFromObject(object *glib.GObject) *EventBox {\n\treturn &EventBox{Bin{Container{Widget{C.toGWidget(object.Object)}}}}\n}" ]
[ "def _build_msg_content(self, msgtype='text', **kwargs):\n \n data = {'msgtype': msgtype}\n if msgtype == 'text':\n data[msgtype] = {'content': kwargs.get('content')}\n elif msgtype == 'image' or msgtype == 'voice' or msgtype == 'file':\n data[msgtype] = {'media_id'...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Splits table sql into indexed array @param string $sql @return array|bool
[ "private function splitTabSql($sql)\n {\n $result = [];\n //find opening bracket, get the prefix along with it\n $openBracketPos = $this->getDelimiterPos($sql, 0, '(');\n\n if ($openBracketPos === false) {\n trigger_error('[WARNING] can not find opening bracket in table def...
[ "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 Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Removes an event handler from the calendar. @param l the event handler to remove
[ "public final void removeEventHandler(EventHandler<CalendarEvent> l) {\n if (l != null) {\n if (MODEL.isLoggable(FINER)) {\n MODEL.finer(getName() + \": removing event handler: \" + l); //$NON-NLS-1$\n }\n eventHandlers.remove(l);\n }\n }" ]
[ "function makeEventDispatcher(obj) {\n $.extend(obj, {\n on: on,\n off: off,\n one: one,\n trigger: trigger,\n _EventDispatcher: true\n });\n // Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,\n ...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
[ "function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {\n\t // convert -0 to +0\n\t if (NEGATIVE_ZERO$1) return $native$1.apply(this, arguments) || 0;\n\t var O = _toIobject(this);\n\t var length = _toLength(O.length);\n\t var index = length - 1;\n\t if (arguments.length > 1) index = Mat...
[ "Rule FirstOfS(Object rule, Object rule2, Object... moreRules) {\r\n return FirstOf(rule, rule2, moreRules).label(\"FirstOf\").skipNode();\r\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Language and Writing:" }
Create tags when creating the configuration. @param tags Create tags when creating the configuration. @return Returns a reference to this object so that method calls can be chained together.
[ "public CreateConfigurationRequest withTags(java.util.Map<String, String> tags) {\n setTags(tags);\n return this;\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 instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
----------------------------------------------------------------------------- Arrows and Line Marks
[ "function drawLineMark(x, type) {\n const p = x.perpendicularVector.scale(6);\n const n = x.normalVector.scale(3);\n const m = x.midpoint;\n\n switch (type) {\n case 'bar':\n return drawPath(m.add(p), m.add(p.inverse));\n case 'bar2':\n return drawPath(m.add(n).add(p), m.add(n).add(p.inverse)) +...
[ "def _print_help(self):\n \"\"\"\"\"\"\n msg = \"\"\"Commands (type help <command> for details)\n\nCLI: help history exit quit\nSession, General: set load save reset\nSession, Access Control: allowaccess denyaccess clearaccess\nSession, Replication: allowrep denyrep prefe...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
To build BigtableDataSettings#sampleRowKeysSettings with default Retry settings.
[ "private static void buildSampleRowKeysSettings(Builder builder, BigtableOptions options) {\n RetrySettings retrySettings =\n buildIdempotentRetrySettings(builder.sampleRowKeysSettings().getRetrySettings(), options);\n\n builder.sampleRowKeysSettings()\n .setRetrySettings(retrySettings)\n ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Waits for our asynchronous result and returns it if all is well. If anything goes wrong (a timeout or a asynchronous call failure) the exception is logged and a {@link ServiceException} is thrown.
[ "public T waitForResult ()\n throws ServiceException\n {\n try {\n if (waitForResponse()) {\n return getArgument();\n } else {\n throw getError();\n }\n\n } catch (InvocationException ie) {\n // pass these through with...
[ "@Override\n protected int runTask(long ssl) {\n try {\n callback.handle(ssl, keyTypeBytes, asn1DerEncodedPrincipals);\n return 1;\n } catch (Exception e) {\n // Just catch the exception and return 0 to fail the handshake.\n // The problem is that rethrow...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
This method returns true only if the metadata for the service contains the given region in the list of supported regions.
[ "private boolean isServiceSupportedInRegion(String serviceName) {\n return partition.getServices().get(serviceName) != null\n && partition.getServices().get(serviceName).getEndpoints()\n .containsKey(region);\n }" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
UnmarshalThisMessage Method.
[ "public Object unmarshalThisMessage(String strXMLBody)\n {\n try {\n Reader inStream = new StringReader(strXMLBody);\n \n Object msg = this.unmarshalRootElement(inStream);\n \n inStream.close();\n \n return msg;\n } catch(Throwabl...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about File management:" }
Validates current entry and removes new entry if an older item exists in the repo @param localId local repository item ID (not the precise mongoID)
[ "protected void removeExistingEntity(String localId) {\n\t\tif (StringUtils.isEmpty(localId))\n\t\t\treturn;\n\t\tList<Scope> scopes = projectRepo.getScopeIdById(localId);\n\n\t\tif (CollectionUtils.isEmpty(scopes))\n\t\t\treturn;\n\n\t\tObjectId tempEntId = scopes.get(0).getId();\n\t\tif (localId.equalsIgnoreCase(...
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Encrypts the given attribute to a target location using the encryption options configured for that attribute
[ "def write_encrypted_attribute(attr_name, to_attr_name, cipher_class, options)\n value = send(attr_name)\n \n # Only encrypt values that actually have content and have not already\n # been encrypted\n unless value.blank? || value.encrypted?\n callback(\"before_encrypt_#{a...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// GetVersion fetches a specific version of a cookbooks data from the server api // GET /cookbook/foo/1.2.3 // GET /cookbook/foo/_latest // Chef API docs: https://docs.chef.io/api_chef_server.html#cookbooks-name-version
[ "func (c *CookbookService) GetVersion(name, version string) (data Cookbook, err error) {\n\turl := fmt.Sprintf(\"cookbooks/%s/%s\", name, version)\n\tc.client.magicRequestDecoder(\"GET\", url, nil, &data)\n\treturn\n}" ]
[ "def _generate_api_gateway(self):\n \n self.tf_conf['resource']['aws_api_gateway_rest_api']['rest_api'] = {\n 'name': self.resource_name,\n 'description': self.description\n }\n self.tf_conf['output']['rest_api_id'] = {\n 'value': '${aws_api_gateway_rest_...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Remove the specified category from storage. @param int $id @return Response
[ "public function destroy($id)\n {\n try {\n $this->repository->delete($id);\n\n return $this->redirect('categories.index');\n } catch (ModelNotFoundException $e) {\n return $this->redirectNotFound();\n }\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Returns the HREF of a dynamic choice parameter. Throws an error if this is not a choice parameter.
[ "def get_choice_href(self):\n \n if 'choiceInfo' not in self.dto[self.name]:\n raise GPException('not a choice parameter')\n\n return self.dto[self.name]['choiceInfo']['href']" ]
[ "private function getColumnFromName($name)\n {\n foreach ($this->columnConfiguration as $i => $col) {\n if ($col->getName() == $name) {\n return $col;\n }\n }\n\n // This exception should never happen. If it does, something is\n // wrong w/ the rel...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Returns the reload mode to use for the given changes.<p> @param fieldValues the field values @param editedFields the set of edited fields @return the reload mode
[ "private CmsReloadMode getReloadMode(Map<String, String> fieldValues, Set<String> editedFields) {\n\n for (String fieldName : editedFields) {\n if (checkContains(fieldName, CmsClientProperty.PROPERTY_DEFAULTFILE, CmsClientProperty.PROPERTY_NAVPOS)) {\n return CmsReloadMode.reloadPar...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Declarative Services method for unsetting the SerializationService service reference @param ref reference to service object; type of service object is verified
[ "protected void unsetSerializationService(ServiceReference<SerializationService> ref) {\n if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {\n LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, \"unsetSerializationService\", \"unsetti...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Send messages using qmail.
[ "public function isQmail()\n {\n $ini_sendmail_path = ini_get('sendmail_path');\n\n if (false === stripos($ini_sendmail_path, 'qmail')) {\n $this->Sendmail = '/var/qmail/bin/qmail-inject';\n } else {\n $this->Sendmail = $ini_sendmail_path;\n }\n $this->Mai...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Boot the service provider. @return void
[ "public function bootExtensionComponents()\n {\n if (!app('antares.installed')) {\n return;\n }\n\n $router = app(Router::class);\n $router->pushMiddlewareToGroup('web', Middleware::class);\n\n $path = realpath(__DIR__ . '/../');\n\n $this->addConfigComponent(...
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Does a simple HEAD request to a configuration endpoint to check if it's reachable. If not an IllegalStateException is thrown @param configUrl Full qualified configuration url
[ "private void assertRemotePropertiesServerIsAvailable(final URL configUrl) {\n\t\tnew HttpClient().send(\n\t\t\t\t\"HEAD\",\n\t\t\t\tconfigUrl.toExternalForm(),\n\t\t\t\tnew HashMap<String, String>(),\n\t\t\t\tnull,\n\t\t\t\tnew HttpClient.ResponseHandler<Void>() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Void handle...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github instruction about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about programming:" }
Renders the full XML output for this RSS feed @return string
[ "public function render()\n {\n $xml = new SimpleXMLElement(\n '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n <rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Update the collection's attributes. @param title [String] The title of the collection. @param description [String] The collection's description. (optional) @param private [Boolean] Whether to make the collection private. (optional)
[ "def update(title: nil, description: nil, private: nil)\n params = {\n title: title,\n description: description,\n private: private\n }.select { |k,v| v }\n updated = JSON.parse(connection.put(\"/collections/#{id}\", params).body)\n self.title = updated[\"title\"]\...
[ "function(terria) {\n CatalogGroup.call(this, terria, \"ckan\");\n\n /**\n * Gets or sets the URL of the CKAN server. This property is observable.\n * @type {String}\n */\n this.url = \"\";\n\n /**\n * Gets or sets a description of the custodian of the data sources in this group.\n * This property is...
codesearchnet
{ "query": "Represent the Github comment about Documentation:", "pos": "Represent the Github code about Documentation:", "neg": "Represent the Github code about AWS Redshift:" }
Returns the node path where defined user is stored.
[ "String getUserNodePath(String userName) throws RepositoryException\n {\n return service.getStoragePath() + \"/\" + JCROrganizationServiceImpl.STORAGE_JOS_USERS + \"/\" + userName;\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Load load plugin by config param. // This method need be called before domain init to inject global variable info during bootstrap.
[ "func Load(ctx context.Context, cfg Config) (err error) {\n\ttiPlugins := &plugins{\n\t\tplugins: make(map[Kind][]Plugin),\n\t\tversions: make(map[string]uint16),\n\t\tdyingPlugins: make([]Plugin, 0),\n\t}\n\n\t// Setup component version info for plugin running env.\n\tfor component, version := range cfg.E...
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Really odd function - used to help ensure we actually warn for duplicate keys.
[ "def _warn_dupkey(self, k):\n \n if self._privflags & PYCBC_CONN_F_WARNEXPLICIT:\n warnings.warn_explicit(\n 'Found duplicate keys! {0}'.format(k), RuntimeWarning,\n __file__, -1, module='couchbase_ffi.bucket', registry={})\n else:\n warnings....
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Auto Generated Code
[ "def get_stp_mst_detail_output_has_more(self, **kwargs):\n \n config = ET.Element(\"config\")\n get_stp_mst_detail = ET.Element(\"get_stp_mst_detail\")\n config = get_stp_mst_detail\n output = ET.SubElement(get_stp_mst_detail, \"output\")\n has_more = ET.SubElement(output, ...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the sentence about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code about File management:" }
Creates REST object @param mixed $first email address or apikey or OAuthToken @param string $last Null if using apikey or OAuthToken @return REST @ignore
[ "protected function createREST($first, $last = null, $api_url = self::API_URL)\n {\n if ($first instanceof OAuthToken) {\n $rest = new REST(array(\n 'server' => $api_url,\n 'debug_mode' => $this->debug_mode\n ));\n $auth = $first->getTokenType...
[ "def get_session_key(self, username, password_hash):\n \n\n params = {\"username\": username, \"authToken\": md5(username + password_hash)}\n request = _Request(self.network, \"auth.getMobileSession\", params)\n\n # default action is that a request is signed only when\n # a sessio...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Extracts the responder, action and parameter from an HTTP request.
[ "private function parsePath()\n {\n $components = array();\n $uri = $this->getUri();\n\n if ($uri !== false) {\n Logger::get()->debug('Parsing URI: ' . $uri);\n // Add the URL parameters.\n $components = $this->getHttpParameters();\n\n $matched = f...
[ "@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 description about Web development:", "pos": "Represent the Github code about Web development:", "neg": "Represent the Github code:" }
Przypina id wartości atrybutu do obiektu z id @param integer $attributeValueId id kategorii
[ "public function createAttributeValueRelation($attributeValueId)\n {\n //niepoprawna kategoria\n if (null === $attributeValueRecord = (new CmsAttributeValueQuery)\n ->findPk($attributeValueId)) {\n return;\n }\n //wyszukiwanie relacji\n $relationRecord...
[ "public static function byObjectAndClass($object = null, $objectId = null, $class = 'image')\n {\n //zapytanie o pliki po obiektach i id\n return (new self)\n ->whereObject()->equals($object)\n ->andFieldObjectId()->equals($objectId)\n ->whereClass()->eq...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Use this API to fetch lbvserver_filterpolicy_binding resources of given name .
[ "public static lbvserver_filterpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tlbvserver_filterpolicy_binding obj = new lbvserver_filterpolicy_binding();\n\t\tobj.set_name(name);\n\t\tlbvserver_filterpolicy_binding response[] = (lbvserver_filterpolicy_binding[]) obj.get_resources(ser...
[ "def reload(self):\n \"\"\"\"\"\"\n\n app_profile_pb = self.instance_admin_client.get_app_profile(self.name)\n\n # NOTE: _update_from_pb does not check that the project and\n # app_profile ID on the response match the request.\n self._update_from_pb(app_profile_pb)" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Upload one chunk to `upload_uri`.
[ "async def _put_chunk(\n cls, session: aiohttp.ClientSession,\n upload_uri: str, buf: bytes):\n \"\"\"\"\"\"\n # Build the correct headers.\n headers = {\n 'Content-Type': 'application/octet-stream',\n 'Content-Length': '%s' % len(buf),\n }\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Dummy function called after each event loop, this method only ensures the child process eventually exits (after 5 iterations).
[ "def on_loop(notifier, counter):\n \n if counter.count > 4:\n # Loops 5 times then exits.\n sys.stdout.write(\"Exit\\n\")\n notifier.stop()\n sys.exit(0)\n else:\n sys.stdout.write(\"Loop %d\\n\" % counter.count)\n counter.plusone()" ]
[ "def _shutdown_broker(self):\n \n if self.broker:\n self.broker.shutdown()\n self.broker.join()\n self.broker = None\n self.router = None\n\n # #420: Ansible executes \"meta\" actions in the top-level process,\n # meaning \"reset_connec...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// SetChildWorkflowExecutionCompletedEventAttributes sets the ChildWorkflowExecutionCompletedEventAttributes field's value.
[ "func (s *HistoryEvent) SetChildWorkflowExecutionCompletedEventAttributes(v *ChildWorkflowExecutionCompletedEventAttributes) *HistoryEvent {\n\ts.ChildWorkflowExecutionCompletedEventAttributes = v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
@param $table @param null $fields_info @param null $requested_fields @param null $requested_types @return array|\DreamFactory\Core\Database\Schema\ColumnSchema[] @throws \DreamFactory\Core\Exceptions\BadRequestException
[ "protected function getIdsInfo($table, $fields_info = null, &$requested_fields = null, $requested_types = null)\n {\n $idsInfo = [];\n if (empty($requested_fields)) {\n $requested_fields = [];\n /** @type ColumnSchema[] $idsInfo */\n $idsInfo = static::getPrimaryKey...
[ "public function GetListOfTablesInDatabase() {\n $dbConfig = new \\Puzzlout\\Framework\\Dal\\DbStatementConfig(null, \\Puzzlout\\Framework\\Dal\\DbExecutionType::SHOWTABLES, new \\Puzzlout\\Framework\\Dal\\DbQueryFilters());\n $dbConfig->setQuery(\"SHOW TABLES;\");\n $this->addDbConfigItem($dbC...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about database:" }
Placeholder to insert your own function to read subject-wise features.
[ "def get_features(subject_id):\n \"\"\n \n features_path = os.path.join(my_project,'base_features', subject_id, 'features.txt')\n feature_vector = np.loadtxt(features_path)\n \n return feature_vector" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Retrieve a specific RepositoryConfiguration
[ "def get_repository_configuration(id):\n \n\n response = utils.checked_api_call(pnc_api.repositories, 'get_specific', id=id)\n if response:\n return response.content" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Return a cached property value (if available) @param \DOMElement $element Element @return mixed|null Property value
[ "protected function getPropertyCache(\\DOMElement $element)\n {\n $elementHash = $element->getNodePath();\n return isset($this->propertyCache[$elementHash]) ? $this->propertyCache[$elementHash] : null;\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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
/* Create the response for rename apoc with impacted constraints and indexes
[ "private Stream<BatchAndTotalResultWithInfo> getResultOfBatchAndTotalWithInfo(Stream<BatchAndTotalResult> iterate, GraphDatabaseService db, String label, String rel, String prop) {\n\t\tList<String> constraints = new ArrayList<>();\n\t\tList<String> indexes = new ArrayList<>();\n\n\t\tif(label != null){\n\t\t\tIter...
[ "@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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Attach the given tag(s) to the model. @param mixed $tags @return void
[ "public function setTagsAttribute($tags): void\n {\n static::saved(function (self $model) use ($tags) {\n $model->syncTags($tags);\n });\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
This is a helper method to initialize event source for invalidation listener
[ "private boolean initEventSource() {\n boolean success = false;\n try {\n eventSource = ServerCache.cacheUnit.createEventSource(cacheConfig.useListenerContext, cacheName);\n } catch (Exception ex) {\n com.ibm.ws.ffdc.FFDCFilter.processException(ex, \"com.ibm.ws.cache.Cache...
[ "@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:" }
Inserts a new item into the timeline. (timeline.insert) @param Google_TimelineItem $postBody @param array $optParams Optional parameters. @return Google_Service_Mirror_TimelineItem
[ "public function insert(Google_Service_Mirror_TimelineItem $postBody, $optParams = array())\n {\n $params = array('postBody' => $postBody);\n $params = array_merge($params, $optParams);\n return $this->call('insert', array($params), \"Google_Service_Mirror_TimelineItem\");\n }" ]
[ "public function getTimes($limit = 100, $offset = 0)\n {\n /** @var TimeFbApi $response */\n $response = $this->call(new Request('time.get', array(), $limit, $offset), 'DVelopment\\FastBill\\Model\\TimeFbApi');\n\n return $response->getResponse()->getTimes();\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Works the same as async.map
[ "function(items, iterator, done) {\n done = done || function() {};\n var results = [];\n var failure = false;\n var expected = items.length;\n var actual = 0;\n var createIntermediary = function(index) {\n return function(err, result) {\n // Return if we found a failure anywhere.\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:" }
We consider two query builders with an equal SQL string and equal parameters to be equal. @param QueryBuilder $queryBuilder @return array @internal This method is public to be usable as callback. It should not be used in user code.
[ "public function getQueryBuilderPartsForCachingHash($queryBuilder)\n {\n return [\n $queryBuilder->getQuery()->getSQL(),\n array_map([$this, 'parameterToArray'], $queryBuilder->getParameters()->toArray()),\n ];\n }" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Get the destination folder @return mixed
[ "protected function getDestinationFolder()\n {\n $destination = \\Config::get('uploadPath');\n $folder = null;\n\n // Specify the target folder in the DCA (eval)\n if (isset($this->arrConfiguration['uploadFolder'])) {\n $folder = $this->arrConfiguration['uploadFolder'];\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Convert a validated point to a string conforming to https://community.wavefront.com/docs/DOC-1031. No validation is done here. @param point [Hash] a hash describing a point. See #write() for the format.
[ "def hash_to_wf(point)\n format('%s %s %s source=%s %s %s',\n *point_array(point)).squeeze(' ').strip\n rescue StandardError\n raise Wavefront::Exception::InvalidPoint\n end" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Composes AX request parameters. @return array AX parameters.
[ "protected function buildAxParams()\n {\n $params = [];\n if (!empty($this->requiredAttributes) || !empty($this->optionalAttributes)) {\n $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';\n $params['openid.ax.mode'] = 'fetch_request';\n $aliases = [];\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 post about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code:" }
如果包含中文字符,中文字符按两个长度计算 e.g. length('name', value, 0, 20);
[ "public static WebValidator length(String propertyName, String propertyValue, int start, int end) {\n\t\tWebValidator valid = new WebValidator(true, \"\");\n\t\tif (StringUtils.isBlank(propertyValue)) {\n\t\t\treturn valid;\n\t\t}\n\n\t\tint length = ValidatorUtils.length(propertyValue);\n\t\tif (start == 0 && leng...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about text processing:" }
Jackson serialization only
[ "@JsonProperty\n public Serializable getSerializable()\n {\n return new Serializable(type, value == null ? null : Utils.nativeValueToBlock(type, value));\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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Signatures provides the signatures on this JWS as opaque blobs, sorted by // keyID. These blobs can be stored and reassembled with payloads. Internally, // they are simply marshaled json web signatures but implementations should // not rely on this.
[ "func (js *JSONSignature) Signatures() ([][]byte, error) {\n\tsort.Sort(jsSignaturesSorted(js.signatures))\n\n\tvar sb [][]byte\n\tfor _, jsig := range js.signatures {\n\t\tp, err := json.Marshal(jsig)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsb = append(sb, p)\n\t}\n\n\treturn sb, nil\n}" ]
[ "func ExternalCAsEqualStable(a, b []*api.ExternalCA) bool {\n\t// because DeepEqual will treat an empty list and a nil list differently, we want to manually check this first\n\tif len(a) == 0 && len(b) == 0 {\n\t\treturn true\n\t}\n\t// The assumption is that each individual api.ExternalCA within both lists are cre...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Time returns a new time.Time for the given clock components. // It is meant to be used with the `OnDate` function.
[ "func (d date) Time(hour, min, sec, nsec int, loc *time.Location) time.Time {\n\treturn time.Date(0, 0, 0, hour, min, sec, nsec, loc)\n}" ]
[ "func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}" ]
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Computer Science:" }
Serialisiert die übergebenen Items. @param items @return
[ "private static byte[] persist(Item... items) {\n\t\tByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();\n\t\tDataOutputStream dataOutputStream = new DataOutputStream(arrayOutputStream);\n\n\t\t// Items sortieren, damit sich die Id nicht unnötig ändert.\n\t\tArrays.sort(items);\n\n\t\ttry {\n\t\t...
[ "protected function processEntityFormRequest(Entity $entity, FormData $requestData, $revision) {\n $dataName = 'layoutManager';\n \n if (isset($requestData->$dataName) && count($requestData->$dataName) > 0) {\n $serialized = $requestData->$dataName;\n } /*else {\n throw $this->err->validationE...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Validates the 7Zip settings
[ "private void validate7ZipSettings()\n\t{\n\t\tboolean flag = controller.is7ZipEnabled();\n\n\t\tsevenZipEnableBox.setSelected(flag);\n\t\tsevenZipLabel.setEnabled(flag);\n\t\tsevenZipPathField.setEnabled(flag);\n\t\tsevenZipSearchButton.setEnabled(flag);\n\t}" ]
[ "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:" }
// evalDuration evals a builtinTimeTimeTimeDiffSig. // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_timediff
[ "func (b *builtinTimeTimeTimeDiffSig) evalDuration(row chunk.Row) (d types.Duration, isNull bool, err error) {\n\tlhs, isNull, err := b.args[0].EvalTime(b.ctx, row)\n\tif isNull || err != nil {\n\t\treturn d, isNull, err\n\t}\n\n\trhs, isNull, err := b.args[1].EvalTime(b.ctx, row)\n\tif isNull || err != nil {\n\t\t...
[ "public function execute($sql) {\n //\n // TODO: check mysql_unbuffered_query() with mysql_free_result() for larger result sets\n // @see https://www.percona.com/blog/2006/06/26/handling-of-big-parts-of-data/\n // @see https://dev.mysql.com/doc/refman/5.7/en/mysql-use-resul...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Get the IDs of the file sets that this file belongs to. @return int[]
[ "public function getFileSetIDs()\n {\n $app = Application::getFacadeApplication();\n $db = $app->make(Connection::class);\n $rows = $db->fetchAll('select fsID from FileSetFiles where fID = ?', [$this->getFileID()]);\n $ids = array_map('intval', array_map('array_pop', $rows));\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 post about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about programming:" }
Get options saved. @since 1.1.2 @param array $params @return mixed
[ "public static function getOption(...$params)\n {\n $that = self::getInstance();\n\n $key = array_shift($params);\n\n $col[] = isset($that->settings[$key]) ? $that->settings[$key] : 0;\n\n if (! count($params)) {\n return ($col[0]) ? $col[0] : '';\n }\n\n fore...
[ "def setConfiguration(self, configuration):\n \n \"\"\"\n if isinstance(configuration, Configuration):\n configuration = configuration.value\n\n self.dev.set_configuration(configuration)" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param resource|null $part @return string
[ "public function getBody($part = null)\n {\n $data = $this->getPartData($part);\n $start = $data['starting-pos-body'];\n $end = $data['ending-pos-body'];\n\n return substr($this->text, $start, $end - $start);\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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
reseting password
[ "def gen_passwd(self):\n '''\n \n '''\n post_data = self.get_post_data()\n\n userinfo = MUser.get_by_name(post_data['u'])\n\n sub_timestamp = int(post_data['t'])\n cur_timestamp = tools.timestamp()\n if cur_timestamp - sub_timestamp < 600 and cur_timestamp > s...
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
@param Collection $settings @param string $section @param string $key @param string|null $owner @return Collection
[ "private function filter(Collection $settings, string $section, string $key, ?string $owner)\n {\n return $settings->filter(\n function (SettingInterface $setting) use ($section, $key, $owner) {\n return $section === $setting->getSection()\n && $key === $settin...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
this method is used when there's a known version
[ "private String getSha1(String name, String version) {\n if (dotHexCachePath == null || name == null || version == null){\n logger.warn(\"Can't calculate SHA1, missing information: .hex-cache = {}, name = {}, version = {}\", dotHexCachePath, name, version);\n return null;\n }\n ...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }