query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Sanitise the identifier and populate the variables list | [
"public function onBeforeWrite() {\n\t\tparent::onBeforeWrite();\n\t\t$slug = singleton('SiteTree')->generateURLSegment($this->Identifier);\n\t\t$original_slug = $slug;\n\t\t$i = 0;\n\t\twhile($t = PermamailTemplate::get()\n\t\t\t->filter(array(\"Identifier\" => \"$slug\"))\n\t\t\t->exclude(array(\"ID\" => $this->I... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
-------------------------------------------------------- | [
"private static byte[] hexStringToByteArray(String s)\n\t{\n\t\tbyte[] b = new byte[s.length() / 2];\n\t\tfor (int i = 0; i < b.length; i++)\n\t\t{\n\t\t\tint index = i * 2;\n\t\t\tint v = Integer.parseInt(s.substring(index, index + 2), 16);\n\t\t\tb[i] = (byte) v;\n\t\t}\n\t\treturn b;\n\t}"
] | [
"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 description about language and writing:",
"pos": "Represent the Github code about language and writing:",
"neg": "Represent the Github code:"
} |
Return `True` if the given object conforms to the Serializable protocol.
:rtype: bool | [
"def is_serializable(obj):\n \n if inspect.isclass(obj):\n return Serializable.is_serializable_type(obj)\n return isinstance(obj, Serializable) or hasattr(obj, '_asdict')"
] | [
"@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 post about text analysis:",
"pos": "Represent the code about text analysis:",
"neg": "Represent the code about Software development:"
} |
// Convert_v1beta1_ImageMeta_To_kubeadm_ImageMeta is an autogenerated conversion function. | [
"func Convert_v1beta1_ImageMeta_To_kubeadm_ImageMeta(in *ImageMeta, out *kubeadm.ImageMeta, s conversion.Scope) error {\n\treturn autoConvert_v1beta1_ImageMeta_To_kubeadm_ImageMeta(in, out, s)\n}"
] | [
"func Convert_build_CommonSpec_To_v1_CommonSpec(in *build.CommonSpec, out *v1.CommonSpec, s conversion.Scope) error {\n\treturn autoConvert_build_CommonSpec_To_v1_CommonSpec(in, out, s)\n}"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
An array of string identifiers that uniquely idenitifies an entity such as class name, parent
classes and the entity service identifier.
@return array | [
"public function getUniqueIdentifiers()\n {\n if (!isset($this->_unique_identifiers)) {\n $classname = $this->getEntityIdentifier()->classname;\n $this->_unique_identifiers = get_parents($classname, 'AnDomainEntity');\n if (strpos($classname, 'AnDomainEntity') !== 0) {\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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Returns the row sums for a matrix. | [
"public static double[] rowSums(double[][] data) {\n double[] x = new double[data.length];\n\n for (int i = 0; i < x.length; i++) {\n x[i] = sum(data[i]);\n }\n\n return x;\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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Returns an array of MethodDescriptions to wrap and describe the
specified MethodDescriptors. | [
"public MethodDescription[] createMethodDescriptions(\n MethodDescriptor[] mds) {\n if (mds == null) {\n return null;\n }\n\n MethodDescription[] descriptions = \n new MethodDescription[mds.length];\n\n for (int i ... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// newPartFromBytes creates a generic binary part,
// using specified contentType, Content-Disposition, Content-ID
// (do not wrap with angle brackets), and with the bytes as its content
// (do not encode, this will happen automatically when needed). | [
"func newPartFromBytes(raw []byte, contentType string, contentDisposition string, contentID string) *Message {\n\theaders := Header{}\n\n\tif len(contentType) > 0 {\n\t\theaders.Set(\"Content-Type\", contentType)\n\t} else {\n\t\theaders.Set(\"Content-Type\", \"application/octet-stream\")\n\t}\n\n\tif len(contentDi... | [
"private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {\n // Get default form\n in.defaultReadObject();\n\n // Create new Archive\n final String name = this.name;\n final ZipImporter archive = ShrinkWrap.create(ZipImporter.class, name);\n\... | codesearchnet | {
"query": "Represent the Github instruction about Java programming:",
"pos": "Represent the Github code about Java programming:",
"neg": "Represent the Github code about programming:"
} |
This function is used for rechecking the status the desired step
@return \Zend\View\Model\JsonModel | [
"public function checkSysConfigAction()\n {\n $success = 0;\n $errors = [];\n\n if ($this->getRequest()->isXmlHttpRequest()) {\n $response = $this->systemConfigurationChecker();\n $success = $response['success'];\n $errors = $response['errors'];\n\n ... | [
"private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }"
] | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
@param string|null $restriction
@return array | [
"public function getSortedEventsForConfigForm($restriction = null)\n {\n $events = array();\n\n foreach ($this->getEvents($restriction) as $event) {\n $events[$event] = 'log_' . $event . '_title';\n }\n\n return $events;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Validate the response of an api call against a swagger schema. | [
"def validate_api_response(schema, raw_response, request_method='get', raw_request=None):\n \n request = None\n if raw_request is not None:\n request = normalize_request(raw_request)\n\n response = None\n if raw_response is not None:\n response = normalize_response(raw_response, request... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the summarization about software development:",
"pos": "Represent the code about software development:",
"neg": "Represent the code about programming:"
} |
@param string $whenYouWereFourteenYourMothersEmploymentStatus
@throws \InvalidArgumentException
@return Employment | [
"public function setWhenYouWereFourteenYourMothersEmploymentStatus($whenYouWereFourteenYourMothersEmploymentStatus)\n {\n if (\n !is_string($whenYouWereFourteenYourMothersEmploymentStatus)\n &&\n !is_null($whenYouWereFourteenYourMothersEmploymentStatus)\n ) {\n ... | [
"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 post about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code about Software development:"
} |
Called when the base buffer has just acquired 2*k elements.
@param <T> the data type
@param sketch the given quantiles sketch | [
"@SuppressWarnings(\"unchecked\")\n static <T> void processFullBaseBuffer(final ItemsSketch<T> sketch) {\n final int bbCount = sketch.getBaseBufferCount();\n final long n = sketch.getN();\n assert bbCount == (2 * sketch.getK()); // internal consistency check\n\n // make sure there will be enough levels... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns a callable for the given controller.
@param string $controller A Controller string
@return mixed A PHP callable | [
"private function createController($controller)\n {\n if (false === strpos($controller, '::'))\n {\n $count = substr_count($controller, ':');\n if (2 == $count)\n {\n // controller in the a:b:c notation then\n $controller = $this->parse... | [
"private function _init()\n {\n // TODO: check if self::$instance is required here or if we can only set\n // decorated object\n\n // initialize and store the instance of template engine for further access\n self::$instance = Doozr_Loader_Serviceloader::load($this->library, $this->res... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Tokenizes a text file. | [
"def tokenize(self, path):\n \"\"\"\"\"\"\n assert os.path.exists(path)\n # Add words to the dictionary\n with open(path, 'r') as f:\n tokens = 0\n for line in f:\n words = line.split() + ['<eos>']\n tokens += len(words)\n ... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
recursive function to get previous sibling nodes of given element | [
"function getPreviousSiblings(el) {\n var siblings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var previousSibling = el.previousSibling;\n\n if (!previousSibling) {\n return siblings;\n }\n\n siblings.push(previousSibling);\n return getPreviousSiblings(previousSibling, sibli... | [
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(DeleteJobRequest deleteJobRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (deleteJobRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(deleteJobRequest.... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get the properties for this discriminator (none) | [
"public Map getProperties() {\n if (tc.isEntryEnabled())\n SibTr.entry(this, tc, \"getProperties\");\n if (tc.isEntryEnabled())\n SibTr.exit(this, tc, \"getProperties\");\n return null;\n }"
] | [
"def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
// RemoteAdd adds a remote named <name> for the repository at <url>. | [
"func (g *Git) RemoteAdd(name, url string) *command.Model {\n\treturn g.command(\"remote\", \"add\", name, url)\n}"
] | [
"def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Natural Language Processing:"
} |
Build querystring from object
@link http://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq
@param {Object} params
@param {String} [sep='&']
@param {String} [eq='=']
@returns {String} | [
"function(params, sep, eq) {\n var query = '',\n value,\n typeOf,\n tmpArray,\n i, size, key;\n\n if ( ! params) {\n return query;\n }\n\n sep || (sep = '&');\n eq || (eq = '=');\n\n for (key in params) {\n i... | [
"function (value) {\n if (is(value).a(Object)) value = Unirest.serializers.form(value)\n if (!value.length) return $this\n $this.options.url += (does($this.options.url).contain('?') ? '&' : '?') + value\n return $this\n }"
] | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
/*
Формирует SQL запрос на создание таблицы
@param array $table информация о таблице
@param string $charset default charset таблицы
@return string | [
"private function getCreateTable($data, $charset = 'utf8')\n {\n \t$sql = \"CREATE TABLE `\".$data['name'].\"` (\\n\";\n \t\n \tif (is_array($data['fields'])) foreach ($data['fields'] as $field) {\n \t $sql .= \" `\".$field['name'].\"` \".$this->getFieldDef($field).\",\\n\";\n \t}\n \t\n... | [
"private function processA(array $result) {\n\t\ttry {\n\t\t\t$result = $this->processI($result);\n\t\t}\n\t\t/**\n\t\t * 2016-08-02\n\t\t * Исключительная ситуация может быть не только типа @see \\Df\\Core\\Exception,\n\t\t * но и типа @see \\Exception,\n\t\t * потому что чтение некорректных данных может приводить... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
Creates a phpbu configuration.
@return \phpbu\App\Configuration | [
"protected function createConfiguration()\n {\n // check if a phpbu xml/json config file is configured\n $phpbuConfigFile = $this->configProxy->get('phpbu.phpbu');\n if (!empty($phpbuConfigFile)) {\n // load xml or json configurations\n $configLoader = PhpbuConfigLoade... | [
"public function logBanner($additions = null)\n {\n $this->addStatusMessage('FlexiBee '.str_replace('://',\n '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\\Ease\\Atom::$frameworkVersion.' '.$additio... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Returns true if the define's if and unless conditions (if any) are
satisfied. | [
"public boolean isActive(final org.apache.tools.ant.Project p) {\n if (this.value == null) {\n return false;\n }\n if (this.ifCond != null && p.getProperty(this.ifCond) == null) {\n return false;\n } else if (this.unlessCond != null && p.getProperty(this.unlessCond) != null) {\n return fa... | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Print grammar rules | [
"def dump_grammar(self, out=sys.stdout):\n \n for rule in sorted(self.rule2name.items()):\n out.write(\"%s\\n\" % rule2str(rule[0]))\n return"
] | [
"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 Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Adding a new element to the container.
@param string $place
@param ItemMenu $itemMenu
@return $this | [
"public function add(string $place, ItemMenu $itemMenu)\n {\n $arg = get_object_vars($itemMenu);\n\n if (array_key_exists('show', $arg) && ! $arg['show']) {\n return $this;\n }\n\n $this->location = $place;\n $this->arg = $arg;\n $this->sort = $arg['sort'];\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 instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Extra logic for the field.
Adds all sub-fields.
@access public
@param array $args The arguments of the field. | [
"public function init( $args ) {\n\n\t\t$args['required'] = isset( $args['required'] ) ? (array) $args['required'] : [];\n\t\t$config_id = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global';\n\t\t/**\n\t\t * Add a hidden field, the label & description.\n\t\t */\n\t\tKirki::add_field(\n\t\t\t$c... | [
"protected function configureFormer()\n {\n // Use Bootstrap 3\n Config::set('former.framework', 'TwitterBootstrap3');\n\n // Reduce the horizontal form's label width\n Config::set('former.TwitterBootstrap3.labelWidths', []);\n\n // Change Former's required field HTML\n ... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Connect method. It's returning JSONP response
@param Request $request
@return string | [
"public function index(Request $request)\n {\n $referrerDomain = parse_url($request->server('HTTP_REFERER'), PHP_URL_HOST);\n if ($referrerDomain !== $this->config->get('vanilla-integration.forum_domain')) {\n return app()->abort(404);\n }\n\n if (class_exists('Debugbar')) ... | [
"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 summarization about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
Live template for pycharm:
y = func(command="$cmd$", description="$desc$", link="$lnk$", params_string="$first_param$", returns="$returns$", return_type="$returntype$") | [
"def func(command, description, link, params_string, returns=\"On success, the sent Message is returned.\", return_type=\"Message\"):\n \n description_with_tabs = \"\\t\\t\" + description.strip().replace(\"\\n\", \"\\n\\t\\t\")\n param_list_args = []\n param_list_kwargs = []\n args = []\n args2 = ... | [
"def _init_prtfmt(self, key=\"fmta\"):\n \"\"\"\"\"\"\n prtfmt = self.gosubdag.prt_attr[key]\n return prtfmt.replace(\"{NS}\", \"{NS} {hdr1usr01:2} {num_usrgos:>4} uGOs\")"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Exists checks if a file or directory exists. | [
"func Exists(path string, fs afero.Fs) (bool, error) {\n\treturn afero.Exists(fs, path)\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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Creating database if not exists.
@param $name name of database
@return bool | [
"public function createDb($name)\n {\n $sql = $this->query->createDb($name);\n $this->db->exec($sql);\n\n return true;\n }"
] | [
"def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about AWS Auto Scaling:"
} |
return the relevant Validator by the given class type and required indication | [
"public static<T extends ParamValidator> T getValidator(Class<T> clazz, boolean required) {\n\n List<ParamValidator> validators = validatorsMap.get(clazz);\n if (validators != null) {\n\n if (required) {\n return (T)validators.get(0);\n }\n\n return (T)v... | [
"@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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
@param string
@throws InvalidArgumentException Invalid HTTP version was set. Note that HttpResponse supports 1.0 & 1.1
venison only. | [
"public function setProtocolVersion($httpVersion)\n {\n $httpVersion = (string)$httpVersion;\n\n if ($httpVersion !== '1.1' && $httpVersion !== '1.0') { //SPDY is not supported currently\n throw new InvalidArgumentException('Invalid (non-RFC) HTTP version.');\n }\n\n $this-... | [
"private boolean isCloudantAuthError(Response response) {\n String server = response.header(\"Server\");\n // Cloudant could send `CouchDB/ad97a06 (Erlang OTP/17)` as Server header value\n // Another cloudant server value example: `CouchDB/1.0.2`\n if (server == null || server.indexOf(\"... | codesearchnet | {
"query": "Represent the description about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code:"
} |
u"""
:type pattern: text_type
:param pattern:
:param start:
:return: | [
"def _parse_bracket_expression(pattern, start=0, no_escape=False):\n \n \"\"\"\n i = start\n\n if pattern[i:i+len(_BE_OPEN)] != _BE_OPEN:\n raise ValueError(u'Expected {}'.format(repr(_BE_OPEN)))\n i += len(_BE_OPEN)\n\n # fnmatch builds on top of POSIX, but uses `!` while POSIX uses `^`\n ... | [
"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 post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
上传一个文件.
这个是使用的网页中的上传接口.
upload_mode - const.UploadMode, 如果文件已在服务器上存在:
* overwrite, 直接将其重写.
* newcopy, 保留原先的文件, 并在新上传的文件名尾部加上当前时间戳. | [
"def upload(cookie, source_path, path, upload_mode):\n '''\n '''\n ondup = const.UPLOAD_ONDUP[upload_mode]\n dir_name, file_name = os.path.split(path)\n url = ''.join([\n const.PCS_URL_C,\n 'file?method=upload&app_id=250528',\n '&ondup=', ondup,\n '&dir=', encoder.encode_u... | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about text processing:"
} |
植物识别接口
@param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
@param array $options - 可选参数对象,key: value都为string类型
@description options列表:
@return array | [
"public function plantDetect($image, $options=array()){\n\n $data = array();\n \n $data['image'] = base64_encode($image);\n\n $data = array_merge($data, $options);\n\n return $this->request($this->plantDetectUrl, $data);\n }"
] | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about text processing:"
} |
Returns route collection for current request
@param Request $request
@return RouteCollection | [
"public function getRouteCollectionForRequest(Request $request)\n {\n $collection = new RouteCollection();\n $path = $this->getNormalizedPath($request);\n $resource = $this->repository->findOneBy(['path' => $path]);\n \n if ($resource) {\n $route = $this->cre... | [
"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 sentence about Symfony:",
"pos": "Represent the Github code about Symfony:",
"neg": "Represent the Github code about Programming:"
} |
/* eslint-disable | [
"function reducer(state, action) {\n state = state || {count: 0};\n\n if (action.type === 'TEST') {\n return {count: state.count + action.payload.value};\n }\n\n return state;\n}"
] | [
"function printDebugWithCode(msg, code) {\n // eslint-disable-next-line no-console\n console.log(`\\n\\n${msg}:\\n`);\n // eslint-disable-next-line no-console\n console.log(`${highlightFn(code)}\\n`);\n}"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Natural Language Processing:"
} |
Ensures that the DB represented by connection posses a segment table.
If not, creates one and prints a warning to stderr | [
"def ensure_segment_table(connection):\n \"\"\"\"\"\"\n\n count = connection.cursor().execute(\"SELECT count(*) FROM sqlite_master WHERE name='segment'\").fetchone()[0]\n\n if count == 0:\n print >>sys.stderr, \"WARNING: None of the loaded files contain a segment table\"\n theClass = lsctabl... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software development:"
} |
Builds Table Heading with Month, Year and Links for Selection.
@access protected
@param int $day Number of Day
@param string $class Class of Cell
@return string | [
"protected function buildHeading( $span = NULL )\r\n\t{\r\n\t\t$month\t= (int) $this->getOption( 'show_month' );\r\n\t\t$year\t= (int) $this->getOption( 'show_year' );\r\n\t\t$prev_month\t= $month - 1;\r\n\t\t$next_month\t= $month + 1;\r\n\t\t$prev_year\t= $next_year = $year;\r\n\r\n\t\t$month\t= $this->months[$mon... | [
"private function AddPublishToHourField()\n {\n $name = 'PublishToHour';\n $to = $this->page->GetPublishTo();\n $field = Input::Text($name, $to ? $to->ToString('H') : '');\n $field->SetHtmlAttribute('data-type', 'hour');\n $this->AddField($field);\n }"
] | codesearchnet | {
"query": "Represent the summarization about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Returns date-related translations for a locale
@returns [ dayPeriodsFormat, dayPeriodsStandalone, daysFormat, dayStandalone, monthsFormat, monthsStandalone, eras ]
each value: [ narrow, abbreviated, wide, short? ] | [
"function getDateTimeTranslations(localeData) {\n const dayNames = localeData.main(`dates/calendars/gregorian/days`);\n const monthNames = localeData.main(`dates/calendars/gregorian/months`);\n const erasNames = localeData.main(`dates/calendars/gregorian/eras`);\n const dayPeriods = getDayPeriodsAmPm(localeData... | [
"@Override\n public String getFormatPattern(\n DisplayStyle style,\n Locale locale\n ) {\n\n return GenericDatePatterns.get(\"chinese\", style, locale); // always redirect to chinese calendar\n\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// NewPeerstore creates a data structure that stores peer data, backed by the
// supplied implementations of KeyBook, AddrBook and PeerMetadata. | [
"func NewPeerstore(kb KeyBook, ab AddrBook, md PeerMetadata) Peerstore {\n\treturn &peerstore{\n\t\tKeyBook: kb,\n\t\tAddrBook: ab,\n\t\tPeerMetadata: md,\n\t\tMetrics: NewMetrics(),\n\t\tinternedProtocols: make(map[string]string),\n\t}\n}"
] | [
"@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC... | codesearchnet | {
"query": "Represent the Github comment about Technology:",
"pos": "Represent the Github code about Technology:",
"neg": "Represent the Github code:"
} |
Creates individual Entry objects of the appropriate type and
stores them in the $_entry array based upon DOM data.
@param DOMNode $child The DOMNode to process | [
"protected function takeChildFromDOM($child)\n {\n $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;\n switch ($absoluteNodeName) {\n case $this->lookupNamespace('atom') . ':' . 'generator':\n $generator = new Zend_Gdata_App_Extension_Generator();\n $g... | [
"final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n /... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Get the queue's number of tasks in each state.
Returns dict with queue size for the QUEUED, SCHEDULED, and ACTIVE
states. Does not include size of error queue. | [
"def get_queue_sizes(self, queue):\n \n\n states = [QUEUED, SCHEDULED, ACTIVE]\n pipeline = self.connection.pipeline()\n for state in states:\n pipeline.zcard(self._key(state, queue))\n results = pipeline.execute()\n return dict(zip(states, results))"
] | [
"public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi... | codesearchnet | {
"query": "Represent the comment about AWS Route 53:",
"pos": "Represent the code about AWS Route 53:",
"neg": "Represent the code about programming:"
} |
// Validate inspects the fields of the type to determine if they are valid. | [
"func (s *ListJobsByStatusInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"ListJobsByStatusInput\"}\n\tif s.Status == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Status\"))\n\t}\n\tif s.Status != nil && len(*s.Status) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMi... | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Test if indices are valid
@param inds index set
@return True if valid, False otherwise | [
"def areIndicesValid(self, inds):\n \n return reduce(operator.and_, [0 <= inds[d] < self.dims[d]\n for d in range(self.ndims)], True)"
] | [
"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 post about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Create a new Facile instance.
@param string $name Name of template
@param array $data
@param string $format
@return \Orchestra\Facile\Facile | [
"public function make($name, array $data = [], $format = null)\n {\n return new Facile($this, $name, $data, $format);\n }"
] | [
"private static function validation()\n {\n $files = ['Validator', 'ValidationResult'];\n $folder = static::$root.'Validation'.'/';\n\n self::call($files, $folder);\n\n //Initiate the validation surface\n Validator::ini();\n }"
] | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
https://github.com/substack/node-findit/blob/master/index.js | [
"function findSync(dir, callback) {\n\tvar rootStat = fs.statSync(dir);\n\tif (!rootStat.isDirectory()) {\n\t\tif (callback) callback(dir, rootStat);\n\t\treturn [dir];\n\t}\n\n\treturn fs.readdirSync(dir).reduce(function(files, file) {\n\t\tvar p = path.join(dir, file),\n\t\t\tstat = fs.statSync(p);\n\t\tif (callb... | [
"def cli(verbose):\n \n floyd.floyd_host = floyd.floyd_web_host = \"https://dev.floydhub.com\"\n floyd.tus_server_endpoint = \"https://upload-v2-dev.floydhub.com/api/v1/upload/\"\n configure_logger(verbose)\n check_cli_version()"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// SetMessageConfiguration sets the MessageConfiguration field's value. | [
"func (s *MessageRequest) SetMessageConfiguration(v *DirectMessageConfiguration) *MessageRequest {\n\ts.MessageConfiguration = v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
check current selection styles and activate buttons | [
"function (selection) {\n var parentNode = selection.anchorNode;\n\n if (!parentNode.tagName) {\n parentNode = selection.anchorNode.parentNode;\n }\n\n var childNode = parentNode.childNodes[0];\n\n if(childNode && childNode.tagName && childNode.tagName.toLowerCase() in ge... | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
buildRouteMaps
@param bool $refresh
@return static | [
"protected function buildRouteMaps($refresh = false)\n {\n if ($this->routeMaps && !$this->debug && !$refresh) {\n return $this;\n }\n\n foreach ($this->routes as $key => $routeItem) {\n $this->routeMaps[$routeItem->getPattern()] = $key;\n }\n\n ksort($thi... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Compose with all route names for the specified resource.
@param View $view The view object.
@return void | [
"public function composeWithAllRouteNames(View $view)\n {\n $routes = $this->getAllRouteNames();\n\n foreach ($routes as $action => $routeName) {\n $view->with(\"{$action}Route\", $routeName);\n }\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:"
} |
Normalizes the original PHP token stream into a format which is more
usable for analysis.
@param array $tokens the format returned by ``token_get_all``
@return array the normalized tokens | [
"private function normalizeTokens(array $tokens)\n {\n $nTokens = array();\n for ($i=0,$c=count($tokens); $i<$c; $i++) {\n $token = $tokens[$i];\n\n if (is_string($token)) {\n $nTokens[] = new LiteralToken($token, end($nTokens)->getEndLine());\n c... | [
"public function write(string $fileName) : void\n {\n file_put_contents(\n $fileName,\n // str_replace here is to convert empty arrays into empty JS objects, which is expected by\n // codecov.io. Owner of the service said he was going to patch it, haven't tested since\n ... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Function mapping anything to one. | [
"def one(self):\n \"\"\"\"\"\"\n # See zero() for remarks\n def one_vec(x, out=None, **kwargs):\n \"\"\"One function, vectorized.\"\"\"\n if is_valid_input_meshgrid(x, self.domain.ndim):\n scalar_out_shape = out_shape_from_meshgrid(x)\n elif is_va... | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Returns a new AjaxCall object, must be compiled using $jquery object
@param string $url
@param string $method
@param string $params
@param string $jsCallback
@return AjaxCall | [
"public function jsJsonArray($url, $method=\"get\", $params=\"{}\", $jsCallback=NULL,$parameters=[]){\n\t\t$parameters=\\array_merge($parameters,[\"modelSelector\"=>\"#\".$this->_identifier.\" tr.\".$this->_modelClass,\"url\"=>$url,\"method\"=>$method,\"params\"=>$params,\"jsCallback\"=>$jsCallback]);\n\t\treturn n... | [
"protected function createLink(DataGrid $grid, $href, $params)\n\t{\n\t\t/**\n\t\t * Int case of ActionCallback, $this->href is a identifier of user callback\n\t\t */\n\t\t$params = $params + ['__key' => $this->href];\n\n\t\treturn $this->grid->link('actionCallback!', $params);\n\t}"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
If the belief its a count of some sort his counting its increased by one.
@param bName
- the name of the belief count. | [
"private void increaseBeliefCount(String bName) {\n Object belief = this.getBelief(bName);\n int count = 0;\n if (belief!=null) {\n count = (Integer) belief;\n }\n this.setBelief(bName, count + 1);\n }"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Request the specified team membership from the OpenID user
@param team_name: the unqualified team name
@type team_name: str | [
"def requestTeam(self, team_name):\n \n if not team_name in self.requested:\n self.requested.append(team_name)"
] | [
"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 sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
Start the HourGlass process | [
"public static void main(String argv[]) {\n StringUtils.startupShutdownMessage(HourGlass.class, argv, LOG);\n try {\n HourGlass hourGlass = new HourGlass(new Configuration());\n hourGlass.run();\n } catch (Throwable e) {\n LOG.fatal(StringUtils.stringifyException(e));\n System.exit(-1);... | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Sets a file whose contents will be prepended to the JAR file's data.
@param file the prefix file, or {@code null} for none.
@return {@code this} | [
"public Jar setJarPrefix(Path file) {\n verifyNotSealed();\n if (jos != null)\n throw new IllegalStateException(\"Really executable cannot be set after entries are added.\");\n if (file != null && jarPrefixStr != null)\n throw new IllegalStateException(\"A prefix has alrea... | [
"private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {\n // Get default form\n in.defaultReadObject();\n\n // Create new Archive\n final String name = this.name;\n final ZipImporter archive = ShrinkWrap.create(ZipImporter.class, name);\n\... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Gets the user-specified configuration for the given audit rule.
@param {string} auditRuleName
@return {Object?} The configuration object for the given audit rule. | [
"function(auditRuleName) {\n if (!(auditRuleName in this.rules_))\n return null;\n if (!('config' in this.rules_[auditRuleName]))\n return null;\n return this.rules_[auditRuleName].config;\n }"
] | [
"function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Format the conditions before being used in SQL.
@param array $conditions
@return array FormInterfaceatted conditions. | [
"protected function processConditions(array $conditions) {\r\n\t\tforeach($cp=$conditions as $k=>$v) {\r\n\t\t\tif(is_numeric($k) || in_array(strtolower($k), ['and', 'or', 'xor', 'not'])) {\r\n\t\t\t\t$newK = $k;\r\n\t\t\t\tif(is_array($v))\r\n\t\t\t\t\t$v = $this->processConditions($v);\r\n\t\t\t\telse\r\n\t\t\t\t... | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
@param Matrix $matrix
@return Matrix
@throws InvalidArgumentException | [
"public function multiply(Matrix $matrix)\n {\n if ($this->columns != $matrix->getRows()) {\n throw InvalidArgumentException::inconsistentMatrixSupplied();\n }\n\n $product = [];\n $multiplier = $matrix->toArray();\n for ($i = 0; $i < $this->rows; ++$i) {\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Inject second Span Context to record headers
@param spanContext Span Context
@param headers record headers | [
"static void injectSecond(SpanContext spanContext, Headers headers,\n Tracer tracer) {\n tracer.inject(spanContext, Format.Builtin.TEXT_MAP,\n new HeadersMapInjectAdapter(headers, true));\n }"
] | [
"public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Signal receiver with an extra, required 'user' kwarg. This method becomes a real (valid) signal receiver when
it is curried with the actor. | [
"def set_actor(user, sender, instance, signal_duid, **kwargs):\n \n if hasattr(threadlocal, 'auditlog'):\n if signal_duid != threadlocal.auditlog['signal_duid']:\n return\n try:\n app_label, model_name = settings.AUTH_USER_MODEL.split('.')\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 instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Set the HTTP response code
@param Mixed $code The response code to use or false to return current value
@return Return the code used if $code is false | [
"public function code($code = false)\n {\n\n if (!$code) {\n return http_response_code();\n }\n\n if (headers_sent()) {\n if (self::$exceptOnHeaders && (http_response_code() != $code)) {\n throw new \\Exception('Headers already sent. HTTP response code ca... | [
"public function get($key, $default = null)\n {\n $this->hydrate();\n\n // Create an Element instance using the data for the key\n if ($this->has($key)) {\n return new $this->model(array_merge($this->items[$key], ['key' => $key]));\n }\n\n // If the key doesn't exist... | codesearchnet | {
"query": "Represent the text about PHP programming:",
"pos": "Represent the code about PHP programming:",
"neg": "Represent the code about Programming:"
} |
Get the type of a value
@return string | [
"protected function getTypeOf($value): string\n {\n $type = gettype($value);\n\n switch ($type) {\n case 'integer':\n case 'boolean':\n case 'string':\n return $type;\n case 'double':\n return 'float';\n case 'arra... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// SaltEncode encode the message with a fixed salt and a random salt, typically
// used to verify | [
"func SaltEncode(hash hash.Hash, msg, fixed, rand []byte) []byte {\n\tif hash == nil {\n\t\thash = sha256.New()\n\t}\n\n\thash.Write(msg)\n\tenc := hash.Sum(nil)\n\n\thash.Reset()\n\thash.Write(fixed)\n\thash.Write(rand)\n\tnew := hash.Sum(nil)\n\n\thash.Reset()\n\thash.Write(enc)\n\thash.Write(new)\n\n\treturn has... | [
"def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Add new Header Media Element
@param int $headerCount
@param string $src
@return int | [
"public static function addHeaderMediaElement($headerCount, $src, PHPWord_Section_MemoryImage $memoryImage = null) {\r\n\t\t$mediaId = md5($src);\r\n\t\t$key = 'header'.$headerCount;\r\n\t\t\r\n\t\tif(!array_key_exists($key, self::$_headerMedia)) {\r\n\t\t\tself::$_headerMedia[$key] = array();\r\n\t\t}\r\n\t\t\r\n\... | [
"public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Init this table.
Add this table to the database and hook this table to the record.
@param database The database to add this table to.
@param record The record to connect to this table. | [
"public void init(BaseDatabase database, Record record)\n {\n super.init(database, record);\n\n // Call super to set the table property (without calling remote).\n super.setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);\n }"
] | [
"private function getColumnFromName($name)\n {\n foreach ($this->columnConfiguration as $i => $col) {\n if ($col->getName() == $name) {\n return $col;\n }\n }\n\n // This exception should never happen. If it does, something is\n // wrong w/ the rel... | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
Try execute a function n times, until no exception raised or tried
``max_try`` times.
**中文文档**
反复尝试执行一个函数若干次。直到成功为止或是重复尝试 ``max_try`` 次。期间
只要有一次成功, 就正常返回。如果一次都没有成功, 则行为跟最后一次执行了
``func(*args, **kwargs)`` 一样。 | [
"def try_ntime(max_try, func, *args, **kwargs):\n \n if max_try < 1:\n raise ValueError\n\n for i in range(max_try):\n try:\n return func(*args, **kwargs)\n except Exception as e:\n last_exception = e\n\n raise last_exception"
] | [
"function redirectToIndex() {\n var baseURL = window.DEBUG\n ? 'index-debug.html'\n : 'index.html';\n location.href = baseURL + location.hash;\n // 在`Promise`中,抛出异常会使其进入失败状态,\n // 一般来说跳转了就不会有下面的代码执行,这里就是防止进入成功状态\n throw new Error('... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// InitMetrics new a metrics obj | [
"func InitMetrics(statsd string) error {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn err\n\t}\n\tClient = Metrics{StatsdAddr: statsd, Hostname: utils.CleanStatsdMetrics(hostname)}\n\n\tClient.MemoryCapacity = prometheus.NewGaugeVec(prometheus.GaugeOpts{\n\t\tName: \"memory_capacity\",\n\t\tHelp... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
d may be:
- datetime()
- [y,m,d,h[,m[,ms]]]
- [date(),time()]
- [[y,m,d],[h,m,s,ms]]
and permutations of above | [
"def dateTime(arg):\n \n l = len(arg)\n if l is 1:\n dt = arg[0]\n typed = type(dt)\n if typed is datetime.datetime:\n return dt\n if typed in (tuple, list) and len(dt) in [5, 6, 7]:\n return datetime.datetime(*dt)\n if l is 2:\n date = time = None\n typeArg0 = type(arg[0])\n type... | [
"def reminder_validator(input_str):\n \n match = re.match(REMINDER_REGEX, input_str)\n if match or input_str == '.':\n return input_str\n else:\n raise ValidationError('Expected format: <number><w|d|h|m> '\n '<popup|email|sms>. (Ctrl-C to exit)\\n')"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Called when any mouse button is pressed.
.. versionchanged:: 0.11
Do not trigger `route-electrode-added` event if `ALT` key is
pressed. | [
"def on_widget__button_press_event(self, widget, event):\n '''\n \n '''\n if self.mode == 'register_video' and event.button == 1:\n self.start_event = event.copy()\n return\n elif self.mode == 'control':\n shape = self.canvas.find_shape(event.x, ev... | [
"def on_checked_changed(self, on):\n \n #: Since iOS decides to call this like 100 times for each defer it\n d = self.declaration\n with self.widget.setOn.suppressed():\n d.checked = on"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the file's ID from the real file's path.
@param string $file The real file's path
@todo Fix the slowness!
@return bool|string | [
"public function real_to_id($file){\n $timer = new bbn\\util\\timer();\n $timer->start('real_to_id');\n $url = self::real_to_url($file);\n $dir = self::dir(self::dir_from_url($url));\n if ( !empty($dir) &&\n \\defined($dir['bbn_path'])\n ){\n $bbn_p = constant($dir['bbn_path']);\n i... | [
"protected function VerifyPLUGName()\n {\n // if plug already set, don't need to set it now.\n if ($this->getOption('plug') != '') {\n return;\n }\n\n //Sets the default plug.\n $size = 512;\n $unit = 'K';//or M\n\n /*4K, 32K, 65K, 512K,\n 1M, ... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. | [
"func (u *User) GetPublicGists() int {\n\tif u == nil || u.PublicGists == nil {\n\t\treturn 0\n\t}\n\treturn *u.PublicGists\n}"
] | [
"function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Delete image from file storage and database
@param FileModelInterface $model File being deleted | [
"public function deleteFile(FileModelInterface $model)\n {\n $url = $model->getUploadDir() . DS . $model->getFile();\n\n @unlink(str_replace('..', '', $url));\n\n $model->delete();\n }"
] | [
"@SuppressWarnings(\"unused\") // called through reflection by RequestServer\n public ModelsV3 delete(int version, ModelsV3 s) {\n Model model = getFromDKV(\"key\", s.model_id.key());\n model.delete(); // lock & remove\n return s;\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
////////////////////////// Internal Helper Functions ////////////////////////// Takes in the name of a role and a discord message | [
"function getGuildRole(input, message) {\n input = input.trim().toLowerCase()\n return message.guild.roles.find(role => role.name.toLowerCase() === input)\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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the next rule.
:return: the next rule object
:rtype: AssociationRule | [
"def next(self):\n \n if self.index < self.length:\n index = self.index\n self.index += 1\n return self.rules[index]\n else:\n raise StopIteration()"
] | [
"def _parse_singlefile(self, desired_type: Type[T], file_path: str, encoding: str, logger: Logger,\n options: Dict[str, Dict[str, Any]]) -> T:\n \n raise Exception('Not implemented since this is a MultiFileParser')"
] | 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:"
} |
// GetRoles returns a list of roles to initiate for this secret | [
"func (s *InstanceSecrets) GetRoles() []services.Role {\n\tvar roles []services.Role\n\tfor _, ca := range s.GetCAs() {\n\t\tif ca.GetType() != services.UserCA {\n\t\t\tcontinue\n\t\t}\n\t\trole := services.RoleForCertAuthority(ca)\n\t\trole.SetLogins(services.Allow, s.AllowedLogins())\n\t\troles = append(roles, ro... | [
"func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus... | codesearchnet | {
"query": "Represent the Github text about Agent Identity Management:",
"pos": "Represent the Github code about Agent Identity Management:",
"neg": "Represent the Github code about Software development:"
} |
// MakeTable returns the Table constructed from the specified algorithm. | [
"func MakeTable(params Params) *Table {\n\ttable := new(Table)\n\ttable.params = params\n\tfor n := 0; n < 256; n++ {\n\t\tcrc := uint16(n) << 8\n\t\tfor i := 0; i < 8; i++ {\n\t\t\tbit := (crc & 0x8000) != 0\n\t\t\tcrc <<= 1\n\t\t\tif bit {\n\t\t\t\tcrc ^= params.Poly\n\t\t\t}\n\t\t}\n\t\ttable.data[n] = crc\n\t}\... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Replace all the ACLs with the given ACL sequence.
This will not replace ACLs generated by autoAcl, to disable autoAcl, turn it off.
@param acls The ACLs to use.
@return A copy of this descriptor. | [
"public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) {\n return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);\n }"
] | [
"def getLockByID(self, lockid):\n \n assert isinstance(lockid, (locks.MasterLock, locks.WorkerLock))\n if lockid not in self.locks:\n self.locks[lockid] = lockid.lockClass(lockid)\n # if the master.cfg file has changed maxCount= on the lock, the next\n # time a build is... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// set values in object | [
"func (cMgr *ConfigurationManager) setValue(rValue reflect.Value, keyName string) error {\n\tconfigValue := cMgr.GetConfigurationsByKey(keyName)\n\tif configValue == nil {\n\t\treturn nil\n\t}\n\n\t// assign value if assignable\n\tconfigRValue := reflect.ValueOf(configValue)\n\tif configRValue.Kind() != rValue.Kind... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// GetDraft retrieves a draft comment of a revision that belongs to the calling user.
//
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-draft | [
"func (s *ChangesService) GetDraft(changeID, revisionID, draftID string) (*CommentInfo, *Response, error) {\n\tu := fmt.Sprintf(\"changes/%s/revisions/%s/drafts/%s\", changeID, revisionID, draftID)\n\treturn s.getCommentInfoResponse(u)\n}"
] | [
"public function codeOfConduct($username, $repository)\n {\n //This api is in preview mode, so set the correct accept-header\n $this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';\n\n return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository)... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
/* (non-Javadoc)
@see org.springframework.jdbc.core.namedparam.SqlParameterSource#hasValue(java.lang.String) | [
"@Override\n public boolean hasValue(String paramName) {\n return criterias.containsKey(paramName) || LIMIT_NAME.equals(paramName)\n || OFFSET_NAME.equals(paramName);\n }"
] | [
"protected boolean isInIgnoreParamList(Parameter param) {\n\t\treturn \"javax.servlet.http.HttpServletRequest\".equals(param.type().qualifiedTypeName())\n\t\t\t\t|| \"javax.servlet.http.HttpServletResponse\".equals(param.type().qualifiedTypeName())\n\t\t\t\t|| \"javax.servlet.http.HttpSession\".equals(param.type().... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
// reflectValues converts interface{} to reflect.Value based on string type
// representing a slice of values | [
"func reflectValues(valueType string, value interface{}) (reflect.Value, error) {\n\ttheType, ok := typesMap[valueType]\n\tif !ok {\n\t\treturn reflect.Value{}, NewErrUnsupportedType(valueType)\n\t}\n\n\t// For NULL we return an empty slice\n\tif value == nil {\n\t\treturn reflect.MakeSlice(theType, 0, 0), nil\n\t}... | [
"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 Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// Check verifies that an event is valid. | [
"func (e Event) Check() error {\n\tif len(e.Title) == 0 {\n\t\treturn fmt.Errorf(\"statsd.Event title is required\")\n\t}\n\tif len(e.Text) == 0 {\n\t\treturn fmt.Errorf(\"statsd.Event text is required\")\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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Adds the value to the named header, or creates the header with the given value if it did not exist.
@param string $name
@param string|string[] $value
@throws \Error If the header name or value is invalid. | [
"protected function addHeader(string $name, $value)\n {\n \\assert($this->isNameValid($name), \"Invalid header name\");\n\n if (\\is_array($value)) {\n if (!$value) {\n return;\n }\n\n $value = \\array_values(\\array_map(\"strval\", $value));\n ... | [
"private function guardValidModelAndIdentifier($model, $identifier)\n {\n if (empty($model) || (!is_object($model) && (null === $identifier || '' === $identifier))) {\n throw new ResolveComponentDataException('Model has to be an object or (a scalar + an identifier in 2nd argument)');\n }... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// NewRESTStorage returns an APIGroupInfo object that will work against apiservice. | [
"func NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) genericapiserver.APIGroupInfo {\n\tapiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(apiregistration.GroupName, aggregatorscheme.Scheme, metav1.ParameterCodec, aggregatorscheme.Code... | [
"func (e *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {\n\t// This provider doesn't track instance -> controller.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Send a wave that will carry the service result.
2 Kinds of wave can be sent according to service configuration
@param res the service result
@throws CoreException if the wave generation has failed | [
"@SuppressWarnings(\"unchecked\")\n private void sendReturnWave(final T res) throws CoreException {\n\n Wave returnWave = null;\n\n // Try to retrieve the return Wave type, could be null\n final WaveType responseWaveType = this.wave.waveType().returnWaveType();\n\n final Class<? exten... | [
"def putParamset(self, paramset, data={}):\n \n try:\n if paramset in self._PARAMSETS and data:\n self._proxy.putParamset(self._ADDRESS, paramset, data)\n # We update all paramsets to at least have a temporarily accurate state for the device.\n #... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// getCertificate returns the best certificate for the given ClientHelloInfo,
// defaulting to the first element of c.Certificates. | [
"func (c *Config) getCertificate(clientHello *ClientHelloInfo) (*Certificate, error) {\n\tif c.GetCertificate != nil &&\n\t\t(len(c.Certificates) == 0 || len(clientHello.ServerName) > 0) {\n\t\tcert, err := c.GetCertificate(clientHello)\n\t\tif cert != nil || err != nil {\n\t\t\treturn cert, err\n\t\t}\n\t}\n\n\tif... | [
"def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Prepare the release: bump version, build packages, ... | [
"def prepare(ctx, new_version=None, version_part=None, hide=True,\n dry_run=False):\n \"\"\"\"\"\"\n if new_version is not None:\n bump_version(ctx, new_version, version_part=version_part,\n dry_run=dry_run)\n build_packages(ctx, hide=hide)\n packages = ensure_packa... | [
"def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Calculates new picture dimension after applying this effect
@param int $width
@param int $height
@return array w,h | [
"public function getNewDimensions($width, $height)\n {\n if(!$this->resizeSmaller && $this->height >= $height && $this->width >= $width)\n {\n return parent::getNewDimensions($width, $height);\n }\n\n if(in_array($this->resizeMode, array($this::MODE_CROP, $this::MODE_STRETC... | [
"public function isSmall() :bool {\n // Invoke cropToStyle, to get info about the size.\n $this->cropToStyle($this->configFactory->get('social_group.settings')->get('default_hero'));\n // Return info about the size.\n return $this->isSmall;\n }"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about NLP:"
} |
Chainable
Add data that should be in the head (aka add_header).
@param mixed $data
@return View_Factory | [
"public function add_head( $data ) : View_Factory {\n\t\t$this->head_data = $data;\n\n\t\tif ( \\is_array( $data ) ) {\n\t\t\t$this->head_data = array_merge( $this->head_data, $data );\n\t\t}\n\n\t\treturn $this;\n\t}"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Renders the buttons in this form.
@return string the rendering result. | [
"public function renderButtons()\n {\n $buttons = array();\n foreach ($this->getButtons() as $button) {\n $buttons[] = $this->renderElement($button);\n }\n return $this->getActiveFormWidget()->createFormActions($buttons);\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 text processing:",
"pos": "Represent the Github code about text processing:",
"neg": "Represent the Github code about programming:"
} |
Re-sizes the `Stream` field by appending zero bytes or
removing bytes from the end.
:param int size: `Stream` size in number of bytes. | [
"def resize(self, size):\n \n count = max(int(size), 0) - len(self)\n\n if count == 0:\n pass\n elif -count == len(self):\n self._value = bytes()\n elif count > 0:\n self._value += b'\\x00' * count\n else:\n self._value = self._va... | [
"def _set_text(self, value):\n \n working_index = self.working_index\n working_lines = self._working_lines\n\n original_value = working_lines[working_index]\n working_lines[working_index] = value\n\n # Return True when this text has been changed.\n if len(value) != l... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// SetToIf sets the Boolean to new only if the Boolean matches the old
// Returns whether the set was done | [
"func (ab *AtomicBool) SetToIf(old, new bool) (set bool) {\n\tvar o, n int32\n\tif old {\n\t\to = 1\n\t}\n\tif new {\n\t\tn = 1\n\t}\n\treturn atomic.CompareAndSwapInt32((*int32)(ab), o, n)\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// SetData sets the data attribute | [
"func (k *Item) SetData(b []byte) {\n\tif b != nil {\n\t\tk.attr[DataKey] = b\n\t} else {\n\t\tdelete(k.attr, DataKey)\n\t}\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Helper method to get the value as a Java long from four bytes starting at given array offset
@param bytes the array of bytes
@param offset the offset to start
@return the corresponding Java long value | [
"public static long getValue(byte[] bytes, int offset) {\n long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;\n value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;\n value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;\n value += (bytes[offset] & BYTE_MASK);\n ... | [
"public static int byteCount(Slice slice, int offset, int length, int codePointCount)\n {\n requireNonNull(slice, \"slice is null\");\n if (length < 0) {\n throw new IllegalArgumentException(\"length must be greater than or equal to zero\");\n }\n if (offset < 0 || offset +... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Constructor: OpenLayers.Marker.Box
Parameters:
bounds - {<OpenLayers.Bounds>}
borderColor - {String}
borderWidth - {int} | [
"function(bounds, borderColor, borderWidth) {\n this.bounds = bounds;\n this.div = OpenLayers.Util.createDiv();\n this.div.style.overflow = 'hidden';\n this.events = new OpenLayers.Events(this, this.div);\n this.setBorder(borderColor, borderWidth);\n }"
] | [
"function(options) {\n // compile regular expressions once instead of every time they are used\n this.regExes = {\n trimSpace: (/^\\s*|\\s*$/g),\n removeSpace: (/\\s*/g),\n splitSpace: (/\\s+/),\n trimComma: (/\\s*,\\s*/g),\n kmlColor: (/(\\w{2})(... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// matchImage returns true if an image matches the restricted list. | [
"func matchImage(s *drone.Secret, image string) bool {\n\tfor _, pattern := range s.Images {\n\t\tif match, _ := filepath.Match(pattern, image); match {\n\t\t\treturn true\n\t\t} else if pattern == \"*\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Child node to array
@param SimpleXmlElement $xml
@param string $name
@return array | [
"protected function childToArray(SimpleXmlElement $xml, $name)\n {\n if (!isset($xml->{$name})) {\n return array();\n }\n\n return $xml->{$name}->toPhpValue('array');\n }"
] | [
"protected function create_relatedObject($key, $relation_type)\n {\n $c = $this->addChild($this->working_node, 'relatedObject');\n $this->addChild($c, 'key', $key);\n $c = $this->addChild($c, 'relation');\n // Mimick ANDS with enpty value to get both tags for relation. Only for better... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.