query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Set response headers and print response text
@access public
@return object | [
"public function render() {\n // Parse contents\n $res = $this->get();\n \n // Set HTTP Headers\n foreach ($this->_headers as $header) {\n header($header);\n }\n \n // Set cookies\n foreach($this->_cookies as $k => $v) {\n Cookie::... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github summarization about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Serialize the payment account unique id node if there's a valid value.
@return string | [
"protected function _serializePaymentAccountUniqueId()\n\t{\n\t\t$isToken = $this->getIsToken();\n $paymentAccountUniqueId = $this->getPaymentAccountUniqueId();\n\n if( $isToken && $isToken != false && $isToken != \"false\" )\n {\n return $payment... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Format error line.
@param {object} message Message object to format
@return {string} | [
"function formatMessage (message) {\n return '<error' +\n attr(message, 'line') +\n attr(message, 'column') +\n attr(message, 'severity') +\n attr(message, 'message') +\n ('source' in message ? attr(message, 'source') : '') +\n ' />'\n}"
] | [
"function function_ (options) {\n options.hash.kind = 'function'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find function.'\n}"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Parse element with given function | [
"def parse(self, func, *args, **kwargs):\n \n result = []\n for element in self.xpath('child::node()'):\n if isinstance(element, Parser):\n children = element.parse(func, *args, **kwargs)\n element_result = func(element, children, *args, **kwargs)\n ... | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// Values returns a channel of Values contained in the HashMap | [
"func (hm *SyncedHashMap) Values() (ci chan interface{}) {\n\tci = make(chan interface{})\n\tgo func() {\n\t\thm.RLock()\n\t\tdefer hm.RUnlock()\n\t\tdefer close(ci)\n\t\tfor _, v := range hm.values {\n\t\t\tci <- v\n\t\t}\n\t}()\n\treturn\n}"
] | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Begins an array of values. | [
"private function startList()\n {\n $list = new ArrayObject();\n\n if (null === ($key = $this->tokens->getKey())) {\n $this->current[] = $list;\n } else {\n $this->current[$key] = $list;\n }\n\n $this->stack[] = $this->current;\n $this->current = $l... | [
"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 text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// SetInstanceIdentity sets the InstanceIdentity field's value. | [
"func (s *PollForTaskInput) SetInstanceIdentity(v *InstanceIdentity) *PollForTaskInput {\n\ts.InstanceIdentity = 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 instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// Bootstrap creates the first Region. The Stores should be in the Cluster before
// bootstrap. | [
"func (c *Cluster) Bootstrap(regionID uint64, storeIDs, peerIDs []uint64, leaderPeerID uint64) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\tif len(storeIDs) != len(peerIDs) {\n\t\tpanic(\"len(storeIDs) != len(peerIDs)\")\n\t}\n\tc.regions[regionID] = newRegion(regionID, storeIDs, peerIDs, leaderPeerID)\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 text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Register a set of types with the provided constructor and serializer callables
@param array $types An Array of name => constructor or alias => [ constructor, serializer ]
@throws InvalidArgumentException
@throws DBALException | [
"public static function registerEnumTypes(array $types = [])\n {\n foreach ($types as $name => $callbacks) {\n [$constructor, $serializer] = (is_array($callbacks) ? $callbacks : [$callbacks, null]);\n\n static::registerEnumType($name, $constructor, $serializer);\n }\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 Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
A helper function that converts the results returned from C function
:param rule_ids:
:param outputs:
:param raw_rules:
:return: | [
"def from_raw(self, rule_ids, outputs, raw_rules):\n \n self._rule_pool = [([], [])] + raw_rules\n self._rule_list = []\n for i, idx in enumerate(rule_ids):\n rule = Rule([Clause(f, c) for f, c in zip(*self._rule_pool[idx])], outputs[i])\n self._rule_list.append(rul... | [
"def start_index(self, value):\n \"\"\"\"\"\"\n # TODO: Validate contents? (May want to set before adding the data.)\n if not isinstance(value, dict):\n raise TypeError('start_index attribute must be a dict.')\n self._start_index = value"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Checking that typed fields really exist in table
@param array $fields Indexed array
@return boolean
@throws LazerException If field(s) does not exist | [
"public function fields(array $fields)\n {\n $fields = self::filter($fields);\n $diff = array_diff($fields, Config::table($this->name)->fields());\n\n if (empty($diff))\n {\n return TRUE;\n }\n throw new LazerException('Field(s) \"' . implode(', ', $diff) . ... | [
"protected function getSingleFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())\n {\n // booleans were handled here. They are now handled as complextypes\n\n // q: do we really want this to happen by default on all scalar field values?\n //... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
Registers the server in the container.
@return \Illuminate\Foundation\Application
@throws \Exception | [
"public function register()\n {\n // Auto register the support service provider\n if (! get_class($this) == SupportServiceProvider::class) {\n $this->app->register(SupportServiceProvider::class);\n }\n\n $this->viewsPath = Str::replace($this->viewsPath, '{resourcesPath}', ... | [
"protected function _setupRouter()\n {\n //powołanie routera z konfiguracją\n return new \\Mmi\\Mvc\\Router(\\App\\Registry::$config->router ? \\App\\Registry::$config->router : new \\Mmi\\Mvc\\RouterConfig);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Given the R,G,B int values for the RGB color mode in the range [0..255],
return a RGB color tuple with float values in the range [0..1]. | [
"def colorRGB(r, g, b):\n \n return (float(r / 255), float(g / 255), float(b / 255))"
] | [
"def getPixelValue(self, x, y):\n \"\"\"\"\"\"\n assert x < self.size, \"x: %d<%d\" % (x, self.size)\n assert y < self.size, \"y: %d<%d\" % (y, self.size)\n # Same as calcOffset, inlined for performance reasons\n offset = x + self.size * (self.size - y - 1)\n #print offset\... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Computer Science:"
} |
Safely translate and convert to UTF8, any zope i18n msgid returned from
a bikaMessageFactory _ | [
"def t(i18n_msg):\n \n text = to_unicode(i18n_msg)\n try:\n request = api.get_request()\n domain = getattr(i18n_msg, \"domain\", \"senaite.core\")\n text = translate(text, domain=domain, context=request)\n except UnicodeDecodeError:\n # TODO: This is only a quick fix\n ... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Initiate a transaction: this will defer all writes to real cache until
commit() is called. | [
"public function begin()\n {\n // we'll rely on buffer to respond data that has not yet committed, so\n // it must never evict from cache - I'd even rather see the app crash\n $buffer = new Buffer(ini_get('memory_limit'));\n\n // transactions can be nested: the previous transaction wi... | [
"@Override\n public void checkin(K key, V resource) {\n super.checkin(key, resource);\n // NB: Blocking checkout calls for synchronous requests get the resource\n // checked in above before processQueueLoop() attempts checkout below.\n // There is therefore a risk that asynchronous re... | codesearchnet | {
"query": "Represent the Github description about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Programming:"
} |
// CommentNode implements the Builder interface. | [
"func (tb *KeyStringValueTreeBuilder) CommentNode(comment string) error {\n\tif tb.done {\n\t\treturn errors.New(ErrBuilder, errorMessages, \"building is already done\")\n\t}\n\treturn nil\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Can the user split the post in this discussion?
@param stdClass $user The user to check
@param discussion_entity $discussion The discussion to check
@param post_entity $post The post the user wants to split
@return bool | [
"public function can_split_post(stdClass $user, discussion_entity $discussion, post_entity $post) : bool {\n if ($post->is_private_reply()) {\n // It is not possible to create a private discussion.\n return false;\n }\n\n return $this->can_split_discussions($user) && $post... | [
"private static function lookupRequestedChange()\n {\n // Only run if the query param is present\n if (!$change_id = request(Change::QUERY_KEY)) {\n return;\n }\n\n // Don't execute for classes that result in recusirve queries when the\n // Change model gets built be... | codesearchnet | {
"query": "Represent the summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Database management:"
} |
Set the color this view should show.
@param color The color that should be selected. #argb
@param callback If you want to get a callback to your OnColorChangedListener. | [
"public void setColor(int color, boolean callback) {\n\n int alpha = Color.alpha(color);\n int red = Color.red(color);\n int blue = Color.blue(color);\n int green = Color.green(color);\n\n float[] hsv = new float[3];\n\n Color.RGBToHSV(red, green, blue, hsv);\n\n this.alpha = alpha;\n hue = ... | [
"function(list){\n localStorage.setItem(localStorageKey, JSON.stringify(list));\n // if we used a real database, we would likely do the below in a callback\n this.list = list;\n this.trigger(list); // sends the updated list to all listening components (TodoApp)\n }... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Clone the current container. | [
"def clone(self, newname, config_path=None, flags=0, bdevtype=None,\n bdevdata=None, newsize=0, hookargs=()):\n \n\n args = {}\n args['newname'] = newname\n args['flags'] = flags\n args['newsize'] = newsize\n args['hookargs'] = hookargs\n if config_path:... | [
"@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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// NewProxy returns a new Websocket reverse proxy that rewrites the
// URL's to the scheme, host and base path provider in target. | [
"func NewProxy(target *url.URL) *WebsocketProxy {\n\tbackend := func(r *http.Request) *url.URL {\n\t\t// Shallow copy\n\t\tu := *target\n\t\tu.Fragment = r.URL.Fragment\n\t\tu.Path = r.URL.Path\n\t\tu.RawQuery = r.URL.RawQuery\n\t\treturn &u\n\t}\n\treturn &WebsocketProxy{Backend: backend}\n}"
] | [
"func NewHTTPCommand(stdin io.Reader, stdout, stderr io.Writer) *cobra.Command {\n\tcom, err := cobrafy.Command(http.NewMain())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcom.Use = `http`\n\tcom.Short = `listens for and indexes arbitrary JSON data in Pilosa`\n\tcom.Long = `\npdk http listens for and indexes arbitra... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Get image.
@param \simplehtmldom_1_5\simple_html_dom $each_anime
@return string | [
"private function getImage($each_anime)\n {\n $temp_image = $each_anime->find('div[class=image]', 0)->find('img', 0);\n $image = $temp_image->src;\n $image = !$image ? $temp_image->getAttribute('data-src') : $image;\n\n return Helper::imageUrlCleaner($image);\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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
check if the specified string it Latin numeric
@param str
@param beginIndex
@param endIndex
@return boolean | [
"public static boolean isNumeric(String str, int beginIndex, int endIndex)\n {\n for ( int i = beginIndex; i < endIndex; i++ ) {\n char chr = str.charAt(i);\n if ( ! StringUtil.isEnNumeric(chr) ) {\n return false;\n }\n }\n\n return true;\n ... | [
"def u_string_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_strict(\"Python-2-style unicode string\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// RGBAAt returns the color of the pixel at (x, y) as RGBA. | [
"func (p *Image) RGBAAt(x, y int) color.RGBA {\n\tif !(image.Point{x, y}.In(p.Rect)) {\n\t\treturn color.RGBA{}\n\t}\n\ti := (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*3\n\treturn color.RGBA{p.Pix[i+0], p.Pix[i+1], p.Pix[i+2], 0xFF}\n}"
] | [
"def getPixelValue(self, x, y):\n \"\"\"\"\"\"\n assert x < self.size, \"x: %d<%d\" % (x, self.size)\n assert y < self.size, \"y: %d<%d\" % (y, self.size)\n # Same as calcOffset, inlined for performance reasons\n offset = x + self.size * (self.size - y - 1)\n #print offset\... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Computer Science:"
} |
Set the value of DateAdded / date_added
@param $value DateTime
@return User | [
"public function setDateAdded($value) : User\n {\n $this->validateDate('DateAdded', $value);\n\n if ($this->data['date_added'] !== $value) {\n $this->data['date_added'] = $value;\n $this->setModified('date_added');\n }\n\n return $this;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// ValidateAffinityInPodAnnotations tests that the serialized Affinity in Pod.Annotations has valid data | [
"func ValidateAffinityInPodAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\n\taffinity, err := api.GetAffinityFromPodAnnotations(annotations)\n\tif err != nil {\n\t\tallErrs = append(allErrs, field.Invalid(fldPath, api.AffinityAnnotationKey, err.Er... | [
"func NewRemoteConfigSource(source *apiv1.NodeConfigSource) (RemoteConfigSource, string, error) {\n\t// NOTE: Even though the API server validates the config, we check whether all *known* fields are\n\t// nil here, so that if a new API server allows a new config source type, old clients can send\n\t// an error mess... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Read incoming data on the socket connection.
@param buf The incoming buffer or internal request
array. | [
"function data(buf) {\n if(this._tcp) {\n if(this._paused) {\n this.client._qbuf = Buffer.concat(\n [this.client._qbuf, buf], this.client._qbuf.length + buf.length);\n return false;\n }\n this.emit('input', buf.length);\n this._process(buf);\n }else{\n // TODO: handle pausing inter... | [
"def _make_read_lob_request(self, readoffset, readlength):\n \n self._connection._check_closed()\n\n request = RequestMessage.new(\n self._connection,\n RequestSegment(\n message_types.READLOB,\n (ReadLobRequest(self._lob_header.locator_id, re... | codesearchnet | {
"query": "Represent the Github summarization about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about software development:"
} |
Check if this component has a port by the given reference to a CORBA
PortService object. | [
"def has_port_by_ref(self, port_ref):\n '''\n\n '''\n with self._mutex:\n if self.get_port_by_ref(self, port_ref):\n return True\n return False"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Returns the whole config or a specific value
namespace - the namespace where the key is searched
key - the key neede
defaultValue - default value to return if the value is nil | [
"def get(namespace = false, key = false, defaultValue = '')\n if namespace && key\n value = @config[namespace][key]\n if value\n return value\n else\n return defaultValue\n end\n end\n\n return @config if !@config.empty?\n\n get_config\n end"
] | [
"function inflate(object) {\n // check if the object is an object and isn't empty\n if (is(object) && !empty(object)) {\n // create a new object for the result\n let result = {};\n\n // for each key in the object\n Object.keys(object).forEach((path) => {\n // get value from the object\n cons... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// EndBackup implements BackupHandle. | [
"func (bh *GCSBackupHandle) EndBackup(ctx context.Context) error {\n\tif bh.readOnly {\n\t\treturn fmt.Errorf(\"EndBackup cannot be called on read-only backup\")\n\t}\n\treturn nil\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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
Get details of a top-level domain.
Get details of a top-level domain.
@param name Name of the top-level domain.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TopLevelDomainInner object | [
"public Observable<TopLevelDomainInner> getAsync(String name) {\n return getWithServiceResponseAsync(name).map(new Func1<ServiceResponse<TopLevelDomainInner>, TopLevelDomainInner>() {\n @Override\n public TopLevelDomainInner call(ServiceResponse<TopLevelDomainInner> response) {\n ... | [
"function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Creates connection to a named peer using given SSLContext. Connection
is in client mode but can be changed before read/write.
@param peer
@param port
@param sslContext
@return
@throws IOException | [
"public static SSLSocketChannel open(String peer, int port, SSLContext sslContext) throws IOException\r\n {\r\n SSLEngine engine = sslContext.createSSLEngine(peer, port);\r\n engine.setUseClientMode(true);\r\n SSLParameters sslParameters = engine.getSSLParameters();\r\n SNIServerName ... | [
"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 Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Populate attributes from the raw DynamoDB response
@param array $data | [
"public function populateFromDynamoDB(array $data)\n {\n foreach ($data as $name => $value) {\n list ($type, $value) = each($value);\n $this->setAttribute($name, $value, $type);\n }\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Gets the container information for a given container, creating it if it doesn't already exist.<p>
@param name the container name
@return the container info object | [
"private ContainerInfo getContainerInfo(String name) {\n\n if (!m_containerInfos.containsKey(name)) {\n m_containerInfos.put(name, new ContainerInfo(name));\n }\n return m_containerInfos.get(name);\n }"
] | [
"function(loader) {\n // public\n this.maxRecursion = 5;\n this.loader = (typeof loader === 'function') ? loader : null;\n\n // internal\n this._schemaRegistry = new SchemaRegistry();\n this._customFormatHandlers = {};\n\n // _refsRequested is an object where the key is the normalized ID\n // of the schema ... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// SetSnapshotId sets the SnapshotId field's value. | [
"func (s *GetDeployablePatchSnapshotForInstanceInput) SetSnapshotId(v string) *GetDeployablePatchSnapshotForInstanceInput {\n\ts.SnapshotId = &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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Set the default referrer policy to use. See
https://scotthelme.co.uk/a-new-security-header-referrer-policy/
@param eReferrerPolicy
Policy to use. May be <code>null</code>. | [
"public static void setReferrerPolicy (@Nullable final EHttpReferrerPolicy eReferrerPolicy)\n {\n if (eReferrerPolicy == null)\n removeResponseHeaders (CHttpHeader.REFERRER_POLICY);\n else\n setResponseHeader (CHttpHeader.REFERRER_POLICY, eReferrerPolicy.getValue ());\n }"
] | [
"def __check_suc_cookie(self, components):\n\t\t'''\n\t\t\n\t\t'''\n\t\tnetloc = components.netloc.lower()\n\n\t\tfor cookie in self.cj:\n\t\t\tif cookie.domain_specified and (cookie.domain.lower().endswith(netloc)\n\t\t\t\tor (cookie.domain.lower().endswith(\"127.0.0.1\") and (\n\t\t\t\tcomponents.path == \"/sucur... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetLon sets the Lon field's value. | [
"func (s *GeoLocation) SetLon(v float64) *GeoLocation {\n\ts.Lon = &v\n\treturn s\n}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github summarization about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
HeartBeat action
AJAX POST
@return void | [
"public function heartBeat()\n {\n if (!$this->request->isAll(['ajax', 'post'])) {\n throw new MethodNotAllowedException();\n }\n\n $loginTime = $this->request->session()->check('loginTime') ? $this->request->session()->read('loginTime') : 0;\n $maxLoggedInTime = (int)Wasab... | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Adds the pair $userAgent, $deviceID to the clusters they belong to.
@param String $userAgent
@param String $deviceID
@see WURFL_Handlers_Handler::filter() | [
"public function filter($userAgent, $deviceID)\n {\n WURFL_Handlers_Utils::reset();\n $generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();\n $userAgent = $generic_normalizer->normalize($userAgent);\n $this->_userAgentHandlers[0]->filter($userAgent, $de... | [
"public List<Audit> getAllNotifications(JPAEntity entity) {\n\t\treturn _auditService.findByEntityHostnameMessage(entity.getId(), null, \"Triggering event value:\");\n\t}"
] | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Documentation:"
} |
// read returns the value stored in the identified refcount doc. | [
"func (nsRefcounts_) read(coll mongo.Collection, key string) (int, error) {\n\tvar doc refcountDoc\n\tif err := coll.FindId(key).One(&doc); err == mgo.ErrNotFound {\n\t\treturn 0, errors.NotFoundf(\"refcount %q\", key)\n\t} else if err != nil {\n\t\treturn 0, errors.Trace(err)\n\t}\n\treturn doc.RefCount, nil\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 comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Color is dark
@param {Number} r Red
@param {Number} g Green
@param {Number} b Blue
@returns {Boolean} Is dark | [
"function isDark (r, g, b) {\n /**\n * W3C perceived brightness calculator\n * @see {@link https://www.w3.org/TR/AERT/#color-contrast}\n */\n const brightness = ((r * 299) + (g * 587) + (b * 114)) / 1000\n\n if (brightness < 140) {\n return true\n }\n\n return false\n}"
] | [
"function Gap (Glide, Components) {\n return {\n /**\n * Modifies passed translate value with number in the `gap` settings.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n return translate + Components.Gaps.value * Glide.index;\n ... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
/* (non-Javadoc)
@see org.joml.Matrix4dc#scaleLocal(double, org.joml.Matrix4d) | [
"public Matrix4d scaleLocal(double xyz, Matrix4d dest) {\n return scaleLocal(xyz, xyz, xyz, dest);\n }"
] | [
"func (xf *Transform) TransformVect(v vect.Vect) vect.Vect {\n\treturn vect.Add(xf.Position, xf.RotateVect(v))\n}"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about mathematics:"
} |
Generates index name for the given column orders.
Columns should be normalized using [[buildSortFields()]] before being passed to this method.
@param array $columns columns with sort order.
@return string index name. | [
"public function generateIndexName($columns)\n {\n $parts = [];\n foreach ($columns as $column => $order) {\n $parts[] = $column . '_' . $order;\n }\n return implode('_', $parts);\n }"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get annotations by entity and annotation
@param Object $entity
@param string $annotation
@return array | [
"public function get($entity, $annotation)\n {\n $properties = $this->getProperties($entity);\n\n $return = array();\n foreach ($properties as $reflectionProperty) {\n $propertyAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, $annotation);\n if (!i... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Get all
@return null|\FondOfPHP\ActiveCampaign\DataTransferObject\MailingList | [
"public function getAll()\n {\n $parameters = array(\n 'api_action' => 'list_list',\n 'ids' => 'all'\n );\n\n $response = $this->request($parameters);\n\n if ($response === null || $response->getStatusCode() !== 200) {\n return null;\n }\n\n ... | [
"public function choices(): HasMany\n {\n return $this->hasMany(\\Iocaste\\Microservice\\Foundation\\Data\\Models\\Parameter\\Choice::class);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Twilio:",
"pos": "Represent the Github code about Twilio:",
"neg": "Represent the Github code about programming:"
} |
ben-doc entry point | [
"def main(argv=None):\n \"\"\"\"\"\"\n arguments = cli_common(__doc__, argv=argv)\n campaign_path = arguments['CAMPAIGN-DIR']\n driver = CampaignDriver(campaign_path, expandcampvars=False)\n with pushd(campaign_path):\n render(\n template=arguments['--template'],\n ostr=a... | [
"def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
/*!
Returns the content action(s) for this attribute | [
"function contentActionList()\n {\n $dataType = $this->dataType();\n if ( $dataType )\n {\n return $dataType->contentActionList( $this->contentClassAttribute() );\n }\n return false;\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 about CSS:",
"pos": "Represent the Github code about CSS:",
"neg": "Represent the Github code:"
} |
Parses the specified string content and creates annotations for each
found warning.
@param content
the content to scan
@param warnings
the found annotations
@throws ParsingCanceledException
indicates that the user canceled the operation | [
"protected void findAnnotations(final String content, final List<FileAnnotation> warnings) throws ParsingCanceledException {\n Matcher matcher = pattern.matcher(content);\n\n while (matcher.find()) {\n Warning warning = createWarning(matcher);\n if (warning != FALSE_POSITIVE) { /... | [
"def condition_from_text(text) -> Condition:\n \n try:\n condition = pypeg2.parse(text, output.Condition)\n except SyntaxError:\n # Invalid conditions are possible, see https://github.com/duniter/duniter/issues/1156\n # In such a case, they are store as empty PE... | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Set the rule that the current rule is an alias of.
@param string $alias The name of an entry in the container to point to.
@return $this | [
"public function setAliasOf($alias) {\n $alias = $this->normalizeID($alias);\n\n if ($alias === $this->currentRuleName) {\n trigger_error(\"You cannot set alias '$alias' to itself.\", E_USER_NOTICE);\n } else {\n $this->currentRule['aliasOf'] = $alias;\n }\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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
------------ helper generation function start | [
"function (statements, global) {\n var source = [];\n if (!global) {\n source.push('function(scopes) {');\n }\n source.push('var buffer = \"\"' + (global ? ',' : ';'));\n if (global) {\n source.push('config = this.config,' +\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 Github text about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
得到分词结果 String[],不进行断句
@param src 字符串
@return String[] 词数组,每个元素为一个词 | [
"public String[] tag2Array(String src) {\r\n\t\tArrayList<String> words = tag2List(src);\r\n\t\treturn (String[]) words.toArray(new String[words.size()]);\r\n\t}"
] | [
"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 text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about text processing:"
} |
Casts to float when necessary
@param mixed value to typecast
@throws InvalidContentType
@return float | [
"public static function type_float($var)\n\t{\n\t\tif (is_array($var) or is_object($var))\n\t\t{\n\t\t\tthrow new InvalidContentType('Array or object could not be converted to float.');\n\t\t}\n\n\t\t// deal with locale issues\n\t\t$locale_info = localeconv();\n\t\t$var = str_replace($locale_info[\"mon_thousands_se... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Get all transactions. per page.
@param $page
@throws \Exception|mixed
@return array | [
"public function allTransactions($page)\n {\n $transactions = [];\n $transactionData = $this->getTransactionResource()->getAll($page);\n\n if ($transactionData instanceof \\Exception) {\n throw $transactionData;\n }\n\n foreach ($transactionData as $transaction) {\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 comment about API documentation:",
"pos": "Represent the code about API documentation:",
"neg": "Represent the code about programming:"
} |
// SetRouteId sets the RouteId field's value. | [
"func (s *DeleteRouteResponseInput) SetRouteId(v string) *DeleteRouteResponseInput {\n\ts.RouteId = &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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Merges two leads.
@param Lead $source The source lead (he will be deleted afterwards)
@param Lead $destination The lead to merge the data in
@throws InvalidParamException If any of the two leads have an invalid ID | [
"public function merge(Lead $source, Lead $destination): void\n {\n if (empty($source->getId()) || empty($destination->getId())) {\n throw new InvalidParamException('You need to specify two already existing leads in order to merge them');\n }\n\n $this->client->post($this->prepare... | [
"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 Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about PHP programming:"
} |
Imports an event. (events.import)
@param string $calendarId Calendar identifier.
@param Google_Event $postBody
@param array $optParams Optional parameters.
@return Google_Event | [
"public function import($calendarId, Google_Event $postBody, $optParams = array()) {\n $params = array('calendarId' => $calendarId, 'postBody' => $postBody);\n $params = array_merge($params, $optParams);\n $data = $this->__call('import', array($params));\n if ($this->useObjects()) {\n ret... | [
"public static function all($params = null, $opts = null)\n {\n $msg = \"Subscription Schedule Revisions cannot be listed without a Subscription Schedule ID. \" .\n \"List those using \\$schedule->allRevisions('revision_id') instead.\";\n throw new Error\\InvalidRequest($msg, null);\n... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about PHP:"
} |
add another subgraph | [
"function addGraph (g1, g2) {\n eachEdge(g2, function (from, to, data) {\n addEdge(g1, from, to, data)\n })\n return g1\n}"
] | [
"def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Algorithm pass
MATH: get distances stuff and power 2 issues | [
"function pass() {\n var a, i, j, l, r, n, n1, n2, e, w, g, k, m;\n\n var outboundAttCompensation,\n coefficient,\n xDist,\n yDist,\n ewc,\n mass,\n distance,\n size,\n factor;\n\n // 1) Initializing layout data\n //--------... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Initialize arguments
@return void
@api | [
"public function initializeArguments()\n {\n $this->registerArgument('action', 'string', 'Target action', true);\n $this->registerArgument('arguments', 'array', 'Arguments', false, []);\n $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is us... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Generate a new resourceful controller file.
@return void | [
"protected function generateController()\n\t{\n\t\t// Once we have the controller and resource that we are going to be generating\n\t\t// we will grab the path and options. We allow the developers to include or\n\t\t// exclude given methods from the resourceful controllers we're building.\n\t\t$controller = $this->... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Reads the json data in path
:param Path path: Path that json data will be readed
:param create_file: Creates the file if it isn't exists
:return: json data | [
"def read(path, create_file=False):\n \n if create_file:\n with open(str(path), 'a+') as data_file:\n data_file.seek(0)\n return json.load(data_file)\n\n else:\n with open(str(path)) as data_file:\n return json.load(data_file)"
... | [
"def getMetadata(L):\n \n _l = {}\n try:\n # Create a copy. Do not affect the original data.\n _l = copy.deepcopy(L)\n # Remove values fields\n _l = rm_values_fields(_l)\n except Exception as e:\n # Input likely not formatted correctly, though other problems can occur.... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
// Validate inspects the fields of the type to determine if they are valid. | [
"func (s *DescribeCodeRepositoryInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"DescribeCodeRepositoryInput\"}\n\tif s.CodeRepositoryName == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"CodeRepositoryName\"))\n\t}\n\tif s.CodeRepositoryName != nil && len(*s.CodeReposi... | [
"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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
<pre>
Performs generic data validation for the operation to be performed
</pre> | [
"protected void validate(String operationType) throws Exception\r\n\t{\r\n\t\tsuper.validate(operationType);\r\n\r\n\t\tMPSString propkey_validator = new MPSString();\r\n\t\tpropkey_validator.setConstraintIsReq(MPSConstants.DELETE_CONSTRAINT, true);\r\n\t\tpropkey_validator.setConstraintMaxStrLen(MPSConstants.GENER... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Check module metadata for incorrect namespace shop classes.
Class might be misspelled or not found in Unified Namespace.
@param \OxidEsales\Eshop\Core\Module\Module $module
@throws \OxidEsales\Eshop\Core\Exception\ModuleValidationException | [
"public function checkModuleExtensionsForIncorrectNamespaceClasses(\\OxidEsales\\Eshop\\Core\\Module\\Module $module)\n {\n $incorrect = $this->getIncorrectExtensions($module);\n if (!empty($incorrect)) {\n $message = $this->prepareMessage('MODULE_METADATA_PROBLEMATIC_DATA_IN_EXTEND', $i... | [
"protected function getCacheDir()\n {\n return \\OxidEsales\\Eshop\\Core\\Registry::get(\\OxidEsales\\Eshop\\Core\\ConfigFile::class)->getVar(\"sCompileDir\");\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Computer Science:"
} |
Utility method to create an action that opened a given file.
@param path path to the file
@return corresponding action | [
"public static SeerClickableLabelAction createOpenFileAction(final String path) {\n return () -> {\n File file = new File(path);\n try {\n Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;\n if (desktop != null && desktop.isSuppo... | [
"@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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Sets the full URI (all parts) as a String.
@param str the full URI to be used by the `UriBuilder`
@return a reference to the builder
@throws IllegalArgumentException if there is a problem with the URI syntax | [
"public final UriBuilder setFull(final String str) {\n try {\n return setFull(new URI(str));\n } catch (URISyntaxException ex) {\n throw new IllegalArgumentException(ex.getMessage());\n }\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:"
} |
Run the command in the foreground.
@param \Illuminate\Contracts\Container\Container $container
@return void | [
"protected function runCommandInForeground(Container $container)\n {\n $this->callBeforeCallbacks($container);\n\n $this->exitCode = Process::fromShellCommandline($this->buildCommand(), base_path(), null, null, null)->run();\n\n $this->callAfterCallbacks($container);\n }"
] | [
"public function boot()\n {\n $manager = new Manager;\n\n // If you have to customize the manager instance, like setting a custom serializer,\n // I strongly suggest you to create your own service provider and add you manager configuration action here\n // Here some example if you wan... | codesearchnet | {
"query": "Represent the Github sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
// collapseAggregateErrors returns the minimal errors. it handles empty as nil, handles one item in a list
// by returning the item, and collapses all NoMatchErrors to a single one (since they should all be the same) | [
"func collapseAggregateErrors(errors []error) error {\n\tif len(errors) == 0 {\n\t\treturn nil\n\t}\n\tif len(errors) == 1 {\n\t\treturn errors[0]\n\t}\n\n\tallNoMatchErrors := true\n\tfor _, err := range errors {\n\t\tallNoMatchErrors = allNoMatchErrors && IsNoMatchError(err)\n\t}\n\tif allNoMatchErrors {\n\t\tret... | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get mongo connection instance
@return \MongoClient
@throws Exception | [
"public function getMongoClient()\n {\n if ($this->mongoClient) {\n return $this->mongoClient;\n }\n\n $this->mongoClient = new \\MongoClient(\n $this->dsn,\n $this->connectOptions\n );\n \n return $this->mongoClient;\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Like #os.makedirs(), with *exist_ok* defaulting to #True. | [
"def makedirs(path, exist_ok=True):\n \n\n try:\n os.makedirs(path)\n except OSError as exc:\n if exist_ok and exc.errno == errno.EEXIST:\n return\n raise"
] | [
"def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
// Error can be either of the following types:
//
// - InvalidObjectFault
// - RuntimeFault | [
"func (service *VboxPortType) INATNetworksetIPv6Enabled(request *INATNetworksetIPv6Enabled) (*INATNetworksetIPv6EnabledResponse, error) {\n\tresponse := new(INATNetworksetIPv6EnabledResponse)\n\terr := service.client.Call(\"\", request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, ni... | [
"@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 post about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Removes a basic meta tag
@param string $sName The elements's name attribute
@param string $sContent The elements's content attribute
@param string $sTag The elements's type | [
"public function remove($sName, $sContent, $sTag = '')\n {\n $aMeta = [\n 'name' => $sName,\n 'content' => $sContent,\n 'tag' => $sTag,\n ];\n\n return $this->removeRaw($aMeta);\n }"
] | [
"public function initializeArguments()\n {\n $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted');\n $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST or dialog)');\n $this->registerTagAttribute('name', 'string', 'Name of fo... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Changes video volume | [
"def OnAdjustVolume(self, event):\n \"\"\"\"\"\"\n\n self.volume = self.player.audio_get_volume()\n\n if event.GetWheelRotation() < 0:\n self.volume = max(0, self.volume-10)\n elif event.GetWheelRotation() > 0:\n self.volume = min(200, self.volume+10)\n\n sel... | [
"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:"
} |
Return private key ("key.pem") from Reader | [
"@CheckForNull\n public static PrivateKey loadPrivateKey(final Reader reader) throws IOException, NoSuchAlgorithmException,\n InvalidKeySpecException {\n try (PEMParser pemParser = new PEMParser(reader)) {\n Object readObject = pemParser.readObject();\n while (readObject !... | [
"public ResponseOnSingeRequest genErrorResponse(Exception t) {\n ResponseOnSingeRequest sshResponse = new ResponseOnSingeRequest();\n String displayError = PcErrorMsgUtils.replaceErrorMsg(t.toString());\n\n sshResponse.setStackTrace(PcStringUtils.printStackTrace(t));\n sshResponse.setErr... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about PHP:"
} |
If we found 'standby' key in the configuration, we need to bootstrap
not a real master, but a 'standby leader', that will take base backup
from a remote master and start follow it. | [
"def bootstrap_standby_leader(self):\n \n clone_source = self.get_remote_master()\n msg = 'clone from remote master {0}'.format(clone_source.conn_url)\n result = self.clone(clone_source, msg)\n self._post_bootstrap_task.complete(result)\n if result:\n self.state_... | [
"func (rl *resignLeadership) Execute(state State) (*State, error) {\n\t// TODO(fwereade): this hits a lot of interestingly intersecting problems.\n\t//\n\t// 1) we can't yet create a sufficiently dumbed-down hook context for a\n\t// leader-deposed hook to run as specced. (This is the proximate issue,\n\t// an... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
쿼리의 정렬 조건을 가져옵니다. | [
"def _order_queries(self):\n \"\"\"\"\"\"\n from .condition import Order\n order = []\n for column in self.columns:\n if column.order_by:\n o = Order(self.cls, column.attr, column.order_by)\n order.append(o.__query__())\n if not order:\n ... | [
"public static function checkEcn($ecn)\n {\n $ecn = trim(StringUtils::removeHyphen($ecn));\n /*\n * ECN을 더이상 사용하지 않고, 그 대안으로 UCI를 사용하도록 하였다.\n * 기존에 ECN을 발급받은 도서들의 경우\n * UCI를 발급받지 않고,\n * ECN 번호 앞에 I410을 붙여 UCI 번호로 하기로 하였다.\n */\n $ecn = str_replace('... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Constructor used to start the undordered bulk operation
@param model
@constructor | [
"function BulkChange(model) {\n this.model = model;\n this.bulk = model.collection.initializeUnorderedBulkOp();\n this.isChange = false;\n }"
] | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
/*
(non-Javadoc)
@see javax.servlet.http.HttpSessionListener#sessionCreated(javax.servlet.http.HttpSessionEvent) | [
"public void sessionCreated(HttpSessionEvent httpSessionEvent) {\r\n\t\tif (active) {\r\n\t\t\tif (log.isDebugEnabled()) \r\n\t\t\t\tlog.debug(\"sessionCreated sessionId = \"\r\n\t\t\t\t\t\t+ httpSessionEvent.getSession().getId());\r\n\t\t}\r\n\t}"
] | [
"@Override\n public void removeSSOCookieFromResponse(HttpServletResponse resp) {\n if (resp instanceof com.ibm.wsspi.webcontainer.servlet.IExtendedResponse) {\n ((com.ibm.wsspi.webcontainer.servlet.IExtendedResponse) resp).removeCookie(getSSOCookiename());\n removeJwtSSOCookies((com.... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
// parseOperator return operator and eventually matchType
// matchType can be exact | [
"func (p *Parser) parseOperator() (op Operator, err error) {\n\ttok, lit := p.consume(KeyAndOperator)\n\tswitch tok {\n\t// DoesNotExistToken shouldn't be here because it's a unary operator, not a binary operator\n\tcase InToken:\n\t\top = InOperator\n\tcase EqualsToken:\n\t\top = EqualsOperator\n\tcase DoubleEqual... | [
"def t_ATOM(self, t):\n '\n t.type = PLLexer.reserved.get(t.value, 'ATOM') # Check for reserved words\n return t"
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Regular expressions:"
} |
Get file associated with the given URI | [
"public static File uriToFile(URI u) throws IOException {\n if (!u.getScheme().equals(NNStorage.LOCAL_URI_SCHEME)) {\n throw new IOException(\"URI does not represent a file\");\n }\n return new File(u.getPath());\n }"
] | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Init attribute ( also handles version to version copy, and attribute to attribute copy )
@param eZContentObjectAttribute $contentObjectAttribute
@param int|null $currentVersion
@param eZContentObjectAttribute $originalContentObjectAttribute | [
"function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )\n {\n if ( $currentVersion == false )\n {\n $contentObjectAttribute->setAttribute( 'data_int', 0 );\n }\n else if ( $contentObjectAttribute->attribute( 'id' ) !... | [
"SimpleArticle readData(int properties, String name) {\n return getPerformedAction(new GetRevision(null, name, properties)).getArticle();\n }"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// Mode returns the permission and mode bits for the headerFileInfo. | [
"func (fi headerFileInfo) Mode() (mode os.FileMode) {\n\t// Set file permission bits.\n\tmode = os.FileMode(fi.h.Mode).Perm()\n\treturn mode\n}"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github text about File management:",
"pos": "Represent the Github code about File management:",
"neg": "Represent the Github code about programming:"
} |
Returns a reference to a Format object, only creating it
if it doesn't already exist.
@param string $type The format to load
@return AbstractRegistryFormat Registry format handler
@since 1.0
@throws \InvalidArgumentException | [
"public static function getInstance($type)\n\t{\n\t\t// Sanitize format type.\n\t\t$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));\n\n\t\t// Only instantiate the object if it doesn't already exist.\n\t\tif (!isset(self::$instances[$type]))\n\t\t{\n\t\t\t$class = '\\\\Joomla\\\\Registry\\\\Format\\\\' ... | [
"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 Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
// SetEvents sets the Events field's value. | [
"func (s *RepositoryTrigger) SetEvents(v []*string) *RepositoryTrigger {\n\ts.Events = 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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Create a new fact from an existing one. | [
"def duplicate(self, template_fact, **modifiers):\n \"\"\"\"\"\"\n\n newfact = template_fact.copy()\n newfact.update(dict(self._get_real_modifiers(**modifiers)))\n\n return self.declare(newfact)"
] | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Reconfigures the messaging.
@param etcDir the KARAF_ETC directory
@param msgData the messaging configuration parameters | [
"public void reconfigureMessaging( String etcDir, Map<String,String> msgData )\n\tthrows IOException {\n\n\t\tString messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY );\n\t\tLogger.getLogger( getClass().getName()).fine( \"Messaging type for reconfiguration: \" + messagingType );\n\t\tif( ! Ut... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Stop the mitmproxy | [
"def stop_proxy(self):\n \n\n self.runner.info_log(\"Stopping proxy...\")\n\n files = [\n (self.remote_proxy_output_path, self.local_proxy_output_path),\n (self.remote_proxy_log_path, self.local_proxy_log_path)\n ]\n for remote_file_path, local_file_path in f... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Tells if the response content should be styled on send().
Regardless of this setting content will only be styled with output format
set to "styled".
@return boolean true if the terminal support ANSI colors, otherwise false | [
"public function hasColorSupport(): bool\n {\n if ($this->colorSupport !== null) {\n return $this->colorSupport;\n }\n if (DIRECTORY_SEPARATOR !== '\\\\') {\n return function_exists('posix_isatty') && posix_isatty(STDOUT);\n } else {\n return getenv('A... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github description about NLP:",
"pos": "Represent the Github code about NLP:",
"neg": "Represent the Github code about programming:"
} |
// Reset all hashes to initial state | [
"func (check *FileChecksumGenerator) Reset() {\n\tcheck.WeakRollingHash.Reset()\n\tcheck.StrongHash.Reset()\n\tcheck.FileChecksumHash.Reset()\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the post about Redis command documentation:",
"pos": "Represent the code about Redis command documentation:",
"neg": "Represent the code:"
} |
// DefaultHTTPErrorHandler invokes the default HTTP error handler. | [
"func (f *Fibre) defaultErrorHandler(err error, c *Context) {\n\n\tcode := http.StatusInternalServerError\n\tmesg := http.StatusText(code)\n\n\tif he, ok := err.(*HTTPError); ok {\n\t\tcode = he.Code()\n\t\tmesg = he.Error()\n\t}\n\n\tif !c.Response().Done() {\n\t\thttp.Error(c.response, mesg, code)\n\t}\n\n\tf.Log... | [
"@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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Distinct types (``type_``) in :class:`.models.Feature`
:return: all distinct feature types
:rtype: list[str] | [
"def feature_types(self):\n \n r = self.session.query(distinct(models.Feature.type_)).all()\n return [x[0] for x in r]"
] | [
"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 post about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
Provides a ``repr``-style representation of a function parameter. | [
"def repr_parameter(param: inspect.Parameter) -> str:\n \n return (\n \"Parameter(name={name}, annotation={annotation}, kind={kind}, \"\n \"default={default}\".format(\n name=param.name, annotation=param.annotation, kind=param.kind,\n default=param.default)\n )"
] | [
"def write_repr(self, out, visited):\n '''\n \n '''\n # Default implementation: generate a proxy value and write its repr\n # However, this could involve a lot of work for complicated objects,\n # so for derived classes we specialize this\n return out.write(repr(self... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Computer Science:"
} |
// SetDbiResourceId sets the DbiResourceId field's value. | [
"func (s *DescribeDBSnapshotsInput) SetDbiResourceId(v string) *DescribeDBSnapshotsInput {\n\ts.DbiResourceId = &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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Add phones.
@param \Sulu\Bundle\ContactBundle\Entity\Phone $phones
@return PhoneType | [
"public function addPhone(\\Sulu\\Bundle\\ContactBundle\\Entity\\Phone $phones)\n {\n $this->phones[] = $phones;\n\n return $this;\n }"
] | [
"public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Registers that the handler has completed and has provided a location
// where information can be retreived | [
"func (h *AsyncHttpHandler) CompletedWithLocation(location string) {\n\n\th.manager.lock.RLock()\n\tdefer h.manager.lock.RUnlock()\n\n\tgodbc.Require(h.completed == false)\n\n\th.location = location\n\th.completed = true\n\n\tgodbc.Ensure(h.completed == true)\n\tgodbc.Ensure(h.location == location)\n\tgodbc.Ensure(... | [
"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 instruction about software development:",
"pos": "Represent the Github code about software development:",
"neg": "Represent the Github code about Software development:"
} |
Get the value of the property identified by the key as Enum.
If {@code key} is null or there is no property for the key,
{@code defaultValue} is returned. | [
"public <TEnum extends Enum<TEnum>> TEnum getEnum(String key, Class<TEnum> enumClass, TEnum defaultValue)\n {\n String name = getString(key);\n\n if (name == null)\n {\n return defaultValue;\n }\n\n try\n {\n return Enum.valueOf(enumClass, name);\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 text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Sets the path name for this ID
@param pathId ID of path
@param pathName Name of path | [
"public void setName(int pathId, String pathName) {\n PreparedStatement statement = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_PATH +\n \" SET \" + C... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Get the object we are working with. Makes sure
get_queryset is called even when in add mode. | [
"def get_object(self):\n \n\n if not self.force_add and self.kwargs.get(self.slug_url_kwarg, None):\n return super(FormView, self).get_object()\n else:\n self.queryset = self.get_queryset()\n\n return None"
] | [
"def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):\n \n if self.delete_related:\n return super(AuditlogHistoryField, self).bulk_related_objects(objs, using)\n\n # When deleting, Collector.collect() finds related objects using this\n # method. However, because we d... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
Creates a {@link JsonRpcClientException} from the given
{@link ObjectNode}.
@param errorObject the error object
@return the exception | [
"private JsonRpcClientException createJsonRpcClientException(ObjectNode errorObject) {\n\t\tint code = errorObject.has(JsonRpcBasicServer.ERROR_CODE) ? errorObject.get(JsonRpcBasicServer.ERROR_CODE).asInt() : 0;\n\t\treturn new JsonRpcClientException(code, errorObject.get(JsonRpcBasicServer.ERROR_MESSAGE).asText(),... | [
"public OptionalThing<Redirectable> getMappedRedirectable() { // exists after application exception handling\n final Class<?> exType = getClass();\n return OptionalThing.ofNullable(mappedRedirectable, () -> {\n throw new IllegalStateException(\"Not found the mapped redirectable in exception... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Language and Writing:"
} |
Propagates the names of all facets to each single facet. | [
"private void propagateFacetNames() {\n\n // collect all names and configurations\n Collection<String> facetNames = new ArrayList<String>();\n Collection<I_CmsSearchConfigurationFacet> facetConfigs = new ArrayList<I_CmsSearchConfigurationFacet>();\n facetNames.addAll(m_fieldFacets.keySet... | [
"@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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Renders the tree.
@return string the rendering result. | [
"protected function renderTree()\n {\n $lines = [];\n\n $tag = ArrayHelper::remove($this->options, 'tag', 'div');\n $lines[] = Html::beginTag($tag, $this->options);\n\n $lines[] = $this->renderToolbar();\n $lines[] = $this->renderNodes($this->nodes);\n\n $lines[] = Html:... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.