query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
@param mixed $className @param mixed $name @param mixed $alias @param mixed $method @return $this
[ "public function add($alias, $name = null, $className = null, $method = null)\n {\n if (is_array($alias)) {\n $this->dashboards = array_merge($this->dashboards, $alias);\n\n return $this;\n }\n\n $this->dashboards[] = [\n 'alias' => $alias,\n '...
[ "protected function readSpecificAnnotationFor($reflection)\n {\n // Construct Method to be used for reading.\n $methodName = $this->constructReadMethod();\n\n // Read, Collect and return annotations.\n return collect($this->reader->{$methodName}($reflection, $this->annotationName));\n...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Adds rating to the database @param {Object} rating The rating to add. @param {Object} config The optional config. @param {Object} conn The optional db connection. @return {Object} Promise with success or fail.
[ "function addRating(rating, config, conn) {\n\n // validate\n if (!rating.uri || rating.uri === '') {\n return 'You must enter a valid uri'\n }\n if (!rating.reviewer || rating.reviewer === '') {\n return 'You must enter a valid reviewer'\n }\n if (isNaN(rating.rating)) {\n return 'You must enter a v...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
@param FormMapper $formMapper @throws \Exception @return mixed
[ "public function getMediaBuilder($formMapper)\n {\n $admin_pool = $this->getContainer()->get('sonata.admin.pool');\n\n $admin = $admin_pool->getAdminByAdminCode('compo_core.admin.settings');\n // simulate an association ...\n $fieldDescription = $this->getMediaAdmin()->getModelManager...
[ "protected function loadStructure()\n {\n // Method ajaxTreeView is in TreeView.php - watch out!\n $response = new Response(\n $this->getDataContainer()->ajaxTreeView($this->getAjaxId(), (int) $this->getPost('level'))\n );\n\n throw new ResponseException($response);\n }"...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Add a file handler to the global logger.
[ "def add_filehandler(level, fmt, filename, mode, backup_count, limit, when):\n \"\"\"\"\"\"\n kwargs = {}\n \n # If the filename is not set, use the default filename\n if filename is None:\n filename = getattr(sys.modules['__main__'], '__file__', 'log.py')\n filename = os.path.basename(fil...
[ "@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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *OutputGroupSettings) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"OutputGroupSettings\"}\n\tif s.ArchiveGroupSettings != nil {\n\t\tif err := s.ArchiveGroupSettings.Validate(); err != nil {\n\t\t\tinvalidParams.AddNested(\"ArchiveGroupSettings\", err.(request.ErrInvalidParams...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Push websocket message to clients. @param \Swoole\Websocket\Server $server @param mixed $data
[ "public function pushMessage($server, array $data)\n {\n $pusher = Pusher::make($data, $server);\n $pusher->push($this->payloadParser->encode(\n $pusher->getEvent(),\n $pusher->getMessage()\n ));\n }" ]
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Puts data into the cache. @param string $id The cache id. @param mixed $data The cache entry/data. @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
[ "public function save($id, $data, $ttl = 20)\n {\n if ($this->businessEntityDebug) {\n parent::save($id, $data, $ttl);\n } else {\n parent::save($id, $data);\n }\n }" ]
[ "public function validate( $input )\n {\n // Check if passed input is an object and instance of phpillowDocument\n // at all, otherwise we can exit immediately\n if ( !is_object( $input ) ||\n !( $input instanceof phpillowDocument ) )\n {\n throw new phpillowVal...
codesearchnet
{ "query": "Represent the post about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about PHP programming:" }
True if there is no item in Jenkins that has this name @param name The name to test @param currentJobName The name of the job that the user is configuring
[ "boolean isNameUnique(String name, String currentJobName) {\n Item item = getItem(name);\n\n if(null==item) {\n // the candidate name didn't return any items so the name is unique\n return true;\n }\n else if(item.getName().equals(currentJobName)) {\n // ...
[ "@Override\n public void save() throws IOException {\n // this should be a no-op unless this node instance is the node instance in Jenkins' list of nodes\n // thus where Jenkins.getInstance() == null there is no list of nodes, so we do a no-op\n // Nodes.updateNode(n) will only persist the n...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about writing:" }
<p> A list of output structures. </p> @param outputs A list of output structures.
[ "public void setOutputs(java.util.Collection<Output> outputs) {\n if (outputs == null) {\n this.outputs = null;\n return;\n }\n\n this.outputs = new com.amazonaws.internal.SdkInternalList<Output>(outputs);\n }" ]
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// NewClient creates a new client.
[ "func NewClient(params ClientParams) Client {\n\treturn newClient(params.ServiceName, params.ClientConfig, params.Options...)\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
If not already created, a new <code>mime-mapping</code> element will be created and returned. Otherwise, the first existing <code>mime-mapping</code> element will be returned. @return the instance defined for the element <code>mime-mapping</code>
[ "public MimeMappingType<WebFragmentType<T>> getOrCreateMimeMapping()\n {\n List<Node> nodeList = childNode.get(\"mime-mapping\");\n if (nodeList != null && nodeList.size() > 0)\n {\n return new MimeMappingTypeImpl<WebFragmentType<T>>(this, \"mime-mapping\", childNode, nodeList.get(0));\n ...
[ "private void required(String attributeName, String attributValue) throws ApplicationException {\n\tif (StringUtil.isEmpty(attributValue))\n\t throw new ApplicationException(\"invalid attribute constellation for the tag zip\", \"attribute [\" + attributeName + \"] is required, if action is [\" + action + \"]\");...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
// -------------------------------------------------------------------- // Constructor
[ "func new_flclient() (client *flclient_t) {\n\tclient = &flclient_t{}\n\n\tclient.socket, _ = zmq.NewSocket(zmq.DEALER)\n\treturn\n}" ]
[ "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 Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Ensure attributes are copied to subsequent queries.
[ "def _clone(self, *args, **kwargs):\n \n for attr in (\"_search_terms\", \"_search_fields\", \"_search_ordered\"):\n kwargs[attr] = getattr(self, attr)\n return super(SearchableQuerySet, self)._clone(*args, **kwargs)" ]
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// NotEmpty succeeds if submatches array is non-empty. // // Example: // m := NewMatch(t, submatches, names) // m.NotEmpty()
[ "func (m *Match) NotEmpty() *Match {\n\tif len(m.submatches) == 0 {\n\t\tm.chain.fail(\"expected non-zero submatches\")\n\t}\n\treturn m\n}" ]
[ "func TagsFilter(t map[string]string) Filter {\n\tj := tagsEncoder(t, false)\n\treturn Param(\"tags\", j)\n}" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Logs the current user
[ "public function logUser(User $user)\n {\n $this->strictEventDispatcher->dispatch('log', 'Log\\LogUserLogin', array($user));\n $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());\n $this->container->get('security.token_storage')->setToken($token);\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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetDomainControllers sets the DomainControllers field's value.
[ "func (s *JoinDomainInput) SetDomainControllers(v []*string) *JoinDomainInput {\n\ts.DomainControllers = v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n classLoaderIdentifier = (String) fields.get(CLASS_LOADER_IDENTIFIER, null);\n\n // Note that further processing is required in JEEMetadataContextProviderImp...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Converts a raw column value of type Variant to a JavaScript value. @param {String} rawColumnValue @param {Object} column @param {Object} context @returns {Object | Array}
[ "function convertRawVariant(rawColumnValue, column, context)\n{\n var ret;\n\n // if the input is a non-empty string, convert it to a json object\n if (Util.string.isNotNullOrEmpty(rawColumnValue))\n {\n try\n {\n ret = eval(\"(\" + rawColumnValue + \")\");\n }\n catch (parseError)\n {\n ...
[ "<T extends ListValue> IListValueProperty getListValue(Class<T> valuesClass,\n String name) {\n return new ListValueProperty<T>(valuesClass, name);\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Group typed objects by their type @param Typed[] $objects @return Typed[][] map indexed by types and lists of objects as values
[ "public static function groupByType(array $objects)\n {\n $perType = [];\n foreach ($objects as $object) {\n $type = $object->getType();\n if (!isset($perType[$type])) {\n $perType[$type] = [];\n }\n $perType[$type][] = $object;\n }\...
[ "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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Returns an array of properties suitable for generating a quickforms element @param base_task $task @param renderer_base $output @return array (element, name, label, options, attributes)
[ "public function get_element_properties(base_task $task = null, renderer_base $output = null) {\n return ['element' => 'defaultcustom'] + parent::get_element_properties($task, $output);\n }" ]
[ "public function XML_val($field, $arguments = [], $cache = false)\n {\n $result = $this->obj($field, $arguments, $cache);\n // Might contain additional formatting over ->XML(). E.g. parse shortcodes, nl2br()\n return $result->forTemplate();\n }" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Applies match results to other template variables. @param TemplateInterface $template @return array
[ "protected function getTemplateVars(TemplateInterface $template)\n {\n $vars = [\n 'expected' => $this->match->getExpected(),\n 'actual' => $this->match->getActual(),\n ];\n\n if ($tplVars = $template->getTemplateVars()) {\n $vars = array_merge($vars, $tplVar...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Configure dirs from env, composer extra values, and via user input.
[ "private function configureDirs()\n {\n // Configure dirs from environment variables and composer extra values.\n foreach ($this->resolver->names() as $name) {\n $default = $this->resolver->raw($name);\n $path = $this->options->get($name . '-dir', $default);\n if ($...
[ "public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
/* (non-Javadoc) @see cyclops2.monads.transformers.values.ListT#takeUntil(java.util.function.Predicate)
[ "@Override\n public StreamT<W,T> takeUntil(final Predicate<? super T> p) {\n\n return (StreamT<W,T>) FoldableTransformerSeq.super.takeUntil(p);\n }" ]
[ "public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> concatDoubles( ReactiveSeq<Double> b){\n\n return a->ReactiveSeq.fromSpliterator(DoubleStream.concat(a.mapToDouble(i->i),b.mapToDouble(i->i)).spliterator());\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// AppResourceList returns a list of all resources under appID.
[ "func (c *Client) AppResourceList(appID string) ([]*ct.Resource, error) {\n\tvar resources []*ct.Resource\n\treturn resources, c.Get(fmt.Sprintf(\"/apps/%s/resources\", appID), &resources)\n}" ]
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Clean data from shared memory block
[ "protected function clean()\n {\n if ($this->exists()) {\n $id = shmop_open($this->id, \"a\", 0, 0);\n shmop_delete($id);\n shmop_close($id);\n }\n }" ]
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Technology:" }
// NewAggregateFromChannel creates a new aggregate instance from the provided // errors channel. // // A context.Context can be passed in so the caller has the ability to cancel // the operation. If this is not desired, simply pass context.Background().
[ "func NewAggregateFromChannel(errCh chan error, ctx context.Context) error {\n\tvar errs []error\n\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase err, ok := <-errCh:\n\t\t\tif !ok { // the channel is closed, time to exit\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t\terrs = append(errs, err)\n\t\tcase <-ctx.Done():\n\t\t\tbreak Loop...
[ "func (m *Manager) removeProxyServiceLocked(proxyID string) {\n\tstate, ok := m.proxies[proxyID]\n\tif !ok {\n\t\treturn\n\t}\n\n\t// Closing state will let the goroutine we started in Ensure finish since\n\t// watch chan is closed.\n\tstate.Close()\n\tdelete(m.proxies, proxyID)\n\n\t// We intentionally leave poten...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
跳转到下一个状态 @param currentState 当前状态 @param character 接受字符 @return 跳转结果
[ "private static State getState(State currentState, Character character)\n {\n State newCurrentState = currentState.nextState(character); // 先按success跳转\n while (newCurrentState == null) // 跳转失败的话,按failure跳转\n {\n currentState = currentState.failure();\n newCurrentState...
[ "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 summarization about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about text processing:" }
// parseMacro parses a macro definition. // // {% macro <name>([ arg [ , arg]) %} // Macro body // {% endmacro %}
[ "func parseMacro(t *Tree, start Pos) (Node, error) {\n\ttok, err := t.expect(tokenName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname := tok.value\n\t_, err = t.expect(tokenParensOpen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar args []string\n\tfor {\n\t\ttok = t.nextNonSpace()\n\t\tswitch tok.token...
[ "def from_template(cls, template):\n \n regex = r'#{\\s*%s\\s*}' % cls.ALLOWED_KEY\n keys = re.findall(regex, template)\n if len(keys) == 0:\n raise cls.Bad(\"Bad keys template: %s. Should be: \\\"%s\\\"\" % (\n template, \"a = #{key1}, b = #{key2.key3} ...\"))\...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Sends commands to this hypervisor. :param command: a uBridge hypervisor command :returns: results as a list
[ "def send(self, command):\n \n\n # uBridge responses are of the form:\n # 1xx yyyyyy\\r\\n\n # 1xx yyyyyy\\r\\n\n # ...\n # 100-yyyy\\r\\n\n # or\n # 2xx-yyyy\\r\\n\n #\n # Where 1xx is a code from 100-199 for a success or 200-299 for a...
[ "def service_start(name):\n '''\n \n '''\n cmd = 'start ' + name\n\n # Send the command to execute\n out, err = DETAILS['server'].sendline(cmd)\n\n # \"scrape\" the output and return the right fields as a dict\n return parse(out)" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
A patch for https://www.ruby-forum.com/topic/4419577 Since the division values are off for values < 1, multiply the BigDecimal instance by its precision
[ "def / other\n if other.is_a?(BigDecimal) && other < 1\n precision = 10 * precs.first\n (self * precision) / (other * precision)\n else\n super\n end\n end" ]
[ "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:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *ConfirmTransitVirtualInterfaceInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ConfirmTransitVirtualInterfaceInput\"}\n\tif s.DirectConnectGatewayId == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"DirectConnectGatewayId\"))\n\t}\n\tif s.VirtualInterfaceId == ...
[ "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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Set response status from a status string. @param string $statusLine Response status as a string. @return $this @throws \InvalidArgumentException For invalid status line.
[ "public function setStatus($statusLine)\n {\n $parts = explode(' ', $statusLine, 3);\n if (count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) {\n throw new \\InvalidArgumentException(\n sprintf('\"%s\" is not a valid HTTP status line', $statusLine)\n ...
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the post about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about Software development:" }
@param array $defaults @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
[ "protected function createStandardParameter(array $defaults)\n {\n $standardParameterTransfer = new PayoneStandardParameterTransfer();\n $standardParameterTransfer->fromArray($defaults);\n\n $payoneConfig = Config::get(PayoneConstants::PAYONE);\n $standardParameterTransfer->setAid($pa...
[ "public function choices(): HasMany\n {\n return $this->hasMany(\\Iocaste\\Microservice\\Foundation\\Data\\Models\\Parameter\\Choice::class);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Rotate the motor at ``speed`` for ``degrees`` ``speed`` can be a percentage or a :class:`ev3dev2.motor.SpeedValue` object, enabling use of other units.
[ "def on_for_degrees(self, speed, degrees, brake=True, block=True):\n \n speed_sp = self._speed_native_units(speed)\n self._set_rel_position_degrees_and_speed_sp(degrees, speed_sp)\n self._set_brake(brake)\n self.run_to_rel_pos()\n\n if block:\n self.wait_until('r...
[ "def _convert_angle_limit(angle, joint, **kwargs):\n \"\"\"\"\"\"\n angle_pypot = angle\n\n # No need to take care of orientation\n if joint[\"orientation\"] == \"indirect\":\n angle_pypot = 1 * angle_pypot\n\n # angle_pypot = angle_pypot + offset\n\n return angle_pypot * np.pi / 180" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Check match in tail array @param base @param index @param key @return index if it is complete match. 0 if it is prefix match. negative value if it doesn't match
[ "private int matchTail(int base, int index, String key) {\n int positionInTailArr = base - TAIL_OFFSET;\n\n int keyLength = key.length();\n for (int i = 0; i < keyLength; i++) {\n if (key.charAt(i) != tailBuffer.get(positionInTailArr + i)) {\n return -1;\n }...
[ "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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Is the IP address in the subnet? @param string $ip_address_string @return bool
[ "public function isIPAddressInSubnet($ip_address_string)\n {\n $ip_address = ip2long($ip_address_string);\n list($start_ip, $end_ip) = $this->getIPAddressRangeAsInts();\n\n return $ip_address >= $start_ip && $ip_address <= $end_ip\n ? true\n : false;\n }" ]
[ "def getNetworkName(self):\n \"\"\"\"\"\"\n print '%s call getNetworkname' % self.port\n networkName = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:Name')[0]\n return self.__stripValue(networkName)" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Broadcasts a progress update. @param uploadedBytes number of bytes which has been uploaded to the server @param totalBytes total bytes of the request
[ "protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) {\n\n long currentTime = System.currentTimeMillis();\n if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) {\n return;\n }\n\n ...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about File management:" }
Parses the Bitcoin transactions in a byte buffer. @param rawByteBuffer ByteBuffer from which the transactions have to be parsed @param noOfTransactions Number of expected transactions @return Array of transactions
[ "public List<BitcoinTransaction> parseTransactions(ByteBuffer rawByteBuffer,long noOfTransactions) {\n\tArrayList<BitcoinTransaction> resultTransactions = new ArrayList<>((int)noOfTransactions);\n\t// read all transactions from ByteBuffer\n\tfor (int k=0;k<noOfTransactions;k++) {\n\t\t// read version\n\t\tint curre...
[ "def reset(self):\n \n self.getsCounter = 0\n\n # dictionary of processed requests for each client. Value for each\n # client is a dictionary with request id as key and transaction id as\n # value\n self.processedRequests = {} # type: Dict[str, Dict[int, str]]\n\n #...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
/* list -> array
[ "public DataArray array(File[] files, int start, int count) {\n\t\treturn STRUCT.fromMapsAndCollections(list(files, start, count));\n\t}" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Gets an array of commands that have been configured to be disabled. @return array A flat array of disabled commands.
[ "protected function getDisabledCommands() {\n $disabled_commands_config = $this->getConfigValue('disable-targets');\n if ($disabled_commands_config) {\n $disabled_commands = ArrayManipulator::flattenMultidimensionalArray($disabled_commands_config, ':');\n return $disabled_commands;\n }\n retur...
[ "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:" }
Returns a gap range between two ranges. @param DateRange $range The range to compare to. @return DateRange @since 2.0.0
[ "public function gap(DateRange $range)\n\t{\n\t\treturn self::cast($this->range->gap($range->range));\n\t}" ]
[ "public static function objectType($fieldId)\n {\n //====================================================================//\n // decode\n $result = self::isIdField($fieldId);\n if (empty($result)) {\n return false;\n }\n //=====================================...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Seo content @return SeoContent
[ "public function getSeoContentModel() {\n\t\tif ($this->_model === null) {\n\t\t\t$seoOwnModelQuery = SeoContent::find()->where([\n\t\t\t\t'model_id' => $this->owner->getPrimaryKey(),\n\t\t\t\t'model_name' => $this->owner->className()\n\t\t\t]);\n\n\t\t\t$enableCache = $this->owner->enableSqlQueryCache;\n\t\t\t$cac...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Enables/disables autowiring. @param bool $autowired @return $this
[ "public function setAutowired($autowired)\n {\n $this->changes['autowired'] = true;\n\n $this->autowired = (bool) $autowired;\n\n return $this;\n }" ]
[ "final protected function sEav($c = EavSetup::class) {return dfc($this, function($c) {return\n\t\tdf_new_om($c, ['setup' => $this->_setup])\n\t;}, [$c]);}" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Loads bundles routes into application's router.
[ "public function loadBundlesRoutes()\n {\n $loadedBundles = array_keys($this->container->findTaggedServiceIds('bundle.config'));\n foreach ($loadedBundles as $serviceId) {\n $config = $this->container->get($serviceId);\n $recipes = $this->getLoaderRecipesByConfig($config);\n\n...
[ "function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Convert a string to an array like [singular-form, plural-form] @param {string|array} value Date to convert @return {array} An array like [singular-form, plural-form]
[ "function expandItemName(value) {\n\t\t\tif (typeof value === \"string\") {\n\t\t\t\treturn [value, value + (value !== \"\" ? \"s\" : \"\")];\n\t\t\t}\n\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tif (value.length === 1) {\n\t\t\t\t\treturn [value[0], value[0] + \"s\"];\n\t\t\t\t} else if (value.length > 2) {\n\t\t...
[ "function validateDoc(lines) {\n expect(lines.length).toBe(18);\n\n // First line should be overall comment with preamble\n expect(lines[0]).toBe('\\t * Test object comment');\n\n // Second line should be a newline with preamble\n expect(lines[1]).toBe('\\t * ');\n\n /* Third line should be first parameter de...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Get {@code numElements} out of the {@link CodecOutputList} and forward these through the pipeline.
[ "static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) {\n for (int i = 0; i < numElements; i ++) {\n ctx.fireChannelRead(msgs.getUnsafe(i));\n }\n }" ]
[ "@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
// AuthURL provides a URL to redirect the client for authorization // at the authorization server
[ "func (c Client) AuthURL(state string) string {\n\tvalues := url.Values{\"client_id\": {c.ISS}, \"state\": {\"state\"}, \"response_type\": {\"code\"}}\n\treturn fmt.Sprintf(\"%s?%s\", c.Endpoint.AuthURL, values.Encode())\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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Calculates the error between the autoencoder's reconstruction of the input and the argument instances. This error is converted to vote scores. @param inst the instance to get votes for @return the votes for the instance's label [normal, outlier]
[ "@Override\n\tpublic double[] getVotesForInstance(Instance inst)\n\t{\n\t\tdouble[] votes = new double[2];\n\n\t\tif (this.reset == false)\n\t\t{\n\t\t\tdouble error = this.getAnomalyScore(inst);\n\t\t\t\n\t\t\t// Exponential function to convert the error [0, +inf) into a vote [1,0].\n\t\t\tvotes[0] = Math.pow(2.0,...
[ "def add (data, label)\n raise \"No meaningful label associated with data\" unless ([:positive, :negative].include? label)\n \n #Create a data point in the vector space from the datum given\n data_point = Eluka::DataPoint.new(data, @analyzer)\n \n #Add the data point to the feature spa...
codesearchnet
{ "query": "Represent the description about Deep Learning:", "pos": "Represent the code about Deep Learning:", "neg": "Represent the code:" }
Allowed input/output patterns are 1. [N, C] ---> [N, 1] Note that N must be 1 currently because TensorToProbability doesn't support batch size larger than 1.
[ "def calculte_tensor_to_label_output_shapes(operator):\n '''\n \n '''\n check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1)\n check_input_and_output_types(operator, good_input_types=[FloatTensorType])\n\n N = operator.inputs[0].type.shape[0]\n if operator.target_...
[ "def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i...
codesearchnet
{ "query": "Represent the sentence about Deep Learning:", "pos": "Represent the code about Deep Learning:", "neg": "Represent the code:" }
// Accept waits for and returns the next connection to the listener. // Returns a Multiaddr friendly Conn
[ "func (l *maListener) Accept() (Conn, error) {\n\tnconn, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar raddr ma.Multiaddr\n\t// This block protects us in transports (i.e. unix sockets) that don't have\n\t// remote addresses for inbound connections.\n\tif nconn.RemoteAddr().String(...
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Sets the password for the user @param string $password @param string $algorithm @param array $options [optional]
[ "public function setPassword($password, $algorithm = PasswordFile::ALG_MD5, array $options = null)\n {\n $this->hash = Crypt::hash($password, $algorithm, $options);\n }" ]
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Returns the default class of $namespace. @param string $namespace Namespace of the controller @return array Default method and controller
[ "public static function getNamespaceDefaultClass($namespace, $defaultNamespace) {\n if (strpos($namespace, $defaultNamespace) === 0) {\n $namespace = substr($namespace, strlen($defaultNamespace));\n }\n\n $defaults = self::$_config['defaults'];\n $controller = $defaults[str_re...
[ "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 post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software Development:" }
// replyError sends HTTP 500 on transient errors, HTTP 400 on fatal ones.
[ "func replyError(c context.Context, rw http.ResponseWriter, err error) {\n\tlogging.Errorf(c, \"Error while processing PubSub notification - %s\", err)\n\tif transient.Tag.In(err) {\n\t\thttp.Error(rw, err.Error(), http.StatusInternalServerError)\n\t} else {\n\t\thttp.Error(rw, err.Error(), http.StatusBadRequest)\n...
[ "def get(resource, params: {}, key: Steam.apikey)\n params[:key] = key\n response = @conn.get resource, params\n JSON.parse(response.body)\n rescue JSON::ParserError\n # If the steam web api returns an error it's virtually never in json, so\n # lets pretend that we're getting some sort...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Set the maximum time to live (ttl) @param int|null $value Seconds or null to live forever @throws InvalidArgumentException
[ "protected function setTtlOption(?int $value): void\n {\n if (isset($value) && $value < 1) {\n throw new InvalidArgumentException('ttl cant be lower than 1');\n }\n\n $this->ttl = $value;\n }" ]
[ "public function setDirectives($directives)\n {\n parent::setDirectives($directives);\n $lifetime = $this->getLifetime(false);\n if ($lifetime > 2592000) {\n // #ZF-3490 : For the memcached backend, there is a lifetime limit of 30 days (2592000 seconds)\n $this->_log('m...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// Exec executes a query that returns no rows. See sql/driver.Stmt. // You must bolt encode a map to pass as []bytes for the driver value
[ "func (c *boltConn) Exec(query string, args []driver.Value) (driver.Result, error) {\n\tif c.statement != nil {\n\t\treturn nil, errors.New(\"An open statement already exists\")\n\t}\n\tif c.closed {\n\t\treturn nil, errors.New(\"Connection already closed\")\n\t}\n\n\tstmt := newStmt(query, c)\n\tdefer stmt.Close()...
[ "func (sq *subquery) PushFilter(_ *primitiveBuilder, _ sqlparser.Expr, whereType string, _ builder) error {\n\treturn errors.New(\"unsupported: filtering on results of cross-shard subquery\")\n}" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns checksum from the configuration files. You can set $this->checksum = false to disable this check. @return bool|string
[ "public function checksum()\n {\n if (null === $this->checksum) {\n $this->checksum = md5(json_encode($this->files) . $this->version);\n }\n\n return $this->checksum;\n }" ]
[ "protected function VerifyPLUGName()\n {\n // if plug already set, don't need to set it now.\n if ($this->getOption('plug') != '') {\n return;\n }\n\n //Sets the default plug.\n $size = 512;\n $unit = 'K';//or M\n\n /*4K, 32K, 65K, 512K,\n 1M, ...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
1. determine bin coverage 2. determine rRNA gene coverage 3. compare
[ "def copies(mapping, s2bins, rna, min_rna = 800, mismatches = 0):\n \n cov = {} # cov[scaffold] = [bases, length]\n s2bins, bins2s = parse_s2bins(s2bins)\n rna_cov = parse_rna(rna, s2bins, min_rna)\n s2bins, bins2s = filter_missing_rna(s2bins, bins2s, rna_cov)\n # count bases mapped to scaffolds a...
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
// Quit issues a QUIT FTP command to properly close the connection from the // remote FTP server.
[ "func (c *ServerConn) Quit() error {\n\tc.conn.Cmd(\"QUIT\")\n\treturn c.conn.Close()\n}" ]
[ "private void stopOut() throws IOException {\n if (outClosed) {\n return;\n }\n outClosed = true;\n\n LOG.log(Level.FINE, \"Shutting down socket for output\");\n\n // close socket for output - that will initiate normal socket close procedure; in case of TCP\n // socket this is\n // a buffe...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Gets the HTTP method. @param request the specified request @return HTTP method
[ "private String getHttpMethod(final HttpServletRequest request) {\n String ret = (String) request.getAttribute(Keys.HttpRequest.REQUEST_METHOD);\n if (StringUtils.isBlank(ret)) {\n ret = request.getMethod();\n }\n\n return ret;\n }" ]
[ "@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 instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
@param object $owner @param string $type @return static
[ "public function remove($owner, $type = 'default')\n {\n $owner_id = spl_object_id($owner);\n\n if (!isset($this->_pool[$owner_id])) {\n return $this;\n }\n\n foreach ($type === null ? array_keys($this->_pool[$owner_id]) : [$type] as $current) {\n $queue = $this-...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Compute the required standard security handler version based on the RC4 key size. _key_size_:: Key size in bits. Returns [ version, revision ].
[ "def crypto_revision_from_rc4_key(key_size)\n raise EncryptionError, \"Invalid RC4 key length\" unless key_size.between?(40, 128) and key_size % 8 == 0\n\n if key_size > 40\n version = 2\n revision = 3\n else\n version = 1\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization about Blockchain:", "pos": "Represent the Github code about Blockchain:", "neg": "Represent the Github code:" }
Read and return the next line from the file. @param array $data
[ "public function printLine($data)\n {\n if (!is_array($data)) {\n throw new \\RuntimeException(\"can not write CSV data. supplied data is not an array.\");\n }\n fputcsv($this->handle, $data, $this->delimiter, $this->enclosure, $this->escape);\n ++$this->lineNumber;\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 description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Dial dials a named connection. // // Known networks are "memb" (memconn buffered) and "memu" (memconn unbuffered). // // When the provided network is unknown the operation defers to // net.Dial.
[ "func Dial(network, address string) (net.Conn, error) {\n\treturn provider.Dial(network, address)\n}" ]
[ "func (c *agentConf) AddFlags(f *gnuflag.FlagSet) {\n\t// TODO(dimitern) 2014-02-19 bug 1282025\n\t// We need to pass a config location here instead and\n\t// use it to locate the conf and the infer the data-dir\n\t// from there instead of passing it like that.\n\tf.StringVar(&c.dataDir, \"data-dir\", util.DataDir,...
codesearchnet
{ "query": "Represent the sentence about network configuration:", "pos": "Represent the code about network configuration:", "neg": "Represent the code about programming:" }
Generates a map of all client-side default content properties to be added with new content. @param absolutePath @param creator @return
[ "public static Map<String, String> createContentProperties(String absolutePath,\n String creator) {\n\n Map<String, String> props = new HashMap<String, String>();\n if (creator != null && creator.trim().length() > 0) {\n props.put...
[ "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 summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Helper function to construct a UfoOptions object.
[ "function () {\n const options = {};\n options.host = cli.ufo || process.env.LUFO_ADDRESS || '';\n options.password = cli.password || process.env.LUFO_PASSWORD || undefined;\n options.localHost = cli.localHost || process.env.LUFO_LOCALHOST || undefined;\n options.localUdpPort = parseInt(cli.localUdpPort || pro...
[ "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 summarization about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code about programming:" }
Check if path should be excluded. @param string $path @return bool True if path has matched pattern
[ "protected function exclude(string $path): bool\n {\n foreach ($this->exclude as $pattern) {\n $replacements = [\n '\\\\,' => ',',\n '*' => '.*',\n ];\n\n $pattern = strtr($pattern, $replacements);\n\n if (preg_match(\"|{$pattern}|i...
[ "public function reduceFilePath($varValue, \\DataContainer $dc)\n {\n $doc = $dc->activeRecord;\n\n $path = \\FilesModel::findByUuid($varValue)->path;\n\n $arrFileNameParts = \\Document::splitFileName(substr($path, strlen(\\DmsConfig::getBaseDirectory(true))));\n\n // TODO (#33): reset the new fileType...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
set order @param string $order_field @param string $order_type @return Datatable
[ "public function setOrder($order_field, $order_type)\n {\n $this->order_field = $order_field;\n $this->order_type = $order_type;\n $this->queryBuilder->orderBy($order_field, $order_type);\n return $this;\n }" ]
[ "protected function map() {return df_map_0(df_sort_a(df_map_r(df_cms_blocks(), function(B $b) {return [\n\t\t$b->getId(), $b->getTitle()\n\t];})), '-- select a CMS block --');}" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// HandleWebsocketConnection handles the online viewers per example(gist source)
[ "func HandleWebsocketConnection(c websocket.Connection) {\n\n\tc.On(\"watch\", func(pageSource string) {\n\t\tv.Add(pageSource)\n\t\t// join the socket to a room linked with the page source\n\t\tc.Join(pageSource)\n\n\t\tviewsCount := v.Get(pageSource).getCount()\n\t\tif viewsCount == 0 {\n\t\t\tviewsCount++ // cou...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Creates a new page entity. @Route("/new") @Method({"GET", "POST"}) @Template()
[ "public function newAction(Request $request)\n {\n $page = new Page();\n $form = $this->createForm('CoreBundle\\Form\\PageType', $page, array('translator'=>$this->get('translator')));\n $form->handleRequest($request);\n\n if ($form->isSubmitted() && $form->isValid()) {\n $e...
[ "func New() http.Handler {\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/\", actionHandler).Methods(\"GET\", \"POST\")\n\tr.HandleFunc(\"/{account}\", actionHandler).Methods(\"GET\", \"POST\")\n\tr.HandleFunc(\"/queue/{queueName}\", actionHandler).Methods(\"GET\", \"POST\")\n\tr.HandleFunc(\"/{account}/{queueName}\"...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Data processing:" }
Specify a callback to be called to load the collection. TODO: Figure out how to declare the arguments @param string $function_name @param null $obj_or_class @throws CollectionException
[ "public function setLoadCallback($function_name, $obj_or_class = null) : void\n {\n if ($obj_or_class) {\n $callback = array($obj_or_class, $function_name);\n } else {\n $callback = $function_name;\n }\n // Make sure the function is valid\n if (!is_callabl...
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// getArgsEnv returns the nspawn or lkvm args and env according to the flavor // as the first two return values respectively.
[ "func getArgsEnv(p *stage1commontypes.Pod, flavor string, canMachinedRegister bool, debug bool, n *networking.Networking, parentIPC bool) ([]string, []string, error) {\n\tvar args []string\n\tenv := os.Environ()\n\n\t// We store the pod's flavor so we can later garbage collect it correctly\n\tif err := os.Symlink(f...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Edit button. @param string $type @param int $id @param string $class @return string
[ "public function editBtn($type = null, $id = null, $class=\"btn-outline-secondary\")\n {\n if (Gate::allows('cms', Auth::user())) {\n if (!is_null($id)) {\n return '<a href=\"'.url($this->backendRoute.'/'.$type.'/'.$id.'/edit').'\" class=\"btn btn-sm '.$class.'\"><span class=\"fa...
[ "function openTable()\n {\n $this->examples = [];\n $this->markdown = ''; // Clear table\n $this->declareAbstraction = true;\n $this->add('| Visibility | Function |');\n $this->add('|:-----------|:---------|');\n }" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Retrieve the name of the request host @return string
[ "public function getDnsName(): string\n {\n $host = $this->environment[\"HTTP_HOST\"] ?? \"\";\n $port = strpos($host, \":\");\n if ($port !== false) {\n return substr($host, 0, $port);\n }\n return $host;\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 Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Returns an array of procedure and/or observableProperty concepts, and sets item._previousProcedureIdentifier and _previousObservablePropertyIdentifier. @private
[ "function buildConcepts(item) {\n var concepts = [];\n if (!defined(item.procedures) || !defined(item.observableProperties)) {\n throw new DeveloperError(\n \"Both `procedures` and `observableProperties` arrays must be defined on the catalog item.\"\n );\n }\n if (item.procedures.length > 1) {\n v...
[ "def creationTime(item):\n \n forThisItem = _CreationTime.createdItem == item\n return item.store.findUnique(_CreationTime, forThisItem).timestamp" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Do multiple inheritance @author Jelle De Loecker <jelle@develry.be> @since 0.3.6 @version 0.3.6 @param {Function} new_constructor @param {Function} parent_constructor @param {Object} proto
[ "function doMultipleInheritance(new_constructor, parent_constructor, proto) {\n\n\t\tvar more;\n\n\t\tif (proto == null) {\n\t\t\tproto = Object.create(new_constructor.prototype);\n\t\t}\n\n\t\t// See if this goes even deeper FIRST\n\t\t// (older properties could get overwritten)\n\t\tmore = Object.getPrototypeOf(p...
[ "function init(entry, socket, req) { // {{{2\n/**\n * Class constructor\n *\n * @param entry {Object} Entry of xorg kind\n *\n * @method constructor\n */\n\n this.entry = entry;\n\n O.link.open(this, socket);\n}" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
Extract measured data from `FeedbackResults` instance into `pandas.DataFrame`.
[ "def feedback_results_to_measurements_frame(feedback_result):\n '''\n \n '''\n index = pd.Index(feedback_result.time * 1e-3, name='seconds')\n df_feedback = pd.DataFrame(np.column_stack([feedback_result.V_fb,\n feedback_result.V_hv,\n ...
[ "def _get_result_paths(self, data):\n \n\n # Swarm OTU map (mandatory output)\n return {'OtuMap': ResultPath(Path=self.Parameters['-o'].Value,\n IsWritten=True)}" ]
codesearchnet
{ "query": "Represent the instruction about Data Science:", "pos": "Represent the code about Data Science:", "neg": "Represent the code about programming:" }
// hasPath returns true if the map contains the given key, false otherwise.
[ "func hasPath(data map[string]interface{}, key string) bool {\n\t_, ok := data[key]\n\treturn ok\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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Format given string to valid URL string @param string $url @return string URL-safe string
[ "public function formatUrl($string)\n {\n // Allow only alphanumerics, underscores and dashes\n $string = preg_replace('/([^a-zA-Z0-9_\\-]+)/', '-', strtolower($string));\n // Replace extra spaces and dashes with single dash\n $string = preg_replace('/\\s+/', '-', ...
[ "public function reduceFilePath($varValue, \\DataContainer $dc)\n {\n $doc = $dc->activeRecord;\n\n $path = \\FilesModel::findByUuid($varValue)->path;\n\n $arrFileNameParts = \\Document::splitFileName(substr($path, strlen(\\DmsConfig::getBaseDirectory(true))));\n\n // TODO (#33): reset the new fileType...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
/* RefreshTokenInterface
[ "public function getRefreshToken($refresh_token)\n {\n return isset($this->refreshTokens[$refresh_token]) ? $this->refreshTokens[$refresh_token] : null;\n }" ]
[ "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 Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about File management:" }
// listenLinux is the entry point for tests on Linux.
[ "func listenLinux(lfd listenFD, cid, port uint32) (l *Listener, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t// If any system calls fail during setup, the socket must be closed\n\t\t\t// to avoid file descriptor leaks.\n\t\t\t_ = lfd.EarlyClose()\n\t\t}\n\t}()\n\n\t// Zero-value for \"any port\" is fr...
[ "def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Sets an String object at the given index. @param index the index. This value must not exceed the bounds of the array. @param value the String object @return The self object
[ "@NonNull\n @Override\n public MutableArray setString(int index, String value) {\n return setValue(index, value);\n }" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
@see http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductService/help/operations/GetProductsByBarcode @param string $barCode @param int $siteId @return array
[ "public function getProductsByBarcode(string $barCode, int $siteId) : array\n {\n Assert::that($barCode)->minLength(1, 'The length of $barCode has to be > 0');\n Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');\n\n return (array)$this->master->doRequest(\n ...
[ "def get(self):\n ''''''\n request = TOPRequest('xxxxx.xxxxx.campaign.areaoptions.get')\n self.create(self.execute(request), fields=['success','result'], models={'result':AreaOption})\n return self.result" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Loop Article Blog. @param int $nbposts Number of posts to display. @return void
[ "public static function getArticles($nbposts)\n {\n $args = [\n 'post_type' => 'post',\n 'category_name' => 'blog',\n 'posts_per_page' => $nbposts,\n 'order' => 'DESC',\n ];\n $loop = new \\WP_Query($args);\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 text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
(Constructor) Initialises the module @param {object} isnodeObj - The parent isnode object
[ "function(isnodeObj){\n\t\tif(initialised)\n\t\t\treturn ismod;\n\t\tisnode = isnodeObj;\n\t\tlog = isnode.module(\"logger\").log;\n\t\tisnode.on(\"shutdown\", function(){ shutdown(); });\n\t\tismod.initialised = true;\n\t\treturn ismod;\n\t}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
copy project to local temp directory
[ "private boolean copyProjectFolder(String projectFolder, File buildGradleTempDirectory) {\n try {\n FileUtils.copyDirectory(new File(projectFolder), buildGradleTempDirectory);\n } catch (IOException e) {\n logger.error(\"Could not copy the folder {} to {} , the cause {}\", projec...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns true iff the two hits can be used to circularise the reference sequence of the hits
[ "def _can_circularise(self, start_hit, end_hit):\n ''''''\n if not(self._is_at_ref_start(start_hit) or self._is_at_ref_end(end_hit)):\n return False\n\n if self._is_at_qry_end(start_hit) \\\n and self._is_at_qry_start(end_hit) \\\n and start_hit.on_same_strand() \\\...
[ "def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
This method generates all seven masks so that the best mask can be determined. The template parameter is a code matrix that will server as the base for all the generated masks.
[ "def make_masks(self, template):\n \n from copy import deepcopy\n\n nmasks = len(tables.mask_patterns)\n masks = [''] * nmasks\n count = 0\n\n for n in range(nmasks):\n cur_mask = deepcopy(template)\n masks[n] = cur_mask\n\n #Add the type pa...
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Settings lazy loading. @param SettingsOwnerInterface|null $owner @return SettingsManager
[ "private function loadSettings(SettingsOwnerInterface $owner = null)\n {\n // Global settings\n if ($this->globalSettings === null) {\n $this->globalSettings = $this->getSettingsFromRepository();\n }\n\n // User settings\n if ($owner !== null && ($this->ownerSettings...
[ "public function init()\n {\n $this->response->disableLayout();\n $this->userStore = b8\\Store\\Factory::getStore('User');\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Values returns the type of values that can be enumerated for a.
[ "func Values(a Type) Type {\n\tswitch a := a.(type) {\n\tcase *Array:\n\t\tvar tpe Type\n\t\tfor i := range a.static {\n\t\t\ttpe = Or(tpe, a.static[i])\n\t\t}\n\t\treturn Or(tpe, a.dynamic)\n\tcase *Object:\n\t\tvar tpe Type\n\t\tfor _, v := range a.static {\n\t\t\ttpe = Or(tpe, v.Value)\n\t\t}\n\t\tif a.dynamic !...
[ "@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:" }
Call the given callback if or when the connected deferred succeeds.
[ "def on_success(self, fn, *args, **kwargs):\n \n\n self._callbacks.append((fn, args, kwargs))\n\n result = self._resulted_in\n if result is not _NOTHING_YET:\n self._succeed(result=result)" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get controller name. @return string
[ "public function getControllerName()\n {\n $controller = Str::studly($this->getEntities()).'Controller';\n\n if ($this->console->option('prefix')) {\n $controller = Str::studly($this->getPrefix('/')).$controller;\n }\n\n return str_replace('/', '\\\\', $controller);\n }"...
[ "def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
ホワイトリストにもとづきフィルタリングを行った結果を返します。 @param string $input @return string HTMLの解析に失敗した場合は、空文字列を返します。
[ "public function filter(string $input): string\n {\n // 解析\n $body = $this->parse($input);\n if (!$body) {\n return '';\n }\n \n // beforeコールバック関数の実行\n if (isset($this->options['before']) && call_user_func($this->options['before'], $body) === false) {\n...
[ "func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S...
codesearchnet
{ "query": "Represent the text about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about Software development:" }
Call helloWorld @param name String name @return String helloworld
[ "public String helloWorld(String name)\n {\n if (mc == null)\n associate();\n\n return mc.helloWorld(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 text about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about programming:" }
Creates a dropdown from a list of commands. @param LibBaseTemplateObjectContainer $commands Container of commands @param array $config Configuration array @return string
[ "public function dropdown($commands, $config = array())\n {\n $config['commands'] = $commands;\n\n if (!isset($config['icon'])) {\n $config['icon'] = 'cog';\n }\n\n return $this->_render('dropdown', $config);\n }" ]
[ "public ScreenComponent startEditor(Field fldProperties, boolean bAllowAppending, Map<String,Object> mapKeyDescriptions)\n {\n return null; // TODO add thin impl\n }" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Execute the statement and return only the first record from the result set. @param returnType The Class to return. @param <V> The type parameter. @return An instance of {@literal <V>} from the result set.
[ "public <V> V executeAndFetchFirst(Class<V> returnType) {\n Object o = executeScalar();\n if (null == o) {\n return null;\n }\n return convert(o, returnType);\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Compiles regular expression used for parsing SMS messages based on current mode
[ "def _compileSmsRegexes(self):\n \n if self._smsTextMode:\n if self.CMGR_SM_DELIVER_REGEX_TEXT == None:\n self.CMGR_SM_DELIVER_REGEX_TEXT = re.compile(r'^\\+CMGR: \"([^\"]+)\",\"([^\"]+)\",[^,]*,\"([^\"]+)\"$')\n self.CMGR_SM_REPORT_REGEXT_TEXT = re.compile(r'^...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// StructType = "struct" "{" [ FieldList ] "}" . // FieldList = Field { ";" Field } .
[ "func (p *gc_parser) parse_struct_type() ast.Expr {\n\tvar fields []*ast.Field\n\tparse_field := func() {\n\t\tfld := p.parse_field()\n\t\tfields = append(fields, fld)\n\t}\n\n\tp.expect_keyword(\"struct\")\n\tp.expect('{')\n\tif p.tok != '}' {\n\t\tparse_field()\n\t\tfor p.tok == ';' {\n\t\t\tp.next()\n\t\t\tparse...
[ "Rule LocalVariableDeclarationStatement() {\n return Sequence(ZeroOrMore(FirstOf(FINAL, Annotation())), Type(), VariableDeclarators(), SEMI);\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about language and writing:" }
Provide options for default selection. @param GetOptionsEvent $event The event. @return void @SuppressWarnings(PHPMD.Superglobals) @SuppressWarnings(PHPMD.CamelCaseVariableName)
[ "public function getOptions(GetOptionsEvent $event)\n {\n // Check the context.\n $allowedProperties = array('lookupservice', 'second_attr_id', 'single_attr_id');\n if (!$this->isAllowedProperty($event, 'tl_metamodel_filtersetting', $allowedProperties)\n || 'lookupservice' !== $ev...
[ "public function attachValidators(Validator $validator)\n {\n /** @var ClassMetadata $fileMetadata */\n $fileMetadata = $validator->getMetadataFor('phpDocumentor\\Descriptor\\FileDescriptor');\n /** @var ClassMetadata $constantMetadata */\n $constantMetadata = $validator->getMetadat...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
@return Result @SuppressWarnings(PHPMD.UnusedFormalParameter)
[ "public function getData(array $options)\n {\n $provider = $this->getProvider();\n\n $ownerDetails = $provider->getResourceOwner($this->accessToken);\n\n $ownerDetailsArray = $ownerDetails->toArray();\n\n $email = null;\n if (isset($ownerDetailsArray['emails']) && is_array($own...
[ "private void initJavaFXTaglets() {\n addStandardTaglet(new PropertyGetterTaglet());\n addStandardTaglet(new PropertySetterTaglet());\n addStandardTaglet(new SimpleTaglet(\"propertyDescription\",\n message.getText(\"doclet.PropertyDescription\"),\n SimpleTaglet.FIE...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Add the current locale's URL segment to the start of the URL @param string &$base @param string &$action
[ "public function updateRelativeLink(&$base, &$action)\n {\n // Don't inject locale to subpages\n if ($this->owner->ParentID && SiteTree::config()->get('nested_urls')) {\n return;\n }\n\n // Get appropriate locale for this record\n $localeObj = $this->getRecordLocale(...
[ "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 Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Set updates the value of SyncVal with the passed argument
[ "func (sv *SyncVal) Set(val interface{}) {\n\tsv.lock.Lock()\n\tsv.val = val\n\tsv.lock.Unlock()\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:" }