query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
bind parameters @param \mysqli_stmt $stmt @param array $parameters @return bool @access protected
[ "protected function bindParameters(\r\n \\mysqli_stmt $stmt,\r\n array $parameters\r\n )/*# : bool */ {\r\n $types = '';\r\n $args = [];\r\n foreach ($parameters as $name => &$value) {\r\n $type = Types::guessType($value);\r\n switch ($type) {\r\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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Put the device into standby mode so that the registers can be set. @return: No return value
[ "def standby(self):\n \n register = self.MMA8452Q_Register['CTRL_REG1']\n self.board.i2c_read_request(self.address, register, 1,\n Constants.I2C_READ | Constants.I2C_END_TX_MASK,\n self.data_val, Constants.CB_TYPE_DIRECT)\n\n...
[ "def timeout(self, value):\n \"\"\"\"\"\"\n self.check_pyb()\n try:\n self.pyb.serial.timeout = value\n except:\n # timeout is a property so it calls code, and that can fail\n # if the serial port is closed.\n pass" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *QueryArgProfileConfig) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"QueryArgProfileConfig\"}\n\tif s.ForwardWhenQueryArgProfileIsUnknown == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ForwardWhenQueryArgProfileIsUnknown\"))\n\t}\n\tif s.QueryArgProfiles != nil ...
[ "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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
保存数据 @param array $option 参数
[ "public function save($fileName = null)\r\n\t{\r\n\t\t$file = fopen(empty($fileName) ? $this->fileName : $fileName,'w');\r\n\t\tflock($file,LOCK_EX);\r\n\t\tforeach($this->data as $section => $data)\r\n\t\t{\r\n\t\t\tfwrite($file, '[' . $section . ']' . PHP_EOL);\r\n\t\t\tforeach($data as $key => $value)\r\n\t\t\t{...
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// setFileMode sets the FileMode.
[ "func (t *TemplateResource) setFileMode() error {\n\tif t.Mode == \"\" {\n\t\tif !util.IsFileExist(t.Dest) {\n\t\t\tt.FileMode = 0644\n\t\t} else {\n\t\t\tfi, err := os.Stat(t.Dest)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tt.FileMode = fi.Mode()\n\t\t}\n\t} else {\n\t\tmode, err := strconv.ParseUi...
[ "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 about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about programming:" }
// NewPollArg returns a new PollArg instance
[ "func NewPollArg(AsyncJobId string) *PollArg {\n\ts := new(PollArg)\n\ts.AsyncJobId = AsyncJobId\n\treturn s\n}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Add returns the local date-time d + duration.
[ "func (dt DateTime) Add(duration time.Duration) DateTime {\n\tt := dt.t.Add(toSeconds(duration))\n\treturn DateTime{t: t}\n}" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetServerSideEncryption sets the ServerSideEncryption field's value.
[ "func (s *PutObjectInput) SetServerSideEncryption(v string) *PutObjectInput {\n\ts.ServerSideEncryption = &v\n\treturn s\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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Template variable getter. Returns list of customer also bought these products @return object
[ "public function getAlsoBoughtTheseProducts()\n {\n if ($this->_aLastProducts === null) {\n $this->_aLastProducts = false;\n // 5th order step\n $aBasketContents = array_values($this->getBasket()->getContents());\n if ($oBasketItem = $aBasketContents[0]) {\n ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Build an element in the correct format for UserChain. Format:<APP>:<ID>:<protocol>[:AS][,<APP>:<ID>:<protocol>]* @see UserChain
[ "public static StringBuilder build(StringBuilder sb, String app, String id, UserChain.Protocol proto, boolean as) {\n\t\tboolean mayAs;\n\t\tif(!(mayAs=sb.length()==0)) {\n\t\t\tsb.append(',');\n\t\t}\n\t\tsb.append(app);\n\t\tsb.append(':');\n\t\tsb.append(id);\n\t\tsb.append(':');\n\t\tsb.append(proto.name());\n\...
[ "def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])" ]
codesearchnet
{ "query": "Represent the description about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
Sets the {@code "Content-Length"} header.
[ "public static void setContentLength(HttpMessage message, long length) {\n message.headers().set(HttpHeaderNames.CONTENT_LENGTH, length);\n }" ]
[ "public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
First bench helenus
[ "function bench(callback){\n conn.connect(function(err, keyspace){\n if(err){\n throw(err);\n }\n\n console.time('Helenus ' + times + ' writes');\n \n function cb(err, results){\n if(err){\n console.log('Error encountered at: ' + completed);\n throw(err);\n }\n comp...
[ "func Beep(freq float64, duration int) (err error) {\n\tdefer func() {\n\t\te := recover()\n\n\t\tif e == nil {\n\t\t\treturn\n\t\t}\n\n\t\tif e, ok := e.(*js.Error); ok {\n\t\t\terr = e\n\t\t} else {\n\t\t\tpanic(e)\n\t\t}\n\t}()\n\n\ta := js.Global().Get(\"document\").Call(\"createElement\", \"audio\")\n\ta.Set(\...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
执行插件 @param string $hook 插件钩子名称 @param array $params 参数 @return mixed
[ "public static function hook($hook, $params = [])\n {\n $hookRun = isset(self::$mountInfo[$hook]) ? self::$mountInfo[$hook] : null;\n if (!is_null($hookRun)) {\n foreach ($hookRun as $key => $val) {\n if (is_int($key)) {\n $callBack = $val;\n ...
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the post about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code:" }
expire @param string $key [@todo description] @param integer $seconds [@todo description] @param callable $cb [@todo description] @callback $cb ( ) @return void
[ "public function expire($key, $seconds, $cb = null)\n {\n $this->redis->expire($this->config->redisprefix->value . $key, $seconds, $cb);\n }" ]
[ "private function response(...$k) {\n\t\t$ev = dfc($this, function($f) {return\n \t\t\tcall_user_func($f, $this->responses())\n\t\t;}, [dfa(['L' => 'df_last', 'F' => 'df_first'], substr(df_caller_f(), -1))]); /** @var Ev|null $ev */\n\t\treturn/** @var int $c */!($c = count($k)) || !$ev ? $ev : $ev->r(1 < $c ? $k :...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Parse dates in certain known json fields, if possible.
[ "def __json_date_parse(json_object):\n \n known_date_fields = [\"created_at\", \"week\", \"day\", \"expires_at\", \"scheduled_at\"]\n for k, v in json_object.items():\n if k in known_date_fields:\n if v != None:\n try:\n if isi...
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
/* A definite node is constructed from a specified number of children. That number of nodes are popped from the stack and made the children of the definite node. Then the definite node is pushed on to the stack.
[ "void closeNodeScope(Node n, int num) {\r\n mk = ((Integer)marks.pop()).intValue();\r\n while (num-- > 0) {\r\n Node c = popNode();\r\n c.jjtSetParent(n);\r\n n.jjtAddChild(c, num);\r\n }\r\n n.jjtClose();\r\n pushNode(n);\r\n node_created = true;\r\n }" ]
[ "function flattenList(list) {\n // Make a copy, so the original tensor is not modified.\n list = [].concat(list);\n\n // Note that i must be checked against the length of the list each time through the loop, as the\n // list is modified within the iterations.\n for (let i = 0; i < list.length; i++) {\n if (...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
used to display the step. @param array $aCallTimeVars - place any custom vars that you want to pass through the call here @return string
[ "public function Render($sSpotName = null, $aCallTimeVars = array())\n {\n $oUser = TdbDataExtranetUser::GetInstance();\n if (!is_null($oUser->fieldName) && !$oUser->IsLoggedIn()) {\n $this->SetLastUserBoughtToSession($oUser);\n }\n $sHTML = parent::Render($sSpotName, $aCal...
[ "public function getTemplateFile($filename, $data)\n {\n $data['getRegion'] = function($name) { \n return $this->getRegion($name); \n }; // This is for mustache compatibility\n\n // Push the data into regions and then pass a pointer to this class to the layout\n // $thi...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Logs a result. @param boolean $boolean Set `true` for success and `false` for failure. @param array $data Test details array. @return boolean
[ "protected function _log($boolean, $data = [])\n {\n $not = $this->_not;\n $pass = $not ? !$boolean : $boolean;\n if ($pass) {\n $data['type'] = 'passed';\n } else {\n $data['type'] = 'failed';\n $this->_passed = false;\n }\n\n $descripti...
[ "protected function processConfig(array $config)\n {\n // set defaults as an array if not provided\n if (!isset($config['defaults'])) {\n $config['defaults'] = [];\n }\n\n // Add the handlers based on the configuration option\n $stack = $this->getHandlerStack();\n\n ...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Limit the number of mappings - only this number of mappings will be generate. @param limit the number of mappings @return fluent-api instance
[ "public Mappings limit(int limit) {\n return new Mappings(query, target, Iterables.limit(iterable, limit));\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get UploadedFile from given key @param string $key @return UploadedFile|null
[ "public function getUploadedFile($key)\n {\n if(isset($this->uploadedFiles[$key]))\n return $this->uploadedFiles[$key];\n\n return null;\n }" ]
[ "function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Builds up a dependency graph for using a simple object structure containing the modules as keys and using arrays as dependecy descriptors.
[ "function buildDependencyGraph(module, dependencies, graph) {\n\tif (module && !graph[module]) {\n\t\tgraph[module] = [];\n\t}\n\n\tvar dependencyNames = Object.keys(dependencies);\n\tdependencyNames.forEach(function(dependencyName) {\n\t\tvar dependency = dependencies[dependencyName];\n\n\t\tif (module && graph[mo...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
An oriented bounding box for the current mesh. Returns --------- obb : trimesh.primitives.Box Box object with transform and extents defined representing the minimum volume oriented bounding box of the mesh
[ "def bounding_box_oriented(self):\n \n from . import primitives, bounds\n to_origin, extents = bounds.oriented_bounds(self)\n obb = primitives.Box(transform=np.linalg.inv(to_origin),\n extents=extents,\n mutable=False)\n retu...
[ "def point(self):\n \n if not self.geometry:\n raise ValueError('geometry attribute must be set before trying to get point property')\n if self.geometry.geom_type == 'Point':\n return self.geometry\n else:\n try:\n # point_on_surface guaran...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Use GATK to extract reads from full BAM file.
[ "def _gatk_extract_reads_cl(data, region, prep_params, tmp_dir):\n \n args = [\"PrintReads\",\n \"-L\", region_to_gatk(region),\n \"-R\", dd.get_ref_file(data),\n \"-I\", data[\"work_bam\"]]\n # GATK3 back compatibility, need to specify analysis type\n if \"gatk4\" in dd...
[ "def runner(self):\n \n logging.info('Starting {} analysis pipeline'.format(self.analysistype))\n if not self.pipeline:\n # If the metadata has been passed from the method script, self.pipeline must still be false in order to\n # get Sippr() to function correctly, but the ...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// Encodes all data needed to decrypt message into a JSON string and writes it to disk.
[ "func writeCiphertext(salt []byte, keyiter int, isPass bool, sealed secret.SealedData, filename string) error {\n\t// fill in the ciphertext fields\n\tec := EncodedCiphertext{\n\t\tCiphertextNonce: sealed.NonceBytes(),\n\t\tCiphertext: sealed.CiphertextBytes(),\n\t\tCipherAlgorithm: \"salsa20_poly1305\",\n\t}\...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about File management:" }
Store a newly created Files in storage. @param FileRequest $request @return Response
[ "public function upload(Request $request)\n {\n $validation = app(ValidationService::class)->check([\n 'location' => ['required'],\n ]);\n\n if (!$validation['errors']) {\n $file = $request->file('location');\n $fileSaved = app(FileService::class)->saveFile($...
[ "@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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Reflow text width while maintaining certain formatting characteristics like double newlines and indented statements.
[ "def _fill_text(self, text, width=None, indent=None):\n \n assert isinstance(text, str)\n if indent is None:\n indent = NBSP * self._current_indent\n assert isinstance(indent, str)\n paragraphs = []\n line_buf = []\n pre = ''\n for fragment in text....
[ "def colorize_text(self, text):\n \"\"\"\"\"\"\n # As originally implemented, this method acts upon all the contents of\n # the file as a single string using the MULTILINE option of the re\n # package. I believe this was ostensibly for performance reasons, but\n # it has a few sid...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Streams view @param string $view Name of view file @param array $params Parameters supposed to be passed to the view @return StreamedResponse
[ "protected function stream(string $view, array $params = []): StreamedResponse\n {\n $templateEngine = $this->getTemplateEngine();\n\n $callback = function () use ($templateEngine, $view, $params) {\n echo $templateEngine->render($view, $params);\n };\n\n $headers = $this->...
[ "public function getTemplateFile($filename, $data)\n {\n $data['getRegion'] = function($name) { \n return $this->getRegion($name); \n }; // This is for mustache compatibility\n\n // Push the data into regions and then pass a pointer to this class to the layout\n // $thi...
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:" }
term ::= factor+
[ "Token parseTerm() throws ParseException {\r\n\t\tint ch = this.read();\r\n\t\tToken tok = null;\r\n\t\tif (ch == T_OR || ch == T_RPAREN || ch == T_EOF) {\r\n\t\t\ttok = Token.createEmpty();\r\n\t\t} else {\r\n\t\t\ttok = this.parseFactor();\r\n\t\t\tToken concat = null;\r\n\t\t\twhile ((ch = this.read()) != T_OR &...
[ "final static function sn(M $m) {return dfcf(function(M $m) {return df_new(\n\t\tdf_con_heir($m, __CLASS__), $m\n\t);}, [$m]);}" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Show the form for editing the specified resource. @param string $name @param int $id @access public @return Response
[ "public function edit($name, $id)\n\t{\n\t\t$model = Bauhaus::getInstance($name)->buildForm($id);\n\n\t\treturn View::make($model->getView('edit'))\n\t\t\t->with('name', $name)\n\t\t\t->with('model', $model)\n\t\t\t->with('id', $id);\n\t}" ]
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Cancels this stream.
[ "private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd,\n ChannelPromise promise) {\n NettyClientStream.TransportState stream = cmd.stream();\n Status reason = cmd.reason();\n if (reason != null) {\n stream.transportReportStatus(reason, true, new Metadata());\n }\n...
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// Error can be either of the following types: // // - InvalidObjectFault // - RuntimeFault
[ "func (service *VboxPortType) IHostNetworkInterfacegetIPV6NetworkMaskPrefixLength(request *IHostNetworkInterfacegetIPV6NetworkMaskPrefixLength) (*IHostNetworkInterfacegetIPV6NetworkMaskPrefixLengthResponse, error) {\n\tresponse := new(IHostNetworkInterfacegetIPV6NetworkMaskPrefixLengthResponse)\n\terr := service.cl...
[ "@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 instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
// ShiftLeft shifts the binary string left by one bit, causing the // most-signficant bit to disappear and a zero to be introduced at the right. // This corresponds to the `x << 1` notation of RFC 4493.
[ "func ShiftLeft(b []byte) []byte {\n\tl := len(b)\n\tif l == 0 {\n\t\tpanic(\"shiftLeft requires a non-empty buffer.\")\n\t}\n\n\toutput := make([]byte, l)\n\n\toverflow := byte(0)\n\tfor i := int(l - 1); i >= 0; i-- {\n\t\toutput[i] = b[i] << 1\n\t\toutput[i] |= overflow\n\t\toverflow = (b[i] & 0x80) >> 7\n\t}\n\n...
[ "public void fastClear(int index) {\n assert index >= 0 && index < numBits;\n int wordNum = index >> 6;\n int bit = index & 0x03f;\n long bitmask = 1L << bit;\n bits[wordNum] &= ~bitmask;\n // hmmm, it takes one more instruction to clear than it does to set... any\n ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Smazani cache @throws AbortException
[ "public function handleInvalidateCache(): void\n\t{\n\t\t$this->checkHandlerPermission();\n\n\t\t$this->app->invalidateCache();\n\t\t$this->flashNotifier->success('dockbar.management.application.cacheInvalidated');\n\t}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Creates a namespace aware document builder. @return New instance.
[ "@NotNull\n public static DocumentBuilder createDocumentBuilder() {\n try {\n final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n factory.setNamespaceAware(true);\n return factory.newDocumentBuilder();\n } catch (final ParserConfigurationE...
[ "protected Expression instantiate(Object oldInstance, Encoder out)\n {\n //\n // An implementation instance is actually constructed at decode time by calling\n // ControlBean.ensureControl on the parent bean. This will create a new impl\n // instance and run the impl initializer on i...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Creates the instance callback which is passed to the wrappers if they exist. @param string $name @param mixed $spec @return \Closure
[ "private function createInstanceCallback($name, $spec)\n {\n if (is_string($spec) && class_exists($spec)) {\n $spec = new $spec;\n }\n if ($spec instanceof ServiceFactoryInterface) {\n return function () use ($spec) {\n return $spec->createService($this);...
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
/* Maps a default context (whithout whiteboard-service) to a ServletContextDTO
[ "private ServletContextDTO mapServletContext(Map.Entry<ServiceReference<ServletContext>, ServletContext> mapEntry) {\n final ServiceReference<ServletContext> ref = mapEntry.getKey();\n final ServletContext servletContext = mapEntry.getValue();\n\n ServletContextDTO dto = new ServletContextDTO()...
[ "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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Gets the value of the sharedCacheMode property. @return value of the sharedCacheMode property.
[ "SharedCacheMode getSharedCacheMode()\n {\n // Not available in 1.0 persistence schema\n // Per the spec, must return UNSPECIFIED if not in xml\n if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())\n Tr.debug(tc, \"getSharedCacheMode : defaulted to UNSPECIFIED\");\n\n...
[ "@Override\n public boolean setProperty(String name, Object value)\n {\n /* Note: can not call local method, since it'll return false for\n * recognized but non-mutable properties\n */\n return mConfig.setProperty(name, value);\n }" ]
codesearchnet
{ "query": "Represent the text about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
Uses positive check instance for validating match @param string $name @param mixed $subject @param array $arguments @return bool @throws FailureException
[ "public function positiveMatch($name, $subject, array $arguments)\n {\n return $this->validateCheckerConditionsAndThrowFailureExceptionOnFailedCheck(\n $this->positiveCheck,\n $arguments,\n $this->positiveError\n );\n }" ]
[ "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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Do a two-phase/two-attempts shutdown @param pool the thread pool @param waitSeconds number of seconds to wait in each of the shutdown attempts @return true if shutdown completed, false if not
[ "public static boolean shutdownAndAwaitTermination(ExecutorService pool, long waitSeconds) {\n\t\tpool.shutdown(); // Disable new tasks from being submitted\n\t\ttry {\n\t\t\t// Wait a while for existing tasks to terminate\n\t\t\tif(!pool.awaitTermination(waitSeconds, TimeUnit.SECONDS)) {\n\t\t\t\t//logger.warn(\"T...
[ "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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Do a git pull of `ref` from `remote`.
[ "def git_pull(repo_dir, remote=\"origin\", ref=None, update_head_ok=False):\n \"\"\"\"\"\"\n command = ['git', 'pull']\n if update_head_ok:\n command.append('--update-head-ok')\n command.append(pipes.quote(remote))\n if ref:\n command.append(ref)\n return execute_git_command(command,...
[ "func (r *printRun) RegisterIDFlag() {\n\tr.Flags.BoolVar(&r.id, \"id\", false, doc(`\n\t\tPrint only build ids.\n\n\t\tIntended for piping the output into another bb subcommand:\n\t\t\tbb ls -cl myCL -id | bb cancel\n\t`))\n}" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software Development:" }
Decide how to ping
[ "def ping_class\n return Net::Ping::External unless ports\n return Net::Ping::TCP unless @protocol =~ /tcp|udp|http|wmi/\n Net::Ping.const_get(@protocol.upcase)\n end" ]
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Shutdown executor in order. @param iterator Executors to shutdown.
[ "private void shutdownGracefully(final Iterator<EventExecutorGroup> iterator) {\n if (iterator.hasNext()) {\n EventExecutorGroup group = iterator.next();\n if (!group.isShuttingDown()) {\n group.shutdownGracefully().addListener(future -> {\n if (!future...
[ "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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Serialize obj to a JSON formatted string. This is useful for pretty printing log records in the console.
[ "def __obj2json(self, obj):\n \n return json.dumps(obj, indent=self._indent, sort_keys=self._sort_keys)" ]
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
<pre> Use this operation to add ns ip on NS Instance. </pre>
[ "public static ns_ns_ip add(nitro_service client, ns_ns_ip resource) throws Exception\r\n\t{\r\n\t\tresource.validate(\"add\");\r\n\t\treturn ((ns_ns_ip[]) resource.perform_operation(client, \"add\"))[0];\r\n\t}" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Adds num to the current value
[ "def add(self, num):\n \n try:\n val = self.value() + num\n except:\n val = num\n self.set(min(self.imax, max(self.imin, val)))" ]
[ "@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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Computes and returns the CSS styles for the given position. @private
[ "function(oPosition) {\n\t\tvar oPos = oPosition.getComputedPosition();\n\n\t\tvar addStyle = function(oPosition, aBuffer, sPos, sVal){\n\t\t\tif (sVal) {\n\t\t\t\taBuffer.push(sPos + \":\" + sVal + \";\");\n\t\t\t}\n\t\t};\n\n\t\tvar aBuffer = [];\n\t\taddStyle(oPosition, aBuffer, \"top\", oPos.top);\n\t\taddStyle...
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Usage: java twitter4j.examples.account.GetRateLimitStatus @param args message
[ "public static void main(String[] args) {\n try {\n Twitter twitter = new TwitterFactory().getInstance();\n Map<String ,RateLimitStatus> rateLimitStatus = twitter.getRateLimitStatus();\n for (String endpoint : rateLimitStatus.keySet()) {\n RateLimitStatus statu...
[ "public LogStreamResponse getLogs(Log.LogRequestBuilder logRequest) {\n return connection.execute(new Log(logRequest), apiKey);\n }" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// execute update sql dbQuerier with given struct reflect.Value.
[ "func (d *dbBase) Update(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, cols []string) (int64, error) {\n\tpkName, pkValue, ok := getExistPk(mi, ind)\n\tif ok == false {\n\t\treturn 0, ErrMissPK\n\t}\n\n\tvar setNames []string\n\n\t// if specify cols length is zero, then commit all columns.\n\tif...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get a new instance of the User @param $data @return $this
[ "public function instance($data)\n {\n $RagnarokUser = new SecUser();\n $this->userRagnarok = $RagnarokUser->populate($data);\n return $this->userRagnarok;\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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Condition check on finished or stopped status The method returns a value which is equivalent with not 'active' status of the current state machine. :return: outcome of condition check stopped or finished :rtype: bool
[ "def finished_or_stopped(self):\n \n return (self._status.execution_mode is StateMachineExecutionStatus.STOPPED) or \\\n (self._status.execution_mode is StateMachineExecutionStatus.FINISHED)" ]
[ "def fix_config(self, options):\n \n options = super(Trigger, self).fix_config(options)\n\n opt = \"condition\"\n if opt not in options:\n options[opt] = \"True\"\n if opt not in self.help:\n self.help[opt] = \"The (optional) condition for teeing off the toke...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Remove Listener of a given notification type. @param <T> Type of notification. @param type Type of notification listener. @param listener Listener to be removed.
[ "@Synchronized\n public <T extends Notification> void removeListener(final String type, final Listener<T> listener) {\n map.get(type).removeIf(e -> e.getListener().equals(listener));\n }" ]
[ "public void init(BaseMessageReceiver messageReceiver, BaseMessageFilter messageFilter)\n {\n if (messageFilter == null)\n {\n if (messageReceiver != null)\n {\n messageFilter = messageReceiver.createDefaultFilter(this); // Add filter to handler\n ...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Decorator to issue warnings for API moving onto the param namespace and to add a docstring directing people to the appropriate method.
[ "def deprecate(cls, fn):\n \n def inner(*args, **kwargs):\n if cls._disable_stubs:\n raise AssertionError('Stubs supporting old API disabled')\n elif cls._disable_stubs is None:\n pass\n elif cls._disable_stubs is False:\n g...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// DescribeInstanceStatus describes instance status // // You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&describeinstancestatus
[ "func (client *Client) DescribeInstanceStatus(args *DescribeInstanceStatusArgs) (instanceStatuses []InstanceStatusItemType, pagination *common.PaginationResult, err error) {\n\tresponse, err := client.DescribeInstanceStatusWithRaw(args)\n\n\tif err == nil {\n\t\treturn response.InstanceStatuses.InstanceStatus, &res...
[ "def limits(args):\n \n # https://aws.amazon.com/about-aws/whats-new/2014/06/19/amazon-ec2-service-limits-report-now-available/\n # Console-only APIs: getInstanceLimits, getAccountLimits, getAutoscalingLimits, getHostLimits\n # http://boto3.readthedocs.io/en/latest/reference/services/dynamodb.html#Dynam...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Writes a file if it doesn't already exist with the same content. This is useful because cargo uses timestamps to decide whether to compile things.
[ "def _replace_file(path, content):\n \"\"\"\"\"\"\n if os.path.exists(path):\n with open(path, 'r') as f:\n if content == f.read():\n print(\"Not overwriting {} because it is unchanged\".format(path), file=sys.stderr)\n return\n\n with open(path, 'w') as f:\n f.write(content)" ]
[ "def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Called to update the GUI when a repo tree item has changed or a new one was selected.
[ "def currentRepoTreeItemChanged(self):\n \n # When the model is empty the current index may be invalid and the currentItem may be None.\n currentItem, currentIndex = self.getCurrentItem()\n\n hasCurrent = currentIndex.isValid()\n assert hasCurrent == (currentItem is not None), \\\...
[ "def get_render_language(contentitem):\n \n plugin = contentitem.plugin\n\n if plugin.render_ignore_item_language \\\n or (plugin.cache_output and plugin.cache_output_per_language):\n # Render the template in the current language.\n # The cache also stores the output under the current lang...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Language and programming:" }
The famous register helper matching the Handlebars API @param string $name The name of the helper @param callable $helper The helper handler @return Handlebars
[ "public function registerHelper(string $name, callable $helper): Handlebars\n {\n $this->runtime->addHelper($name, $helper);\n return $this;\n }" ]
[ "function () {\n /**\n * Get a valid file path for a template file from a set of directories\n * @param {Object} opts Configurable options (see periodicjs.core.protocols for more details)\n * @param {string} [opts.extname] Periodic extension that may contain view file\n * @param {string} opts.viewna...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Set to a PEM-format client private key
[ "def key=(*args)\n cert, passphrase = args.flatten\n ssl_context.key = OpenSSL::PKey::RSA.new(cert, passphrase)\n end" ]
[ "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:" }
// Validate checks the field values on HttpFilter with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned.
[ "func (m *HttpFilter) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tif len(m.GetName()) < 1 {\n\t\treturn HttpFilterValidationError{\n\t\t\tfield: \"Name\",\n\t\t\treason: \"value length must be at least 1 bytes\",\n\t\t}\n\t}\n\n\tswitch m.ConfigType.(type) {\n\n\tcase *HttpFilter_Config:\n\n\t\t{...
[ "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:" }
@DI\Observe("crud_pre_create_object_claroline_forumbundle_entity_message") @param CreateEvent $event @return ResourceNode
[ "public function preCreate(CreateEvent $event)\n {\n $message = $event->getObject();\n $forum = $this->getSubject($message)->getForum();\n\n //create user if not here\n $user = $this->om->getRepository(User::class)->findOneBy([\n 'user' => $message->getCreator(),\n '...
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
setMaxSpeed(string, double) -> None Sets a new maximum allowed speed on the lane in m/s.
[ "def setMaxSpeed(self, laneID, speed):\n \n self._connection._sendDoubleCmd(\n tc.CMD_SET_LANE_VARIABLE, tc.VAR_MAXSPEED, laneID, speed)" ]
[ "@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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Downloads a file using http get and request @param {string} source - The http URL to download from @param {object} options - Options object @returns {Promise}
[ "function download(source, { verbose, output, onStart, onProgress } = {}) {\n return new Promise(function(y, n) {\n if (typeof output === 'undefined') {\n output = path.basename(url.parse(source).pathname) || 'unknown';\n }\n\n /**\n * Parse the source url into parts\n */\n const sourceUrl...
[ "function () {\n /**\n * Get a valid file path for a template file from a set of directories\n * @param {Object} opts Configurable options (see periodicjs.core.protocols for more details)\n * @param {string} [opts.extname] Periodic extension that may contain view file\n * @param {string} opts.viewna...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// WithResourceID assigns ID to the resource
[ "func WithResourceID(id int64) MarshalOption {\n\treturn func(c *MarshalConfig) error {\n\t\tc.ID = id\n\t\treturn nil\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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
`index` stores the character number we are currently at while `length` is a constant All of the gobbles below will modify `index` as we move along
[ "function() {\n index++;\n var node = gobbleExpression();\n gobbleSpaces();\n if (exprICode(index) === CPAREN_CODE) {\n index++;\n return node;\n } else {\n throwError(\"Unclosed (\", index);\n }\n }" ]
[ "def generate_optimized_y_move_down_x_SOL(y_dist):\n \n\n # Optimization to move N lines and go to SOL in one command. Note that some terminals \n # may not support this so we might have to remove this optimization or make it optional \n # if that winds up mattering for terminals we care about. If we ha...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Save the cache once the script terminates. Is attached as a shutdown hook by calling Cache::setHook @param string $cache_name Can be specified to save one specific cache
[ "public function saveCache(string $cache_name = null)\n {\n $cache_dir = $this->cache_path;\n $cnt = 0;\n foreach ($this->repository as $name => &$cache)\n {\n if ($cache_name !== null && $name !== $cache_name)\n continue;\n\n if (empty($cache['_ch...
[ "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 about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Removing all placeholders @param string|array|null $parent $root or $parent @throws TemplateException
[ "public function removeAllPlaceholders($parent = null)\n {\n if (isset($parent)) {\n list(, , $template) = $this->getParentPlaceholder($parent);\n }\n\n if (!isset($template)) {\n $template = $this;\n }\n if ($template === false) {\n if ($this->...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
For refresh, we can ignore things like deletion or transience. @param pc @return the refreshed object
[ "private ZooPC checkObjectForRefresh(Object pc) {\r\n if (!(pc instanceof ZooPC)) {\r\n \tthrow DBLogger.newUser(\"The object is not persistent capable: \" + pc.getClass());\r\n }\r\n \r\n ZooPC pci = (ZooPC) pc;\r\n if (!pci.jdoZooIsPersistent()) {\r\n \treturn pci;...
[ "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 sentence about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Read the lines between BEGIN and END marker and convert the Base64 encoded content into binary byte array. @return DER encoded octet stream @throws IOException
[ "private static byte[] readBytes(BufferedReader reader, String endMarker) throws IOException\n {\n String line = null;\n StringBuilder buf = new StringBuilder();\n\n while ((line = reader.readLine()) != null)\n {\n if (line.contains(endMarker)) {\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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
returns doubles not floats b/c we get doubles from H2O
[ "private double[] hiddenDropoutratios(BackendParams bparms) {\n double[] hiddenDropoutRatios = (double[]) bparms.get(\"hidden_dropout_ratios\");\n if(null != hiddenDropoutRatios) {\n return hiddenDropoutRatios;\n }\n int layerNr = ((int[]) bparms.get(\"hidden\")).length;\n ...
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Render the template and layout. @param array $data @throws \Throwable @throws \Exception @return string
[ "public function render(array $data = [])\n {\n $this->data($data);\n unset($data);\n extract($this->data);\n\n if (! $this->exists()) {\n throw new LogicException(\n 'The template \"'.$this->name->getName().'\" could not be found at \"'.$this->path().'\".'\n...
[ "public function onDelete()\n {\n $this->validateRequestTheme();\n\n $type = Request::input('templateType');\n\n $this->loadTemplate($type, trim(Request::input('templatePath')))->delete();\n\n /*\n * Extensibility - documented above\n */\n $this->fireSystemEvent...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
decodes a binary sequence to return a string
[ "def decode(self, binSequence):\n\t\t\"\"\"\"\"\"\n\t\ttry:\n\t\t\tbinSeq = iter(binSequence[0])\n\t\texcept TypeError, te:\n\t\t\tbinSeq = binSequence\n \n\t\tret = ''\n\t\tfor b in binSeq :\n\t\t\tch = ''\n\t\t\tfor c in self.charToBin :\n\t\t\t\tif b & self.forma[self.charToBin[c]] > 0 :\n\t\t\t\t\tch += c +'...
[ "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 about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// ApplyWithError populates the flag given the flag set and environment
[ "func (f Float64Flag) ApplyWithError(set *flag.FlagSet) error {\n\tif envVal, ok := flagFromFileEnv(f.FilePath, f.EnvVar); ok {\n\t\tenvValFloat, err := strconv.ParseFloat(envVal, 10)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not parse %s as float64 value for flag %s: %s\", envVal, f.Name, err)\n\t\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 instruction about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code:" }
Creates the publish resource warnings.<p> @return a map from structure ids to the warnings for the corresponding resources
[ "protected Map<CmsUUID, CmsPublishResourceInfo> computeWarnings() {\n\n Map<CmsUUID, CmsPublishResourceInfo> warnings = Maps.newHashMap();\n Set<CmsResource> resourcesWithoutErrors = new HashSet<CmsResource>(m_resources.values());\n\n List<I_PublishResourceValidator> validators = getValidators(...
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// WithEndpointConfig injects a EndpointConfig interface to the SDK // it accepts either a full interface of EndpointConfig or a list // of sub interfaces each implementing one (or more) function(s) of EndpointConfig
[ "func WithEndpointConfig(endpointConfigs ...interface{}) Option {\n\treturn func(opts *options) error {\n\t\tc, err := fabImpl.BuildConfigEndpointFromOptions(endpointConfigs...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topts.endpointConfig = c\n\t\treturn nil\n\t}\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 Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
// Run executes DefaultDeltaRunMethod for this task.
[ "func (e *VirtualMachine) Run(c *fi.Context) error {\n\tglog.V(4).Info(\"VirtualMachine.Run invoked!\")\n\treturn fi.DefaultDeltaRunMethod(e, c)\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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// SetProposedByMemberId sets the ProposedByMemberId field's value.
[ "func (s *Proposal) SetProposedByMemberId(v string) *Proposal {\n\ts.ProposedByMemberId = &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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Device represents your physical device. @param {Object} Connection The constructor function of the connection.
[ "function Device(Connection) {\n var self = this;\n\n // call super class\n EventEmitter2.call(this, {\n wildcard: true,\n delimiter: ':',\n maxListeners: 1000 // default would be 10!\n });\n\n if (this.log) {\n this.log = _.wrap(this.log, function(func, msg) {\n func(self.constructor.name + '...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Response when reset password failed. @param string $response @return mixed
[ "public function passwordResetHasFailed($response)\n {\n $message = trans($response);\n $token = Request::input('token');\n\n return $this->redirectWithMessage(handles(\"orchestra::forgot/reset/{$token}\"), $message, 'error');\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 post about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Programming:" }
Write end info to log
[ "def logEndTime():\n \"\"\"\"\"\"\n logger.info('\\n' + '#' * 70)\n logger.info('Complete')\n logger.info(datetime.today().strftime(\"%A, %d %B %Y %I:%M%p\"))\n logger.info('#' * 70 + '\\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 comment about software development:", "pos": "Represent the code about software development:", "neg": "Represent the code:" }
// Get returns for each category (string) its latest rates (up to X values // where X is the configured number of samples of the Rates struct). // Rates are ordered from least recent (index 0) to most recent (end of slice).
[ "func (rt *Rates) Get() (rateMap map[string][]float64) {\n\trt.mu.Lock()\n\tdefer rt.mu.Unlock()\n\n\trateMap = make(map[string][]float64)\n\ttimeStamps := rt.timeStamps.Values()\n\tif len(timeStamps) <= 1 {\n\t\treturn\n\t}\n\tfor k, v := range rt.counts {\n\t\trateMap[k] = make([]float64, len(timeStamps)-1)\n\t\t...
[ "protected void purgeObsoleteSamples(MetricConfig config, long now) {\n long expireAge = config.samples() * config.timeWindowMs();\n for (int i = 0; i < samples.size(); i++) {\n Sample sample = this.samples.get(i);\n if (now - sample.lastWindowMs >= expireAge) {\n ...
codesearchnet
{ "query": "Represent the sentence about Text analysis:", "pos": "Represent the code about Text analysis:", "neg": "Represent the code:" }
Returns a string like "&amp;" or a falsy value if no match. Fails fatally if something looks like a named entity but isn't.
[ "function (scanner, inAttribute) {\n // look for `&` followed by alphanumeric\n if (! peekMatcher(scanner, getPossibleNamedEntityStart))\n return null;\n\n var matcher = getNamedEntityByFirstChar[scanner.rest().charAt(1)];\n var entity = null;\n if (matcher)\n entity = peekMatcher(scanner, matcher);\n\n ...
[ "def _safe_match_string(value):\n \"\"\"\"\"\"\n if not isinstance(value, six.string_types):\n if isinstance(value, bytes): # should only happen in py3\n value = value.decode('utf-8')\n else:\n raise GraphQLInvalidArgumentError(u'Attempting to convert a non-string into a s...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Get a set() of files from a jottapath (a folder)
[ "def filelist(jottapath, JFS):\n \"\"\"\"\"\"\n log.debug(\"filelist %r\", jottapath)\n try:\n jf = JFS.getObject(jottapath)\n except JFSNotFoundError:\n return set() # folder does not exist, so pretend it is an empty folder\n if not isinstance(jf, JFSFolder):\n return False\n ...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
One of ways of creating builder. This is possibly the least verbose way where compiler should be able to guess the generic parameters.
[ "@Nonnull\n\tpublic static LBoolSupplier boolSupplierFrom(Consumer<LBoolSupplierBuilder> buildingFunction) {\n\t\tLBoolSupplierBuilder builder = new LBoolSupplierBuilder();\n\t\tbuildingFunction.accept(builder);\n\t\treturn builder.build();\n\t}" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Creates an audit entry for the 'contract broken' event. @param bean the bean @param securityContext the security context @return the audit entry
[ "public static AuditEntryBean contractBrokenToApi(ContractBean bean, ISecurityContext securityContext) {\n AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);\n entry.setWhat(AuditEntryType.BreakContract);\n entry.setEntityId(...
[ "@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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
// NewEntity returns a entity with a name, public and private key.
[ "func NewEntity(name string, publicKey, privateKey []byte) Entity {\n\treturn Entity{Name: name, PublicKey: publicKey, PrivateKey: privateKey}\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
@param array $params @param string $key @param null $default @return mixed|null
[ "public static function get(\n array $params,\n string $key,\n $default = null\n ) {\n if (self::has($params, $key)) {\n return $params[$key];\n }\n\n return $default;\n }" ]
[ "protected static function getField(\n ParticleInterface $particle,\n FieldsCargo $cargo,\n string $name,\n array $args = []\n )/*: mixed*/\n {\n $name = Utils::findFieldName($cargo, $name);\n return $particle->attributes()->$name; // test with null.\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
==========================================================================
[ "public AttributeConfig_5 get_attribute_config_obj_5() {\n return new AttributeConfig_5(\n name,\n writable,\n data_format,\n data_type,\n isMemorized,\n isSetAtInit,\n max_dim_x,\n max_dim...
[ "def closeEvent(self, event):\n \n\n self.save_config(self.gui_settings['gui_settings'])\n self.script_thread.quit()\n self.read_probes.quit()\n event.accept()\n\n print('\\n\\n======================================================')\n print('================= Closin...
codesearchnet
{ "query": "Represent the Github description about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code:" }
Validate all `service_checks.json` files.
[ "def service_checks():\n \"\"\"\"\"\"\n root = get_root()\n echo_info(\"Validating all service_checks.json files...\")\n failed_checks = 0\n ok_checks = 0\n for check_name in sorted(os.listdir(root)):\n service_checks_file = os.path.join(root, check_name, 'service_checks.json')\n\n i...
[ "def remove_all_servers(self):\n \n # 'no ntp' removes all server entries.\n # For command_builder, disable command 'ntp' gives the desired command\n cmd = self.command_builder('ntp', disable=True)\n return self.configure(cmd)" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Networking:" }
Returns the annotation element as {@link JAnnotationValue}.
[ "public static JAnnotationValue getAnnotationMember(JAnnotationUse annotation, String annotationMember) {\n\t\tif (annotation == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// FIXME: Workaround for https://java.net/jira/browse/JAXB-1040:\n\t\tMap<String, JAnnotationValue> memberValues = getPrivateField(annotation, \"...
[ "@Override\n public void setPrimaryKey(WV value, Mapper mapper, String column, K primaryKey, Object Entity) {\n }" ]
codesearchnet
{ "query": "Represent the summarization about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
Absolute URL to the HTTP(S) rendered/served representation of this resource
[ "def http_url\n return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile)\n return if is_a?(Jekyll::Document) && !collection.write?\n @http_url ||= Addressable::URI.new(\n :scheme => scheme, :host => host, :port => port,\n :path => path_with_base(JekyllAdmin.site.config[\"base...
[ "public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Updates the value. @param value the value
[ "private void updateValue(Value value) {\n while (true) {\n Value current = currentValue.get();\n if (value.isNewerThan(current)) {\n if (currentValue.compareAndSet(current, value)) {\n if (current == null || !Objects.equals(current.value(), value.value())) {\n eventListeners...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Hydrate array data to an object based on the configuration given @param array $data @param ByConfigBuilder $config @return object | \ArrayIterator on a collection
[ "public static function hydrate(array $data, ByConfigBuilder $config)\r\n {\r\n // When entity is not available. Only use the collection to set the data\r\n if ($config->getEntity() === false) {\r\n return $config->getCollectionEntity($data);\r\n }\r\n\r\n // When there is ...
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/** * Revert non ascii chracters escaped by git or windows (as octal sequences \000) back to bytes. */
[ "func DecodePathBytes(path []byte) []byte {\n\tvar expression = regexp.MustCompile(`\\\\[0-9]{3}`)\n\tvar buffer bytes.Buffer\n\n\t// strip quotes if any\n\tif len(path) > 2 && path[0] == '\"' && path[len(path)-1] == '\"' {\n\t\tpath = path[1 : len(path)-1]\n\t}\n\n\tbase := 0\n\tfor _, submatches := range expressi...
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
/* Checks whether the stored string starts with given string. If given argument is not a string or a String instance, an InvalidArgumentException is thrown. Returns boolean. TODO: Examples
[ "public function starts_with ($needle)\n\t{\n\t\tensure('Argument', $needle, 'is_a_string', __CLASS__, __METHOD__);\n\n\t\tif ($needle instanceof self) {\n\t\t\t$needle = $needle->to_s();\n\t\t}\n\n\t\treturn 0 === strcmp($this->slice(0, strlen($needle))->to_s(), $needle);\n\t}" ]
[ "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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Check parsed code for having namespaces. @param array $parsed @return bool
[ "protected function parsedCodeHasNamespaces(array $parsed)\n {\n // Namespaces can only be on first level in the code,\n // so we make only check on it.\n $node = array_filter(\n $parsed,\n function ($value) {\n return $value instanceof NamespaceNode;\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
@param number $money - Total order amount. (REQUIRED) @param Merchant_Billing_CreditCard $creditcard - A creditcard class object (REQUIRED) @param array $options @return Merchant_Billing_Response
[ "public function authorize($money, Merchant_Billing_CreditCard $creditcard, $options = array())\n {\n $this->required_options('customer_email', $options);\n $this->build_xml($money, 'PreAuth', $creditcard, $options);\n\n return $this->commit();\n }" ]
[ "public function execute(Observer $observer) {\n\n // Get the order\n $order = $observer->getEvent()->getOrder();\n\n // Get the payment method\n $paymentMethod = $order->getPayment()->getMethod();\n\n // Test the current method used\n if ($paymentMethod == ConfigProvider::...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// SetUserData sets the UserData field's value.
[ "func (s *InstanceEntry) SetUserData(v string) *InstanceEntry {\n\ts.UserData = &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 post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
First wait till some elements are loaded, then initialize and open dynamically added popup. <br> See <a href="http://demos.jquerymobile.com/1.4.5/popup-dynamic/#&ui-state=dialog&ui-state=dialog&ui-state=dialog">Dynamic popup with images</a>
[ "public void waitInitOpen(String waitForSelector) {\n if (waitForSelector == null || waitForSelector.isEmpty()) {\n initDynamic();\n open();\n return;\n }\n waitInitOpen(waitForSelector, getElement());\n }" ]
[ "function addSelectKeyListener(){var select=this.refs.select;select.addEventListener('keyup',this.setSelectValue);select.addEventListener('keydown',this.setKeypress);// weird shit\n// http://stackoverflow.com/questions/34660500/mobile-safari-multi-select-bug\nif(this.isIos){var classes=this.classes;var firstOption=...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Convert a string representation of a residue number to a residue number object. The string representation can be a integer followed by a character. @param pdb_code @return a ResidueNumber object, or null if the input was null
[ "public static ResidueNumber fromString(String pdb_code) {\n\t\tif(pdb_code == null)\n\t\t\treturn null;\n\n\t\tResidueNumber residueNumber = new ResidueNumber();\n\t\tInteger resNum = null;\n\t\tString icode = null;\n\n\t\ttry {\n\t\t\tresNum = Integer.parseInt(pdb_code);\n\t\t} catch ( NumberFormatException e){\n...
[ "def getValue(words):\n \"\"\"\"\"\"\n value = 0\n for word in words:\n for letter in word:\n # shared.getConst will evaluate to the dictionary broadcasted by\n # the root Future\n value += shared.getConst('lettersValue')[letter]\n return value" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Natural Language Processing:" }
cuts lo=val hi=val ch=chname If neither `lo` nor `hi` is provided, returns the current cut levels. Otherwise sets the corresponding cut level for the given channel. If `ch` is omitted, assumes the current channel.
[ "def cmd_cuts(self, lo=None, hi=None, ch=None):\n \n viewer = self.get_viewer(ch)\n if viewer is None:\n self.log(\"No current viewer/channel.\")\n return\n\n loval, hival = viewer.get_cut_levels()\n\n if (lo is None) and (hi is None):\n self.log(\...
[ "def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
optimistic,if no error,goto done
[ "protected void readHeader(ByteBuffer buffer) {\n super.readHeader(buffer);\n if (this.responseStatus == ResponseStatus.NO_ERROR) {\n this.decodeStatus = BinaryDecodeStatus.DONE;\n }\n }" ]
[ "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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }