query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
@return bool Whether the configuration is enabled @throws InvalidArgumentException When the config is not enableable
[ "protected function isConfigEnabled(ContainerBuilder $container, array $config)\n {\n if (!array_key_exists('enabled', $config)) {\n throw new InvalidArgumentException(\"The config array has no 'enabled' key.\");\n }\n\n return (bool) $container->getParameterBag()->resolveValue($c...
[ "def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in mo...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Computes the output of the given data table array @param DataTable\Map $table @param array $allColumns @return string
[ "protected function renderDataTableMap($table, &$allColumns = array())\n {\n $str = '';\n foreach ($table->getDataTables() as $currentLinePrefix => $dataTable) {\n $returned = explode(\"\\n\", $this->renderTable($dataTable, $allColumns));\n\n // get rid of the columns names\n ...
[ "def _get_result_paths(self, data):\n \n\n # Swarm OTU map (mandatory output)\n return {'OtuMap': ResultPath(Path=self.Parameters['-o'].Value,\n IsWritten=True)}" ]
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Encode special characters found in string I{s}. @param s: A string to encode. @type s: str @return: The encoded string. @rtype: str
[ "def encode(self, s):\n \n if isinstance(s, str) and self.needsEncoding(s):\n for x in self.encodings:\n s = re.sub(x[0], x[1], s)\n return s" ]
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// DestroyMachines removes a given set of machines.
[ "func (client *Client) DestroyMachines(machines ...string) ([]params.DestroyMachineResult, error) {\n\treturn client.destroyMachines(\"DestroyMachine\", machines)\n}" ]
[ "public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
$options为是否指定options的string内容,用在允许多次执行里面
[ "private function _parseReturn($method, $operate = '', $options = null)\n {\n if ($operate) $operate = ' ' . $operate . ' ';\n $string = (is_null($options) && isset($this->options[$method]['0'])) ? $this->options[$method]['0'] : $options;\n if (isset($string)) {\n if (in_array($me...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Sets the host for this URL. @param string $host The hostname or IP address for this URL. @throws InvalidArgumentException If the given host is not an IP address or hostname. @return void
[ "public function setHost($host)\n {\n if (! (self::_isHostname($host) || self::_isIpAddress($host))) {\n\n throw new InvalidArgumentException(\"Invalid host ($host)\");\n }\n\n $this->_host = strtolower(trim($host));\n }" ]
[ "public static function getDatabaseConfig($dbConfig = null)\n {\n $config = Config::getInstance();\n\n if (is_null($dbConfig)) {\n $dbConfig = $config->database;\n }\n\n /**\n * Triggered before a database connection is established.\n *\n * This even...
codesearchnet
{ "query": "Represent the Github description about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Programming:" }
// SetName sets the Name field's value.
[ "func (s *PipelineObject) SetName(v string) *PipelineObject {\n\ts.Name = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// intersect removes positions from e that are not present in x.
[ "func (e editSet) intersect(x editSet) {\n\tfor pos := range e {\n\t\tif _, ok := x[pos]; !ok {\n\t\t\tdelete(e, pos)\n\t\t}\n\t}\n}" ]
[ "function _detectPreciseCollisionsFromCollisions(collisions) {\n return collisions.filter(collision => {\n // TODO:\n // - Use temporal bisection with discrete sub-time steps to find time of collision (use\n // x-vs-y-specific intersection detection methods).\n // - Make sure the collision object...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
Attempt to authenticate to the given transport using any of the private keys available from an SSH agent.
[ "def agent_auth(transport, username):\n \n \n agent = ssh.Agent()\n agent_keys = agent.get_keys()\n if len(agent_keys) == 0:\n return\n \n for key in agent_keys:\n print 'Trying ssh-agent key %s' % hexlify(key.get_fingerprint()),\n try:\n transport.auth_publi...
[ "def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in mo...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
This function is similar to read_csv, but it reads data from the list of <lines>. fd = open("foo", "r") data = chart_data.read_str(",", fd.readlines())
[ "def read_str(delim=',', *lines):\n \"\"\"\"\"\"\n\n data = []\n for line in lines:\n com = parse_line(line, delim)\n data.append(com)\n return data" ]
[ "def wild_card_logs():\n \n file_name = 'GLWC.TXT'\n z = get_zip_file(wild_card_url)\n data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='\"')\n data.columns = gamelog_columns\n return data" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
<Enabled>true|false</Enabled> <Days>number-of-days</Days>
[ "def _convert_xml_to_retention_policy(xml, retention_policy):\n '''\n \n '''\n # Enabled\n retention_policy.enabled = _bool(xml.find('Enabled').text)\n\n # Days\n days_element = xml.find('Days')\n if days_element is not None:\n retention_policy.days = int(days_element.text)" ]
[ "def SetWeekdayService(self, has_service=True):\n \"\"\"\"\"\"\n for i in range(0, 5):\n self.SetDayOfWeekHasService(i, has_service)" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Restores global URL aliases from the backup table.
[ "protected function restoreGlobalAliases()\n {\n $table = static::MIGRATION_TABLE;\n $backupTable = static::GLOBAL_ALIAS_BACKUP_TABLE;\n\n if (!$this->tableExists($table)) {\n throw new RuntimeException(\n \"Could not find main URL alias migration table '{$table}'. ...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// sniffNode sniffs a single node. This method is run as a goroutine // in sniff. If successful, it returns the list of node URLs extracted // from the result of calling Nodes Info API. Otherwise, an empty array // is returned.
[ "func (c *Client) sniffNode(url string) []*conn {\n\tnodes := make([]*conn, 0)\n\n\t// Call the Nodes Info API at /_nodes/http\n\treq, err := NewRequest(\"GET\", url+\"/_nodes/http\")\n\tif err != nil {\n\t\treturn nodes\n\t}\n\n\tres, err := c.c.Do((*http.Request)(req))\n\tif err != nil {\n\t\treturn nodes\n\t}\n\...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
stop all Patronis, remove their data directory and cleanup the keys in etcd
[ "def after_feature(context, feature):\n \n context.pctl.stop_all()\n shutil.rmtree(os.path.join(context.pctl.patroni_path, 'data'))\n context.dcs_ctl.cleanup_service_tree()\n if feature.status == 'failed':\n shutil.copytree(context.pctl.output_dir, context.pctl.output_dir + '_failed')" ]
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Technology:" }
Converts a string to the corresponding log level
[ "def string_to_level(log_level):\n \n if (log_level.strip().upper() == \"DEBUG\"):\n return logging.DEBUG\n if (log_level.strip().upper() == \"INFO\"):\n return logging.INFO\n if (log_level.strip().upper() == \"WARNING\"):\n return logging.WARNING\n if (log_level.strip().upper() == \"ERROR\"):\n re...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Add translations @param \Haven\CoreBundle\Entity\CategoryTranslation $translation @return Category
[ "public function addTranslation(\\Haven\\CoreBundle\\Entity\\CategoryTranslation $translation) {\n $translation->setParent($this);\n $this->translations[] = $translation;\n\n return $this;\n }" ]
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
入口方法(主方法) @param {Object} options
[ "function commander (options) {\n const { cmds, version } = options\n const argvs = parseArgs()\n if (argvs._.length === 0) {\n if (argvs.v || argvs.version) {\n process.stdout.write(version + '\\n' || 'unknow\\n')\n process.exit()\n } else {\n help(options)\n...
[ "public void addSharedFunctionByString(String content) {\r\n\t\t// content 中的内容被解析后会存放在 Env 之中,而 StringSource 所对应的\r\n\t\t// Template 对象 isModified() 始终返回 false,所以没有必要对其缓存\r\n\t\tStringSource stringSource = new StringSource(content, false);\r\n\t\tdoAddSharedFunction(stringSource, null);\r\n\t}" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Sets the classpath.
[ "public void setClasspath(String classpath) {\n this.classpath = new LinkedList<String>();\n StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);\n while (tokenizer.hasMoreTokens()) {\n this.classpath.add(tokenizer.nextToken());\n }\n }" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the instruction about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code about programming:" }
Convert a given value to a YAML string.
[ "def to_yaml(value) -> str:\n \"\"\"\"\"\"\n stream = yaml.io.StringIO()\n dumper = ConfigDumper(stream, default_flow_style=True, width=sys.maxsize)\n val = None\n try:\n dumper.open()\n dumper.represent(value)\n val = stream.getvalue().strip()\n dumper.close()\n finall...
[ "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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// DeleteSha256Witness attempts to delete a sha256 preimage identified by hash.
[ "func (w *WitnessCache) DeleteSha256Witness(hash lntypes.Hash) error {\n\treturn w.deleteWitness(Sha256HashWitness, hash[:])\n}" ]
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the Github post about Text processing:", "pos": "Represent the Github code about Text processing:", "neg": "Represent the Github code about Software development:" }
Set active = false in offer list, after product was removed
[ "protected function processOfferAfterDelete()\n {\n $obOfferList = $this->obElement->offer;\n if ($obOfferList->isEmpty()) {\n return;\n }\n\n foreach ($obOfferList as $obOffer) {\n $obOffer->active = false;\n $obOffer->save();\n }\n }" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Creates a global IP.
[ "def cli(env, ipv6, test):\n \"\"\"\"\"\"\n\n mgr = SoftLayer.NetworkManager(env.client)\n\n version = 4\n if ipv6:\n version = 6\n\n if not (test or env.skip_confirmations):\n if not formatting.confirm(\"This action will incur charges on your \"\n \"acc...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Default implementation for {@link Streamable}. <p>Subclasses can simply add {@code implements Streamable} if they have an implementation in Sanitizers.<name>Streaming. If they don't, this method will throw while trying to find it.
[ "public final AppendableAndOptions applyForJbcSrcStreaming(\n JbcSrcPluginContext context, Expression delegateAppendable, List<SoyExpression> args) {\n MethodRef sanitizerMethod = javaStreamingSanitizer;\n if (sanitizerMethod == null) {\n // lazily allocated\n sanitizerMethod =\n Metho...
[ "public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) {\n // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming.\n // We still populate it with a reasonable method name for use in logging. The service type is currently\n ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// NewCluster generates a new Cluster object using the provided ClusterOptions object
[ "func NewCluster(options *ClusterOptions) (*Cluster, error) {\n\tif options == nil {\n\t\toptions = defaultClusterOptions\n\t}\n\tif options.NodeManager == nil {\n\t\toptions.NodeManager = &defaultNodeManager{}\n\t}\n\tif options.ExecutionAttempts == 0 {\n\t\toptions.ExecutionAttempts = defaultExecutionAttempts\n\t...
[ "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 instruction about API documentation:", "pos": "Represent the Github code about API documentation:", "neg": "Represent the Github code about Software development:" }
Enables simple datepicker for input @return $this
[ "public function enableCalendarDatepicker()\n {\n if (!$this->isEnabledCalendarDatepicker()) {\n // First time enabling\n PageTail::getInstance()\n ->addCssUrl('plugins/datepicker/datepicker.css')\n ->addJsUrl('plugins/datepicker/bootstrap-datepicker.js'...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Find any valid target for "ref()" in the graph by its name and package name, or None for any package.
[ "def find_refable_by_name(self, name, package):\n \n return self._find_by_name(name, package, 'nodes', NodeType.refable())" ]
[ "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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Sets the potential range 0 to 1.
[ "def normalize(self):\n \n self.__v = self.__v - np.amin(self.__v)\n self.__v = self.__v / np.amax(self.__v)" ]
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// SetTemplateBody sets the TemplateBody field's value.
[ "func (s *CreateApplicationRequest) SetTemplateBody(v string) *CreateApplicationRequest {\n\ts.TemplateBody = &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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Get the content-type value of http header from the file's extension name. @param string $name Default file extension name. @return string content-type
[ "public static function getMimetype($name)\n {\n $parts = explode('.', $name);\n if (count($parts) > 1) {\n $ext = strtolower(end($parts));\n if (isset(self::$mime_types[$ext])) {\n return self::$mime_types[$ext];\n }\n }\n\n return null...
[ "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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
@param string $subdef_type @param string $subdef_name @return databox_subdef @throws Exception_Databox_SubdefNotFound
[ "public function get_subdef($subdef_type, $subdef_name)\n {\n $type = strtolower($subdef_type);\n $name = strtolower($subdef_name);\n\n $group = $this->getSubdefGroup(strtolower($subdef_type));\n\n if (!$group) {\n throw new Exception_Databox_SubdefNotFound(sprintf('Databox...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
List default first if it exists
[ "def list_available(cls) -> List[str]:\n \"\"\"\"\"\"\n keys = list(Registrable._registry[cls].keys())\n default = cls.default_implementation\n\n if default is None:\n return keys\n elif default not in keys:\n message = \"Default implementation %s is not regi...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Switch a subField with its previous one Called when the user clicked on the up arrow of a sortable list @param {Event} e Original click event
[ "function(e) {\n\t var childElement = Event.getTarget(e).parentNode;\n\t \n\t var previousChildNode = null;\n\t var nodeIndex = -1;\n\t for(var i = 1 ; i < childElement.parentNode.childNodes.length ; i++) {\n\t var el=childElement.parentNode.childNodes[i];\n\t if(el == childElement) {\n\t ...
[ "public void discardHeaderClick(ClickEvent event) {\n if (event == null) return;\n\n // Example: we use radioset on collapsible header, so stopPropagation() is needed\n // to suppress collapsible open/close behavior.\n // But preventDefault() is not needed, otherwise radios won't switch....
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Register callback methods for triggered actions :param rafcon.gui.shortcut_manager.ShortcutManager shortcut_manager:
[ "def register_actions(self, shortcut_manager):\n \n shortcut_manager.add_callback_for_action(\"undo\", self.undo)\n shortcut_manager.add_callback_for_action(\"redo\", self.redo)" ]
[ "def _configure_manager(self):\n \n self._manager = ContainerManager(self, resource_class=Container,\n response_key=\"\", uri_base=\"\")" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Fired to reset all key statuses based on no fingers being on the screen. @param {Object} event DOM event data including the position touched.
[ "function(event) {\n this.states.left = false;\n this.states.right = false;\n this.states.front = false;\n this.states.back = false;\n\n event.preventDefault();\n event.stopPropagation();\n }" ]
[ "def handle_key ch\n $log.debug \" KeyDispatcher GOT KEY #{ch} \"\n @keyint = ch\n @keychr = nil\n chr = nil\n chr = ch.chr if ch > 32 and ch < 127\n @keychr = chr\n\n ret = process_key ch\n # revert to the basic handling of key_map and refreshing pad.\n #####\n # ...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Loads a Bower asset from the Nails asset module's bower_components directory @param string $sAsset The asset to unload @param string $sForceType Force a particular type of asset (i.e. JS or CSS) @return void
[ "protected function unloadNailsBower($sAsset, $sForceType)\n {\n $sType = $this->determineType($sAsset, $sForceType);\n\n switch ($sType) {\n\n case 'CSS':\n\n unset($this->aCss['NAILS-BOWER-' . $sAsset]);\n break;\n\n case 'JS':\n\n ...
[ "function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Implement NDEF URI Identifier Code. This is a small hack to replace some well known prefixes (such as http://) with a one byte code. If the prefix is not known, 0x00 is used.
[ "def _encode_ndef_uri_type(self, data):\n \n t = 0x0\n for (code, prefix) in uri_identifiers:\n if data[:len(prefix)].decode('latin-1').lower() == prefix:\n t = code\n data = data[len(prefix):]\n break\n data = yubico_util.chr_byte(...
[ "public static void encodeURIAttribute(Writer writer, final String string, final String characterEncoding)\n throws IOException\n {\n //StringBuilder sb = null; //create later on demand\n int start = 0;\n String app;\n char c;\n boolean endLoop = false;\n int l...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Gets range values. @param AjaxChoiceLoaderInterface $choiceLoader The ajax choice loader @return int[] The startTo and endTo
[ "protected static function getRangeValues(AjaxChoiceLoaderInterface $choiceLoader)\n {\n $startTo = ($choiceLoader->getPageNumber() - 1) * $choiceLoader->getPageSize();\n $startTo = $startTo < 0 ? 0 : $startTo;\n $endTo = $startTo + $choiceLoader->getPageSize();\n\n if (0 >= $choiceLo...
[ "public void setPage(int page) {\n if(page < 0)\n throw new IllegalArgumentException(Bundle.getErrorString(\"PagerModel_IllegalPage\"));\n\n /* todo: need to check that the new 'current' page is in range given the first/last boundaries */\n _currentRow = new Integer(page * getPageSiz...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
<p> Same as {@link #prettyTimeFormat()} for the specified locale. </p> @param locale Target locale @return PrettyTimeFormat instance @see PrettyTimeFormat
[ "public static PrettyTimeFormat prettyTimeFormat(final Locale locale)\n {\n return withinLocale(new Callable<PrettyTimeFormat>()\n {\n public PrettyTimeFormat call() throws Exception\n {\n return context.get().getPrettyTimeFormat();\n }\n }, lo...
[ "@Override\n public String render(Date date, Locale locale, Map<String, Object> model) {\n ConcurrentDateFormatAccess dateFormatter = new ConcurrentDateFormatAccess(dateFormat);\n return dateFormatter.convertDateToString(date);\n }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Send an xmpp message with the data
[ "def returner(ret):\n '''\n \n '''\n\n _options = _get_options(ret)\n\n from_jid = _options.get('from_jid')\n password = _options.get('password')\n recipient_jid = _options.get('recipient_jid')\n\n if not from_jid:\n log.error('xmpp.jid not defined in salt config')\n return\n\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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Count lines in a file
[ "def count_lines_in(filename):\n \"\"\n f = open(filename) \n lines = 0\n buf_size = 1024 * 1024\n read_f = f.read # loop optimization\n \n buf = read_f(buf_size)\n while buf:\n lines += buf.count('\\n')\n buf = read_f(buf_size)\n \n return lines" ]
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Extract requested controller key. In case the key makes sense (we find a matching class) it will be returned. @return mixed|null
[ "protected function getRequestedControllerKey()\n {\n $return = null;\n $requestedControllerKey = $this->getRequest()->getRequestParameter('oePayPalRequestedControllerKey');\n if (!empty($requestedControllerKey) &&\n \\OxidEsales\\Eshop\\Core\\Registry::getControllerClassNameResol...
[ "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:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public IfcWindowTypePartitioningEnum createIfcWindowTypePartitioningEnumFromString(EDataType eDataType,\r\n\t\t\tString initialValue) {\r\n\t\tIfcWindowTypePartitioningEnum result = IfcWindowTypePartitioningEnum.get(initialValue);\r\n\t\tif (result == null)\r\n\t\t\tthrow new IllegalArgumentException(\r\n\t\t\t\t\...
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github comment about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
Sets the ResourceSegment to the given property of the given document. @param ResourceSegmentBehavior $document @param PropertyMetadata $property
[ "private function persistDocument(ResourceSegmentBehavior $document, PropertyMetadata $property)\n {\n $document->getStructure()->getProperty(\n $property->getName()\n )->setValue($document->getResourceSegment());\n }" ]
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about File management:" }
Sets the value to be returned by {@link org.inferred.freebuilder.processor.property.Property#getBoxedType()}. @return this {@code Builder} object
[ "public org.inferred.freebuilder.processor.property.Property.Builder setNullableBoxedType(\n TypeMirror boxedType) {\n if (boxedType != null) {\n return setBoxedType(boxedType);\n } else {\n return clearBoxedType();\n }\n }" ]
[ "public static <O extends Object> ParameterItem<O> create(final ObjectParameter<O> parameterParams) {\n // Ensure that the uid will be unique at runtime\n return (ParameterItem<O>) ParameterItemImpl.create(parameterParams.object()).uid(parameterIdGenerator.incrementAndGet()).set(parameterParams); // F...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
<p> A list containing the properties of each job that is returned. </p> @param dominantLanguageDetectionJobPropertiesList A list containing the properties of each job that is returned.
[ "public void setDominantLanguageDetectionJobPropertiesList(\n java.util.Collection<DominantLanguageDetectionJobProperties> dominantLanguageDetectionJobPropertiesList) {\n if (dominantLanguageDetectionJobPropertiesList == null) {\n this.dominantLanguageDetectionJobPropertiesList = null;\...
[ "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 text about Documentation:", "pos": "Represent the Github code about Documentation:", "neg": "Represent the Github code about Software development:" }
Generates the generic spin operator in z basis for a system of N=particles and for the selected spin index name. where index=0..N-1 The gauge term sets the behavoir for a system away from half-filling
[ "def spin_gen(particles, index, gauge=1):\n \"\"\"\"\"\"\n mat = np.zeros((2**particles, 2**particles))\n\n flipper = 2**index\n for i in range(2**particles):\n ispin = btest(i, index)\n if ispin == 1:\n mat[i ^ flipper, i] = 1\n else:\n mat[i ^ flipper, i] = g...
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// SetToManyReferenceIDs sets the sweets reference IDs and satisfies the jsonapi.UnmarshalToManyRelations interface
[ "func (u *User) SetToManyReferenceIDs(name string, IDs []string) error {\n\tif name == \"sweets\" {\n\t\tu.ChocolatesIDs = IDs\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"There is no to-many relationship with the name \" + name)\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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/* (non-Javadoc) @see com.popbill.api.CashbillService#issue(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
[ "@Override\r\n\tpublic Response issue(String CorpNum, String MgtKey, String Memo,\r\n\t\t\tString UserID) throws PopbillException {\r\n\t\tif (MgtKey == null || MgtKey.isEmpty())\r\n\t\t\tthrow new PopbillException(-99999999, \"관리번호가 입력되지 않았습니다.\");\r\n\r\n\t\tString PostData = toJsonString(new MemoRequest(Memo));\...
[ "private static com.enioka.jqm.api.Queue getQueue(Queue queue)\n {\n com.enioka.jqm.api.Queue q = new com.enioka.jqm.api.Queue();\n\n q.setDescription(queue.getDescription());\n q.setId(queue.getId());\n q.setName(queue.getName());\n\n return q;\n }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about language and writing:" }
Query for TextLogErrorMatches identical to matches of the given TextLogError.
[ "def precise_matcher(text_log_error):\n \"\"\"\"\"\"\n failure_line = text_log_error.metadata.failure_line\n logger.debug(\"Looking for test match in failure %d\", failure_line.id)\n\n if failure_line.action != \"test_result\" or failure_line.message is None:\n return\n\n f = {\n 'text_...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about File management:" }
Sets and checks that the optional paths, if set, are actually valid. @param bool $check Whether to check the paths for existence or not. @throws \Codeception\Exception\ModuleConfigException If one of the paths does not exist.
[ "protected function ensureOptionalPaths($check = true)\n {\n $optionalPaths = [\n 'themes' => [\n 'mustExist' => true,\n 'default' => '/wp-content/themes',\n ],\n 'plugins' => [\n 'mustExist' => true,\n 'default' ...
[ "public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key....
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// Close stops a Watcher and unlocks its mutex, then sends a close signal.
[ "func (w *Watcher) Close() {\n\tw.mu.Lock()\n\tif !w.running {\n\t\tw.mu.Unlock()\n\t\treturn\n\t}\n\tw.running = false\n\tw.files = make(map[string]os.FileInfo)\n\tw.names = make(map[string]bool)\n\tw.mu.Unlock()\n\t// Send a close signal to the Start method.\n\tw.close <- struct{}{}\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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// HasFailures return true is there's at least one failing suite
[ "func (s Suites) HasFailures() bool {\n\tfor _, suite := range s {\n\t\tif suite.NumFailed() > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}" ]
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Handle a file modified event.
[ "def on_modified(self, event):\n \"\"\"\"\"\"\n path = event.src_path\n if path not in self.saw:\n self.saw.add(path)\n self.recompile(path)" ]
[ "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 description about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about programming:" }
Unset an item @param string | int $key @return Collection
[ "public function unsetItem($key) {\n\t\tif (is_array($key)) {\n\t\t\t$key = $this->arrayHashFunction($key);\n\t\t}\n\t\t\n\t\tif (! isset($this->_data[$key])) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tunset($this->_data[$key], $this->_models[$key]);\n\t\t$this->_map = array_keys($this->_data);\n\t\t\n\t\treturn $this;\n\t...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Performs the Security and Export Change.<p> @throws JspException if including a JSP sub element is not successful
[ "public void actionChangeSecureExport() throws JspException {\n\n // save initialized instance of this class in request attribute for included sub-elements\n getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);\n\n String filename = getParamResource();\n\n try {\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Parses an SQL string into a JS object given the friendly type.
[ "function parseSQLVal(type, val) {\n\tif (val == 'NULL') {\n\t\treturn null;\n\t}\n\n\tswitch (type) {\n\t\tcase 'datetime':\n\t\tcase 'timestamp':\n\t\t\tif (val == 'CURRENT_TIMESTAMP') {\n\t\t\t\treturn val;\n } else if (val == '0000-00-00 00:00:00') {\n // HACK(arlen): Not sure if this ...
[ "@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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote server. @throws TeamSpeak3_Adapter_Update_Exception @return void
[ "public function syn()\r\n {\r\n if(!isset($this->options[\"host\"]) || empty($this->options[\"host\"])) $this->options[\"host\"] = $this->default_host;\r\n if(!isset($this->options[\"port\"]) || empty($this->options[\"port\"])) $this->options[\"port\"] = $this->default_port;\r\n\r\n $this->initTransport(...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
// InvalidCollectionFormat another flavor of invalid type error
[ "func InvalidCollectionFormat(name, in, format string) *Validation {\n\treturn &Validation{\n\t\tcode: InvalidTypeCode,\n\t\tName: name,\n\t\tIn: in,\n\t\tValue: format,\n\t\tmessage: fmt.Sprintf(\"the collection format %q is not supported for the %s param %q\", format, in, name),\n\t}\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 sentence about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Get the url to the directory containing responsive images. @return string
[ "public function getResponsiveImagesDirectoryUrl(): string\n {\n return url($this->getBaseMediaDirectoryUrl().'/'.$this->pathGenerator->getPathForResponsiveImages($this->media)).'/';\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Configures a {@link TransformerFactory} to protect it against XML External Entity attacks. @param factory the factory @see <a href= "https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Prevention_Cheat_Sheet#Java"> XXE Cheat Sheet</a>
[ "public static void applyXXEProtection(TransformerFactory factory) {\n\t\t//@formatter:off\n\t\tString[] attributes = {\n\t\t\t//XMLConstants.ACCESS_EXTERNAL_DTD (Java 7 only)\n\t\t\t\"http://javax.xml.XMLConstants/property/accessExternalDTD\",\n\n\t\t\t//XMLConstants.ACCESS_EXTERNAL_STYLESHEET (Java 7 only)\n\t\t\...
[ "private synchronized static void initParser() throws IOException\n {\n if (__parser != null) return;\n\n __parser = new XmlParser();\n URL config13URL = XmlConfiguration.class.getClassLoader().getResource(\n \"org/browsermob/proxy/jetty/xml/configure_1_3.dtd\");\n __pa...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about N/A:" }
Checks if payment used for current order is available and active. Throws exception if not available @param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket object @return null
[ "public function validatePayment($oBasket)\n {\n $paymentId = $oBasket->getPaymentId();\n\n if (!$this->isValidPaymentId($paymentId) || !$this->isValidPayment($oBasket)) {\n return self::ORDER_STATE_INVALIDPAYMENT;\n }\n }" ]
[ "public function activateModules($modulesToActivate)\n {\n $this->clearModuleChain();\n\n // First load all needed config options before the module will be installed.\n $this->prepareModulesForActivation();\n foreach ($modulesToActivate as $modulePath) {\n $this->installMod...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
检验auth数组正确性 @param array @return null or die
[ "public function checkAuthArray($array)\n\t{\n\n\t\t//root\n\t\tif(array_has($array, 'root')){\n\t\t\tif(array_get($array, 'root') != 'only') {\n\t\t\t\tdie('FooWeChat\\Authorize\\Auth\\checkAuthArray: 参数 root 值错误');\n\t\t\t}\n\t\t}\n\n\t\t//admin\n\t\tif(array_has($array, 'admin')){\n\t\t\t$a = array_get($array, '...
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software Development:" }
Transliterate an Unicode object into an ASCII string. @param str Unicode String to transliterate. @return ASCII string.
[ "public static String decode(final String str) {\n\t\tif (str == null) {\n\t\t\treturn \"\";\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < str.length(); i++) {\n\t\t\tchar c = str.charAt(i);\n\t\t\tint codepoint = str.codePointAt(i);\n\t\t\t// Basic ASCII\n\t\t\tif (codepoint < 0x80) ...
[ "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:" }
Find the closest WApplication instance. @return the closest WApplication instance
[ "private WApplication findApplication() {\n\t\tWApplication appl = WApplication.instance(this);\n\n\t\tif (appl == null) {\n\t\t\tmessages.addMessage(new Message(Message.WARNING_MESSAGE,\n\t\t\t\t\t\"There is no WApplication available for this example.\"));\n\t\t}\n\n\t\treturn appl;\n\t}" ]
[ "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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// DeleteAssets implements github.com/keybase/go/chat/storage/storage.AssetDeleter interface.
[ "func (s *baseConversationSource) DeleteAssets(ctx context.Context, uid gregor1.UID,\n\tconvID chat1.ConversationID, assets []chat1.Asset) {\n\tdefer s.Trace(ctx, func() error { return nil }, \"DeleteAssets: %v\", assets)()\n\n\tif len(assets) == 0 {\n\t\treturn\n\t}\n\n\t// Fire off a background load of the thread...
[ "func Uninstall(context Context, components []string, log Log) keybase1.UninstallResult {\n\treturn keybase1.UninstallResult{}\n}" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Call multiple external functions and return all responses. @param array $requests List of requests. @return array Responses. @since Moodle 3.7
[ "public static function call_external_functions($requests) {\n global $SESSION;\n\n $params = self::validate_parameters(self::call_external_functions_parameters(), ['requests' => $requests]);\n\n // We need to check if the functions being called are included in the service of the current token....
[ "public static function createNotMerged(Envelope $envelope, \\Exception $e = null)\n {\n $message = 'The given DigiDoc envelope must be merged with Api (using Api::merge) before calling this method.';\n\n return new static($message, null, $e);\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about API documentation:" }
// Error can be either of the following types: // // - InvalidObjectFault // - RuntimeFault
[ "func (service *VboxPortType) IFilequeryInfo(request *IFilequeryInfo) (*IFilequeryInfoResponse, error) {\n\tresponse := new(IFilequeryInfoResponse)\n\terr := service.client.Call(\"\", request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Substitutes a free type variable with an actual type. See {@link GenericType this class's javadoc} for an example.
[ "@NonNull\n public final <X> GenericType<T> where(\n @NonNull GenericTypeParameter<X> freeVariable, @NonNull GenericType<X> actualType) {\n TypeResolver resolver =\n new TypeResolver().where(freeVariable.getTypeVariable(), actualType.__getToken().getType());\n Type resolvedType = resolver.resolve...
[ "@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 Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// SetMaxResults sets the MaxResults field's value.
[ "func (s *ListTopicRulesInput) SetMaxResults(v int64) *ListTopicRulesInput {\n\ts.MaxResults = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
//Initialize sets new logger which takes over logging operations. //It is required to call this function before making any loggings.
[ "func Initialize(l api.LoggerProvider) {\n\tloggerProviderOnce.Do(func() {\n\t\tloggerProviderInstance = l\n\t\tlogger := loggerProviderInstance.GetLogger(loggerModule)\n\t\tlogger.Debug(\"Logger provider initialized\")\n\n\t\t// TODO\n\t\t// use custom leveler implementation (otherwise fallback to default)\n\t\t//...
[ "func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Computer Science:" }
Returns temp path. @return string
[ "public function getTempDirectory()\n {\n if (!file_exists($this->tempDirectory)) {\n mkdir($this->tempDirectory, 0777);\n chmod($this->tempDirectory, 0777);\n }\n\n return $this->tempDirectory;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
this will retrieve the export object, using Linz's default export handler amongst custom export handlers this is based on the knowledge that only Linz's default export handler can have an `action` of `export` `exports` should be model.list.export
[ "function (exports) {\n\n var exp = undefined;\n\n // retrieve the export object\n exports.forEach(function (_export) {\n\n // Linz's default export function is called export\n if (_export.action && _export.action === 'export') {\n exp = _export;\n }\n\n });\n\n // if ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the type of the class a node is contained in Returns null if the class is anonymous or the node is not contained in a class @param Node $node The node used to find the containing class @return Types\Object_|null
[ "private function getContainingClassType(Node $node)\n {\n $classFqn = $this->getContainingClassFqn($node);\n return $classFqn ? new Types\\Object_(new Fqsen('\\\\' . $classFqn)) : null;\n }" ]
[ "@Override\n public void visitEnum(String targetMethodName,\n String enumerationTypeDescription,\n String enumerationLiteral) {\n\n if (tc.isDebugEnabled()) {\n Tr.debug(tc, MessageFormat.format(\"visitEnum [ {0} ] Name [ {1} ] Description [ {2}...
codesearchnet
{ "query": "Represent the Github instruction about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Redraw the series after an update in the axes.
[ "function () {\n var series = this,\n chart = series.chart,\n wasDirtyData = series.isDirtyData, // cache it here as it is set to false in render, but used after\n group = series.group,\n xAxis = series.xAxis,\n yAxis = series.yAxis;\n\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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Send a batch of messages :param str topic: a kafka topic :param ksr.transport.Message kmsgs: Messages to serialize :param int timeout: Timeout in seconds :return: Execution result :rtype: kser.result.Result
[ "def bulk_send(self, topic, kmsgs, timeout=60):\n \n\n try:\n for kmsg in kmsgs:\n self.client.send(\n topic, self._onmessage(kmsg).dumps().encode(\"UTF-8\")\n )\n self.client.flush(timeout=timeout)\n return Result(stdou...
[ "def get_value_from_content(key):\n \n def value_from_content_function(service, message):\n \"\"\"Actual implementation of get_value_from_content function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa...
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:" }
Returns common ancestor for paths represented by absolute path and pattern.
[ "public static String extractCommonAncestor(String pattern, String absPath)\n {\n pattern = normalizePath(pattern);\n absPath = normalizePath(absPath);\n\n String[] patterEntries = pattern.split(\"/\");\n String[] pathEntries = absPath.split(\"/\");\n\n StringBuilder ancestor = new String...
[ "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 comment about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
// Fill scales the image to the smallest possible size that will cover the specified dimensions, // crops the resized image to the specified dimensions using the given anchor point. // Space delimited config: 200x300 TopLeft
[ "func (i *Image) Fill(spec string) (*Image, error) {\n\treturn i.doWithImageConfig(\"fill\", spec, func(src image.Image, conf imageConfig) (image.Image, error) {\n\t\tif conf.AnchorStr == smartCropIdentifier {\n\t\t\treturn smartCrop(src, conf.Width, conf.Height, conf.Anchor, conf.Filter)\n\t\t}\n\t\treturn imaging...
[ "def _find_regular_images(container, contentsinfo):\n \n\n for pdfimage, xobj in _image_xobjects(container):\n\n # For each image that is drawn on this, check if we drawing the\n # current image - yes this is O(n^2), but n == 1 almost always\n for draw in contentsinfo.xobject_settings:\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
<p> Additional metadata about the event. </p> @param eventMetadata Additional metadata about the event. @return Returns a reference to this object so that method calls can be chained together.
[ "public EventDetails withEventMetadata(java.util.Map<String, String> eventMetadata) {\n setEventMetadata(eventMetadata);\n return this;\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 summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Get messagearea search users returns. @deprecated since 3.6 @return external_single_structure @since 3.2
[ "public static function data_for_messagearea_search_users_returns() {\n return new external_single_structure(\n array(\n 'contacts' => new external_multiple_structure(\n self::get_messagearea_contact_structure()\n ),\n 'courses' => ne...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Registers helpers accessible by any template in the environment @param string|array|object $name @param string|callable|bool $helper
[ "public function registerHelper($name, $helper = false)\n {\n if (is_array($name)) {\n foreach ($name as $n => $helper) {\n $this->registerHelper($n, $helper);\n }\n } elseif (is_object($name)) {\n $this->registerJavascriptObject('helper', $this->wrap...
[ "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:" }
Get a Jvm property / environment variable @param prop the property to get @return the property value
[ "public static String getJvmProperty(String prop) {\n return (System.getProperty(prop, System.getenv(prop)));\n }" ]
[ "private void loadConfigurationFiles() {\n\n // Parse the first annotation found (manage overriding)\n final Configuration conf = ClassUtility.getLastClassAnnotation(this.getClass(), Configuration.class);\n\n // Conf variable cannot be null because it was defined in this class\n // It's ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
//----------------------------------------
[ "func stripPrefix(key []byte, prefix []byte) (stripped []byte) {\n\tif len(key) < len(prefix) {\n\t\tpanic(\"should not happen\")\n\t}\n\tif !bytes.Equal(key[:len(prefix)], prefix) {\n\t\tpanic(\"should not happne\")\n\t}\n\treturn key[len(prefix):]\n}" ]
[ "public static function ws()\n {\n if (!isset(self::core()->soap)) {\n //====================================================================//\n // WEBSERVICE INITIALISATION\n //====================================================================//\n // Initial...
codesearchnet
{ "query": "Represent the description about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code:" }
URL组装(带域名端口) 支持不同URL模式 eg: \Cml\Http\Response::fullUrl('Home/Blog/cate/id/1') @param string $url URL表达式 路径/控制器/操作/参数1/参数1值/..... @param bool $echo 是否输出 true输出 false return @return string
[ "public static function fullUrl($url = '', $echo = true)\n {\n $url = Request::baseUrl() . self::url($url, false);\n if ($echo) {\n echo $url;\n return '';\n } else {\n return $url;\n }\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 text about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
// NewFxFooYARPCProcedures provides FooYARPCServer procedures to an Fx application. // It expects a FooYARPCServer to be present in the container. // // fx.Provide( // examplepb.NewFxFooYARPCProcedures(), // ... // )
[ "func NewFxFooYARPCProcedures() interface{} {\n\treturn func(params FxFooYARPCProceduresParams) FxFooYARPCProceduresResult {\n\t\treturn FxFooYARPCProceduresResult{\n\t\t\tProcedures: BuildFooYARPCProcedures(params.Server),\n\t\t\tReflectionMeta: reflection.ServerMeta{\n\t\t\t\tServiceName: \"uber.yarpc.interna...
[ "func NewProtoWrapperWithSerializer(db keyval.CoreBrokerWatcher, serializer keyval.Serializer) *ProtoWrapper {\n\t// OBSOLETE, use NewProtoWrapper\n\treturn NewProtoWrapper(db, serializer)\n}" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Through will check if we should fallthrough for qname. Note that we've named the // variable in each plugin "Fall", so this then reads Fall.Through().
[ "func (f F) Through(qname string) bool {\n\treturn plugin.Zones(f.Zones).Matches(qname) != \"\"\n}" ]
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
singelton constructor @param mixed $database @return Pool
[ "public static function getInstance($database = null)\n {\n\n if (self::$instance instanceof Pool) {\n self::$instance->add($database);\n\n return self::$instance;\n }\n\n self::$instance = new Pool($database);\n\n return self::$instance;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Method to deserialize the BatchItemResponse object @param jsonNode the json node @return BatchItemResponse the batch item response
[ "private BatchItemResponse getBatchItemResponse(JsonNode jsonNode) throws IOException {\n\t\tObjectMapper mapper = new ObjectMapper();\n\n\t\tSimpleModule simpleModule = new SimpleModule(\"BatchItemResponseDeserializer\", new Version(1, 0, 0, null));\n\t\tsimpleModule.addDeserializer(BatchItemResponse.class, new Ba...
[ "def processRequest(cls, ps, **kw):\n \n resource = kw['resource']\n method = resource.getOperation(ps, None) # This getOperation method is valid for ServiceSOAPBinding subclass\n rsp = method(ps, **kw)[1] # return (request, response) but we only need response\n return rsp" ]
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Computer Science:" }
/* (non-Javadoc) @see sfdc.adt.IParser#parse(java.lang.String, java.io.Reader)
[ "@Override\n public ParseResult parse(final Source source) {\n return Util.execute(new ExceptionAction<ParseResult>() {\n @Override\n public ParseResult doAction() throws Throwable {\n logger.fine(\"Parsing \" + source.getSrcInfo());\n final BufferedRead...
[ "def custom_properties(self, props):\n \n fprops = javabridge.make_instance(\"java/io/File\", \"(Ljava/lang/String;)V\", props)\n javabridge.call(self.jobject, \"setCustomPropsFile\", \"(Ljava/io/File;)V\", fprops)" ]
codesearchnet
{ "query": "Represent the comment about Data parsing:", "pos": "Represent the code about Data parsing:", "neg": "Represent the code:" }
Adds the false positive to description and changes severity to low
[ "def _set_internal_compiler_error(self):\n \n self.severity = \"Low\"\n self.description_tail += (\n \" This issue is reported for internal compiler generated code.\"\n )\n self.description = \"%s\\n%s\" % (self.description_head, self.description_tail)\n self.cod...
[ "def output(ret, bar, **kwargs): # pylint: disable=unused-argument\n '''\n \n '''\n if 'return_count' in ret:\n val = ret['return_count']\n # Avoid to fail if targets are behind a syndic. In this case actual return count will be\n # higher than targeted by MoM itself.\n # TO...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :param container: :return:
[ "async def _load_container(\n self, reader, container_type, params=None, container=None\n ):\n \n\n c_len = (\n container_type.SIZE\n if container_type.FIX_SIZE\n else await load_uvarint(reader)\n )\n if container and get_elem(container) and...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns a valid timeout value. Non positive values are converted to null, meaning no timeout. @return float|null @throws \InvalidArgumentException
[ "private function getTimeout(): ?float\n {\n if (! is_numeric($this->option('timeout'))) {\n throw new \\InvalidArgumentException('The timeout value must be a number.');\n }\n\n $timeout = (float) $this->option('timeout');\n\n return $timeout > 0 ? $timeout : null;\n }" ...
[ "public void setLog(String log) throws ApplicationException {\n\tif (StringUtil.isEmpty(log, true)) return;\n\tthis.log = log.trim();\n\t// throw new ApplicationException(\"invalid value for attribute log [\"+log+\"]\",\"valid values are\n\t// [application, scheduler,console]\");\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// nodePathLock returns an etcd directory path used specifically for semaphore // indices based on the given key.
[ "func (b *Etcd2Backend) nodePathLock(key string) string {\n\treturn filepath.Join(b.path, filepath.Dir(key), Etcd2NodeLockPrefix+filepath.Base(key)+\"/\")\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Stops the profiling. @param StopwatchEvent $event A stopwatchEvent instance
[ "protected function stopProfiling(StopwatchEvent $event = null)\n {\n if ($this->stopwatch instanceof Stopwatch) {\n $event->stop();\n\n $values = [\n 'duration' => $event->getDuration(),\n 'memory_end' => memory_get_usage(true),\n 'me...
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// DestinationAddress returns the "destination address" field of the ipv6 // header.
[ "func (b IPv6) DestinationAddress() tcpip.Address {\n\treturn tcpip.Address(b[v6DstAddr : v6DstAddr+IPv6AddressSize])\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 Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Releases a named lock. @param string $lockName The lock name. @return bool `true` if the lock was released, `false` if otherwise.
[ "public static function releaseDbLock($lockName)\n {\n $sql = 'SELECT RELEASE_LOCK(?)';\n\n $db = self::get();\n return $db->fetchOne($sql, array($lockName)) == '1';\n }" ]
[ "function Value(payload) {\n\n var path = payload.path;\n\n /**\n @property {string} key The string representation of the Key (read-only).\n @memberof Value\n @instance\n @name key\n */\n this.key = path.join(\".\");\n\n /**\n @property {boolean} exists A boolean value that indic...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetPath sets the Path field's value.
[ "func (s *CreateGroupInput) SetPath(v string) *CreateGroupInput {\n\ts.Path = &v\n\treturn s\n}" ]
[ "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 summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Check or set if we have recieved an exit request @param bool $requested Have we received the request? (optional). @return current exit request status
[ "public function received_exit_request($requested = null)\n\t{\n\t\t// if we are retreiving the value of the exit request\n\t\tif ($requested === null)\n\t\t{\n\t\t\treturn $this->exit_request_status;\n\t\t}\n\n\t\t// ensure we have good data, or set to false if not\n\t\tif (!is_bool($requested))\n\t\t{\n\t\t\t$req...
[ "def set_payload_format(self, payload_format):\n \n request = {\n \"command\": \"payload_format\",\n \"format\": payload_format\n }\n status = self._check_command_response_status(request)\n # Always change the format regardless because if it was already in th...
codesearchnet
{ "query": "Represent the sentence about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Programming:" }
Adds rules from the module/config/routes.php file @return
[ "private function addModuleRules()\n\t{\n\t\t// Load the routes from cache\n\t\t$moduleRoutes = array();\n\t\t$directories = glob(Yii::getPathOfAlias('application.modules') . '/*' , GLOB_ONLYDIR);\n\n\t\tforeach ($directories as $dir)\n\t\t{\n\t\t\t$routePath = $dir .DS. 'config' .DS. 'routes.php';\n\t\t\tif (file_...
[ "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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// Select allows to query only fields passed as parameter. // c.Select("field1", "field2").All(&model) // => SELECT field1, field2 FROM models
[ "func (q *Query) Select(fields ...string) *Query {\n\tfor _, f := range fields {\n\t\tif strings.TrimSpace(f) != \"\" {\n\t\t\tq.addColumns = append(q.addColumns, f)\n\t\t}\n\t}\n\treturn q\n}" ]
[ "func (user *User) Home(options PostlistOptions) *[]Message {\n\tvar message Message\n\tquery := Db().\n\t\tCTE(`WITH blist AS (SELECT \"to\" FROM blacklist WHERE \"from\" = ?)`, user.ID()). // WITH cte\n\t\tTable(message.TableName()). // select * from messages\n\t...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Check whether an element is outside of all hidden selectors. @private @param {Object} issue - The issue to check. @returns {Boolean} Returns whether the issue is outside of a hidden area.
[ "function isElementOutsideHiddenArea(issue) {\n\t\t\tconst hiddenElements = [...window.document.querySelectorAll(options.hideElements)];\n\t\t\treturn !hiddenElements.some(hiddenElement => {\n\t\t\t\treturn hiddenElement.contains(issue.element);\n\t\t\t});\n\t\t}" ]
[ "function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }