query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Because any rotation can be expressed within 360 degrees of any given number, and since negative angles sometimes are one character longer than corresponding positive angle, we shorten the number to one in the range to [-90, 270[.
[ "def optimizeAngle(angle):\n \n # First, we put the new angle in the range ]-360, 360[.\n # The modulo operator yields results with the sign of the\n # divisor, so for negative dividends, we preserve the sign\n # of the angle.\n if angle < 0:\n angle %= -360\n else:\n angle %= 360...
[ "def _calculate_index_of_coincidence(frequency_map, length):\n \n if length <= 1:\n return 0\n # We cannot error here as length can legitimiately be 1.\n # Imagine a ciphertext of length 3 and a key of length 2.\n # Spliting this text up and calculating the index of coincidence res...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns a list of all media from all library sections. This may be a very large dataset to retrieve.
[ "def all(self, **kwargs):\n \n items = []\n for section in self.sections():\n for item in section.all(**kwargs):\n items.append(item)\n return items" ]
[ "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 description about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Requires: account ID (taken from Client object) Returns: a list of Server objects Endpoint: api.newrelic.com Errors: 403 Invalid API Key Method: Get
[ "def view_servers(self):\n \n endpoint = \"https://api.newrelic.com\"\n uri = \"{endpoint}/api/v1/accounts/{id}/servers.xml\".format(endpoint=endpoint, id=self.account_id)\n response = self._make_get_request(uri)\n servers = []\n\n for server in response.findall('.//server'...
[ "def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Extract config from dataSource nodes. @param {Node} node @return {Object} @private
[ "function getDataSource(node) {\n const config = Object.assign({}, copyXmlAttributes(node));\n\n if (node.childNodes.length) {\n // parse datasource options\n for (let i = 0; i < node.childNodes.length; ++i) {\n const childNode = node.childNodes.item(i);\n\n if (childNode.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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Generates a solver vector of a clause. @param clause the clause @return the solver vector
[ "private LNGIntVector generateClauseVector(final Formula clause) {\n final LNGIntVector clauseVec = new LNGIntVector(clause.numberOfOperands());\n for (final Literal lit : clause.literals()) {\n int index = this.idxForName(lit.name());\n if (index == -1) {\n index ...
[ "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 Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Natural Language Processing:" }
Updates the item with the new data value. :param editor | <QtGui.QWidget> model | <QtGui.QModel> index | <QtGui.QModelIndex>
[ "def setModelData(self, editor, model, index):\r\n \r\n value = editor.currentText()\r\n model.setData(index, wrapVariant(value))" ]
[ "def handleThumbDblClick( self, item ):\r\n \r\n if ( isinstance(item, RecordListWidgetItem) ):\r\n self.emitRecordDoubleClicked(item.record())" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Set the LineRoundLimit property <p> Used to automatically convert round joins to miter joins for shallow angles. </p> @param value property wrapper value around Float
[ "public void setLineRoundLimit( Float value) {\n PropertyValue propertyValue = lineRoundLimit(value);\n constantPropertyUsageMap.put(PROPERTY_LINE_ROUND_LIMIT, propertyValue);\n layer.setProperties(propertyValue);\n }" ]
[ "def createPenWidthCti(nodeName, defaultData=1.0, zeroValueText=None):\n \n # A pen line width of zero indicates a cosmetic pen. This means that the pen width is\n # always drawn one pixel wide, independent of the transformation set on the painter.\n # Note that line widths other than 1 may be slow when...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Concatenate values of a given key as a string. @param string $value @param string $glue @return string
[ "public function implode($value, $glue = null)\n\t{\n\t\tif (is_null($glue)) return implode($this->lists($value));\n\n\t\treturn implode($glue, $this->lists($value));\n\t}" ]
[ "protected function _matchColumnString($column)\n {\n $matches = [];\n if (!preg_match('/^([\\w\\.]+)(:(\\w*))?(:(.*))?$/', $column, $matches)) {\n throw new InvalidConfigException(\\Yii::t('skeeks/cms',\n \"Invalid column configuration for '{column}'. The column must be s...
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:" }
Monitor the original element for changes and update select2 accordingly abstract
[ "function () {\n var el = this.opts.element, observer, self = this;\n\n el.on(\"change.select2\", this.bind(function (e) {\n if (this.opts.element.data(\"select2-change-triggered\") !== true) {\n this.initSelection();\n }\n }));\n\n ...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Next assigns the next result from the results into the value pointer, returning whether the read was successful.
[ "func (r *SearchResults) Next(hitPtr *SearchResultHit) bool {\n\tif r.err != nil {\n\t\treturn false\n\t}\n\n\trow := r.NextBytes()\n\tif row == nil {\n\t\treturn false\n\t}\n\n\tr.err = json.Unmarshal(row, hitPtr)\n\tif r.err != nil {\n\t\treturn false\n\t}\n\n\treturn true\n}" ]
[ "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 Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about File management:" }
Auxiliary method for getting errors in nested entities @param string $field the field in this entity to check for errors @return array errors in nested entity if any
[ "protected function _nestedErrors($field)\n {\n $path = explode('.', $field);\n\n // Only one path element, check for nested entity with error.\n if (count($path) === 1) {\n return $this->_readError($this->get($path[0]));\n }\n\n $entity = $this;\n $len = coun...
[ "def filter_connec_entity_for_id_refs(connec_entity, id_references)\n return {} if id_references.empty?\n\n entity = connec_entity.dup.with_indifferent_access\n tree = build_id_references_tree(id_references)\n\n filter_connec_entity_for_id_refs_helper(entity, tree)\n\n # TODO, improve perfo...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// findVerifiedParents attempts to find certificates in s which have signed the // given certificate. If any candidates were rejected then errCert will be set // to one of them, arbitrarily, and err will contain the reason that it was // rejected.
[ "func (s *CertPool) findVerifiedParents(cert *Certificate) (parents []int, errCert *Certificate, err error) {\n\tif s == nil {\n\t\treturn\n\t}\n\tvar candidates []int\n\n\tif len(cert.AuthorityKeyId) > 0 {\n\t\tcandidates = s.bySubjectKeyId[string(cert.AuthorityKeyId)]\n\t}\n\tif len(candidates) == 0 {\n\t\tcandid...
[ "func ErrToRejectErr(err error) (wire.RejectCode, string) {\n\t// Return the reject code along with the error text if it can be\n\t// extracted from the error.\n\trejectCode, found := extractRejectCode(err)\n\tif found {\n\t\treturn rejectCode, err.Error()\n\t}\n\n\t// Return a generic rejected string if there is n...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Appends a task message to the buffer. @param sourceHSId @param task @throws IOException If the buffer is not of the type TASK @return how many bytes are left in this buffer for adding a new task
[ "public int appendTask(long sourceHSId, TransactionInfoBaseMessage task) throws IOException {\n Preconditions.checkState(compiledSize == 0, \"buffer is already compiled\");\n\n final int msgSerializedSize = task.getSerializedSize();\n ensureCapacity(taskHeaderSize() + msgSerializedSize);\n\n ...
[ "void writeRecord(EngineOutputRecord eor) throws IOException {\n // eventually compress as well.\n writer.writeRecord(eor, writeMAC, writeCipher);\n\n /*\n * Check the sequence number state\n *\n * Note that in order to maintain the connection I/O\n * properly, w...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
taobao.product.add 上传一个产品,不包括产品非主图和属性图片 获取类目ID,必需是叶子类目ID;调用taobao.itemcats.get.v2获取 传入关键属性,结构:pid:vid;pid:vid.调用taobao.itemprops.get.v2获取pid, 调用taobao.itempropvalues.get获取vid;如果碰到用户自定义属性,请用customer_props.
[ "def add(self, cid, price, image, name, desc, major, market_time, property_alias, session, **kwargs):\n ''''''\n request = TOPRequest('taobao.product.add')\n request['cid'] = cid\n request['price'] = price\n request['image'] = image\n request['name'] = name\n request...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
得到分词结果 List,不进行断句 @param src 字符串 @return ArrayList&lt;String&gt; 词数组,每个元素为一个词
[ "public ArrayList<String> tag2List(String src) {\r\n\t\tif(src==null||src.length()==0)\r\n\t\t\treturn null;\r\n\t\tArrayList<String> res =null;\r\n\t\ttry {\r\n\t\t\tInstance inst = new Instance(src);\r\n\t\t\tString[] preds = _tag(inst);\r\n\t\t\tres = FormatCWS.toList(inst, preds);\r\n\t\t} catch (Exception e) ...
[ "protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------...
codesearchnet
{ "query": "Represent the comment about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about text processing:" }
// parsePositionalArguments tries to parse the given args to an array of values with the // given types. It returns the parsed values or an error when the args could not be // parsed. Missing optional arguments are returned as reflect.Zero values.
[ "func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]reflect.Value, error) {\n\tdec := json.NewDecoder(bytes.NewReader(rawArgs))\n\tvar args []reflect.Value\n\ttok, err := dec.Token()\n\tswitch {\n\tcase err == io.EOF || tok == nil && err == nil:\n\t\t// \"params\" is optional and may be...
[ "def generate(options, command: nil)\n # First, enable `always_trace`, to show the stack trace\n always_trace!\n\n used_switches = []\n options.each do |option|\n next if option.description.to_s.empty? # \"private\" options\n next unless option.display_in_shell\n\n short_swi...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
@param string $verb @param string $location @return Response @throws EntityException
[ "protected function sendApiCall($verb, $location)\n {\n try {\n $this->detectInvalidJsonFields();\n $response = $this->client->sendRequest($verb, $location, $this->postFields);\n\n $entity = $this->getItems($response->getBody());\n if (isset($entity[0])) {\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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
// Reset resets the count of all buckets.
[ "func (w *window) Reset() {\n\tw.bucketLock.Lock()\n\n\tw.buckets.Do(func(x interface{}) {\n\t\tx.(*bucket).Reset()\n\t})\n\tw.bucketLock.Unlock()\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
List all Galleries Example Usage: - require 'kairos' - client = Kairos::Client.new(:app_id => '1234', :app_key => 'abcde1234') - client.gallery_list_all
[ "def gallery_list_all\n # ToDo: Research why Typhoeus works better than Faraday for this endpoint\n request = Typhoeus::Request.new(\n \"#{Kairos::Configuration::GALLERY_LIST_ALL}\",\n method: :post,\n headers: { \"Content-Type\" => \"application/x-www-form-urlencoded\",\n ...
[ "def authenticate_with_access_token(access_token):\n \"\"\"\"\"\"\n credentials = Credentials(access_token=access_token)\n client = YamcsClient('localhost:8090', credentials=credentials)\n\n for link in client.list_data_links('simulator'):\n print(link)" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Allows setting HTTP headers to be used for each request. class Foo include HTTParty headers 'Accept' => 'text/html' end
[ "def headers(h = nil)\n if h\n raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)\n default_options[:headers] ||= {}\n default_options[:headers].merge!(h.to_hash)\n else\n default_options[:headers] || {}\n end\n en...
[ "def request(uri, method = :get, body = nil, query = nil, content_type = nil)\n headers = {}\n\n {\n 'Content-Type' => content_type || 'application/json',\n 'User-Agent' => \"Parse for Ruby, #{VERSION}\",\n Protocol::HEADER_MASTER_KEY => @master...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about software development:" }
{@inheritDoc} @see \Symfony\Component\Translation\Loader\LoaderInterface::load()
[ "public function load($resource, $locale, $domain = 'messages') {\n\t\t$repo = $this->service->getResourceRepository();\n\t\tif (!$repo->contains($resource)) {\n\t\t\tthrow new NotFoundResourceException(sprintf('File \"%s\" not found.', $resource));\n\t\t}\n\n\t\t// find file in puli repo\n\t\t$file = $repo->get($r...
[ "public function objectMethods($builder)\n {\n $array = $this->getParameters();\n if (empty($array)) {\n throw new InvalidArgumentException('Please, define your rules for validation.');\n }\n $this->cleanupParameters();\n\n $this->builder = $builder;\n $this->...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
CPU information @return void
[ "protected function cpuinfo()\n {\n $dev = new CpuDevice();\n\n if (PSI_OS == \"NetBSD\") {\n if ($model = $this->grabkey('machdep.cpu_brand')) {\n $dev->setModel($model);\n }\n if ($cpuspeed = $this->grabkey('machdep.tsc_freq')) {\n $dev...
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// initLogRotator initializes the logging rotater to write logs to logFile and // create roll files in the same directory. It must be called before the // package-global log rotater variables are used.
[ "func initLogRotator(logFile string) {\n\tlogDir, _ := filepath.Split(logFile)\n\terr := os.MkdirAll(logDir, 0700)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to create log directory: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tr, err := rotator.New(logFile, 10*1024, false, 3)\n\tif err != nil {\n\t\tfmt.Fpri...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
collapse logically equivalent lt/lte values
[ "function mergeLtLte(operator, value, fieldMatchers) {\n if (typeof fieldMatchers.$eq !== 'undefined') {\n return; // do nothing\n }\n if (typeof fieldMatchers.$lte !== 'undefined') {\n if (operator === '$lte') {\n if (value < fieldMatchers.$lte) { // more specificity\n fieldMatchers.$lte = val...
[ "def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Create a new Map typed path @param <K> @param <V> @param property property name @param key key type @param value value type @return property path
[ "public <K, V> MapPath<K, V, PathBuilder<V>> getMap(String property, Class<K> key, Class<V> value) {\n return this.<K, V, PathBuilder<V>>getMap(property, key, value, PathBuilder.class);\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Returns a builder for an {@code InsertAllRequest} object given the destination table and the rows to insert.
[ "public static Builder newBuilder(String datasetId, String tableId, Iterable<RowToInsert> rows) {\n return newBuilder(TableId.of(datasetId, tableId), rows);\n }" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Set global default encoding @param string $encoding
[ "public static function setDefaultEncoding($encoding=null)\n {\n if(!is_null($encoding) && is_string($encoding) && !empty($encoding))\n {\n self::$defaultencoding = $encoding;\n }\n else\n {\n self::$defaultencoding = null;\n }\n }" ]
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
* Restore reading from a certain row/sheet position and restore schema without rereadingit. @param split @param state @throws IOException
[ "public void reopen(FileInputSplit split, Tuple3<Long, Long, GenericDataType[]> state) throws IOException {\n\t\tthis.customSchema = state.f2;\n\t\tthis.open(split);\n\t\tthis.getOfficeReader().getCurrentParser().setCurrentSheet(state.f0);\n\t\tthis.getOfficeReader().getCurrentParser().setCurrentRow(state.f1);\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 text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Run this section and print out information.
[ "def run(self):\n \"\"\"\"\"\"\n if self.mloginfo.logfile.repl_set:\n print(\" rs name: %s\" % self.mloginfo.logfile.repl_set)\n print(\" rs members: %s\"\n % (self.mloginfo.logfile.repl_set_members\n if self.mloginfo.logfile.repl_set_membe...
[ "protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Data synchronization:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@Override\r\n\tpublic EEnum getIfcUnitaryEquipmentTypeEnum() {\r\n\t\tif (ifcUnitaryEquipmentTypeEnumEEnum == null) {\r\n\t\t\tifcUnitaryEquipmentTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(1096);\r\n\t\t}\r\n\t\treturn ifcUnitaryEquipment...
[ "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 text about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
// Set mocks base method
[ "func (m *MockVolumeDriver) Set(arg0 string, arg1 *api.VolumeLocator, arg2 *api.VolumeSpec) error {\n\tret := m.ctrl.Call(m, \"Set\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Works like Symbol.__str__(), but allows a custom format to be used for all symbol/choice references. See expr_str().
[ "def custom_str(self, sc_expr_str_fn):\n \n return \"\\n\\n\".join(node.custom_str(sc_expr_str_fn)\n for node in self.nodes)" ]
[ "def write_repr(self, out, visited):\n '''\n \n '''\n # Default implementation: generate a proxy value and write its repr\n # However, this could involve a lot of work for complicated objects,\n # so for derived classes we specialize this\n return out.write(repr(self...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Computer Science:" }
// ParseJSONFile - Read a file and convert into a representation of the parsed JSON.
[ "func ParseJSONFile(path string) (*Container, error) {\n\tif len(path) > 0 {\n\t\tcBytes, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcontainer, err := ParseJSON(cBytes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn container, nil\n\t}\n\treturn nil, Err...
[ "@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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// CreateOverlayPATNATEntry creates a new child OverlayPATNATEntry under the OverlayAddressPool
[ "func (o *OverlayAddressPool) CreateOverlayPATNATEntry(child *OverlayPATNATEntry) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}" ]
[ "@Override\n public void perform() throws PortalException {\n // push the change into the PLF\n if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {\n // remove the parm edit\n ParameterEditManager.removeParmEditDirective(nodeId, name, person);\n }\n // pu...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return MD5 Checksum
[ "def md5(source):\n \n # fix passing char '+' from source\n source = source.replace(\"%2B\", \"+\")\n with open(source) as file_to_check:\n data = file_to_check.read()\n return hashlib.md5(data).hexdigest()" ]
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// IsSorted checks whether a slice of KSUIDs is sorted
[ "func IsSorted(ids []KSUID) bool {\n\tif len(ids) != 0 {\n\t\tmin := ids[0]\n\t\tfor _, id := range ids[1:] {\n\t\t\tif bytes.Compare(min[:], id[:]) > 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tmin = id\n\t\t}\n\t}\n\treturn true\n}" ]
[ "function _parseVertex(line) {\n var vertex = JSON.parse(line);\n assert.ok(_smellsLikeAnElement(vertex));\n // A vertex is an object, i.e. a key,value map.\n // We don't sort the keys of the object, leaving that to jsonStableStringify below.\n // But a vertex values contain `prop...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Return a json dictionary representing this model.
[ "def _to_dict(self):\n \"\"\"\"\"\"\n _dict = {}\n if hasattr(self, 'overwrite') and self.overwrite is not None:\n _dict['overwrite'] = self.overwrite\n return _dict" ]
[ "@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:" }
Set sort field and direction @param string $field Field name @param string $direction Sort direction @param int $priority Priority @return self
[ "public function addSort($field = 'time_created', $direction = 'DESC', $priority = 500) {\n\n\t\tif (!$field || !$direction) {\n\t\t\treturn $this;\n\t\t}\n\n\t\twhile (isset($this->sorts[$priority])) {\n\t\t\t$priority++;\n\t\t}\n\n\t\t$field = sanitize_string($field);\n\t\t$direction = strtoupper(sanitize_string(...
[ "public function getStoreValue($data = null)\n {\n\n // If Overrite Value\n if (isset($this->value) && $this->overwriteValue) {\n return $this->value;\n }\n\n // If user have user input value\n if ($data != null && isset($data[$this->getName()])) {\n\n // ...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns an ``int`` of the total number of two point field goals the player attempted during the season.
[ "def two_point_attempts(self):\n \n if self.field_goal_attempts and self.three_point_attempts:\n return int(self.field_goal_attempts - self.three_point_attempts)\n # Occurs when the player didn't take any three pointers, so the number\n # of two pointers the player took is equ...
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// SetParallelismPerKPU sets the ParallelismPerKPU field's value.
[ "func (s *ParallelismConfigurationDescription) SetParallelismPerKPU(v int64) *ParallelismConfigurationDescription {\n\ts.ParallelismPerKPU = &v\n\treturn s\n}" ]
[ "public void setLossVariables(String... lossVariableNames){\n this.lossVariables.clear();\n for(String s : lossVariableNames){\n addLossVariable(s);\n }\n //After changing loss function variables, we (probably) need to recreate gradient function - as gradient\n // funct...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Called when the signed in status changes, to update the UI appropriately. After a sign-in, the API is called.
[ "function updateSigninStatus(isSignedIn) {\n\tif (isSignedIn) {\n\t\tauthorizeButton.style.display = 'none';\n\t\tsignoutButton.style.display = 'block';\n\t\tlistFiles();\n\t} else {\n\t\tauthorizeButton.style.display = 'block';\n\t\tsignoutButton.style.display = 'none';\n\t}\n}" ]
[ "function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetMaxRecords sets the MaxRecords field's value.
[ "func (s *DescribeSchemasInput) SetMaxRecords(v int64) *DescribeSchemasInput {\n\ts.MaxRecords = &v\n\treturn s\n}" ]
[ "def from_bucket(cls, connection, bucket):\n \"\"\"\"\"\"\n if bucket is None:\n raise errors.NoContainerException\n\n # It appears that Amazon does not have a single-shot REST query to\n # determine the number of keys / overall byte size of a bucket.\n return cls(conne...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about AWS S3:" }
Sync the requested folders and files. @return bool
[ "public function syncSharedFolders()\n {\n $shared = (array) $this->config->getContextually('remote.shared');\n foreach ($shared as &$file) {\n $this->share($file);\n }\n\n return true;\n }" ]
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
List all RepositoryConfigurations
[ "def list_repository_configurations(page_size=200, page_index=0, sort=\"\", q=\"\"):\n \n response = utils.checked_api_call(pnc_api.repositories, 'get_all', page_size=page_size, page_index=page_index, sort=sort, q=q)\n if response:\n return utils.format_json_list(response.content)" ]
[ "public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) {\n return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);\n }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// NewPerBuildConfigResolver returns a Resolver that selects Builds to prune per BuildConfig
[ "func NewPerBuildConfigResolver(dataSet DataSet, keepComplete int, keepFailed int) Resolver {\n\treturn &perBuildConfigResolver{\n\t\tdataSet: dataSet,\n\t\tkeepComplete: keepComplete,\n\t\tkeepFailed: keepFailed,\n\t}\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 comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Remove the complete fragment and show an empty form fragment
[ "public void reset() {\n fileLink = null;\n formFragment = new FormFragment();\n getSupportFragmentManager()\n .beginTransaction()\n .replace(R.id.root, formFragment)\n .commit();\n }" ]
[ "@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Create a user and assign roles to it. @param array $data @param array $users
[ "public function createWithUsers(array $data, $users)\n {\n $role = $this->create((array) $data);\n\n if (! empty($users)) {\n $role->users()->attach($users);\n }\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Erstellt eine neue Methode @return GMethod
[ "public function createMethod($name, $params = array(), $body = NULL, $modifiers = 256) {\n $method = $this->class->createMethod($name, $params, $body, $modifiers);\n $method->setClassBuilder($this);\n return $method;\n }" ]
[ "@Override\n public GeldbetragFactory getFactory() {\n return new GeldbetragFactory().setCurrency(currency).setNumber(betrag).setContext(context);\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the corrections applied to a particular entry. Args: entry: A ComputedEntry object. Returns: ({correction_name: value})
[ "def get_corrections_dict(self, entry):\n \n corrections = {}\n for c in self.corrections:\n val = c.get_correction(entry)\n if val != 0:\n corrections[str(c)] = val\n return corrections" ]
[ "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 comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
@param \Laravel\Nova\Resource $resource @return array
[ "public function indexFields(Resource $resource): array\n {\n return $this->resourceFields($resource)->map(function (Field $field) {\n if (!$field->computed()) {\n return $field->attribute;\n }\n\n return $field->name;\n })->unique()->all();\n }" ]
[ "public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Gets the default set of OAuth1.0a headers.
[ "func headers(consumerKey string) map[string]string {\n\treturn map[string]string{\n\t\t\"oauth_consumer_key\" : consumerKey,\n\t\t\"oauth_nonce\" : nonce(),\n\t\t\"oauth_signature_method\" : \"HMAC-SHA1\",\n\t\t\"oauth_timestamp\" : timestamp(),\n\t\t\"oauth_version\" : \"1.0\",\n\t}...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// SetSnapshotName sets the SnapshotName field's value.
[ "func (s *DeleteApplicationSnapshotInput) SetSnapshotName(v string) *DeleteApplicationSnapshotInput {\n\ts.SnapshotName = &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:" }
Returns a JSON response with a callback wrapper, if asked for. Consider using CORS instead, as JSONP makes the client app insecure. See the :func:`~coaster.views.decorators.cors` decorator.
[ "def jsonp(*args, **kw):\n \n data = json.dumps(dict(*args, **kw), indent=2)\n callback = request.args.get('callback', request.args.get('jsonp'))\n if callback and __jsoncallback_re.search(callback) is not None:\n data = callback + u'(' + data + u');'\n mimetype = 'application/javascript'\...
[ "def webhook_handler(request):\n \n body = request.stream.read().decode('utf8')\n print('webhook handler saw:', body)\n api.notify_webhook_received(payload=body)\n\n # nb. protected references are not part of the API.\n # this is just to demonstrate that the asyncid is stored\n print('key store...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
-----------------------------------------------------------------------
[ "@Override\n public List<ProviderAccount> listProviderAccounts(String url,\n String username,\n String password) {\n return duraCloudDao.listProviderAccounts(url, username, password);\n }" ]
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the instruction about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code:" }
Check security features of an ELF file.
[ "def checksec_app(_parser, _, args): # pragma: no cover\n \n\n import sys\n import argparse\n import csv\n import os.path\n\n def checksec(elf, path, fortifiable_funcs):\n relro = 0\n nx = False\n pie = 0\n rpath = False\n runpath = False\n\n for header i...
[ "func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Unmounts all bind mounts identified by :func:`find_bindmounts`
[ "def unmount_bindmounts(self):\n \"\"\"\"\"\"\n\n for mountpoint in self.find_bindmounts():\n _util.clean_unmount(['umount'], mountpoint, rmdir=False)" ]
[ "def lifecycle_lock(self):\n \"\"\"\"\"\"\n safe_mkdir(self._metadata_base_dir)\n return OwnerPrintingInterProcessFileLock(\n # N.B. This lock can't key into the actual named metadata dir (e.g. `.pids/pantsd/lock`\n # via `ProcessMetadataManager._get_metadata_dir_by_name()`) because of a need to ...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// getImageStreamTagMarker will return the appropriate marker for when a BuildConfig is missing its input ImageStreamTag
[ "func getImageStreamTagMarker(g osgraph.Graph, f osgraph.Namer, bcInputNode graph.Node, imageStreamNode graph.Node, tagNode *imagegraph.ImageStreamTagNode, bcNode graph.Node) osgraph.Marker {\n\treturn osgraph.Marker{\n\t\tNode: bcNode,\n\t\tRelatedNodes: []graph.Node{bcInputNode,\n\t\t\timageStreamNode},\n\t\tSeve...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// statsSegmentsLOCKED retrieves stats related to segments.
[ "func (m *collection) statsSegmentsLOCKED(rv *CollectionStats) {\n\tvar sssDirtyTop *SegmentStackStats\n\tvar sssDirtyMid *SegmentStackStats\n\tvar sssDirtyBase *SegmentStackStats\n\tvar sssClean *SegmentStackStats\n\n\tif m.stackDirtyTop != nil {\n\t\tsssDirtyTop = m.stackDirtyTop.Stats()\n\t}\n\n\tif m.stackDirty...
[ "public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return the number of jobs in various waiting states
[ "def n_waiting(self):\n \"\"\"\"\"\"\n return self._counters[JobStatus.no_job] +\\\n self._counters[JobStatus.unknown] +\\\n self._counters[JobStatus.not_ready] +\\\n self._counters[JobStatus.ready]" ]
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
match @param string $pattern @param string $string @param string|null $option @param string|null $encoding @return bool
[ "public static function match($pattern, $string, $option = 'msr', $encoding = null)\n {\n $encoding = $encoding === null ? mb_internal_encoding() : $encoding;\n\n $encodingBackup = mb_regex_encoding();\n\n mb_regex_encoding($encoding);\n\n $result = mb_ereg_match($pattern, $string, $o...
[ "public function pregGet( string$pattern, /*int|string*/$match=0 ):string\n\t{\n\t\tpreg_match($pattern,ltrim($this->content,\"\\t\"),$matches);\n\t\treturn $matches[$match]??'';\n\t}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Makes an spatial shape representing the time range defined by the two specified dates. @param from the start {@link Date} @param to the end {@link Date} @return a shape
[ "public NRShape makeShape(Date from, Date to) {\n UnitNRShape fromShape = tree.toUnitShape(from);\n UnitNRShape toShape = tree.toUnitShape(to);\n return tree.toRangeShape(fromShape, toShape);\n }" ]
[ "function Controller(ngeoWMSTime) {\n\n /**\n * @type {import(\"ngeo/misc/WMSTime.js\").WMSTime}\n * @private\n */\n this.ngeoWMSTime_ = ngeoWMSTime;\n\n /**\n * Function called after date(s) changed/selected\n * @type {Function}\n */\n this.onDateSelected = () => undefined;\n\n\n /**\n * A time ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return the information returned when the specified job id was executed
[ "def get_jid(jid):\n '''\n \n '''\n with _get_serv(ret=None, commit=True) as cur:\n\n sql = '''SELECT id, full_ret FROM `salt_returns`\n WHERE `jid` = %s'''\n\n cur.execute(sql, (jid,))\n data = cur.fetchall()\n ret = {}\n if data:\n for minio...
[ "def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Finds the next {@code '$'} in a class name which can be changed to a {@code '.'} when computing a canonical class name.
[ "private static int nextDollar(String className, CharSequence current, int searchStart) {\n while (true) {\n int index = className.indexOf('$', searchStart);\n if (index == -1) {\n return -1;\n }\n // We'll never have two dots nor will a type name end or begin with dot. So no need to\n...
[ "private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
// doDupRowUpdate updates the duplicate row.
[ "func (e *InsertExec) doDupRowUpdate(handle int64, oldRow []types.Datum, newRow []types.Datum,\n\tcols []*expression.Assignment) ([]types.Datum, bool, int64, error) {\n\tassignFlag := make([]bool, len(e.Table.WritableCols()))\n\t// See http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_val...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
{@inheritDoc} @see \n2n\persistence\meta\structure\ColumnFactory::createIntegerColumn() @return IntegerColumn
[ "public function createIntegerColumn(string $name, int $size, bool $signed = true): IntegerColumn {\r\n\t\t$column = new SqliteIntegerColumn($name);\r\n\t\t$this->table->addColumn($column);\r\n\t\treturn $column;\r\n\t}" ]
[ "public void buildSignature(XMLNode node, Content constructorDocTree) {\n constructorDocTree.addContent(\n writer.getSignature(\n (ConstructorDoc) constructors.get(currentConstructorIndex)));\n }" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Check that every key-value in superConfig is in subConfig
[ "public static boolean verifySubset(Config superConfig, Config subConfig) {\n for (Map.Entry<String, ConfigValue> entry : subConfig.entrySet()) {\n if (!superConfig.hasPath(entry.getKey()) || !superConfig.getValue(entry.getKey()).unwrapped()\n .equals(entry.getValue().unwrapped())) {\n retur...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// WithCgroup sets the container's cgroup path
[ "func WithCgroup(path string) SpecOpts {\n\treturn func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {\n\t\tsetLinux(s)\n\t\ts.Linux.CgroupsPath = path\n\t\treturn nil\n\t}\n}" ]
[ "func ConvertToRuntimeMaskedPaths(opt *v1.ProcMountType) []string {\n\tif opt != nil && *opt == v1.UnmaskedProcMount {\n\t\t// Unmasked proc mount should have no paths set as masked.\n\t\treturn []string{}\n\t}\n\n\t// Otherwise, add the default masked paths to the runtime security context.\n\treturn defaultMaskedP...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Creates a row of widgets in a horizontal panel with a 5 pixel gap between them.
[ "public static HorizontalPanel newRow (String styleName, Widget... contents)\n {\n return newRow(HasAlignment.ALIGN_MIDDLE, styleName, contents);\n }" ]
[ "function get_margin_width()\n {\n //ignore image width, use same width as on predefined bullet ListBullet\n //for proper alignment of bullet image and text. Allow image to not fitting on left border.\n //This controls the extra indentation of text to make room for the bullet image.\n ...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Return the Java source code of a whole class :param _class: `ClassDefItem` object, to get the source from :return:
[ "def get_source_class(self, _class):\n \n if not _class.get_name() in self.classes:\n return \"\"\n return self.classes[_class.get_name()]" ]
[ "def _type_description(self):\n \"\"\"\"\"\"\n #This is a little tricker because the docstring is housed\n #inside of the module that contains the actual executable.\n #These TypeExecutables are just pointers.\n iexec = self._element.target\n if iexec is not None:\n ...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Convenience function to append a list of widgets to a table as a new row.
[ "protected static boolean addRow (SmartTable table, List<Widget> widgets)\n {\n if (widgets == null) {\n return false;\n }\n int row = table.getRowCount();\n for (int col=0; col<widgets.size(); ++col) {\n table.setWidget(row, col, widgets.get(col));\n ...
[ "def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add a path to the list of tracked paths (this can be both dir's or files). @param string $path the path to track. @return Tracker this instance.
[ "public function addPath($path)\n {\n if (empty($path) || false === ($real_path = realpath($path))) {\n throw new FileNotFoundException(null, 0, null, $path);\n }\n $this->paths[] = $real_path;\n\n return $this;\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 Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
build @param string $route @param array $queries @param string $type @return string @throws \Psr\Cache\InvalidArgumentException
[ "public function route($route, $queries = [], $type = MainRouter::TYPE_PATH)\n {\n try {\n if ($this->router->hasRoute($this->package->getName() . '@' . $route)) {\n return $this->router->build($this->package->getName() . '@' . $route, $queries, $type);\n }\n\n ...
[ "static function parseWith($optionsResource, array $_ = null)\n {\n if (!static::isConfigurableWith($optionsResource))\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid Configuration Resource provided on (%s); given: (%s).'\n , static::class, \\Poirot\\Std...
codesearchnet
{ "query": "Represent the summarization about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about Software development:" }
Prints last response body. @Then print response
[ "public function printResponse()\n {\n $request = $this->request;\n $response = $this->response;\n\n echo sprintf(\n \"%s %s => %d:\\n%s\",\n $request->getMethod(),\n (string) ($request instanceof RequestInterface ? $request->getUri() : $request->getUrl()),\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 post about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Software development:" }
发送文件 @param ins @param size @param ous @throws IOException
[ "protected void sendFileContent(InputStream ins, long size, OutputStream ous) throws IOException {\n LOGGER.debug(\"开始上传文件流大小为{}\", size);\n long remainBytes = size;\n byte[] buff = new byte[256 * 1024];\n int bytes;\n while (remainBytes > 0) {\n if ((bytes = ins.read(b...
[ "func (q Qiniu) Store(url string, option *media_library.Option, reader io.Reader) (err error) {\n\n\tvar ret qnio.PutRet\n\tpath := strings.Replace(url, \"//\"+getEndpoint(option), \"\", -1)\n\t// ret 变量用于存取返回的信息,详情见 io.PutRet\n\t// uptoken 为业务服务器端生成的上传口令\n\t// r 为io.Reader类型,用于从其读取数据\n\t// extra ...
codesearchnet
{ "query": "Represent the Github post about API documentation:", "pos": "Represent the Github code about API documentation:", "neg": "Represent the Github code:" }
Create and set a Type Value Pair instance for a given type and value @param type The type to set @param value The value to set @return The Type Value Pair instance
[ "protected TypeValuePairType getTypeValuePair(String type, byte[] value) {\n TypeValuePairType tvp = new TypeValuePairType();\n tvp.setType(type);\n //tvp.setValue(Base64.encodeBase64Chunked(value));\n // the TVP itself base64 encodes now, no need for this\n tvp.setValue(value);\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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get layer output type. @param inputType Array of InputTypes @return output type as InputType @throws InvalidKerasConfigurationException Invalid Keras config
[ "@Override\n public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException {\n if (inputType.length > 1)\n throw new InvalidKerasConfigurationException(\n \"Keras ZeroPadding layer accepts only one input (received \" + inputType.leng...
[ "public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about N/A:" }
// newOpClientRequest create a client request object.
[ "func newOpClientRequest(reqType opClientRequestType, args interface{}) opClientRequest {\n\treturn opClientRequest{\n\t\top: reqType,\n\t\targs: args,\n\t\tresponse: make(chan interface{}),\n\t}\n}" ]
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the text about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Sets the cp tax category remote service. @param cpTaxCategoryService the cp tax category remote service
[ "public void setCPTaxCategoryService(\n\t\tcom.liferay.commerce.product.service.CPTaxCategoryService cpTaxCategoryService) {\n\t\tthis.cpTaxCategoryService = cpTaxCategoryService;\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Add a row to the end of the GUI or before another row. @param gui @param [dom] If specified, inserts the dom content in the new row @param [liBefore] If specified, places the new row before another row
[ "function addRow(gui, dom, liBefore) {\n var li = document.createElement('li');\n if (dom) li.appendChild(dom);\n if (liBefore) {\n gui.__ul.insertBefore(li, params.before);\n } else {\n gui.__ul.appendChild(li);\n }\n gui.onResize();\n return li;\n }" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// PostingsForMatchers assembles a single postings iterator against the index reader // based on the given matchers.
[ "func PostingsForMatchers(ix IndexReader, ms ...labels.Matcher) (index.Postings, error) {\n\tvar its, notIts []index.Postings\n\t// See which label must be non-empty.\n\tlabelMustBeSet := make(map[string]bool, len(ms))\n\tfor _, m := range ms {\n\t\tif !m.Matches(\"\") {\n\t\t\tlabelMustBeSet[m.Name()] = true\n\t\t...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
create scaffold with specified project name.
[ "def create_scaffold(project_name):\n \n if os.path.isdir(project_name):\n logger.log_warning(u\"Folder {} exists, please specify a new folder name.\".format(project_name))\n return\n\n logger.color_print(\"Start to create new project: {}\".format(project_name), \"GREEN\")\n logger.color_p...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// ReloadWithParams - Reloads given page optionally ignoring the cache.
[ "func (c *Page) ReloadWithParams(v *PageReloadParams) (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Page.reload\", Params: v})\n}" ]
[ "public void unload() {\n Map<String, String> settings = CACHE.get();\n CACHE.remove();\n // update cache of settings to be used in case of DB connectivity error\n this.getPropertyDbFailureCache = settings;\n }" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Technology:" }
// Encode serializes the target DeleteSession message into the passed io.Writer // observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "func (m *DeleteSession) Encode(w io.Writer, pver uint32) error {\n\treturn nil\n}" ]
[ "func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
TODO: split iterations into "step" method
[ "function() {\n\t\t\n\t\tvar i, j, l;\n\t\t\n\t\t// Extract nodes positions\n\t\tthis.nodes = [];\n\t\tfor( i = 0 ; i < this.layer.containers.length ; i++) {\n\t\t\tvar pos = this.layer.containers[i].terminals[0].getXY();\n\t\t\t\n\t\t\tthis.nodes.push({\n\t\t\t\tlayoutPosX: (pos[0]-400)/200,\n\t\t layoutPosY:...
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Determine if method whose name and signature is specified is a monitor wait operation. @param methodName name of the method @param methodSig signature of the method @return true if the method is a monitor wait, false if not
[ "public static boolean isMonitorWait(String methodName, String methodSig) {\n return \"wait\".equals(methodName) && (\"()V\".equals(methodSig) || \"(J)V\".equals(methodSig) || \"(JI)V\".equals(methodSig));\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 instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// SetRateIncreaseCriteria sets the RateIncreaseCriteria field's value.
[ "func (s *ExponentialRolloutRate) SetRateIncreaseCriteria(v *RateIncreaseCriteria) *ExponentialRolloutRate {\n\ts.RateIncreaseCriteria = v\n\treturn s\n}" ]
[ "public void addValidator(Schema schema, ModeUsage modeUsage) {\n // adds the schema to this section schemas\n schemas.addElement(schema);\n // creates the validator\n Validator validator = createValidator(schema);\n // adds the validator to this section validators\n validators.addElem...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Decrement the numeric data in the cache @param string $id @param int $value @return int | bool @throws OperationFailed
[ "public function dec($id, $value = 1) {\n\t\tif (! $this->connectionCheckStatus) {\n\t\t\t$this->addServer();\n\t\t}\n\t\t\n\t\t$id = $this->prepareId($id);\n\t\t$result = $this->getClient()->decrement($id, $value);\n\t\t\n\t\tif ($result === false && $this->operationsExceptions) {\n\t\t\tthrow new OperationFai...
[ "public static function getLinkCount($url = false)\n {\n $data = static::getCols('2048', $url);\n return (parent::noDataDefaultValue() == $data) ? $data :\n $data['uid'];\n }" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Entry point for mutable map dsl. @param map subject @param nodeClass map class @return operator
[ "public static MapOperator with(final Map map, final Class<? extends Map> nodeClass) {\n return new MapOperator(map, nodeClass);\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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Minimize chart junk by stripping out unnecessary plot borders and axis ticks. The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn
[ "def remove_border(axes=None, keep=('left', 'bottom'), remove=('right', 'top'), labelcol=ALMOST_BLACK):\n \n ax = axes or plt.gca()\n for spine in remove:\n ax.spines[spine].set_visible(False)\n for spine in keep:\n ax.spines[spine].set_linewidth(0.5)\n # ax.spines[spine].set_color(...
[ "def finalize(self, **kwargs):\n \n # Set the title on the plot\n self.set_title(\n 'Prediction Error for {}'.format(self.name)\n )\n\n # Square the axes to ensure a 45 degree line\n if self.shared_limits:\n # Get the current limits\n ylim =...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Given the name of an assembler, get the loaded assembler ready for optimisation. @param assembler [String] assembler name or shortname @return [Biopsy::Target] the loaded assembler
[ "def get_assembler assembler\n ret = @assemblers.find do |a|\n a.name == assembler ||\n a.shortname == assembler\n end\n raise \"couldn't find assembler #{assembler}\" if ret.nil?\n ret\n end" ]
[ "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 Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code:" }
Set image origin Arguments --------- new_origin : tuple or list updated origin for the image. should have one value for each dimension Returns ------- None
[ "def set_origin(self, new_origin):\n \n if not isinstance(new_origin, (tuple, list)):\n raise ValueError('arg must be tuple or list')\n if len(new_origin) != self.dimension:\n raise ValueError('must give a origin value for each dimension (%i)' % self.dimension)\n\n ...
[ "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 description about storage:", "pos": "Represent the code about storage:", "neg": "Represent the code about programming:" }
// CountByOrganization Counts the amount of invitations, filtered by an organization
[ "func (o *InvitationManager) CountByOrganization(globalid string) (int, error) {\n\tcount, err := o.collection.Find(bson.M{\"organization\": globalid}).Count()\n\treturn count, err\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Create a new bare repository
[ "def create(cls, path, encoding='utf-8'):\n \"\"\"\"\"\"\n cmd = [GIT, 'init', '--quiet', '--bare', path]\n subprocess.check_call(cmd)\n return cls(path, encoding)" ]
[ "func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetadataOnlyObjectList.
[ "func (in *MetadataOnlyObjectList) DeepCopy() *MetadataOnlyObjectList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MetadataOnlyObjectList)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "func (resource *Provenance) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Provenance\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Provenance), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*res...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// PutGitMetadata implements the KeybaseService interface for // KeybaseServiceBase.
[ "func (k *KeybaseServiceBase) PutGitMetadata(\n\tctx context.Context, folder keybase1.Folder, repoID keybase1.RepoID,\n\tmetadata keybase1.GitLocalMetadata) error {\n\treturn k.gitClient.PutGitMetadata(ctx, keybase1.PutGitMetadataArg{\n\t\tFolder: folder,\n\t\tRepoID: repoID,\n\t\tMetadata: metadata,\n\t})\n}" ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Returns the current image in a field. This is meant to be used with image uploads so that users can see the current value. @param type $FieldName @param type $Attributes @since 2.1
[ "public function CurrentImage($FieldName, $Attributes = array()) {\n $Result = $this->Hidden($FieldName);\n \n $Value = $this->GetValue($FieldName);\n if ($Value) {\n TouchValue('class', $Attributes, 'CurrentImage');\n $Result .= Img(Gdn_Upload::Url($Value), $Attributes);\n ...
[ "public function rejectInlineListTool(Errors &$errors, Meta &$meta)\n {\n if (stristr((string)$meta->getValue(), '://listtool') !== false) {\n $errors->reject('You cannot embed the List Tool inline, use the provided fields and input [[listtool]] into the contents instead.');\n }\n }" ...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Prepare static and dynamic search structures.
[ "def _compile(self):\n ''' '''\n self.static = {}\n self.dynamic = []\n def fpat_sub(m):\n return m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:'\n for rule in self.rules:\n target = self.routes[rule]\n if not self.syntax.search(rule):\n...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// DistanceFrom computes an O(n) distance from the path. Loops over every // subline to find the minimum distance.
[ "func (p *Path) DistanceFrom(point *Point) float64 {\n\treturn math.Sqrt(p.SquaredDistanceFrom(point))\n}" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Natural Language Processing:" }
// initKeysDir initializes the keystore root directory. Usually it is ~/.tsh
[ "func initKeysDir(dirPath string) (string, error) {\n\tvar err error\n\t// not specified? use `~/.tsh`\n\tif dirPath == \"\" {\n\t\tu, err := user.Current()\n\t\tif err != nil {\n\t\t\tdirPath = os.TempDir()\n\t\t} else {\n\t\t\tdirPath = u.HomeDir\n\t\t}\n\t\tdirPath = filepath.Join(dirPath, defaultKeyDir)\n\t}\n\...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
<p> The group to modify for the snapshot. </p> @param groupNames The group to modify for the snapshot.
[ "public void setGroupNames(java.util.Collection<String> groupNames) {\n if (groupNames == null) {\n this.groupNames = null;\n return;\n }\n\n this.groupNames = new com.amazonaws.internal.SdkInternalList<String>(groupNames);\n }" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the description about AWS Redshift:", "pos": "Represent the code about AWS Redshift:", "neg": "Represent the code about programming:" }