query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// fanOutShardsHandler fetches a list of shards from the job and launches
// named ProcessShard tasks, one per shard. | [
"func (ctl *Controller) fanOutShardsHandler(c context.Context, payload proto.Message) error {\n\tmsg := payload.(*tasks.FanOutShards)\n\n\t// Make sure the job is still present. If it is aborted, we still need to\n\t// launch the shards, so they notice they are being aborted. We could try\n\t// to abort all shards ... | [
"@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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
// SliceOfFieldsWithValPtrs generates slice of translated (cql tag) field names with field values
// used for unit testing purposes only - list_values test | [
"func SliceOfFieldsWithValPtrs(val interface{} /*, opts Options*/) (fieldNames []string, vals []interface{}) {\n\tfields, vals := structs.ListExportedFieldsPtrs(val)\n\n\tfieldNames = []string{}\n\tfor _, field := range fields {\n\t\tfieldName, exported := fieldName(field)\n\t\tif exported {\n\t\t\tfieldNames = app... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the comment about Data transformation:",
"pos": "Represent the code about Data transformation:",
"neg": "Represent the code about programming:"
} |
Attention on image feature with question as query. | [
"def attn(image_feat,\n query,\n hparams,\n name=\"attn\",\n save_weights_to=None,\n make_image_summary=True):\n \"\"\"\"\"\"\n with tf.variable_scope(name, \"attn\", values=[image_feat, query]):\n total_key_depth = hparams.attention_key_channels or hparams.hidden_size\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Plots the fit of the model
Returns
----------
None (plots data and the fit) | [
"def plot_fit(self,intervals=True,**kwargs):\n \n import matplotlib.pyplot as plt\n import seaborn as sns\n\n figsize = kwargs.get('figsize',(10,7))\n\n if self.latent_variables.estimated is False:\n raise Exception(\"No latent variables estimated!\")\n else:\n ... | [
"def normalize(self, inplace=True):\n \n phi = self if inplace else self.copy()\n\n # The pdf of a Joint Gaussian distrinution is always\n # normalized. Hence, no changes.\n if not inplace:\n return phi"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
/*!
\return the HTTP post variable $var, or $fallbackValue if the post variable does not exist , or null if $fallbackValue is omitted.
\sa variable | [
"function postVariable( $var, $fallbackValue = null )\n {\n $ret = $fallbackValue;\n if ( isset( $_POST[$var] ) )\n {\n $ret = $_POST[$var];\n }\n else if ( $ret === null )\n {\n eZDebug::writeWarning( \"Undefined post variable: $var\",\n ... | [
"private function filter($variable, $filter, $options = null)\n {\n\n //gets a specific external variable and filter it\n //determine what variable name is being used here;\n $this->sanitized = true;\n\n //@TODO To trust or not to trust?\n return filter_var($variable, $filter, ... | codesearchnet | {
"query": "Represent the Github description about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code about programming:"
} |
Store targetUrl in session. After login the user is redirected
back to this url.
@return Void | [
"protected function _storeTargetUrl() {\n $request = $this->getRequest();\n // Only store targetUrl when method = GET. A redirect to a POST request is useless.\n if (!$request->isGet()) {\n return;\n }\n\n // Allow ?targetUrl=/path/to/elsewhere on any URL\n if (!... | [
"@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 summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
Changes the the values in the nested collection
@param {Immutable.Map} map - [description]
@param {Array} listKey - [description]
@param {Array} keyPath - [description]
@param {*|Function} value - [description] | [
"function setDeep(map, listKey, keyPath, value) {\n if (!Array.isArray(listKey)) {\n listKey = [listKey];\n }\n var change = typeof value === 'function' ? 'updateIn' : 'setIn';\n var subPaths = getPaths(map, listKey, keyPath);\n return map.withMutations(function (map) {\n subPaths.forEach(function (keyPa... | [
"function Api(config) {\n // config\n this._config = config || {};\n this._config.transforms = _.merge(this._config.transforms || {},{\n defaults: {\n serialize: JSON.stringify,\n deserialize: JSON.parse\n }\n });\n\n this._config.headers = this._config.headers || {};\n\n // stack of [('one' |... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// SetEventsItemResponse sets the EventsItemResponse field's value. | [
"func (s *ItemResponse) SetEventsItemResponse(v map[string]*EventItemResponse) *ItemResponse {\n\ts.EventsItemResponse = 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:"
} |
Write all translations to cache | [
"public function write()\n {\n foreach (config('squanto.locales', []) as $locale) {\n $this->writeLocale($locale, Line::getValuesByLocale($locale));\n }\n\n return $this;\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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Provide implements DockerConfigProvider | [
"func (g *dockerConfigKeyProvider) Provide(image string) credentialprovider.DockerConfig {\n\t// Read the contents of the google-dockercfg metadata key and\n\t// parse them as an alternate .dockercfg\n\tif cfg, err := credentialprovider.ReadDockerConfigFileFromUrl(dockerConfigKey, g.Client, metadataHeader); err != ... | [
"@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 Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Model Reset does a deep reset on the data tree starting at this Model. A `previousAttributes` property is set on the `options` property with the Model's old values. | [
"function(obj, options){\n var changed = {}, key, value;\n options || (options = {});\n options.reset = true;\n obj = (obj && obj.isModel && obj.attributes) || obj || {};\n options.previousAttributes = _.clone(this.attributes);\n\n // Any unset previously existing values will be set back to defaul... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
/* =================== /* Convenience Methods /* =================== | [
"function forwardGeocode(address, callback) {\n var geocoder = new window.google.maps.Geocoder();\n var payload = {address: address};\n geocoder.geocode(payload, callback);\n }"
] | [
"public static function local()\n {\n //====================================================================//\n // Initialize Local Core Management Class\n if (isset(self::core()->localcore)) {\n return self::core()->localcore;\n }\n //==============================... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Computer Science:"
} |
Sets <PROFILE_ROOT>_PROFILE environment variable to the name of the current profile. | [
"def activate(self, profile_name=NotSet):\n \n if profile_name is NotSet:\n profile_name = self.profile_name\n self._active_profile_name = profile_name"
] | [
"def get_stack() -> Optional[str]:\n \n stack = SETTINGS.stack\n if not stack:\n require_test_mode_enabled()\n raise RunError('Missing stack name; for test mode, please set PULUMI_NODEJS_STACK')\n return stack"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@Override\n\tpublic boolean eIsSet(int featureID)\n\t{\n\t\tswitch (featureID)\n\t\t{\n\t\t\tcase XbasePackage.XABSTRACT_FEATURE_CALL__FEATURE:\n\t\t\t\treturn feature != null;\n\t\t\tcase XbasePackage.XABSTRACT_FEATURE_CALL__TYPE_ARGUMENTS:\n\t\t\t\treturn typeArguments != null && !typeArguments.isEmpty();\n\t\t\... | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the instruction about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
// SetStatus sets the Status field's value. | [
"func (s *DocumentDescription) SetStatus(v string) *DocumentDescription {\n\ts.Status = &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 Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
查询商家主页
详情请参考
http://mp.weixin.qq.com/wiki/6/2732f3cf83947e0e4971aa8797ee9d6a.html
:param shop_id: 门店 ID
:return: 返回的 JSON 数据包 | [
"def get_homepage(self, shop_id):\n \n res = self._post(\n 'homepage/get',\n data={'shop_id': shop_id},\n result_processor=lambda x: x['data']\n )\n return res"
] | [
"def _build_msg_content(self, msgtype='text', **kwargs):\n \n data = {'msgtype': msgtype}\n if msgtype == 'text':\n data[msgtype] = {'content': kwargs.get('content')}\n elif msgtype == 'image' or msgtype == 'voice' or msgtype == 'file':\n data[msgtype] = {'media_id'... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Change shape of this region to match the given ``Region`` object | [
"def morphTo(self, region):\n \n if not region or not isinstance(region, Region):\n raise TypeError(\"morphTo expected a Region object\")\n self.setROI(region)\n return self"
] | [
"def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// WithIPv6Mask will configure the limiter to use given mask for IPv6 address. | [
"func WithIPv6Mask(mask net.IPMask) Option {\n\treturn func(o *Options) {\n\t\to.IPv6Mask = mask\n\t}\n}"
] | [
"public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// listen accepts connection from the underlying tcp conn, then performs
// the brontinde handshake procedure asynchronously. A maximum of
// defaultHandshakes will be active at any given time.
//
// NOTE: This method must be run as a goroutine. | [
"func (l *Listener) listen() {\n\tfor {\n\t\tselect {\n\t\tcase <-l.handshakeSema:\n\t\tcase <-l.quit:\n\t\t\treturn\n\t\t}\n\n\t\tconn, err := l.tcp.Accept()\n\t\tif err != nil {\n\t\t\tl.rejectConn(err)\n\t\t\tl.handshakeSema <- struct{}{}\n\t\t\tcontinue\n\t\t}\n\n\t\tgo l.doHandshake(conn)\n\t}\n}"
] | [
"def process_request_thread(self, request, client_address):\n \"\"\"\"\"\"\n # Instantiate the request handler.\n handler = self.RequestHandlerClass(request, client_address, self)\n try:\n # Attempt to handle a request with the handler.\n handler.handle_request()\n self.request_complete_c... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Register asset bundles | [
"protected function registerAssetBundles()\n {\n /*\n * \n */\n CombineAssets::registerCallback(function ($combiner) {\n $combiner->registerBundle('~/modules/system/assets/less/styles.less');\n $combiner->registerBundle('~/modules/system/assets/ui/storm.less');... | [
"protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Data synchronization:"
} |
Substitute the placeholder {tcp_port} and {base_dir}
from a config array.
@param array<string, mixed> $configArray associative array
@param int|string $port
@return array<string, mixed> | [
"protected function substitutePlaceholders(array $configArray, $port): array\n {\n $substituted = [];\n $base_dir = $this->getBaseDir();\n\n foreach ($configArray as $key => $value) {\n $tmp = str_replace('{base_dir}', $base_dir, $value);\n $tmp = str_replace('{tcp_port... | [
"def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Helper method to create an importer transformTask | [
"private boolean createTransformTask(Integer importJobId, Integer taskId, RESTTransform transformTask)\n throws URISyntaxException, HttpException {\n\n LOG.debug(\"Creating a new transform task for import job\" + importJobId + \" and task \" + taskId);\n\n mapper.disable(SerializationFeature.WR... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Constructor: OpenLayers.Format.Text
Create a new parser for TSV Text.
Parameters:
options - {Object} An optional object whose properties will be set on
this instance. | [
"function(options) {\n options = options || {};\n\n if(options.extractStyles !== false) {\n options.defaultStyle = {\n 'externalGraphic': OpenLayers.Util.getImageLocation(\"marker.png\"),\n 'graphicWidth': 21,\n 'graphicHeight': 25,\n ... | [
"function(terria, url) {\n DataSourceCatalogItem.call(this, terria);\n\n this._dataSource = undefined;\n this._readyData = undefined;\n\n this.url = url;\n\n /**\n * Gets or sets the GeoJSON data, represented as a binary blob, object literal, or a Promise for one of those things.\n * If this property is se... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// GetAllAWSServiceDiscoveryPublicDnsNamespaceResources retrieves all AWSServiceDiscoveryPublicDnsNamespace items from an AWS CloudFormation template | [
"func (t *Template) GetAllAWSServiceDiscoveryPublicDnsNamespaceResources() map[string]*resources.AWSServiceDiscoveryPublicDnsNamespace {\n\tresults := map[string]*resources.AWSServiceDiscoveryPublicDnsNamespace{}\n\tfor name, untyped := range t.Resources {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resourc... | [
"public static List<Image> describeAllImages() {\n // pass any credentials as aws-mock does not authenticate them at all\n AWSCredentials credentials = new BasicAWSCredentials(\"foo\", \"bar\");\n AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);\n\n // the mock endpoin... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Code2Session 登录凭证校验 | [
"func (wxa *MiniProgram) Code2Session(jsCode string) (result ResCode2Session, err error) {\n\turlStr := fmt.Sprintf(code2SessionURL, wxa.AppID, wxa.AppSecret, jsCode)\n\tvar response []byte\n\tresponse, err = util.HTTPGet(urlStr)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(response, &result)\n\tif e... | [
"public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Return boolean version of a value | [
"def as_boolean(value)\n res = false\n\n if value\n if value.is_a?(TrueClass) || value.is_a?(FalseClass)\n res = value\n elsif value.is_a?(Fixnum)\n res = value != 0\n elsif value.respond_to?(:to_s)\n value = value.to_s.downcase\n\n res = (value == ... | [
"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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Stop application server. | [
"def stop(context):\n \n config = context.obj[\"config\"]\n pidfile = select(config, \"application.pidfile\", DEFAULT_PIDFILE)\n daemon_stop(pidfile)"
] | [
"@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 description about Container management:",
"pos": "Represent the code about Container management:",
"neg": "Represent the code about Programming:"
} |
@param array $uriParts
@param string $type
@param array $options
@return ResponseTypeInterface | [
"protected function get(array $uriParts, $type, array $options = []) {\n $response = $this->request(GDAXConstants::METHOD_GET, $uriParts, $options);\n if (!is_array($response)) {\n throw new \\Exception('Received invalid response : ' . $response .' when expecting an array ');\n }\n ... | [
"public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Fetch Activereference for an execution. Returns null, if execution not in queue | [
"public ExecutionReference getReference(final int executionId) {\n if (hasExecution(executionId)) {\n return this.queuedFlowMap.get(executionId).getFirst();\n }\n return null;\n }"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// buildPeerListUpdater builds the peer list updater given the peer list
// configuration map. For example, we might get,
//
// least-pending:
// failurePenalty: 5s
// dns:
// name: myservice.example.com
// record: A | [
"func buildPeerListUpdater(c config.AttributeMap, identify func(string) peer.Identifier, kit *Kit) (peer.Binder, error) {\n\t// Special case for explicit list of peers.\n\tvar peers []string\n\tif _, err := c.Pop(\"peers\", &peers); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(peers) > 0 {\n\t\treturn peerbind.... | [
"func (c channelState) ConnectedNodes() map[NodeID]struct{} {\n\tnodes := make(map[NodeID]struct{})\n\tfor _, channels := range c {\n\t\tnodes[channels.Node] = struct{}{}\n\t}\n\n\t// TODO(roasbeef): add outgoing, nodes, allow incoming and outgoing to\n\t// per node\n\t// * only add node is chan as funding amt set... | codesearchnet | {
"query": "Represent the Github description about host:",
"pos": "Represent the Github code about host:",
"neg": "Represent the Github code about Software development:"
} |
Unpack a tar archive, optionally compressed | [
"def extract_tarfile(archive_name, destpath):\n \"\"\n archive = tarfile.open(archive_name)\n archive.extractall(destpath)"
] | [
"public static File writeZipStreamToTempDir(InputStream inputStream) throws IOException\n {\n File dir = FileHelper.createTempDir();\n\n try\n {\n processZipStream(dir, inputStream);\n }\n\n catch (ZipException ex)\n {\n // Java doesn't support zip files with zero byt... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Escapes this string by adding slashes.
@access public
@return int Number of added slashes | [
"public function escape()\n\t{\n\t\t$length\t\t\t= $this->getLength();\n\t\t$this->string\t= addslashes( $this->string );\n\t\treturn $this->getLength() - $length;\n\t}"
] | [
"def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])"
] | codesearchnet | {
"query": "Represent the comment about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
// CreateLicense creates a new child License under the Me | [
"func (o *Me) CreateLicense(child *License) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Adds a radio button in this group and returns it.
@return Radio | [
"public function addRadio() : Radio\n {\n $radio = new Radio($this->form, $this->name);\n $radio->setRequired($this->isRequired());\n $this->radios[] = $radio;\n\n return $radio;\n }"
] | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Adds the given tree node to this nodes child list.
@param TreeNodeInterface $node The node to be inserted
@return void | [
"public function addChild(TreeNodeInterface $node): void\n {\n $this->children[] = $node;\n $this->isLeaf = false;\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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Release any acquired resources. | [
"protected void localRelease()\n {\n super.localRelease();\n\n _state.clear();\n _action = null;\n _value = null;\n _text = null;\n _params = null;\n _targetScope = null;\n _popupSupport = null;\n _disableSecondClick = false;\n _renderAsButton... | [
"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 text about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Software development:"
} |
Add occlusion segment in isovist
@param p0 segment origin
@param p1 segment destination | [
"public void addSegment(Coordinate p0, Coordinate p1) {\n if (p0.distance(p1) < epsilon) {\n return;\n }\n addSegment(originalSegments, p0, p1);\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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Gets swag data for method/view docstring | [
"def parse_docstring(obj, process_doc, endpoint=None, verb=None):\n \n first_line, other_lines, swag = None, None, None\n\n full_doc = None\n swag_path = getattr(obj, 'swag_path', None)\n swag_type = getattr(obj, 'swag_type', 'yml')\n swag_paths = getattr(obj, 'swag_paths', None)\n root_path = ... | [
"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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetPrivateDnsName sets the PrivateDnsName field's value. | [
"func (s *NetworkInterface) SetPrivateDnsName(v string) *NetworkInterface {\n\ts.PrivateDnsName = &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 text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Converts wire type to proto type.
@param fileBlockInfo the wire representation to convert
@return converted proto representation | [
"public static alluxio.grpc.FileBlockInfo toProto(FileBlockInfo fileBlockInfo) {\n List<alluxio.grpc.WorkerNetAddress> ufsLocations = new ArrayList<>();\n for (String ufsLocation : fileBlockInfo.getUfsLocations()) {\n HostAndPort address = HostAndPort.fromString(ufsLocation);\n ufsLocations.add(allu... | [
"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:"
} |
Write output to JUnit format if requested. | [
"protected function log()\n {\n if (!isset($this->options->filtered['log-junit'])) {\n return;\n }\n $output = $this->options->filtered['log-junit'];\n $writer = new Writer($this->interpreter, $this->options->path);\n $writer->write($output);\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 post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Java 2 security APIs for deleteOnExit | [
"public static void delete(final File f) {\n if (f != null && f.exists()) {\n // Why do we have to specify a return type for the run method and paramatize\n // PrivilegedExceptionAction to it, this method should have a void return type ideally.\n AccessController.doPrivileged... | [
"@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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Returns VirtualEthernetCard type recommended for the selected GuestOs | [
"private static VirtualNetworkAdapterType TryGetNetworkAdapterType(GuestOsDescriptor guestOsInfo) {\r\n String ethernetCardType = guestOsInfo.getRecommendedEthernetCard();\r\n\r\n if ((ethernetCardType == null || ethernetCardType.isEmpty()) &&\r\n (guestOsInfo.getSupportedEthernetCard() != ... | [
"@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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Instantiates a bit array with given size.
@param {number} [size = 0] the size of the bit array
@return {void} | [
"function(size){\n this.data = [];\n if(typeof size === 'undefined'){\n return; // Empty instance of a bit array\n }\n if(typeof size !== 'number'){\n size = shred(size);\n }\n for(var i=0; i<Math.ceil(size/INTEGER_SIZE); ++i){\n this.data.push(0);\n }\n}"
] | [
"function Registry(ctx, prefixLength) {\n this._ctx = ctx; // Context for all callbacks.\n this._mask = ~0 >>> (prefixLength | 0); // 16 bits by default.\n this._id = 0; // Unique integer ID for each call.\n this._n = 0; // Number of pending calls.\n this._cbs = {};\n}"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Returns the String identifying the given CUjit_option
@param n The CUjit_option
@return The String identifying the given CUjit_option | [
"public static String stringFor(int n)\r\n {\r\n switch (n)\r\n {\r\n case CU_JIT_MAX_REGISTERS: return \"CU_JIT_MAX_REGISTERS\";\r\n case CU_JIT_THREADS_PER_BLOCK: return \"CU_JIT_THREADS_PER_BLOCK\";\r\n case CU_JIT_WALL_TIME: return \"CU_JIT_WALL_TIME\";\r\n ... | [
"def get_attribute(self, attribute):\n \n\n # Check that the attribute exists.\n try:\n attr = attributes.AttributesByID[attribute]\n except KeyError:\n return 0, constants.StatusCode.error_nonsupported_attribute\n\n # Check that the attribute is valid for th... | codesearchnet | {
"query": "Represent the Github description about Documentation:",
"pos": "Represent the Github code about Documentation:",
"neg": "Represent the Github code about Programming:"
} |
return information about replica set | [
"def info(self):\n \"\"\"\"\"\"\n hosts = ','.join(x['host'] for x in self.members())\n mongodb_uri = 'mongodb://' + hosts + '/?replicaSet=' + self.repl_id\n result = {\"id\": self.repl_id,\n \"auth_key\": self.auth_key,\n \"members\": self.members(),\n ... | [
"function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Remove a specific symbol from a fn_table. | [
"def FilterFnTable(fn_table, symbol):\n \"\"\"\"\"\"\n new_table = list()\n for entry in fn_table:\n # symbol[0] is a str with the symbol name\n if entry[0] != symbol:\n new_table.append(entry)\n return new_table"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Complete the client credentials grant
@return array
@throws | [
"public function completeFlow()\n {\n $selfClient = app('selfClient');\n // Get the required params\n if (is_null($selfClient)) {\n throw new Exception\\InvalidClientException();\n }\n\n // Validate client ID and client secret\n $client = $this->server->getCli... | [
"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 Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Call Class.forName(className), but return null if any exception is thrown.
@param className
The class name to load.
@return The class of the requested name, or null if an exception was thrown while trying to load the class. | [
"public static Class<?> classForNameOrNull(final String className) {\n try {\n return Class.forName(className);\n } catch (final ReflectiveOperationException | LinkageError e) {\n return null;\n }\n }"
] | [
"public Source resolve(Field field) {\n \n /**\n * As promised the registrar simply abstracts away the internal \n * resolution implementations, throwing an error if all of them fail to\n * come up with a source for the field.\n */\n for (Resolver resolver : reso... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Encode packet helpers for binary types | [
"function encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Use this method to perform an Unset operation on netscaler resource.
@param service nitro_service object.
@param option options class object.
@param args string.
@return status of the operation performed.
@throws Exception | [
"private base_response unset_request(nitro_service service, options option, String args[]) throws Exception\n\t{\n\t\tString sessionid = service.get_sessionid();\n\t\tString request = unset_string(service, sessionid, option, args);\n\t\treturn post_data(service,request);\n\t}"
] | [
"def processRequest(cls, ps, **kw):\n \n resource = kw['resource']\n method = resource.getOperation(ps, None) # This getOperation method is valid for ServiceSOAPBinding subclass\n rsp = method(ps, **kw)[1] # return (request, response) but we only need response\n return rsp"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Computer Science:"
} |
// RemoveTeamMember removes a member from a team | [
"func RemoveTeamMember(cmd *m.RemoveTeamMemberCommand) error {\n\treturn inTransaction(func(sess *DBSession) error {\n\t\tif _, err := teamExists(cmd.OrgId, cmd.TeamId, sess); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif cmd.ProtectLastAdmin {\n\t\t\t_, err := isLastAdmin(sess, cmd.OrgId, cmd.TeamId, cmd.UserId)... | [
"func (p *provisioningIdentityMapper) UserFor(info authapi.UserIdentityInfo) (kuser.Info, error) {\n\t// Retrying up to three times lets us handle race conditions with up to two conflicting identity providers without returning an error\n\t// * A single race is possible on user creation for every conflicting identit... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Returns given layout value.
:param layout: Layout name.
:type layout: unicode
:param default: Default value if layout is not found.
:type default: object
:return: Action.
:rtype: QAction | [
"def get(self, layout, default=None):\n \n\n try:\n return self.__getitem__(layout)\n except KeyError as error:\n return default"
] | [
"def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret... | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Prints a formatted string using the specified format string and argument.
@param format the format to follow
@param value the value to be formatted | [
"public void printf(String format, Object value) {\n Object object;\n\n try {\n object = getProperty(\"out\");\n } catch (MissingPropertyException e) {\n DefaultGroovyMethods.printf(System.out, format, value);\n return;\n }\n\n InvokerHelper.invoke... | [
"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 Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// Dequeue removes the oldest, highest priority message from the queue and
// returns it | [
"func (b *PQueue) Dequeue() (*Message, error) {\n\tvar m *Message\n\terr := b.conn.Update(func(tx *bolt.Tx) error {\n\t\terr := tx.ForEach(func(bname []byte, bucket *bolt.Bucket) error {\n\t\t\tif bucket.Stats().KeyN == 0 { //empty bucket\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tcur := bucket.Cursor()\n\t\t\tk, v := cur... | [
"void offerData(byte[] chunk) {\n if (chunk == null || chunk.length == 0) {\n throw new IllegalArgumentException(\"chunk must have at least one byte of data\");\n }\n\n if (closed) {\n return;\n }\n\n // Since this is an unbounded queue, offer() always succeeds. In addition, we don't make a... | codesearchnet | {
"query": "Represent the Github instruction about Technology:",
"pos": "Represent the Github code about Technology:",
"neg": "Represent the Github code:"
} |
@param Request $request
@param string $name
@param string $redirectUrl Optional
@param array $extraParameters Optional
@return string | [
"public function getAuthorizationUrl(Request $request, $name, $redirectUrl = null, array $extraParameters = [])\n {\n $resourceOwner = $this->getResourceOwner($name);\n if (null === $redirectUrl) {\n if (!$this->connect || !$this->authorizationChecker->isGranted($this->grantRule)) {\n ... | [
"public function securedAction(string $connectorName, string $webserviceId, string $action)\n {\n //====================================================================//\n // NO Secured Actions for Non Connected Users\n $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');\n //==... | codesearchnet | {
"query": "Represent the Github description about PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code about PHP:"
} |
Create an instance of the required MBean and register it
@param c
@return | [
"private Controllable createQueueMBean(Controllable c) {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(tc, \"createQueuePointMBean\", new Object[] { c });\n JsQueue qp = new JsQueue(_me, c);\n controllableMap.put(c, qp);\n\n try {\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Adds the specified component to the toolbar container. The component is registered to this
container and will visible only when the container is active.
@param component BaseComponent to add. | [
"public void addToolbarComponent(BaseComponent component) {\n if (tbarContainer == null) {\n tbarContainer = new ToolbarContainer();\n shell.addToolbarComponent(tbarContainer);\n registerComponent(tbarContainer);\n }\n\n tbarContainer.addChild(component);\n }... | [
"function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
signature, with method RSA-SHA1. section 3.4.3
@return [String] | [
"def rsa_sha1_signature\n private_key = OpenSSL::PKey::RSA.new(@attributes['consumer_secret'])\n Base64.encode64(private_key.sign(OpenSSL::Digest::SHA1.new, signature_base)).gsub(/\\n/, '')\n end"
] | [
"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 Encryption:",
"pos": "Represent the Github code about Encryption:",
"neg": "Represent the Github code:"
} |
// Count returns the number of units contained within the duration. | [
"func (tu Unit) Count(d time.Duration) (int, error) {\n\tif d < 0 {\n\t\treturn 0, errNegativeDuraton\n\t}\n\n\tif dur, found := unitsToDuration[tu]; found {\n\t\treturn int(d / dur), nil\n\t}\n\n\t// Invalid unit.\n\treturn 0, errUnrecognizedTimeUnit\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Remove validator(s)
@param string|array $validatorName | [
"public function removeValidator($validatorName)\n {\n $validators = Arr::wrap($validatorName);\n $this->resolver->remove($validators);\n\n foreach ($validators as $validator) {\n if (array_key_exists($validator, $this->validators)) {\n unset($this->validators[$vali... | [
"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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Returns a constant.
@param string|PhpConstant $nameOrConstant
@throws \InvalidArgumentException If the constant cannot be found
@return PhpConstant | [
"public function getConstant($nameOrConstant): PhpConstant {\n\t\tif ($nameOrConstant instanceof PhpConstant) {\n\t\t\t$nameOrConstant = $nameOrConstant->getName();\n\t\t}\n\n\t\tif (!$this->constants->has($nameOrConstant)) {\n\t\t\tthrow new \\InvalidArgumentException(sprintf('The constant \"%s\" does not exist.',... | [
"final public function getString()\n {\n $res = $this->getStringInternal();\n if (!$this->isString($res) && !$this->isStringObject($res)) {\n throw new ConfigException('AbstractDriver method _getString() must return string or StringObject.');\n }\n\n return StdObjectWrapper... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software Development:"
} |
Removes a declaration block from the CSS list if it matches all given selectors.
@param array|string $mSelector The selectors to match.
@param boolean $bRemoveAll Whether to stop at the first declaration block found or remove all blocks | [
"public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {\n\t\tif ($mSelector instanceof DeclarationBlock) {\n\t\t\t$mSelector = $mSelector->getSelectors();\n\t\t}\n\t\tif (!is_array($mSelector)) {\n\t\t\t$mSelector = explode(',', $mSelector);\n\t\t}\n\t\tforeach ($mSelector as $iKey => &... | [
"def is_empty(self):\n \n if self.properties:\n # Rules containing CSS properties are never empty\n return False\n\n if not self.descendants:\n for header in self.ancestry.headers:\n if header.is_atrule and header.directive != '@media':\n ... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// SetCreationDate sets the CreationDate field's value. | [
"func (s *IdentityDescription) SetCreationDate(v time.Time) *IdentityDescription {\n\ts.CreationDate = &v\n\treturn s\n}"
] | [
"function initialize () {\n return pullTaskRunner.run(function() {\n return store.defineTable({\n name: pulltimeTableName,\n columnDefinitions: {\n id: 'string', // column for storing queryId\n tableName: 'string', // column for s... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Executes the given callback when/if the connection is handshaked.
@param callable $cb Callback
@callback $cb ( )
@return void | [
"public function onConnected($cb)\n {\n if ($this->state === self::STATE_AUTH_ERROR) {\n $cb($this, false);\n } elseif ($this->state === self::STATE_AUTH_OK) {\n $cb($this, true);\n } else {\n if (!$this->onConnected) {\n $this->onConnected = n... | [
"private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Render
When rendering 'action', the name of the action could be
camelCased or underscored. | [
"public function render($options = [])\n {\n if ($this->isPerformed()) {\n throw new Exception\\DoubleRenderException(\n 'Can only render or redirect once per action'\n );\n }\n list ($renderOptions, $options) = $this->splitOptions($options);\n $re... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Full canonical name: (<dataset_name>/<config_name>/<version>). | [
"def full_name(self):\n \"\"\"\"\"\"\n names = [self._builder.name]\n if self._builder.builder_config:\n names.append(self._builder.builder_config.name)\n names.append(str(self.version))\n return posixpath.join(*names)"
] | [
"def default(inst):\n \n import pysat.instruments.icon_ivm as icivm\n inst.tag = 'level_2'\n icivm.remove_icon_names(inst, target='ICON_L2_EUV_Daytime_OP_')"
] | codesearchnet | {
"query": "Represent the Github text about network configuration:",
"pos": "Represent the Github code about network configuration:",
"neg": "Represent the Github code:"
} |
Returns only enabled monitors. | [
"public List<AdapterMonitor> getAdapterMonitors(RuntimeContext context) {\n return getAdapterMonitors().stream().filter(monitor ->\n monitor.isEnabled(context)\n ).collect(Collectors.toList());\n }"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Creates new instance of self, and passes it to new instance of CommandResult
@param string $command
@param bool $passThrough
@return CommandResultInterface | [
"public static function command(string $command, bool $passThrough = false): CommandResultInterface\n {\n return new CommandResult(\n new static(\n $command,\n $passThrough\n )\n );\n }"
] | [
"@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 sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Loads and returns a template for one of the given names.
Tries names in order and returns the first template found.
Raises TemplateDoesNotExist if no such template exists. | [
"def select_template(template_name_list, using=None):\n \n if isinstance(template_name_list, six.string_types):\n raise TypeError(\n 'select_template() takes an iterable of template names but got a '\n 'string: %r. Use get_template() if you want to load a single '\n 'te... | [
"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 instruction about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
Count the total number of links between this object and another type of object.
@param type2 the other type of object
@param obj the object to execute this method on
@return the number of links for the given object | [
"@SuppressWarnings(\"unchecked\")\n\tpublic Long countLinks(ParaObject obj, String type2) {\n\t\tif (obj == null || obj.getId() == null || type2 == null) {\n\t\t\treturn 0L;\n\t\t}\n\t\tMultivaluedMap<String, String> params = new MultivaluedHashMap<>();\n\t\tparams.putSingle(\"count\", \"true\");\n\t\tPager pager =... | [
"def _reflex_rule_process(self, wf_action):\n \n # Check out if the analysis has any reflex rule bound to it.\n # First we have get the analysis' method because the Reflex Rule\n # objects are related to a method.\n a_method = self.getMethod()\n if not a_method:\n ... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Set invoice relations
@param array|Bag $value Parameter value
@return AbstractDocument provides a fluent interface. | [
"public function setRelations($value)\n {\n if (is_array($value)) {\n $bag = new Bag();\n foreach ($value as $itemParameters) {\n $bag->add(new Relation($itemParameters));\n }\n $value = $bag;\n }\n return $this->setParameter('relati... | [
"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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
命令 RPOPLPUSH 在一个原子时间内,执行以下两个动作:
将列表 source 中的最后一个元素(尾元素)弹出,并返回给客户端。
将 source 弹出的元素插入到列表 destination ,作为 destination 列表的的头元素。 | [
"@SuppressWarnings(\"unchecked\")\r\n\tpublic <T> T rpoplpush(Object srcKey, Object dstKey) {\r\n\t\tJedis jedis = getJedis();\r\n\t\ttry {\r\n\t\t\treturn (T)valueFromBytes(jedis.rpoplpush(keyToBytes(srcKey), keyToBytes(dstKey)));\r\n\t\t}\r\n\t\tfinally {close(jedis);}\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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about text processing:"
} |
// You should always use this function to get a new UpdateHypervisorCapabilitiesParams instance,
// as then you are sure you have configured all required params | [
"func (s *HypervisorService) NewUpdateHypervisorCapabilitiesParams() *UpdateHypervisorCapabilitiesParams {\n\tp := &UpdateHypervisorCapabilitiesParams{}\n\tp.p = make(map[string]interface{})\n\treturn p\n}"
] | [
"function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Generation of thumbnail tags.
@param m source
@param e element to attach new element to | [
"private void generateThumbails(final Metadata m, final Element e) {\n for (final Thumbnail thumb : m.getThumbnail()) {\n final Element t = new Element(\"thumbnail\", NS);\n addNotNullAttribute(t, \"url\", thumb.getUrl());\n addNotNullAttribute(t, \"width\", thumb.getWidth())... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
todo/check: adm1 => state
why use adm1 and not state ?? duplicate of match___country_n_state ?? | [
"def match_xxx_for_country_n_adm1( name, xxx ) # xxx e.g. parts|counties|etc.\n\n # auto-add required country n states (from folder structure)\n #\n # e.g. de-deutschland!/3--by-bayern/parts (regierungsbezirke)\n # europe/de-deutschland!/3--by-bayern/parts\n #\n # at-austria!/1--n-nie... | [
"def set_form_row\n return :UNHANDLED if @current_component.nil?\n cc = @current_component\n $log.debug \"STACKFLOW #{@name} set_form_row calling sfr for #{cc.name}, r #{cc.row} c: #{cc.col} \"\n $log.debug \" STACKFLOW on enter sfr #{@current_component.name} #{@current_component} \"\n\n @... | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Validation email addresses
@param string $data A list of email addresses separated by a comma.
@return bool Success | [
"public function validEmail($data) {\n\t\t$data = array_shift($data);\n\t\tif (empty($data)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (is_array($data)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$result = true;\n\t\t$emails = explode(CAKE_SETTINGS_APP_SMTP_EMAIL_DELIM, (string)$data);\n\t\tforeach ($emails as $email) {\n\... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Checks if original SQL string valid.
If string contains some unnamed "?" parameters - it is considered unvalid
@param originalSql Original SQL String | [
"protected void validateSqlString(String originalSql) {\r\n if (originalSql == null) {\r\n throw new IllegalArgumentException(ERROR_SQL_QUERY_NULL);\r\n }\r\n if (processor.hasUnnamedParameters(originalSql) == true) {\r\n throw new IllegalArgumentException(ERROR_FOUND_UNNA... | [
"def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Find main locations
@param bootProps An instance of BootstrapConfig
@param processName Process name to be used | [
"protected void findLocations(BootstrapConfig bootProps, String processName) {\n // Check for environment variables...\n String userDirStr = getEnv(BootstrapConstants.ENV_WLP_USER_DIR);\n String serversDirStr = getEnv(bootProps.getOutputDirectoryEnvName());\n\n // Check for the variable ... | [
"@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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
RSA analysis will compare the similarity of two matrices | [
"def RSA(m1,m2):\n '''\n '''\n from scipy.stats import pearsonr\n import scipy.linalg\n import numpy\n\n # This will take the diagonal of each matrix (and the other half is changed to nan) and flatten to vector\n vectorm1 = m1.mask(numpy.triu(numpy.ones(m1.shape)).astype(numpy.bool)).values.fla... | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// strippedIsolatedName returns the base name of an isolated path, with the extension (if any) removed. | [
"func strippedIsolatedName(isolated string) string {\n\tname := filepath.Base(isolated)\n\t// Strip the extension if there is one.\n\tif dotIndex := strings.LastIndex(name, \".\"); dotIndex != -1 {\n\t\treturn name[0:dotIndex]\n\t}\n\treturn name\n}"
] | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// List lists all CiliumNetworkPolicies in the indexer for a given namespace. | [
"func (s ciliumNetworkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v2.CiliumNetworkPolicy, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v2.CiliumNetworkPolicy))\n\t})\n\treturn ret, err\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 description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about Software development:"
} |
A method used to get a Chat object via the chats ID
@param chatID The Chat ID of the chat you want a Chat object of
@return A Chat object or null if the chat does not exist or you don't have permission to get this chat | [
"public Chat getChat(String chatID) {\n\n try {\n\n MultipartBody request = Unirest.post(getBotAPIUrl() + \"getChat\")\n .field(\"chat_id\", chatID, \"application/json; charset=utf8;\");\n HttpResponse<String> response = request.asString();\n JSONObject jso... | [
"function DataModelMigration() {\n /**\n * Gets an array that contains the definition of fields that are going to be added\n * @type {Array}\n */\n this.add = [];\n /**\n * Gets an array that contains a collection of constraints which are going to be added\n * @type {Array}\n */\n ... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
@param EshopModuleSmartyPluginDirectories $moduleSmartyPluginDirectories
@throws EshopModuleValidationException | [
"public function validate(EshopModuleSmartyPluginDirectories $moduleSmartyPluginDirectories)\n {\n $directories = $moduleSmartyPluginDirectories->getWithFullPath();\n\n foreach ($directories as $directory) {\n if (!$this->doesDirectoryExist($directory)) {\n throw new Eshop... | [
"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 Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// routesToMapList turns the list of routes into a list of maps. | [
"func routesToMapList(routes []*ec2.VpnStaticRoute) []map[string]interface{} {\n\tresult := make([]map[string]interface{}, 0, len(routes))\n\tfor _, r := range routes {\n\t\tstaticRoute := make(map[string]interface{})\n\t\tstaticRoute[\"destination_cidr_block\"] = *r.DestinationCidrBlock\n\t\tstaticRoute[\"state\"]... | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Given a Ruby instance, will attempt to push it on the Lua stack. | [
"def stack_push(o)\n\n return stack_push(o.to_lua) if o.respond_to?(:to_lua)\n\n case o\n\n when NilClass then Lib.lua_pushnil(@pointer)\n\n when TrueClass then Lib.lua_pushboolean(@pointer, 1)\n when FalseClass then Lib.lua_pushboolean(@pointer, 0)\n\n when Integer then Lib.lua_pushin... | [
"@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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
[[@doctodo method_description:handleDialog]].
@param [[@doctodo param_type:i]] $i [[@doctodo param_description:i]]
@return [[@doctodo return_type:handleDialog]] [[@doctodo return_description:handleDialog]] | [
"protected function handleDialog(&$i)\n {\n if (!isset($this->taskOptions['isForm'])) {\n $this->taskOptions['isForm'] = strstr($this->content, '<form') === false;\n }\n\n if (!isset($this->taskOptions['isConfirmation'])) {\n $this->taskOptions['isConfirmation'] = false... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the text about PHP programming:",
"pos": "Represent the code about PHP programming:",
"neg": "Represent the code:"
} |
Get all tags
@see http://codex.wordpress.org/Transients_API
@return array<Etiqueta> List with all tags | [
"public static function getAll()\n {\n global $wpdb;\n if (false === ($results = get_transient(self::TRANSIENT_ALL_TAGS))) {\n $results = $wpdb->get_results('\n\t\t\t\tSELECT ta.term_taxonomy_id as taxonomy_id, name, slug, count(*) total\n\t\t\t\tFROM ' . $wpdb->prefix . 'term_taxonomy t... | [
"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 Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Create a form input.
Text is default input type.
echo Form::input('username', $username);
@param string $name Input name
@param string $value Input value
@param array $attributes HTML attributes
@return string | [
"public static function input(string $name, string $value = '', array $attributes = null) : string\n {\n // Set the input name\n $attributes['name'] = $name;\n\n // Set the input id\n $attributes['id'] = (isset($attributes['id'])) ? $attributes['id'] : $name;\n\n // Set the inp... | [
"public function getStoreValue($data = null)\n {\n\n // If Overrite Value\n if (isset($this->value) && $this->overwriteValue) {\n return $this->value;\n }\n\n // If user have user input value\n if ($data != null && isset($data[$this->getName()])) {\n\n // ... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Returns the CDF of this distribution. | [
"def MakeCdf(self, steps=101):\n \"\"\"\"\"\"\n xs = [i / (steps - 1.0) for i in xrange(steps)]\n ps = [scipy.special.betainc(self.alpha, self.beta, x) for x in xs]\n cdf = Cdf(xs, ps)\n return cdf"
] | [
"@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 Mathematics:",
"pos": "Represent the Github code about Mathematics:",
"neg": "Represent the Github code:"
} |
Set the type of the given refobj
:param refobj: the reftrack node to edit
:type refobj: refobj
:param typ: the entity type
:type typ: str
:returns: None
:rtype: None
:raises: ValueError | [
"def set_typ(self, refobj, typ):\n \n try:\n enum = JB_ReftrackNode.types.index(typ)\n except ValueError:\n raise ValueError(\"The given type %s could not be found in available types: %\" % (typ, JB_ReftrackNode.types))\n cmds.setAttr(\"%s.type\" % refobj, enum)"
] | [
"def attribute_warfare(object):\n \n\n def attribute_warfare_wrapper(attribute):\n \"\"\"\n Alterates object attributes using guerilla / monkey patching.\n\n :param attribute: Attribute to alterate.\n :type attribute: object\n :return: Object.\n :rtype: object\n ... | codesearchnet | {
"query": "Represent the comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Creates a label of the form "9:15am". TODO: support 24 hour time for people who go for that
sort of thing. If date is null the empty string is returned. | [
"public static String formatTime (Date date)\n {\n return (date == null) ? \"\" : _tfmt.format(date).toLowerCase();\n }"
] | [
"@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
@param array $payload
@return MessageEchoEvent | [
"public static function createMessageEchoEvent(array $payload)\n {\n $message = MessageEcho::create($payload['message']);\n $senderId = $payload['sender']['id'];\n $recipientId = $payload['recipient']['id'];\n $timestamp = $payload['timestamp'];\n\n return new MessageEchoEvent(... | [
"public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }"
] | codesearchnet | {
"query": "Represent the Github description about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about Software development:"
} |
Update the specified resource in storage.
@param UpdateInvitationRequest $request
@param $id
@return \Illuminate\Http\JsonResponse | [
"public function update(UpdateInvitationRequest $request, $id)\n {\n $invitation = UserInvitation::find($id);\n $invitation->update($request->intersect(['email','state','token']));\n return Response::json(['updated' => true ]);\n }"
] | [
"public function deleteSubscriptionUsageData($usageDataId)\n {\n $requestData = new DeleteUsageData\\RequestData($usageDataId);\n $request = new DeleteUsageData\\Request($requestData);\n\n return $this->sendRequest($request, DeleteUsageData\\ApiResponse::class);\n }"
] | codesearchnet | {
"query": "Represent the instruction about host:",
"pos": "Represent the code about host:",
"neg": "Represent the code about Metadata management:"
} |
APIMethod: isSimpleContent
Test if the given node has only simple content (i.e. no child element
nodes).
Parameters:
node - {DOMElement} An element node.
Returns:
{Boolean} The node has no child element nodes (nodes of type 1). | [
"function(node) {\n var simple = true;\n for(var child=node.firstChild; child; child=child.nextSibling) {\n if(child.nodeType === 1) {\n simple = false;\n break;\n }\n }\n return simple;\n }"
] | [
"function Entry (content, name, parent) {\n if (!(this instanceof Entry)) return new Entry(content, name, parent);\n\n this._parent = parent; // parent can be a Document or ArrayField\n this._schema = parent._schema; // the root Document\n this._name = name; // the field name supplied by the user\n this._hidde... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Set the tag name.
@return Bluora\LaravelHtmlBuilder\Tag | [
"public function setTag($tag)\n {\n if (in_array($tag, $this->getParent()->allowed_tags)) {\n throw new \\Exception($tag.' can not be changed as it is not allowed under '.$this->getParent()->getTag().'.');\n }\n\n $this->tag = $tag;\n\n return $this;\n }"
] | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Converts Collection to array.
@param <T>
@param col
@param cls
@return
@see java.util.Collection#toArray(T[]) | [
"public static <T> T[] toArray(Collection<T> col, Class<T> cls)\r\n {\r\n T[] arr = (T[]) Array.newInstance(cls, col.size());\r\n return col.toArray(arr);\r\n }"
] | [
"public static <T> Level0ArrayOperator<String[],String> onArray(final String[] target) {\r\n return onArrayOf(Types.STRING, target);\r\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// parseFields parses a block of lines that define fields.
//
// It looks like this:
//
// arg1: blah-blah,
// maybe more-blah-blah.
// arg2: shorter blah-blah.
//
// arg3: | [
"func parseFields(lines []string) []Field {\n\tvar fields []Field\n\n\tfor len(lines) > 0 {\n\t\t// Grab the name of the field from the first line.\n\t\tname, firstLine, ok := parseFieldLine(lines[0])\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tlines = lines[1:]\n\n\t\t// All other lines of the field description (if any... | [
"public function normalizeRules($rules)\n {\n // If you want to use a pipe in a regex, custom message etc,\n // single-quote the string (escaping would be too confusing in regexes):\n //\n // This works with:\n //\n // 'foo?\\'my piped | string\\''\n // \"foo?'my ... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Generate a program to compute the inverse quantum Fourier transform on a set of qubits.
:param qubits: A list of qubit indexes.
:return: A Quil program to compute the inverse Fourier transform of the qubits. | [
"def inverse_qft(qubits: List[int]) -> Program:\n \n \n qft_result = Program().inst(_core_qft(qubits, -1))\n qft_result += bit_reversal(qubits)\n inverse_qft = Program()\n while len(qft_result) > 0:\n new_inst = qft_result.pop()\n inverse_qft.inst(new_inst)\n return inverse_qft"
] | [
"def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s... | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Parse a LANGUAGE response (RFC 5255 [3.3]).
@param Horde_Imap_Client_Tokenize $data The server response. | [
"protected function _parseLanguage(Horde_Imap_Client_Tokenize $data)\n {\n $lang_list = $data->flushIterator();\n\n if (count($lang_list) === 1) {\n // This is the language that was set.\n $this->_setInit('lang', reset($lang_list));\n } else {\n // These are ... | [
"public List<Symbol> getSymbolList(final String param) {\n return get(param, new StringToSymbolList(\",\"),\n new AlwaysValid<List<Symbol>>(),\n \"comma-separated list of strings\");\n }"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Documentation:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.