query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Validate non-optional parameters and return new instance.
[ "public function build(): SetShowFPSCounterRequest\n\t{\n\t\t$instance = new SetShowFPSCounterRequest();\n\t\tif ($this->show === null) {\n\t\t\tthrow new BuilderException('Property [show] is required.');\n\t\t}\n\t\t$instance->show = $this->show;\n\t\treturn $instance;\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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// calcDifficultyFrontier is the difficulty adjustment algorithm. It returns the // difficulty that a new block should have when created at time given the parent // block's time and difficulty. The calculation uses the Frontier rules.
[ "func calcDifficultyFrontier(time uint64, parent *types.Header) *big.Int {\n\tdiff := new(big.Int)\n\tadjust := new(big.Int).Div(parent.Difficulty, params.DifficultyBoundDivisor)\n\tbigTime := new(big.Int)\n\tbigParentTime := new(big.Int)\n\n\tbigTime.SetUint64(time)\n\tbigParentTime.SetUint64(parent.Time)\n\n\tif ...
[ "def _pdf_value(pdf, population, fitnesses, fitness_threshold):\n \n # Add the chance of obtaining a solution from the pdf\n # when the fitness for that solution exceeds a threshold\n value = 0.0\n for solution, fitness in zip(population, fitnesses):\n if fitness >= fitness_threshold:\n ...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Create new message of appropriate class. :type body: message body :param body: The body of the newly created message (optional). :rtype: :class:`boto.sqs.message.Message` :return: A new Message object
[ "def new_message(self, body=''):\n \n m = self.message_class(self, body)\n m.queue = self\n return m" ]
[ "def get_value_from_session(key):\n \n def value_from_session_function(service, message):\n \"\"\"Actual implementation of get_value_from_session function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Check if given path is an external asset or not. @param string $path @return bool
[ "protected function isExternal(string $path): bool\n {\n foreach ($this->schemes as $scheme) {\n if (strpos($path, $scheme) !== false) {\n return true;\n }\n }\n\n return false;\n }" ]
[ "public File getExistingDirectory(final String param) {\n return get(param, new StringToFile(),\n new And<>(new FileExists(), new IsDirectory()),\n \"existing directory\");\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Rebder the element's header content @param Descriptor $descriptor @return string
[ "protected function renderHeaderContent(Descriptor $descriptor) {\n\t\t$tagsLocator = $this->getTagsLocator();\n\t\t\n\t\t$title = '';\n\t\t\n\t\tif ($descriptor->hasLabel()) {\n\t\t\t$label = htmlspecialchars($descriptor->getLabel());\n\t\t\t$title .= $tagsLocator->label->render($label);\n\t\t}\n\t\t\n\t\t$title ...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
@param $key @return bool
[ "public function has($key)\n {\n list($section, $name) = explode('.', $key, 2);\n\n return Arr::has($this->getConfig($section), $name);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Add an exists clause to the query. @param \Closure $callback @param string $boolean @param bool $not @return $this
[ "public function whereExists(Closure $callback, $boolean = 'and', $not = false)\n {\n $type = $not ? 'NotExists' : 'Exists';\n\n $query = $this->newQuery();\n\n //\n call_user_func($callback, $query);\n\n $this->wheres[] = compact('type', 'operator', 'query', 'boolean');\n\n ...
[ "public static function forIndex(string $index, string $value, ?\\Throwable $previous = null): self\n {\n return new self(\"The node could not be found by ({$index}:{$value}).\", $previous);\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about text processing:" }
Returns true when the literal is a string containing a calc(). Use \{#special_number?} in preference to this. @param literal [Sass::Script::Value::Base] The value to check @return Boolean
[ "def calc?(literal)\n literal.is_a?(Sass::Script::Value::String) && literal.value =~ /calc\\(/\n end" ]
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Gets an existing metric or registers the given one. // The interface can be the metric to register if not found in registry, // or a function returning the metric for lazy instantiation.
[ "func (r *PrefixedRegistry) GetOrRegister(name string, metric interface{}) interface{} {\n\trealName := r.prefix + name\n\treturn r.underlying.GetOrRegister(realName, metric)\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 post about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about Software development:" }
Return grains pertaining to the operating system
[ "def os_data():\n '''\n \n '''\n grains = {\n 'num_gpus': 0,\n 'gpus': [],\n }\n\n # Windows Server 2008 64-bit\n # ('Windows', 'MINIONNAME', '2008ServerR2', '6.1.7601', 'AMD64',\n # 'Intel64 Fam ily 6 Model 23 Stepping 6, GenuineIntel')\n # Ubuntu 10.04\n # ('Linux'...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Método que normaliza las boletas electrónicas, dte 39 y 41 @param datos Arreglo con los datos del documento que se desean normalizar @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) @version 2018-06-15
[ "private function normalizar_boletas(array &$datos)\n {\n // cambiar tags de DTE a boleta si se pasaron\n if ($datos['Encabezado']['Emisor']['RznSoc']) {\n $datos['Encabezado']['Emisor']['RznSocEmisor'] = $datos['Encabezado']['Emisor']['RznSoc'];\n $datos['Encabezado']['Emisor...
[ "def get_quote(options = {})\n ################### Optionals\n # will be removed from code\n # Ej: 20x2x10,20x2x10 indica que se envian 2 paquetes y cada uno tiene 20 cm de alto x 2 cm de ancho x 10 cm de largo.\n paquetes = options[:paquetes]\n correo = options[:correo] # ID, e.: \"oca\"\...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
This results in the following sort order: view subqueries, then other subqueries view subqueries: views sorted by creation order (earlier declaration first) other subqueries: subqueries sorted by depth within select query (deep == higher level)
[ "@Override\n public int compare(Object a, Object b) {\n\n SubQuery sqa = (SubQuery) a;\n SubQuery sqb = (SubQuery) b;\n\n if (sqa.parentView == null && sqb.parentView == null) {\n return sqb.level - sqa.level;\n } else if (sqa.parentView != null && sqb.parentView != null) {...
[ "protected function compileAnsiOffset(Builder $query, $components)\n\t{\n\t\t// An ORDER BY clause is required to make this offset query work, so if one does\n\t\t// not exist we'll just create a dummy clause to trick the database and so it\n\t\t// does not complain about the queries for not having an \"order by\" ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public EClass getIfcBooleanClippingResult() {\r\n\t\tif (ifcBooleanClippingResultEClass == null) {\r\n\t\t\tifcBooleanClippingResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(43);\r\n\t\t}\r\n\t\treturn ifcBooleanClippingResultEClass;\r\n\...
[ "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 post about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
Helper method for the parse query regex callback which converts the a string like 'cast(text)|null' or '|null' Into processoer callbacks for Modifier @param string Transformer string we're going to process @param Modifier $modifier
[ "private function processStringTransformers( $string, Modifier $modifier )\n {\n\n // there can be multiple transformers are separated by |\n foreach( explode( '|', $string ) as $fragment ) {\n\n switch( true ) {\n\n case $fragment === 'null':\n\n $modif...
[ "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:" }
/* plug into a defined socket
[ "function () {\n /* determine parameters */\n var params = $cs.params(\"plug\", arguments, {\n name: { def: \"default\" },\n object: { pos: 0, req: true },\n spool: { def: null },\n targeting: {...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// NewMemoryThresholdNotifier creates a ThresholdNotifier which is designed to respond to the given threshold. // UpdateThreshold must be called once before the threshold will be active.
[ "func NewMemoryThresholdNotifier(threshold evictionapi.Threshold, cgroupRoot string, factory NotifierFactory, handler func(string)) (ThresholdNotifier, error) {\n\tcgroups, err := cm.GetCgroupSubsystems()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcgpath, found := cgroups.MountPoints[\"memory\"]\n\tif !found |...
[ "func NewSyncManager(cloud cloudprovider.Interface, nodeName types.NodeName, syncPeriod time.Duration) SyncManager {\n\treturn &cloudResourceSyncManager{\n\t\tcloud: cloud,\n\t\tsyncPeriod: syncPeriod,\n\t\tnodeName: nodeName,\n\t\t// nodeAddressesMonitor is a monitor that guards a result (nodeAddresses,\n\t...
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Send multiple SMS @param Message\Message[] $messages @return Message\Response @throws Exception\BadResponseException @throws InvalidArgumentException @throws \GuzzleHttp\Exception\GuzzleException
[ "public function sendBatch(array $messages)\n {\n $body = '';\n /** @var Message\\Message $message */\n foreach ($messages as $i => $message) {\n if (!$message instanceof Message\\Message) {\n throw new InvalidArgumentException();\n }\n\n $body...
[ "public function setSubscriptionAddon(SetAddon\\RequestData $requestData)\n {\n $request = new SetAddon\\Request($requestData);\n\n return $this->sendRequest($request, SetAddon\\ApiResponse::class);\n }" ]
codesearchnet
{ "query": "Represent the summarization about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about Programming:" }
Turn class into a kervi controller
[ "def create(controller_id, name):\n \"\"\"\"\"\"\n def _decorator(cls):\n class _ControllerClass(cls, Controller):\n def __init__(self):\n Controller.__init__(self, controller_id, name)\n for key in cls.__dict__.keys():\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 summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Parse a vcf metadataline
[ "def parse_meta_data(self, line):\n \"\"\"\"\"\"\n line = line.rstrip()\n logger.debug(\"Parsing metadata line:{0}\".format(line))\n line_info = line[2:].split('=')\n match = False\n\n if line_info[0] == 'fileformat':\n logger.debug(\"Parsing fileformat\")\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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Normalize will normalize the Schema_Set, returning an error if it is // invalid.
[ "func (s *Schema_Set) Normalize() error {\n\tif len(s.Entry) == 0 {\n\t\treturn errors.New(\"set requires entries\")\n\t}\n\tset := stringset.New(len(s.Entry))\n\tfor _, entry := range s.Entry {\n\t\tif entry.Token == \"\" {\n\t\t\treturn errors.New(\"blank token\")\n\t\t}\n\t\tif !set.Add(entry.Token) {\n\t\t\tret...
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Find the next node having the specified node name. @param nodeName name to look for. @return <code>null</code> if there are no more node to scan and there was no matching node.
[ "public Node find(String nodeName)\n\t{\n\t\t// Sanity check\n\t\tif (IS_EMPTY.test(nodeName))\n\t\t{\n\t\t\tthrow new IllegalArgumentException(\"The node name should not be empty\");\n\t\t}\n\t\tNode _result = null;\n\t\twhile (hasMoreAvailableElement() && (null == _result))\n\t\t{\n\t\t\tint _position = getPositi...
[ "public function containsValue($value): bool {\n\n /**\n * @var string $arrayIndex\n * @var SinglyLinkedList $list\n */\n foreach ($this->bucket as $arrayIndex => $list) {\n /* $list is the first element in the bucket. The bucket\n * can contain max $maxS...
codesearchnet
{ "query": "Represent the text about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
// ValidateHost wraps methods.ValidateHost
[ "func (m *Manager) ValidateHost(ctx context.Context, ovfDescriptor string, host mo.Reference, vhp types.OvfValidateHostParams) (*types.OvfValidateHostResult, error) {\n\treq := types.ValidateHost{\n\t\tThis: m.Reference(),\n\t\tOvfDescriptor: ovfDescriptor,\n\t\tHost: host.Reference(),\n\t\tVhp: ...
[ "public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) {\n return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Raise an error if user_removable settings are wrong
[ "def validate_user_removable(new_val)\n raise JSS::UnsupportedError, 'User removal settings not applicable to this class' unless self_service_payload == :profile\n\n raise JSS::UnsupportedError, 'Removal :with_auth not applicable to this class' if new_val == :with_auth && !self_service_targets.include?(:i...
[ "def getLockByID(self, lockid):\n \n assert isinstance(lockid, (locks.MasterLock, locks.WorkerLock))\n if lockid not in self.locks:\n self.locks[lockid] = lockid.lockClass(lockid)\n # if the master.cfg file has changed maxCount= on the lock, the next\n # time a build is...
codesearchnet
{ "query": "Represent the Github comment about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about programming:" }
default options: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/renderer.rb#L41-L47
[ "def renderer_options\n options = {\n # script_name: \"\", # unfortunately doesnt seem to effect relative_url_root like desired\n # input: \"\"\n }\n\n origin = headers[\"origin\"]\n if origin\n uri = URI.parse(origin)\n options[:https] = uri.scheme == \"https\"\n ...
[ "def link(ref)\n if ref.kind_of?(Range)\n \"@see - \" + \"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}\".blue\n elsif ref.kind_of?(Integer)\n \"@see - \" + \"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Fetch the registry information from the remote region. @return true, if the fetch was successful, false otherwise.
[ "private boolean fetchRegistry() {\n boolean success;\n Stopwatch tracer = fetchRegistryTimer.start();\n\n try {\n // If the delta is disabled or if it is the first time, get all applications\n if (serverConfig.shouldDisableDeltaForRemoteRegions()\n || (...
[ "def process_source(source)\n if source == \"00\"\n logger.warn(\"Connection has been aborted by the service provider because of an error by the service user (client side).\")\n elsif source == \"02\"\n logger.warn(\"Connection has been aborted by the service provider because of an error by ...
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public FeatureMap getParameterValueGroup() {\n\t\treturn (FeatureMap)getGroup().<FeatureMap.Entry>list(BpsimPackage.Literals.ENUM_PARAMETER_TYPE__PARAMETER_VALUE_GROUP);\n\t}" ]
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github post about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
// Resolve returns the resolved listen address given the configuration.
[ "func (c Configuration) Resolve() (string, error) {\n\tlistenAddrType := c.ListenAddressType\n\n\tvar listenAddress string\n\tswitch listenAddrType {\n\tcase ConfigResolver:\n\t\tif c.Value == nil {\n\t\t\terr := fmt.Errorf(\"missing listen address value using: resolver=%s\",\n\t\t\t\tstring(listenAddrType))\n\t\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 Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Getter method used to read bytes.length bytes from the mapped byte buffer at the current byte cursor position into the supplied byte array. The byte cursor is advanced by bytes.length. @param bytes The target byte array into which the bytes will be read.
[ "protected void get(byte[] bytes)\n {\n if (tc.isEntryEnabled()) Tr.entry(tc, \"get\",new Object[] {this,new Integer(bytes.length)});\n\n _buffer.get(bytes);\n\n if (tc.isDebugEnabled()) Tr.debug(tc, RLSUtils.toHexString(bytes, RLSUtils.MAX_DISPLAY_BYTES));\n if (tc.isEntryEnabled()) Tr.exit(tc, \"get\...
[ "void offerData(byte[] chunk) {\n if (chunk == null || chunk.length == 0) {\n throw new IllegalArgumentException(\"chunk must have at least one byte of data\");\n }\n\n if (closed) {\n return;\n }\n\n // Since this is an unbounded queue, offer() always succeeds. In addition, we don't make a...
codesearchnet
{ "query": "Represent the Github sentence about AWS S3:", "pos": "Represent the Github code about AWS S3:", "neg": "Represent the Github code:" }
appender - THE FUNCTION THAT ACCEPTS A STRING queue - FILLED WITH LOG ENTRIES {"template":template, "params":params} TO WRITE interval - timedelta USE IN A THREAD TO BATCH LOGS BY TIME INTERVAL
[ "def time_delta_pusher(please_stop, appender, queue, interval):\n \n\n next_run = time() + interval\n\n while not please_stop:\n profiler = Thread.current().cprofiler\n profiler.disable()\n (Till(till=next_run) | please_stop).wait()\n profiler.enable()\n\n next_run = time...
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Is called when the component is resized
[ "protected synchronized void internalComponentWasResized()\n\t{\n\t\timageBuffer=null;\n\n\t\tBorder b = this.getBorder();\n\t\tInsets inset = (b==null)?new Insets(1,1,1,1):b.getBorderInsets(this);\n\t\tmyTop = inset.top;\n\t\tmyLeft = inset.left;\n\t\tmyWidth = this.getWidth() - inset.left - inset.right;\n\t\tmyHe...
[ "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 Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
List scheduled jobs.
[ "def scheduled():\n '''\n \n '''\n for job in sorted(schedulables(), key=lambda s: s.name):\n for task in PeriodicTask.objects(task=job.name):\n label = job_label(task.task, task.args, task.kwargs)\n echo(SCHEDULE_LINE.format(\n name=white(task.name.encode('ut...
[ "protected function parentId()\n\t{\n\t\tswitch ( $this->position )\n\t\t{\n\t\t\tcase 'root':\n\t\t\t\treturn null;\n\n\t\t\tcase 'child':\n\t\t\t\treturn $this->target->getKey();\n\n\t\t\tdefault:\n\t\t\t\treturn $this->target->getParentId();\n\t\t}\n\t}" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Computer Science:" }
sets the datasource object
[ "def dataSource(self, value):\n \n if isinstance(value, DataSource):\n self._dataSource = value\n else:\n raise TypeError(\"value must be a DataSource object\")" ]
[ "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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Issues a request to leave our current location. @return true if we were able to leave, false if we are in the middle of moving somewhere and can't yet leave.
[ "public boolean leavePlace ()\n {\n if (_pendingPlaceId != -1) {\n return false;\n }\n\n _lservice.leavePlace();\n didLeavePlace();\n\n // let our observers know that we're no longer in a location\n _observers.apply(_didChangeOp);\n\n return true;\n ...
[ "function errorAndExit(msg, logMe) {\n // @todo Only trigger if `verbosity > 1`\n if (logMe) {\n // Adding some empty lines before error message for readability\n console.log();\n console.log();\n console.log(logMe);\n }\n error(`Error: ${msg}`);\n\n // There's a few ways to handle exiting\n\n // ...
codesearchnet
{ "query": "Represent the description about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Software development:" }
Auto Generated Code
[ "def show_linkinfo_output_show_link_info_linkinfo_version(self, **kwargs):\n \n config = ET.Element(\"config\")\n show_linkinfo = ET.Element(\"show_linkinfo\")\n config = show_linkinfo\n output = ET.SubElement(show_linkinfo, \"output\")\n show_link_info = ET.SubElement(outp...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github post about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about File management:" }
Print the code block to stdout. Does syntax highlighting if possible.
[ "def pprint(self, file_=sys.stdout):\n \n\n code = []\n if self._deps:\n code.append(\"# dependencies:\")\n for k, v in _compat.iteritems(self._deps):\n code.append(\"# %s: %r\" % (k, v))\n code.append(str(self))\n code = \"\\n\".join(code)\n\n ...
[ "def generate_optimized_y_move_down_x_SOL(y_dist):\n \n\n # Optimization to move N lines and go to SOL in one command. Note that some terminals \n # may not support this so we might have to remove this optimization or make it optional \n # if that winds up mattering for terminals we care about. If we ha...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
[ "func (fa *fa_IR) WeekdayAbbreviated(weekday time.Weekday) string {\n\treturn fa.daysAbbreviated[weekday]\n}" ]
[ "func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about datetime:" }
Defines vertical label. @param {number} j index of row @param {string} coordSystem ("A1" or "aa") @param {number} size the grid base (9, 13, 19) @returns {string}
[ "function(j, coordSystem, size) {\n if (\"aa\" === coordSystem) {\n\treturn String.fromCharCode(CODE_a + --j);\n }\n else { // \"A1\" (default)\n\treturn (size - --j).toString();\n }\n}" ]
[ "function parse_drawing(data, rels) {\n\tif(!data) return \"??\";\n\t/*\n\t Chartsheet Drawing:\n\t - 20.5.2.35 wsDr CT_Drawing\n\t - 20.5.2.1 absoluteAnchor CT_AbsoluteAnchor\n\t - 20.5.2.16 graphicFrame CT_GraphicalObjectFrame\n\t - 20.1.2.2.16 graphic CT_GraphicalObject\n\t - 20.1.2.2.17 gr...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Commit the transaction @param $collect @return Array of statements
[ "protected function commitImpl($collect) {\n if ($this->isInCommit) {\n return;\n }\n if (self::$isInfoEnabled) {\n self::$logger->info(\"Commit transaction [collect=\".($collect ? \"true\" : \"false\").\"]\");\n }\n $this->isInCommit = true;\n $this->eventManager->dispatch(TransactionEv...
[ "def db_check( block_id, opcode, op, txid, vtxindex, checked, db_state=None ):\n \n print \"\\nreference implementation of db_check\\n\"\n return False" ]
codesearchnet
{ "query": "Represent the Github summarization about Transaction Management:", "pos": "Represent the Github code about Transaction Management:", "neg": "Represent the Github code about Blockchain:" }
Generate the javascript for the conditional field show / hiding logic. @return void
[ "public function generateConditionalJavascript()\n {\n $rules = '';\n $form = $this->data();\n if (!$form) {\n return;\n }\n $formFields = $form->Fields();\n\n $watch = [];\n\n if ($formFields) {\n /** @var EditableFormField $field */\n ...
[ "public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Called if all forms are valid. Creates a Recipe instance along with associated Ingredients and Instructions and then redirects to a success page.
[ "def form_valid(self, form, forms):\n \n if self.object:\n form.save()\n for (formobj, linkerfield) in forms:\n if form != formobj:\n formobj.save()\n else:\n self.object = form.save()\n for (formobj, linkerfield) in ...
[ "function DefaultChangeRequestInterceptor(saveContext, saveBundle) {\n /**\n Prepare and return the save data for an entity change-set.\n\n The adapter calls this method for each entity in the change-set,\n after it has prepared a \"change request\" for that object.\n\n The method can do anything...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// SetDeadline sets the survey deadline on the socket. After this time, // responses from a survey will be discarded.
[ "func (s *SurveyorSocket) SetDeadline(d time.Duration) error {\n\treturn s.sock.SetOption(mangos.OptionSurveyTime, d)\n}" ]
[ "def connect(self, host, port):\n '''\n \n '''\n # Clear the connect state immediately since we're no longer connected\n # at this point.\n self._connected = False\n\n # Only after the socket has connected do we clear this state; closed\n # must be False so th...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Set original data for each field. @return void
[ "protected function setFieldOriginalValue()\n {\n// static::doNotSnakeAttributes($this->model);\n\n $values = $this->model->toArray();\n\n $this->builder->fields()->each(function (Field $field) use ($values) {\n $field->setOriginal($values);\n });\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:" }
Show the number of pending signals by signal type.
[ "def pending():\n \"\"\"\"\"\"\n\n signalbus = current_app.extensions['signalbus']\n pending = []\n total_pending = 0\n for signal_model in signalbus.get_signal_models():\n count = signal_model.query.count()\n if count > 0:\n pending.append((count, signal_model.__name__))\n ...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
处理POST数据,主要处理上传的文件. @param array $data
[ "private function preparePostData(array &$data) {\n foreach ($data as $key => &$val) {\n if (is_string($val) && $val{0} == '@' && is_file(trim(substr($val, 1), '\"'))) {\n $data [ $key ] = new \\CURLFile(realpath(trim(substr($val, 1), '\"')));\n } else if (is_array($val))...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetRequestMappingTemplate sets the RequestMappingTemplate field's value.
[ "func (s *UpdateFunctionInput) SetRequestMappingTemplate(v string) *UpdateFunctionInput {\n\ts.RequestMappingTemplate = &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:" }
DES解密Base64编码密文 @param data Base64编码密文 @param key 8字节秘钥 @return 明文
[ "public static byte[] decryptBase64DES(byte[] data, byte[] key) {\n try {\n return decryptDES(Base64.getDecoder().decode(data), key);\n } catch (Exception e) {\n return null;\n }\n }" ]
[ "public static String encode(String content, String secret) {\n try {\n //1.构造密钥生成器,指定为AES算法,不区分大小写\n KeyGenerator keygen = KeyGenerator.getInstance(\"AES\");\n //2.根据encodeRules规则初始化密钥生成器\n //生成一个256位的随机源,根据传入的字节数组\n keygen.init(256, new SecureRandom(se...
codesearchnet
{ "query": "Represent the description about Encryption:", "pos": "Represent the code about Encryption:", "neg": "Represent the code:" }
Displays a list of all resources in the current folder.<p> @throws Exception if something goes wrong @see CmsObject#getResourcesInFolder(String, CmsResourceFilter)
[ "public void ls() throws Exception {\n\n String folder = CmsResource.getFolderPath(m_cms.getRequestContext().getUri());\n List<CmsResource> resources = m_cms.getResourcesInFolder(folder, CmsResourceFilter.IGNORE_EXPIRATION);\n m_shell.getOut().println(\n \"\\n\" + getMessages().key(M...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about File management:" }
// IsIP check the input is IP or not
[ "func IsIP(ip string) bool {\n\tif m, _ := regexp.MatchString(ipRegexp, ip); !m {\n\t\treturn false\n\t}\n\n\treturn true\n}" ]
[ "static String getHostString(InetSocketAddress socketAddress) {\n InetAddress address = socketAddress.getAddress();\n if (address == null) {\n // The InetSocketAddress was specified with a string (either a numeric IP or a host name). If\n // it is a name, all IPs for that name should be tried. If it...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
资金预授权冻结接口 @param model {AlipayFundAuthOrderFreezeModel} @return {AlipayFundAuthOrderFreezeResponse} @throws {AlipayApiException}
[ "public static AlipayFundAuthOrderFreezeResponse authOrderFreezeToResponse(AlipayFundAuthOrderFreezeModel model)\n\t\t\tthrows AlipayApiException {\n\t\tAlipayFundAuthOrderFreezeRequest request = new AlipayFundAuthOrderFreezeRequest();\n\t\trequest.setBizModel(model);\n\t\treturn AliPayApiConfigKit.getAliPayApiConf...
[ "public JsPayResponse jsPay(JsPayRequest request){\n checkJsPayParams(request);\n Map<String, Object> respData = doJsPay(request, TradeType.JSAPI);\n return buildJsPayResp(respData);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about API documentation:", "pos": "Represent the Github code about API documentation:", "neg": "Represent the Github code about API documentation:" }
List images CLI Example: .. code-block:: bash salt '*' glanceng.image_list salt '*' glanceng.image_list
[ "def image_list(auth=None, **kwargs):\n '''\n \n '''\n cloud = get_operator_cloud(auth)\n kwargs = _clean_kwargs(**kwargs)\n return cloud.list_images(**kwargs)" ]
[ "def _list_nodes(call=None):\n '''\n \n '''\n local = salt.client.LocalClient()\n ret = local.cmd('salt-cloud:driver:vagrant', 'grains.items', '', tgt_type='grain')\n return ret" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Clear the authorization table.
[ "private void clearAuthorizationTable() {\n userToAccessId.clear();\n groupToAccessId.clear();\n userToRoles.clear();\n groupToRoles.clear();\n specialSubjectToRoles.clear();\n accessIdToRoles.clear();\n explicitAccessIdToRoles.clear();\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// registerToProxyKite dials the proxy kite and calls register method then // returns the reverse-proxy URL.
[ "func (k *Kite) registerToProxyKite(c *Client, kiteURL *url.URL) (*url.URL, error) {\n\terr := c.Dial()\n\tif err != nil {\n\t\tk.Log.Error(\"Cannot connect to Proxy kite: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\n\t// Disconnect from Proxy Kite if error happens while registering.\n\tdefer func() {\n\t\tif er...
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Gets the created tables according to the old/new schemas. @param \Fridge\DBAL\Schema\Schema $oldSchema The old schema. @param \Fridge\DBAL\Schema\Schema $newSchema The new schema. @return array The created tables.
[ "private function getCreatedTables(Schema $oldSchema, Schema $newSchema)\n {\n $createdTables = array();\n\n foreach ($newSchema->getTables() as $table) {\n if (!$oldSchema->hasTable($table->getName())) {\n $createdTables[] = $table;\n }\n }\n\n re...
[ "abstract public function __construct(DataAccessInterface $dataSource);\n \n /**\n * Returns an array with all entities for the given data request.\n * \n * @param \\Zepi\\DataSource\\Core\\DataRequest $dataRequest\n * @return false|array\n */\n public function find(DataRequest $dataReq...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
ModuleManager @return ModuleManager|ModuleManagerBase
[ "function moduleManager()\n {\n if (! $this->moduleManager ) {\n $mm = new ModuleManager;\n $mm->setTarget($this);\n $this->moduleManager = $mm;\n }\n\n return $this->moduleManager;\n }" ]
[ "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:" }
Add configuration for the specified adapters but don't initialize them until they are actually used.
[ "function configure(config) {\n config = config || {};\n logger.debug('configuring adapters', _.keys(config).join(','));\n _.extend(adapterConfig, _.clone(config));\n\n logger.debug('configuring builtin adapters');\n _.each(BUILTIN_ADAPTERS, function(adapter) {\n adapterConfig[adapter] = {\n ...
[ "protected WsMessageRouterImpl getMessageRouter() {\n if (msgRouter == null) {\n // First activation.\n msgRouter = MessageRouterSingleton.singleton;\n\n // Pass the MessageRouter to the TrService via the TrConfigurator.\n TrConfigurator.setMessageRouter(msgRouter)...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Set the content of the activity inside the action bar. @param view The desired content to display.
[ "public void setContentView(View view) {\r\n if (DEBUG) Log.d(TAG, \"[setContentView] view: \" + view);\r\n\r\n setContentView(view, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));\r\n }" ]
[ "@Override\n @CallSuper\n public void bindView(final VH holder, List<Object> payloads) {\n //set the selected state of this item. force this otherwise it may is missed when implementing an item\n holder.itemView.setSelected(isSelected());\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Submits the dialog.<p>
[ "void submit() {\n\n try {\n List<CmsUUID> modifiedResources = undelete();\n m_context.finish(modifiedResources);\n } catch (Exception e) {\n m_context.error(e);\n }\n }" ]
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// ReindexAddressesBlockTime rebuilds the addresses(block_time) index.
[ "func (pgb *ChainDB) ReindexAddressesBlockTime() error {\n\tlog.Infof(\"Reindexing addresses table on block time...\")\n\terr := DeindexBlockTimeOnTableAddress(pgb.db)\n\tif err != nil && !errIsNotExist(err) {\n\t\tlog.Errorf(\"Failed to drop index addresses index on block_time: %v\", err)\n\t\treturn err\n\t}\n\tr...
[ "func updateAddressesValidMainchainPatch(db *sql.DB) (rowsUpdated int64, err error) {\n\treturn sqlExec(db, internal.UpdateAddressesGloballyInvalid,\n\t\t\"failed to update addresses rows valid_mainchain status\")\n}" ]
codesearchnet
{ "query": "Represent the Github description about Address:", "pos": "Represent the Github code about Address:", "neg": "Represent the Github code about Address:" }
// SetMaxResults sets the MaxResults field's value.
[ "func (s *ListQueryExecutionsInput) SetMaxResults(v int64) *ListQueryExecutionsInput {\n\ts.MaxResults = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Applies transformation, does it in one sweep for performance, so don't be surprised about the code repetition. [ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ] [ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ] @param {Array.<Number>} matrix
[ "function(matrix) {\n var path = this._path;\n var i, len, latlng;\n\n var px = L.point(matrix[4], matrix[5]);\n\n var crs = path._map.options.crs;\n var transformation = crs.transformation;\n var scale = crs.scale(path._map.getZoom());\n var projection = crs.projection;\n\n var diff = trans...
[ "def dot(v1, v2):\n '''\n '''\n x1, y1, z1 = v1\n x2, y2, z2 = v2\n return x1 * x2 + y1 * y2 + z1 * z2" ]
codesearchnet
{ "query": "Represent the Github description about Mathematics:", "pos": "Represent the Github code about Mathematics:", "neg": "Represent the Github code about mathematics:" }
invokes callback that should return a (request,response) tuple. representing the SOAP request and response respectively. ps -- ParsedSoap instance representing HTTP Body. request -- twisted.web.server.Request
[ "def processRequest(cls, ps, **kw):\n \n resource = kw['resource']\n request = kw['request']\n method = getattr(resource, 'soap_%s' %\n _get_element_nsuri_name(ps.body_root)[-1])\n \n try:\n req_pyo...
[ "def getChild(self, name, request):\n \n request.prepath = []\n request.postpath.insert(0, name)\n # re-establishes request.postpath so to contain the entire path\n return self.wsgi_resource" ]
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Register the service provider. @return void
[ "public function register()\n {\n $this->app->bind('hashids', function ($app) {\n $config = $app->config->get('hashids');\n\n return new Hashids(\n array_get($config, 'salt'),\n array_get($config, 'length', 0),\n array_get($config, 'alphab...
[ "@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 Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Initializes the widget.
[ "public function init()\n {\n\n $this->options = array_merge([\n 'class' => 'modal-fs fade',\n ], $this->options);\n\n $padding = $this->modalBodyPadding===false? '0' : $this->modalBodyPadding;\n $this->getView()->registerCss(\"\n .modal-fs .modal-body{\n padding...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
GET /directories/new GET /directories/new.xml
[ "def new\n @directory = Cmtool::Directory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @directory }\n end\n end" ]
[ "def list(self, subid, params=None):\n ''' \n '''\n params = update_params(params, {'SUBID': subid})\n return self.request('/v1/server/list_ipv4', params, 'GET')" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
// One gets a specific repository based on the url of the service // // https://developer.github.com/v3/repos/#get
[ "func (r *RepositoriesService) One(uri *Hyperlink, params M) (repo *Repository,\n\tresult *Result) {\n\tif uri == nil {\n\t\turi = &RepositoryURL\n\t}\n\turl, err := uri.Expand(params)\n\tif err != nil {\n\t\treturn nil, &Result{Err: err}\n\t}\n\tresult = r.client.get(url, &repo)\n\treturn\n}" ]
[ "def create_logstash(self, **kwargs):\n \n logstash = predix.admin.logstash.Logging(**kwargs)\n logstash.create()\n logstash.add_to_manifest(self)\n\n logging.info('Install Kibana-Me-Logs application by following GitHub instructions')\n logging.info('git clone https://githu...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
//export getReadBufferSizeCallback
[ "func getReadBufferSizeCallback(a *C.utp_callback_arguments) (ret C.uint64) {\n\ts := libContextToSocket[a.context]\n\tc := s.conns[a.socket]\n\tif c == nil {\n\t\t// socket hasn't been added to the Socket.conns yet. The read buffer\n\t\t// starts out empty, and the default implementation for this callback\n\t\t// ...
[ "def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Parse a url encoded string into an array of values php's `parse_url` requires brackets to indicate an array; this function will parse values of the same name into an array if brackets don't exist @param string $source @return array<string,mixed>
[ "public static function decodeQueryString($source, $rfc = self::RFC_3986)\n {\n $ret = [];\n if ($source !== '') {\n $decode = self::getQueryStringDecoder($rfc);\n $queryPairs = explode('&', $source);\n foreach ($queryPairs as $pair) {\n $parts = expl...
[ "private function param($key, $string, $value) {\n\n $field_required = false;\n\n // If the field name ends with a '*', the parameter is considered as required\n if (preg_match('/^(.+)\\*$/', $key, $bits)) {\n\n $key = $bits[1];\n $field_required = true;\n\n }\n\n ...
codesearchnet
{ "query": "Represent the text about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about programming:" }
parse the input and store data in resultset for xml generation @return void
[ "private function _info()\n {\n if (empty($this->_output)) {\n return;\n }\n $model = array();\n $percCharge = array();\n $lines = explode(PHP_EOL, implode($this->_output));\n if (count($lines)>1) {\n $model = explode('FW:', $lines[1]);\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 Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
Add a node to the element indexes. The node will not be added unless it's an element. @param expandedTypeID The expanded type ID of the node. @param identity The node identity index.
[ "protected void indexNode(int expandedTypeID, int identity)\n {\n\n ExpandedNameTable ent = m_expandedNameTable;\n short type = ent.getType(expandedTypeID);\n\n if (DTM.ELEMENT_NODE == type)\n {\n int namespaceID = ent.getNamespaceID(expandedTypeID);\n int localNameID = ent.getLocalNameID(exp...
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Sometime when connecting to a bad channel which isn't writable, this method will be called
[ "@Override\n public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) {\n // register the newly established channel\n Channel channel = event.getChannel();\n LOG.info(\"connection established to :{}, local port:{}\", client.getRemoteAddr(), channel.getLocalAddress());...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
模板块开始 @param string $name @param string $type @throws BlockException
[ "public function begin($name, $type = 'replace')\n {\n $stacks = [$name, $type];\n if (!isset($this->opens[$name])) {\n $stacks[] = $this->placeholder($name);\n } elseif ($this->opens[$name]) {\n throw new BlockException($name, 'is opened');\n }\n\n $this-...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
import printAST from 'ast-pretty-print'; console.log(printAST(referencePath.parentPath))
[ "function graphqlMacro({\n references,\n state: {\n file: {\n opts: { filename },\n },\n },\n babel: { types: t },\n}: {\n references: { gql: Array<any>, loader: Array<any> },\n state: { file: { opts: { filename: string } } },\n babel: { types: Object },\n}): void {\n const { gql = [], loader = [...
[ "function (param) {\n var root = compiler.parse(param.content, param.name);\n uuid = 0;\n xtplAstToJs.isModule = param.isModule;\n return genTopFunction(xtplAstToJs, root.statements);\n }" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
// GetValueHash implements corresponding function in interface DB
[ "func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error) {\n\tkeyHashStr := string(keyHash)\n\tif !s.BytesKeySupported() {\n\t\tkeyHashStr = base64.StdEncoding.EncodeToString(keyHash)\n\t}\n\treturn s.GetState(deriveHashedDataNs(namespace, collection), k...
[ "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 about Redis command documentation:", "pos": "Represent the Github code about Redis command documentation:", "neg": "Represent the Github code about programming:" }
Auto Generated Code
[ "def get_port_profile_for_intf_output_interface_interface_name(self, **kwargs):\n \n config = ET.Element(\"config\")\n get_port_profile_for_intf = ET.Element(\"get_port_profile_for_intf\")\n config = get_port_profile_for_intf\n output = ET.SubElement(get_port_profile_for_intf, \"o...
[ "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 summarization about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code about File management:" }
// SetValid sets the Valid field's value.
[ "func (s *DescribeCrossAccountAccessRoleOutput) SetValid(v bool) *DescribeCrossAccountAccessRoleOutput {\n\ts.Valid = &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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Get the datasource @param request @return @throws IOException
[ "private IDataSource getDataSource(HttpServletRequest request) throws DataSourceNotFoundException {\n String contextPath = request.getContextPath();\n String requestURI = request.getRequestURI();\n\n String path = contextPath == null\n ? requestURI\n : requestURI.s...
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the summarization about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code:" }
// Handle KICKs from channels to maintain state
[ "func (conn *Conn) h_KICK(line *Line) {\n\tif !line.argslen(1) {\n\t\treturn\n\t}\n\t// XXX: this won't handle autorejoining channels on KICK\n\t// it's trivial to do this in a seperate handler...\n\tconn.st.Dissociate(line.Args[0], line.Args[1])\n}" ]
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
@param Constraint $constraint @throws ConstraintDefinitionException
[ "protected function validateEnclosure(Constraint $constraint)\n {\n if (strlen($constraint->enclosure) > 2) {\n throw new ConstraintDefinitionException(sprintf('\"%s\" is not a valid enclosure', $constraint->enclosure));\n }\n }" ]
[ "public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
------------------------------------------------- 生成不带后缀的原始文档文件名
[ "function (action, suffix) {\n\n var moduleName = action.__module ? action.__module.toUpperCase() : '';\n var ctrlName = action.__controller ? action.__controller.toUpperCase() : '';\n var actionName = action.__action ? action.__action.toUpperCase() : '';\n var methodName = action.__method ? action.__...
[ "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 comment about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code about text processing:" }
Acquires a lock on the given $key. @param string $key @param int $waitTime usleep() @param int $maxTime seconds
[ "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...
[ "final public function create()\n {\n\n $self = $this;\n\n $splash = $self->getSplash();\n $sessId = $this->generateId($splash);\n\n session_id($sessId); //Must be called before the sesion start to generate the Id\n session_cache_limiter('none');\n\n session_name(md5($se...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Return the sub task's serialized job information. @return serialized job information (may be <tt>null</tt> before a call to {@link #loadBigData(PermanentBlobService)}).
[ "@Nullable\n\tpublic SerializedValue<JobInformation> getSerializedJobInformation() {\n\t\tif (serializedJobInformation instanceof NonOffloaded) {\n\t\t\tNonOffloaded<JobInformation> jobInformation =\n\t\t\t\t(NonOffloaded<JobInformation>) serializedJobInformation;\n\t\t\treturn jobInformation.serializedValue;\n\t\t...
[ "@SuppressWarnings(\"unused\") // called through reflection by RequestServer\n public FramesV3 delete(int version, FramesV3 frames) {\n Frame frame = getFromDKV(\"key\", frames.frame_id.key()); // safe\n frame.delete(); // lock & remove\n return frames;\n }" ]
codesearchnet
{ "query": "Represent the Github description about Data management:", "pos": "Represent the Github code about Data management:", "neg": "Represent the Github code:" }
Update the Options table by removing any items that are no longer valid. @param int $maxlifetime Maximum number of seconds for which a session can live @param callable $next Next clean operation in the stack @global \wpdb $wpdb @return mixed
[ "public function clean( $maxlifetime, $next ) {\n\t\tglobal $wpdb;\n\n\t\t// Session is expired if now - item.time > maxlifetime\n\t\t// Said another way, if item.time < now - maxlifetime\n\t\t$filter = intval( time() - $maxlifetime );\n\t\t$keys = $wpdb->get_results( \"SELECT option_name, option_value FROM $wpd...
[ "final public function create()\n {\n\n $self = $this;\n\n $splash = $self->getSplash();\n $sessId = $this->generateId($splash);\n\n session_id($sessId); //Must be called before the sesion start to generate the Id\n session_cache_limiter('none');\n\n session_name(md5($se...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Aggregate routes and return an array of Route DTOs @return RouteInterface[]
[ "public function collectRoutes()\n {\n $routes = [];\n\n foreach($this->getCollectors() as $collector) {\n $routes = array_merge($routes, $collector->collectRoutes());\n }\n\n return $routes;\n }" ]
[ "public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *BatchParameters) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"BatchParameters\"}\n\tif s.JobDefinition == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"JobDefinition\"))\n\t}\n\tif s.JobName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"JobName\")...
[ "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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Config converts the Pre140 config to the current config struct
[ "func (c *Pre182) Config() *Config {\n\tcfg := &Config{\n\t\tRoot: c.Root.StoreConfig(),\n\t\tMounts: make(map[string]*StoreConfig, len(c.Mounts)),\n\t}\n\tfor k, v := range c.Mounts {\n\t\tcfg.Mounts[k] = v.StoreConfig()\n\t}\n\treturn cfg\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// Set the internal pods based on the new pods.
[ "func (pm *basicManager) SetPods(newPods []*v1.Pod) {\n\tpm.lock.Lock()\n\tdefer pm.lock.Unlock()\n\n\tpm.podByUID = make(map[kubetypes.ResolvedPodUID]*v1.Pod)\n\tpm.podByFullName = make(map[string]*v1.Pod)\n\tpm.mirrorPodByUID = make(map[kubetypes.MirrorPodUID]*v1.Pod)\n\tpm.mirrorPodByFullName = make(map[string]*...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
加密方法 @param string $data 加密字符串 @param string $key 密钥 @return mixed
[ "public static function encrypt($data, $key = null)\n {\n is_null($key) && $key = Config::get('auth_key');\n return self::cry(serialize($data), 1, $key);\n }" ]
[ "public static String encode(String content, String secret) {\n try {\n //1.构造密钥生成器,指定为AES算法,不区分大小写\n KeyGenerator keygen = KeyGenerator.getInstance(\"AES\");\n //2.根据encodeRules规则初始化密钥生成器\n //生成一个256位的随机源,根据传入的字节数组\n keygen.init(256, new SecureRandom(se...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Retrieve the address of the local NIC to bind to. @see TCPConnectRequestContext#getLocalAddress()
[ "public InetSocketAddress getLocalAddress()\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, \"getLocalAddress\");\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, \"getLocalAddress\",\"rc=\"+null);\n return null;\n ...
[ "def getNetworkFragmentID(self):\n \n print '%s call getNetworkFragmentID' % self.port\n if not self.____isOpenThreadWpanRunning():\n print 'OpenThreadWpan is not running'\n return None\n\n return self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:PartitionId')[0]...
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
ClassSignature: FormalTypeParametersopt SuperclassSignature SuperinterfaceSignature* <U:Ljava/lang/Integer;:Ljava/io/Serializable;>Lorg/vesalainen/bcc/Test;Ljava/lang/Cloneable;; @param clazz @return
[ "private static String getClassSignature(TypeElement element) throws IOException\n {\n Result sb = new Result();\n formalTypeParameters(sb, element.getTypeParameters());\n TypeMirror superclass = element.getSuperclass();\n // SuperclassSignature:\n // ClassTypeSignature\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:" }
Marshall the given parameter object.
[ "public void marshall(ElasticsearchAction elasticsearchAction, ProtocolMarshaller protocolMarshaller) {\n\n if (elasticsearchAction == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(elastics...
[ "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:" }
Checks if this request handler has a specific action, even if the current user cannot access it. Includes class ancestry and extensions in the checks. @param string $action @return bool
[ "public function hasAction($action)\n {\n if ($action == 'index') {\n return true;\n }\n\n // Don't allow access to any non-public methods (inspect instance plus all extensions)\n $insts = array_merge([$this], (array) $this->getExtensionInstances());\n foreach ($inst...
[ "public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //...
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software Development:" }
Merges the transform and its parameters with other parameters of the request. Ordinarily, and application does not need to call this method. @param currentParams the other parameters @return the union of the other parameters and the transform parameters
[ "public Map<String,List<String>> merge(Map<String,List<String>> currentParams) {\n Map<String,List<String>> params = (currentParams != null) ?\n currentParams : new RequestParameters();\n\n params.put(\"transform\", Arrays.asList(getName()));\n\n for (Map.Entry<String, List<String>> entry: entrySet())...
[ "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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
TODO: I'm a little quesy about the relationship between the model class, the model, and the attribute. I'm going to have to rebuild the model DSL and see how this stuff gets built.
[ "def subject\n return nil unless subject_decorator\n if subject_decorator.respond_to?(:call)\n subject_decorator.call()\n elsif respond_to?(subject_decorator)\n self.send(subject_decorator)\n else\n nil\n end\n end" ]
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Build a new bundle version of files. The format of the input dict is defined in the `schema` module.
[ "def add_bundle(self, data: dict) -> models.Bundle:\n \n bundle_obj = self.bundle(data['name'])\n if bundle_obj and self.version(bundle_obj.name, data['created']):\n LOG.debug('version of bundle already added')\n return None\n\n if bundle_obj is None:\n b...
[ "def register_options(cls, register):\n \"\"\"\"\"\"\n super(BundleMixin, cls).register_options(register)\n register('--archive', choices=list(archive.TYPE_NAMES),\n fingerprint=True,\n help='Create an archive of this type from the bundle. '\n 'This option is also d...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Sends an exception (or throwable) to the Sentry server. <p> The exception will be logged at the {@link Event.Level#ERROR} level. @param throwable exception to send to Sentry.
[ "public void sendException(Throwable throwable) {\n EventBuilder eventBuilder = new EventBuilder().withMessage(throwable.getMessage())\n .withLevel(Event.Level.ERROR)\n .withSentryInterface(new ExceptionInterface(throwable));\n sendEvent(eventBuilder);\n }" ]
[ "public void doPost(final LoggingEvent event) {\n // if event does not meet threshold, exit now\n if (!isAsSevereAsThreshold(event.getLevel())) {\n return;\n }\n\n // get the \"local\" logger for this event from the\n // configured repository.\n Logger localLogge...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Validate scheme, host & routes @param String $scheme HTTP scheme [http, https] @param String $host HTTP host [domain.ext] @param Array $routes Route group configuration
[ "public static function validator(String $scheme, String $host, array $routes)\n {\n // Validate Domain\n self::validate_domain($scheme, $host);\n\n // Validate Routes\n foreach ($routes as $route)\n {\n if (!isset($route['method']))\n throw new Except...
[ "function (host) {\n /*\n * For Host match, we are considering the port with the host, hence we are using getRemote() instead of getHost()\n * We need to address three cases for the host urlStr\n * 1. * It matches all the host + protocol, hence we are not having any parsing logic for it...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Creates the given path as a file, also creating intermediate directories if required.
[ "def touch(path):\n \n parentDirPath = os.path.dirname(path)\n\n PathOperations.safeMakeDirs(parentDirPath)\n\n with open(path, \"wb\"):\n pass" ]
[ "def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
[ "func (uz *uz_Arab) WeekdayNarrow(weekday time.Weekday) string {\n\treturn uz.daysNarrow[weekday]\n}" ]
[ "func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about datetime:" }
Setup UI for default values setting.
[ "def restore_default_values_page(self):\n \"\"\"\"\"\"\n # Clear parameters so it doesn't add parameters when\n # restore from changes.\n if self.default_value_parameters:\n self.default_value_parameters = []\n if self.default_value_parameter_containers:\n se...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// fileExt returns the Terraform configuration extension of the given // path, or a blank string if it is not a recognized extension.
[ "func fileExt(path string) string {\n\tif strings.HasSuffix(path, \".tf\") {\n\t\treturn \".tf\"\n\t} else if strings.HasSuffix(path, \".tf.json\") {\n\t\treturn \".tf.json\"\n\t} else {\n\t\treturn \"\"\n\t}\n}" ]
[ "def generate(options, command: nil)\n # First, enable `always_trace`, to show the stack trace\n always_trace!\n\n used_switches = []\n options.each do |option|\n next if option.description.to_s.empty? # \"private\" options\n next unless option.display_in_shell\n\n short_swi...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }