query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Returns a copy of the BioPAX element (with all the property values are same) @param <T> biopax type @param source biopax element to copy @param newID copy biopax element's absolute URI @return a copy of the source biopax element
[ "public <T extends BioPAXElement> T copy(T source, String newID) \n\t{\n\t\tT copy = (T) level.getDefaultFactory().create(\n\t\t\t\t(Class<T>) source.getModelInterface(), newID);\n\t\tthis.copy = copy;\n\t\t// to avoid unnecessary checks/warnings when existing valid element is being cloned \n\t\t//(e.g., copying B...
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Export info for scan in CSV format @param int $appId @param int $scanId @param string $outFile @param array $queryParams @return BaseResponse
[ "public function exportCsv($appId, $scanId, $outFile, array $queryParams = [])\n {\n $response = $this->api\n ->applications()\n ->scans()\n ->exports()\n ->exportCsv($appId, $scanId, $outFile, $queryParams);\n\n return new BaseResponse($response);\n }...
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Return a generator with the details of each zone.
[ "def temperatures(self):\n \"\"\"\"\"\"\n self.location.status()\n\n if self.hotwater:\n yield {\n 'thermostat': 'DOMESTIC_HOT_WATER',\n 'id': self.hotwater.dhwId,\n 'name': '',\n 'temp': self.hotwater.temperatureStatus['tem...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about AWS Route 53:", "pos": "Represent the Github code about AWS Route 53:", "neg": "Represent the Github code:" }
Print (fluff) using resource bundle look-up, MessageFormat, and add prefix and postfix @param key the resource key @param args
[ "@Override\n public void fluffmsg(String key, Object... args) {\n if (showFluff()) {\n hardmsg(key, args);\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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Name of the field in the search engine mapping. @param ContainerConfigurationInterface $containerConfiguration Container configuration. @param string $fieldName Request field name. @return string
[ "private function getMappingField(ContainerConfigurationInterface $containerConfiguration, $fieldName)\n {\n if (isset($this->fieldMapper[$fieldName])) {\n $fieldName = $this->fieldMapper[$fieldName];\n }\n\n try {\n $optionTextFieldName = $this->mappingHelper->getOptio...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Persist writes the snapshot to the given sink.
[ "func (m *nodeFSM) Persist(sink raft.SnapshotSink) error {\n\tif err := (*Node)(m).handler.Snapshot(sink); err != nil {\n\t\tsink.Cancel()\n\t\treturn err\n\t}\n\tsink.Close()\n\treturn nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Create a Device instance from object path.
[ "def get(self, object_path, interfaces_and_properties=None):\n \"\"\"\"\"\"\n # check this before creating the DBus object for more\n # controlled behaviour:\n if not interfaces_and_properties:\n interfaces_and_properties = self._objects.get(object_path)\n if not in...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Assumes camera is set up correctly in gl context.
[ "def draw_edge_visibility(gl, v, e, f, hidden_wireframe=True):\n \"\"\"\"\"\"\n gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n ec = np.arange(1, len(e)+1)\n ec = np.tile(col(ec), (1, 3))\n ec[:, 0] = ec[:, 0] & 255\n ec[:, 1] = (ec[:, 1] >> 8 ) & 255\n ec[:, 2] = (ec[:, 2] >> 16 ) & 2...
[ "@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 comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// SetReadDeadline sets the network read deadline on the underlying websocket.
[ "func (w *terminalStream) SetReadDeadline(t time.Time) error {\n\treturn w.ws.SetReadDeadline(t)\n}" ]
[ "private void stopOut() throws IOException {\n if (outClosed) {\n return;\n }\n outClosed = true;\n\n LOG.log(Level.FINE, \"Shutting down socket for output\");\n\n // close socket for output - that will initiate normal socket close procedure; in case of TCP\n // socket this is\n // a buffe...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
utility function to merge different options cli args take presendence over config
[ "function mergeOptions(...opt){\n // extract default (last argument)\n const result = opt.pop();\n\n // try to find first match\n while (opt.length > 0){\n // extract first argument (priority)\n const o = opt.shift();\n\n // value set ?\n if (t...
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the total number of jobs that are scheduled for all queues. This function accepts datetime, timedelta instances as well as integers representing epoch values.
[ "def count(self, until=None):\n \n\n until = rationalize_until(until)\n return self.connection.zcount(self.scheduled_jobs_key, 0, until)" ]
[ "def valid_date(date):\n \"\"\n # We want something that acts like a datetime. In particular,\n # strings indicate a failure to parse down to an object and ints are\n # nonstandard and ambiguous at best.\n if not hasattr(date, 'tzinfo'):\n return False\n # Relevant RFCs define UTC as 'close...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Current hypergeometric implementation in scipy is broken, so here's the correct version
[ "def phyper(k, good, bad, N):\n \n pvalues = [phyper_single(x, good, bad, N) for x in range(k + 1, N + 1)]\n return np.sum(pvalues)" ]
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Build a URL path from the given parts. @param string[] $parts @throws \Bitbucket\Exception\InvalidArgumentException @return string
[ "protected static function buildPath(string ...$parts)\n {\n $parts = array_map(function (string $part) {\n if (!$part) {\n throw new InvalidArgumentException('Missing required parameter.');\n }\n\n return self::urlEncode($part);\n }, $parts);\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 Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Returns the key belonging to the given field as char @param index the index of the requested field @return the requested value @throws IOException
[ "public char getKeyAsChar(int index) throws IOException {\n if (index >= structure.keySizes.size()) {\n throw new IOException(\"Index \" + index + \" is out of range.\");\n }\n\n return Bytes.toChar(key, structure.keyByteOffsets.get(index));\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 Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Returns active view template name @return string
[ "protected function _getTplName()\n {\n if (!($sCurrTpl = basename(( string )\\OxidEsales\\Eshop\\Core\\Registry::getConfig()->getRequestParameter('tpl')))) {\n // in case template was not defined in request\n $sCurrTpl = \\OxidEsales\\Eshop\\Core\\Registry::getConfig()->getActiveVie...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// SetStatusReason sets the StatusReason field's value.
[ "func (s *JobQueueDetail) SetStatusReason(v string) *JobQueueDetail {\n\ts.StatusReason = &v\n\treturn s\n}" ]
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// orderNamespacePaths sorts namespace paths into a list of paths that we // can setns in order.
[ "func (c *linuxContainer) orderNamespacePaths(namespaces map[configs.NamespaceType]string) ([]string, error) {\n\tpaths := []string{}\n\tfor _, ns := range configs.NamespaceTypes() {\n\n\t\t// Remove namespaces that we don't need to join.\n\t\tif !c.config.Namespaces.Contains(ns) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Return a fully-qualified project_run string.
[ "def project_run_path(cls, project, transfer_config, run):\n \"\"\"\"\"\"\n return google.api_core.path_template.expand(\n \"projects/{project}/transferConfigs/{transfer_config}/runs/{run}\",\n project=project,\n transfer_config=transfer_config,\n run=run,\n...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the sentence about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
// processGenJSON validates a genJSON file and returns the contents.
[ "func processGenJSON(genJSONPath string) (*isolate.ArchiveOptions, error) {\n\tf, err := os.Open(genJSONPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"opening %s: %s\", genJSONPath, err)\n\t}\n\tdefer f.Close()\n\n\topts, err := processGenJSONData(f)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"processi...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Display an error message box. @this {Element} The offending input field. @param {string} messageHTML
[ "function msgBox(messageHTML) {\n var msgEl = document.querySelector('.msg-box'),\n rect = this.getBoundingClientRect();\n\n msgEl.style.top = window.scrollY + rect.bottom + 8 + 'px';\n msgEl.style.left = window.scrollX + rect.left + 8 + 'px';\n\n msgEl.style.display = 'block'...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Split inputs according to lines. If a line is short enough, just yield it. Otherwise, fix it.
[ "def split_lines(source, maxline=79):\n \n result = []\n extend = result.extend\n append = result.append\n line = []\n multiline = False\n count = 0\n find = str.find\n for item in source:\n index = find(item, '\\n')\n if index:\n line.append(item)\n mu...
[ "def generate_optimized_y_move_down_x_SOL(y_dist):\n \n\n # Optimization to move N lines and go to SOL in one command. Note that some terminals \n # may not support this so we might have to remove this optimization or make it optional \n # if that winds up mattering for terminals we care about. If we ha...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns auth settings. @return array
[ "public function getAuth()\n {\n if ($this->_disabledAuth) {\n return [];\n }\n if ($this->_auth instanceof Closure) {\n $this->_auth = call_user_func($this->_auth, $this);\n }\n\n return $this->_auth;\n }" ]
[ "def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Status returns the current Restore doc status
[ "func (info *RestoreInfo) Status() (RestoreStatus, error) {\n\trestoreInfo, closer := info.st.db().GetCollection(restoreInfoC)\n\tdefer closer()\n\n\tvar doc struct {\n\t\tStatus RestoreStatus `bson:\"status\"`\n\t}\n\terr := restoreInfo.FindId(currentRestoreId).One(&doc)\n\tswitch errors.Cause(err) {\n\tcase nil:\...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Invoke this method to change the currently focused window. @param view A view that belongs to the view hierarchy/window that has focus, or null to remove focus
[ "public void setFocusedWindow(View view) {\n mFocusLock.writeLock().lock();\n try {\n mFocusedWindow = view == null ? null : view.getRootView();\n } finally {\n mFocusLock.writeLock().unlock();\n }\n fireFocusChangedEvent();\n }" ]
[ "function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
/* (non-Javadoc) @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
[ "@Override\n public void endElement(String uri, String localName, String name) throws SAXException {\n if (\"name\".equals(name)) {\n final String itemName = this.chars.toString().trim();\n\n if (this.currentTable == null) {\n this.currentTable = itemName;\n ...
[ "private final void dispatachChars(Node node)\n throws org.xml.sax.SAXException\n {\n if(m_contentHandler instanceof org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)\n {\n ((org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.CharacterNodeHandler)m_contentHandler).characters(node);\n }\n else\n...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
/* 锟斤拷锟斤拷锟揭筹拷锟绞硷拷锟铰嘉伙拷锟�
[ "public int calcuStartIndex(int pageNum,int onePageCount){\r\n\t\tint startIndex=0;\r\n\t\t\r\n\t\tString tempType=calcuDbType();\r\n\t\tif(tempType!=null && tempType.equals(\"mysql\")){\r\n\t\t//if(dbType!=null && dbType.equals(\"mysql\")){\r\n\t\t\tstartIndex=pageNum*onePageCount;\r\n\t\t}else{\r\n\t\t\tstartInde...
[ "static public function randString($len=6,$type='',$addChars='') {\n $str ='';\n switch($type) {\n case 0:\n $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.$addChars;\n break;\n case 1:\n $chars= str_repeat('0123456789',...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Get the reader schema based on the given type and writer schema. @param <E> The entity type @param type The Java class of the entity type @param schema The {@link Schema} for the entity @return The reader schema based on the given type and writer schema
[ "public static <E> Schema getReaderSchema(Class<E> type, Schema schema) {\n Schema readerSchema = schema;\n GenericData dataModel = getDataModelForType(type);\n\n if (dataModel instanceof SpecificData) {\n readerSchema = ((SpecificData)dataModel).getSchema(type);\n }\n\n return readerSchema;\n ...
[ "function(loader) {\n // public\n this.maxRecursion = 5;\n this.loader = (typeof loader === 'function') ? loader : null;\n\n // internal\n this._schemaRegistry = new SchemaRegistry();\n this._customFormatHandlers = {};\n\n // _refsRequested is an object where the key is the normalized ID\n // of the schema ...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Return fixed source code.
[ "def fix_lines(source_lines, options, filename=''):\n \"\"\"\"\"\"\n # Transform everything to line feed. Then change them back to original\n # before returning fixed source code.\n original_newline = find_newline(source_lines)\n tmp_source = ''.join(normalize_line_endings(source_lines, '\\n'))\n\n ...
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// HasMatcher reduces the set of matched elements to those that have a descendant // that matches the matcher. // It returns a new Selection object with the matching elements.
[ "func (s *Selection) HasMatcher(m Matcher) *Selection {\n\treturn s.HasSelection(s.document.FindMatcher(m))\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Adds an OpenDyalight controler
[ "func (s *NetworkService) AddOpenDaylightController(p *AddOpenDaylightControllerParams) (*AddOpenDaylightControllerResponse, error) {\n\tresp, err := s.cs.newRequest(\"addOpenDaylightController\", p.toURLValues())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r AddOpenDaylightControllerResponse\n\tif err :=...
[ "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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
[ "def build\n base_iml = \"#{@name}.iml\"\n\n doc = REXML::Document.new\n doc.context[:attribute_quote] = :quote\n\n mod = doc.add_element 'module', 'type' => 'JAVA_MODULE', 'version' => '4'\n root = mod.add_element 'component', 'name' => 'NewModuleRootManager', 'inherit-compiler-output' => ...
[ "def plugins():\n \n return (\n ClassFactoring,\n ConstantLogic,\n ExceptStatements,\n FutureCompatibility,\n ImportOrder,\n Indentation,\n MissingContextManager,\n NewStyleClasses,\n Newlines,\n PrintStatements,\n TrailingWhitespace,\n PEP8VariableNames,\n PyflakesChecker,\...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return the individual info in a dictionary for json.
[ "def to_json(self):\n \n self.logger.debug(\"Returning json info\")\n individual_info = {\n 'family_id': self.family,\n 'id':self.individual_id, \n 'sex':str(self.sex), \n 'phenotype': str(self.phenotype), \n 'mother': self.mother, \n ...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
アーカイブ中のファイル名を矯正します。 @param ZipFile $archive @return string[] ファイル名の一覧。矯正を行った場合は、キーに矯正前のファイル名を持ちます。
[ "protected function correctArchiveFilenames(ZipFile $archive): array\n {\n $filenames = [];\n \n foreach ($archive->getListFiles() as $filename) {\n $corrected = (new validator\\FilenameValidator(null, $filenames, false))->correct($filename);\n if ($filename !== $correc...
[ "public static double calculateLofWithUpdate(int kn, int max, LofPoint addedPoint,\n LofDataSet dataSet)\n {\n // データ数が最大に達している場合には古い方からデータの削除を行う\n String deleteId = addPointToDataSet(max, addedPoint, dataSet);\n\n // K距離、K距離近傍、局所到達可能密度の更新を行う対象点の一覧を取得する。\n Set<String> updat...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// NewCreateFileRequestArgs returns a new CreateFileRequestArgs instance
[ "func NewCreateFileRequestArgs(Title string, Destination string) *CreateFileRequestArgs {\n\ts := new(CreateFileRequestArgs)\n\ts.Title = Title\n\ts.Destination = Destination\n\ts.Open = true\n\treturn s\n}" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Equivalent to socket.accept(), but transforms the socket into a websocket instance and sends a server handshake (after receiving a client handshake). Note that the handshake may raise a HandshakeError exception.
[ "def accept(self):\n \n sock, address = self.sock.accept()\n wsock = websocket(sock)\n wsock.secure = self.secure\n ServerHandshake(wsock).perform(self)\n wsock.handshake_sent = True\n return wsock, address" ]
[ "def connect(self, host, port):\n '''\n \n '''\n # Clear the connect state immediately since we're no longer connected\n # at this point.\n self._connected = False\n\n # Only after the socket has connected do we clear this state; closed\n # must be False so th...
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Generate example dicts.
[ "def dataset_generator(filepath,\n dataset,\n chunk_size=1,\n start_idx=None,\n end_idx=None):\n \"\"\"\"\"\"\n encoder = dna_encoder.DNAEncoder(chunk_size=chunk_size)\n with h5py.File(filepath, \"r\") as h5_file:\n # Get inpu...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
<p> A list of backups. </p> @param backups A list of backups.
[ "public void setBackups(java.util.Collection<Backup> backups) {\n if (backups == null) {\n this.backups = null;\n return;\n }\n\n this.backups = new java.util.ArrayList<Backup>(backups);\n }" ]
[ "def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t...
codesearchnet
{ "query": "Represent the sentence about document management:", "pos": "Represent the code about document management:", "neg": "Represent the code about AWS Auto Scaling:" }
Create page for Kyc document @param string $userId User Id @param string $kycDocumentId KYC Document Id @param \MangoPay\KycPage $kycPage KYC Page @return bool `true` if the upload was successful, `false` otherwise @throws \MangoPay\Libraries\Exception
[ "public function CreateKycPage($userId, $kycDocumentId, $kycPage, $idempotencyKey = null)\n {\n $uploaded = false;\n try {\n $response = $this->CreateObject('kyc_page_create', $kycPage, null, $userId, $kycDocumentId, $idempotencyKey);\n $uploaded = true;\n } catch (\\Ma...
[ "public function execute($request)\n {\n RequestNotSupportedException::assertSupports($this, $request);\n $this->logger->info(\"Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid\");\n throw new HttpResponse('OK');\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Get the contents list. @param deprapi the deprecated list builder @return a content tree for the contents list
[ "public Content getContentsList(DeprecatedAPIListBuilder deprapi) {\n Content headContent = getResource(\"doclet.Deprecated_API\");\n Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,\n HtmlStyle.title, headContent);\n Content div = HtmlTree.DIV(HtmlStyle.head...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Recursively search for all possible translations of this page, either originals of this page, translations of this page or translations of the original of this page. @param array $translationsArray @return array
[ "public function getRecursiveTranslations(&$translationsArray)\n {\n // find all possible translations\n if (!$this->getTranslations()->isEmpty()) {\n foreach ($this->getTranslations() as $translation) {\n if ($translation) {\n // if we already meet you ...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
gc @param string $past @return bool
[ "public function gc($past)\n {\n $query = $this->db->getQuery(true);\n $query->delete($this->db->quoteName($this->options['table']))\n ->where($this->db->quoteName($this->options['time_col']) . ' < ' . $this->db->quote((int) $past));\n\n // Remove expired sessions from the databas...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Adds a binary clause to the given SAT solver. @param s the sat solver @param a the first literal @param b the second literal
[ "void addBinaryClause(final MiniSatStyleSolver s, int a, int b) {\n this.addBinaryClause(s, a, b, LIT_UNDEF);\n }" ]
[ "def visit_rule(self, node, rule):\n \"\"\"\"\"\"\n label, equals, expression = rule\n expression.name = label # Assign a name to the expr.\n return expression" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Check whether the plugin can be loaded. @param currentPlugin plugin ID @return {@code true} if plugin can be loaded, otherwise {@code false}
[ "private boolean checkPlugin(final String currentPlugin) {\n final Features pluginFeatures = pluginTable.get(currentPlugin);\n final Iterator<PluginRequirement> iter = pluginFeatures.getRequireListIter();\n // check whether dependcy is satisfied\n while (iter.hasNext()) {\n bo...
[ "function ComponentModel(key, impl, cfg) {\n this.key = key\n /**\n * @property {Any} impl The implementation to use for `resolve`\n * */\n this.impl =impl\n this._cfg = cfg || {}\n /**\n * @property {Array} inject The {String} dependencies array a service may declare\n * */\n this...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Add a new event to changeset @param TrackedObject $tracked @param int $eventMask
[ "public function addChangeSet($tracked,$eventMask)\n {\n if($tracked instanceof TrackedObject){\n $path = $tracked->getResource();\n if($this->fileOnly && !$tracked->getResource() instanceof FileResource){\n return;\n }\n }else{\n $path = $...
[ "public List<Audit> getAllNotifications(JPAEntity entity) {\n\t\treturn _auditService.findByEntityHostnameMessage(entity.getId(), null, \"Triggering event value:\");\n\t}" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Documentation:" }
Retrieves the amount of memory used by the process. Returns: int: amount of memory in bytes used by the process or None if not available.
[ "def GetUsedMemory(self):\n \n try:\n memory_info = self._process.memory_info()\n except psutil.NoSuchProcess:\n return None\n\n # Psutil will return different memory information depending on what is\n # available in that platform.\n memory_data = getattr(memory_info, 'data', 0)\n mem...
[ "function ClientState(client) {\n\n /**\n * The associated client instance.\n *\n * @property client\n * @type Client\n */\n this.client = client;\n\n /**\n * The time (in milliseconds) to wait before the next request\n * may be sent to the API; this value is only updated upon\n * reception of a ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
// FuzzyDuration randomizes the duration d within the range specified // by fuzz. Specifically the value range is: [d-(fuzz/2), d+(fuzz/2)] // The result will never be negative.
[ "func FuzzyDuration(d, fuzz time.Duration) time.Duration {\n\tif fuzz < 0 {\n\t\treturn d\n\t}\n\t// apply range [-fuzz/2, fuzz/2]\n\td += time.Duration(rand.Int63n(int64(fuzz)+1) - (int64(fuzz) / 2))\n\tif d < 0 {\n\t\treturn 0\n\t}\n\treturn d\n}" ]
[ "func parsePseudoFloat(str string) (float64, error) {\n\tss := strings.Split(str, \".\")\n\n\tintPart, err := strconv.ParseFloat(ss[0], 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif len(ss) == 1 {\n\t\t// Pure integers are fine.\n\t\treturn intPart, nil\n\t}\n\tfracPart, err := strconv.ParseFloat(ss[1], 64...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
@param Compiler $compiler @param array $params @param string $prepend @param string $append @param string $type @return string
[ "public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type)\n {\n $with = &$compiler->findBlock('for', true);\n\n $params['initialized'] = true;\n $compiler->injectBlock($type, $params);\n\n return '';\n }" ]
[ "protected function readMarkdownItem($params = []) {\n /** @var $apiName */\n /** @var $api */\n /** @var $operation */\n /** @var $phpDocMethod */\n extract($params);\n\n $md = $this->generateDocs($apiName, $operation, $api, $phpDocMethod ?? '');\n $md = $this->appl...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param string $service @return bool
[ "public function hasAccessToken(string $service):bool{\n\t\treturn isset($_SESSION[$this->sessionVar], $_SESSION[$this->sessionVar][$service]);\n\t}" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Add the requested query string arguments to the Request. @param request Request to add query string arguments to
[ "private void addQueryParams(final Request request) {\n if (absoluteDateCreated != null) {\n request.addQueryParam(\"DateCreated\", absoluteDateCreated.toString(Request.QUERY_STRING_DATE_TIME_FORMAT));\n } else if (rangeDateCreated != null) {\n request.addQueryDateTimeRange(\"Dat...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Returns true if the specified character is a BaseChar as defined by production [85] in the XML 1.0 specification. @param ch The character to check.
[ "public static boolean isBaseChar(int ch)\n {\n return (0x0041 <= ch && ch <= 0x005A) || (0x0061 <= ch && ch <= 0x007A) || (0x00C0 <= ch && ch <= 0x00D6)\n || (0x00D8 <= ch && ch <= 0x00F6) || (0x00F8 <= ch && ch <= 0x00FF) || (0x0100 <= ch && ch <= 0x0131)\n || (0x0134 <= ch && ch <= 0x013E)...
[ "function parse_drawing(data, rels) {\n\tif(!data) return \"??\";\n\t/*\n\t Chartsheet Drawing:\n\t - 20.5.2.35 wsDr CT_Drawing\n\t - 20.5.2.1 absoluteAnchor CT_AbsoluteAnchor\n\t - 20.5.2.16 graphicFrame CT_GraphicalObjectFrame\n\t - 20.1.2.2.16 graphic CT_GraphicalObject\n\t - 20.1.2.2.17 gr...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns the elements that are present in s1 but which are not present in s2, without changing the contents of neither s1, nor s2. @param s1 first set @param s2 second set @param <E> type of objects in Set @return the elements in s1 that are not in s2
[ "public static <E> Set<E> difference(Set<? extends E> s1, Set<? extends E> s2) {\n Set<E> copy1 = new HashSet<>(s1);\n copy1.removeAll(new HashSet<>(s2));\n return copy1;\n }" ]
[ "def intersection_update(self, other):\n \n if not isinstance(other, Set):\n raise ValueError('other must be a Set instance')\n if self is other:\n return\n # we make a copy of the list so that we can remove items from\n # the list without breaking the iterat...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
convert file-paths to 'index' files where necessary
[ "function fixOutputPaths(output, files) {\n\n // map directories to use for index files\n var dirMap = {};\n u.each(files, function(file) {\n dirMap[ppath.dirname(file.path)] = true;\n\n // edge case - treat /foo/ as directory too\n if (/\\/$/.test(file.path) && ppath.dirname(file.path) !== ...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
APIMethod: destroy Deconstruct this layer.
[ "function() {\n this.mapObject = null;\n this.pane = null;\n OpenLayers.Layer.prototype.destroy.apply(this, arguments); \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 text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Retrieve a list of `Invalid` errors. The returning array will have one level deep only. @return array<Invalid>
[ "public function getFlatErrors(): array\n {\n /**\n * Reducer that flat the errors.\n *\n * @param array $carry previous error list\n * @param Invalid $item to append to $carry\n *\n * @return array<Invalid>\n */\n $reduce = function(array ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Add a configuration driver to the chain The configuration driver will be placed according to its priority. Highest priority will be verified first @param ConfigurationInterface $config @param integer $priority @return ConfigurationChainInterface self
[ "public function add(ConfigurationInterface $config, $priority = 0)\n {\n $this->priorityList->insert($config, $priority);\n return $this;\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 comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Builds the PluginManager with the plugins of a site. Each plugin is added to PluginManager using "name" meta or its classname if that meta does not exists. @return PluginManager PluginManager filled with the valid plugins
[ "public function build()\n {\n $pm = new PluginManager($this->eventDispatcher);\n $pluginCollection = $pm->getPluginCollection();\n\n if (file_exists($this->path) === false) {\n return $pm;\n }\n\n $classnamesFromComposerFile = [];\n\n $finder = $this->buildFi...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Returns the HTML for the args of dumped variables. @param mixed $var A variable of any type. @return string The HTML for the dumped variable.
[ "protected function _dump_php(&$var) {\n\t\t$scope = false;\n\t\t$prefix = 'unique';\n\t\t$suffix = 'value';\n\n\t\tif ($scope) $vals = $scope;\n\t\telse $vals = $GLOBALS;\n\n\t\t$old = $var;\n\t\t$var = $new = $prefix.rand().$suffix; $vname = false;\n\t\tforeach ($vals as $key => $val) {\n\t\t\tif ($val === $new) ...
[ "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 post about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about programming:" }
Return the object id for this master, for associating state with the master. @returns: ID, via Deferred
[ "def getObjectId(self):\n \n # try to get the cached value\n if self._object_id is not None:\n return defer.succeed(self._object_id)\n\n # failing that, get it from the DB; multiple calls to this function\n # at the same time will not hurt\n\n d = self.db.state.g...
[ "def getLockByID(self, lockid):\n \n assert isinstance(lockid, (locks.MasterLock, locks.WorkerLock))\n if lockid not in self.locks:\n self.locks[lockid] = lockid.lockClass(lockid)\n # if the master.cfg file has changed maxCount= on the lock, the next\n # time a build is...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Computes the calibration for each view..
[ "private void computeSolutions(DMatrix4x4 Q) {\n\t\tDMatrixRMaj w_i = new DMatrixRMaj(3,3);\n\n\t\tfor (int i = 0; i < cameras.size; i++) {\n\t\t\tcomputeW(cameras.get(i),Q,w_i);\n\t\t\tIntrinsic calib = solveForCalibration(w_i);\n\t\t\tif( sanityCheck(calib)) {\n\t\t\t\tsolutions.add(calib);\n\t\t\t}\n\t\t}\n\t}" ...
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// ----------------------------------------
[ "func NewMutableScenarioNode(title string, tags []string) MutableScenarioNode {\n\tn := &scenarioNode{}\n\tn.nodeType = ScenarioNodeType\n\tn.title = title\n\tn.tags = tags\n\treturn n\n}" ]
[ "func (s *StringCodeGenerator) Init() {\n\ts.Position = vm.Position{State: vm.NewState()}\n\ts.Lines = []string{\"(Exported by gocnc)\", \"G21G90\\n\"}\n}" ]
codesearchnet
{ "query": "Represent the Github description about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code about programming:" }
set a new variable, on the highest block hierarchy or global if no hierarchy exists. @param key name of the variable @param value value of the variable @return true if at least one local block hierarchy exists else false
[ "public boolean setNewVariable(Object key, Object value) {\n\t\tboolean success = false;\n\n\t\tsuccess = setLocalVariable(key, value);\n\n\t\tif (!success) {\n\t\t\tsetGlobalVariable(key, value);\n\t\t\tsuccess = true;\n\t\t}\n\n\t\treturn success;\n\t}" ]
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Determine if the error means to retry or fail, True to retry.
[ "def should_try_kafka_again(error):\n \"\"\"\"\"\"\n msg = 'Unable to retrieve'\n return isinstance(error, KafkaException) and str(error).startswith(msg)" ]
[ "func (p *provisioningIdentityMapper) UserFor(info authapi.UserIdentityInfo) (kuser.Info, error) {\n\t// Retrying up to three times lets us handle race conditions with up to two conflicting identity providers without returning an error\n\t// * A single race is possible on user creation for every conflicting identit...
codesearchnet
{ "query": "Represent the Github text about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about Software development:" }
@param string $field @param mixed $value @return $this
[ "public function setOnInsert(string $field, $value)\n {\n $this->update();\n $this->mongoDbUpdate['$setOnInsert'][$field] = $value;\n\n return $this;\n }" ]
[ "private function preconfigured() {return dfc($this, function() {\n\t\t$s = $this->s(); /** @var S $s */\n\t\t/** @var string $key */\n\t\t$key = 'actionFor' . (df_customer_is_new($this->o()->getCustomerId()) ? 'New' : 'Returned');\n\t\t/** @var string $result */\n\t\treturn $s->v($key, null, function() use($s) {re...
codesearchnet
{ "query": "Represent the post about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about programming:" }
Completes any fsyncs in a batch. Because the fsync is slow, this method will typically block while new requests fill the queue, making the next batch efficient.
[ "@AfterBatch\n public void afterBatch()\n {\n long requestSequence = _requestSequence;\n \n if (! _isFsync) {\n return;\n }\n \n _isFsync = false;\n \n try {\n _storeFsync.fsync();\n /*\n if (_tailSequence < requestSequence) {\n _storeFsync.fsync();\n }\n ...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
save user by a given id http://getstarted.sailthru.com/api/user
[ "def save_user(self, idvalue, options=None):\n \n options = options or {}\n data = options.copy()\n data['id'] = idvalue\n return self.api_post('user', data)" ]
[ "def cli(verbose):\n \n floyd.floyd_host = floyd.floyd_web_host = \"https://dev.floydhub.com\"\n floyd.tus_server_endpoint = \"https://upload-v2-dev.floydhub.com/api/v1/upload/\"\n configure_logger(verbose)\n check_cli_version()" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Limit sets limitN condition
[ "func (b *Builder) Limit(limitN int, offset ...int) *Builder {\n\tb.limitation = &limit{limitN: limitN}\n\n\tif len(offset) > 0 {\n\t\tb.limitation.offset = offset[0]\n\t}\n\n\treturn b\n}" ]
[ "def getPostStates(self):\n '''\n \n '''\n self.aNrmNow = self.mNrmNow - self.cNrmNow\n self.aLvlNow = self.aNrmNow*self.pLvlNow # Useful in some cases to precalculate asset level\n return None" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Concatenate HDF5 Files
[ "def ptconcat(output_file, input_files, overwrite=False):\n \"\"\"\"\"\"\n filt = tb.Filters(\n complevel=5, shuffle=True, fletcher32=True, complib='zlib'\n )\n out_tabs = {}\n dt_file = input_files[0]\n log.info(\"Reading data struct '%s'...\" % dt_file)\n h5struc = tb.open_file(dt_file...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Where adds an expression to the WHERE clause of the query. Expressions are // ANDed together in the generated CQL.
[ "func (b *UpdateBuilder) Where(w ...Cmp) *UpdateBuilder {\n\tb.where = append(b.where, w...)\n\treturn b\n}" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Generate RegExp for given hostname value. @param (string|RegExp} val @private
[ "function hostregexp (val) {\n var source = !isregexp(val)\n ? String(val).replace(ESCAPE_REGEXP, ESCAPE_REPLACE).replace(ASTERISK_REGEXP, ASTERISK_REPLACE)\n : val.source\n\n // force leading anchor matching\n if (source[0] !== '^') {\n source = '^' + source\n }\n\n // force trailing anchor matching\...
[ "func (m *Strings) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m == nil {\n\t\treturn info\n\t}\n\t// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}\n\treturn info\n}" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// Returns the payload length.
[ "func (cp *Connect) len() int {\n\ttotal := 0\n\n\tif cp.Version == Version31 {\n\t\t// 2 bytes protocol name length\n\t\t// 6 bytes protocol name\n\t\t// 1 byte protocol version\n\t\ttotal += 2 + 6 + 1\n\t} else {\n\t\t// 2 bytes protocol name length\n\t\t// 4 bytes protocol name\n\t\t// 1 byte protocol version\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 summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// Quorum is a DHT option that tells the DHT how many peers it needs to get // values from before returning the best one. // // Default: 16
[ "func Quorum(n int) ropts.Option {\n\treturn func(opts *ropts.Options) error {\n\t\tif opts.Other == nil {\n\t\t\topts.Other = make(map[interface{}]interface{}, 1)\n\t\t}\n\t\topts.Other[quorumOptionKey{}] = n\n\t\treturn nil\n\t}\n}" ]
[ "func (tab *Table) doRefresh(done chan struct{}) {\n\tdefer close(done)\n\n\t// Load nodes from the database and insert\n\t// them. This should yield a few previously seen nodes that are\n\t// (hopefully) still alive.\n\ttab.loadSeedNodes()\n\n\t// Run self lookup to discover new neighbor nodes.\n\ttab.net.lookupSe...
codesearchnet
{ "query": "Represent the comment about Networking:", "pos": "Represent the code about Networking:", "neg": "Represent the code about Networking:" }
// RegPromotions registers this listener to listen for promotions.
[ "func (el *ChannelEventListener) RegPromotions() *ChannelEventListener {\n\tel.Promoted = make(chan *promoter.PromotionReattachmentEvent)\n\tel.ids = append(el.ids, el.em.RegisterListener(func(data interface{}) {\n\t\tel.Promoted <- data.(*promoter.PromotionReattachmentEvent)\n\t}, promoter.EventPromotion))\n\tretu...
[ "function(list){\n localStorage.setItem(localStorageKey, JSON.stringify(list));\n // if we used a real database, we would likely do the below in a callback\n this.list = list;\n this.trigger(list); // sends the updated list to all listening components (TodoApp)\n }...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Get the current sequence numbers from all partitions. @return an {@link Observable} of partition and sequence number.
[ "private Observable<PartitionAndSeqno> getSeqnos() {\n return conductor.getSeqnos().flatMap(new Func1<ByteBuf, Observable<PartitionAndSeqno>>() {\n @Override\n public Observable<PartitionAndSeqno> call(ByteBuf buf) {\n int numPairs = buf.readableBytes() / 10; // 2 byte short + 8 byte long\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 summarization about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code:" }
Get value from the variable @param method structure of setter method @param variable the variable @return a value
[ "protected Object getValue(SetterMethodCover method, Variable variable) {\n if(method.isTwoDimensionsArray()) \n return assignValuesToTwoDimensionsArray(method, variable.getSFSArrayValue());\n if(method.isArray())\n return assignValuesToArray(method, variable);\n \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:" }
obs-group-list = 1*([CFWS] ",") [CFWS]
[ "function obsGroupList() {\n return opts.strict ? null : wrap('obs-group-list', and(\n star(and(\n invis(opt(cfws)),\n literal(',')\n ), 1),\n invis(opt(cfws))\n )());\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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns a queryset of User objects who are following the given actor (eg my followers).
[ "def followers_qs(self, actor, flag=''):\n \n check(actor)\n queryset = self.filter(\n content_type=ContentType.objects.get_for_model(actor),\n object_id=actor.pk\n ).select_related('user')\n\n if flag:\n queryset = queryset.filter(flag=flag)\n ...
[ "def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):\n \n if self.delete_related:\n return super(AuditlogHistoryField, self).bulk_related_objects(objs, using)\n\n # When deleting, Collector.collect() finds related objects using this\n # method. However, because we d...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software Development:" }
// Set stores the data using the provided fileName
[ "func (s *RemoteStore) Set(fileName string, data []byte) error {\n\tsm := &SetMsg{\n\t\tFileName: fileName,\n\t\tData: data,\n\t}\n\tctx, cancel := s.getContext()\n\tdefer cancel()\n\t_, err := s.client.Set(ctx, sm)\n\treturn err\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code:" }
// NewTelegrafConfigService constructs an instance of an authorizing telegraf serivce.
[ "func NewTelegrafConfigService(s influxdb.TelegrafConfigStore, urm influxdb.UserResourceMappingService) *TelegrafConfigService {\n\treturn &TelegrafConfigService{\n\t\ts: s,\n\t\tUserResourceMappingService: urm,\n\t}\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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Relabels all Atoms in numerical order, offset by the start parameter. Parameters ---------- start : int, optional Defines an offset for the labelling.
[ "def relabel_atoms(self, start=1):\n \n counter = start\n for atom in self.get_atoms(ligands=True):\n atom.id = counter\n counter += 1\n return" ]
[ "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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
<p>Return the value of the <code>ondblclick</code> property.</p> <p>Contents: Javascript code executed when a pointer button is double clicked over this element.
[ "public java.lang.String getOndblclick() {\n return (java.lang.String) getStateHelper().eval(PropertyKeys.ondblclick);\n\n }" ]
[ "function () {\n \n Overlay.superclass.initDefaultConfig.call(this);\n\n var cfg = this.cfg;\n\n // Add overlay config properties //\n \n /**\n * The absolute x-coordinate position of the Overlay\n * @config x\n * @type Numbe...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software Development:" }
// GeneratePacketResponse returns an appropriate answer to an ARP request // or an ICMP echo request.
[ "func GeneratePacketResponse(packet gopacket.Packet) (response gopacket.Packet, err error) {\n\tethLayer := packet.Layer(layers.LayerTypeEthernet)\n\teth, ok := ethLayer.(*layers.Ethernet)\n\tif !ok {\n\t\tfmt.Println(\"Missing ETH layer.\")\n\t\treturn nil, ErrUnhandledPacket\n\t}\n\n\t// Set up buffer and options...
[ "@Override\n public void sendSilenceMessage(\n long startStamp,\n long endStamp,\n long completedPrefix,\n boolean requestedOnly,\n int priorit...
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
/* (non-Javadoc) @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamStrings(ca.uhn.fhir.jpa.entity.ResourceTable, ca.uhn.fhir.model.api.IResource)
[ "@Override\n\tpublic Set<ResourceIndexedSearchParamString> extractSearchParamStrings(ResourceTable theEntity, IBaseResource theResource) {\n\t\tHashSet<ResourceIndexedSearchParamString> retVal = new HashSet<ResourceIndexedSearchParamString>();\n\n\t\tString resourceName = getContext().getResourceDefinition(theResou...
[ "@PostConstruct\n\tprotected synchronized void setUpPostConstruct() {\n\t\tif (myInitialized) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (Entry<Class<? extends IResourceProvider>, IResourceProvider> provider : getProviders().entrySet()) {\n\t\t\taddProvider(provider.getValue(), provider.getKey());\n\t\t}\n\t\tList<BaseMeth...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Ensure that the pattern is safe for Unicode: add the “u” option. @param string $pattern Pattern. @return string
[ "public static function safePattern($pattern)\n {\n $delimiter = \\mb_substr($pattern, 0, 1);\n $options = \\mb_substr(\n \\mb_strrchr($pattern, $delimiter, false),\n \\mb_strlen($delimiter)\n );\n\n if (false === \\strpos($options, 'u')) {\n $pattern ...
[ "def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Encode action to be posted xdomain. @param {gui.Action} a @param @optional {String} key Associates dispatching document to the hosting iframespirit (ascending action scenario) @returns {String}
[ "function(a, key) {\n\t\t\tvar prefix = \"spiritual-action:\";\n\t\t\treturn prefix + (function() {\n\t\t\t\ta.target = null;\n\t\t\t\ta.data = (function(d) {\n\t\t\t\t\t\tif (gui.Type.isComplex(d)) {\n\t\t\t\t\t\t\tif (gui.Type.isFunction(d.stringify)) {\n\t\t\t\t\t\t\t\td = d.stringify();\n\t\t\t\t\t\t\t} else {\...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Receive the next :class:`~av.video.frame.VideoFrame`. The base implementation just reads a 640x480 green frame at 30fps, subclass :class:`VideoStreamTrack` to provide a useful implementation.
[ "async def recv(self):\n \n pts, time_base = await self.next_timestamp()\n\n frame = VideoFrame(width=640, height=480)\n for p in frame.planes:\n p.update(bytes(p.buffer_size))\n frame.pts = pts\n frame.time_base = time_base\n return frame" ]
[ "def is_active(self):\n \n if not self._multiplexer:\n return False\n\n if self._index_cached is not None:\n # If we already have computed the index, use it to determine whether\n # the plugin should be active, and if so, return immediately.\n if any(self._index_cached.values()):\n ...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Returns an unmodifiable set containing all resource names known to this context
[ "public Set<String> getResourceNames() {\n\t\tSet<String> resourceNames = new HashSet<>();\n\n\t\tif (myNameToResourceDefinition.isEmpty()) {\n\t\t\tProperties props = new Properties();\n\t\t\ttry {\n\t\t\t\tprops.load(myVersion.getFhirVersionPropertiesFile());\n\t\t\t} catch (IOException theE) {\n\t\t\t\tthrow new...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Put task to generate a delivery from test uri to the task queue Test uri has to be set and existing
[ "public function generateDeferred()\n {\n try {\n if (! $this->hasRequestParameter(self::REST_DELIVERY_TEST_ID)) {\n throw new \\common_exception_MissingParameter(self::REST_DELIVERY_TEST_ID, $this->getRequestURI());\n }\n\n $test = $this->getResource($this-...
[ "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:" }
// NewMempool returns a new Mempool with the given configuration and connection to an application.
[ "func NewMempool(\n\tconfig *cfg.MempoolConfig,\n\tproxyAppConn proxy.AppConnMempool,\n\theight int64,\n\toptions ...MempoolOption,\n) *Mempool {\n\tmempool := &Mempool{\n\t\tconfig: config,\n\t\tproxyAppConn: proxyAppConn,\n\t\ttxs: clist.New(),\n\t\theight: height,\n\t\trechecking: 0,\...
[ "@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 Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Start this server. If we manage an own HttpServer, then the HttpServer will be started as well.
[ "public void start() {\n // URL as configured takes precedence\n String configUrl = NetworkUtil.replaceExpression(config.getJolokiaConfig().get(ConfigKey.DISCOVERY_AGENT_URL));\n jolokiaHttpHandler.start(lazy,configUrl != null ? configUrl : url, config.getAuthenticator() != null);\n\n if...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Converts an offset to an RVA. @type rva: int @param rva: The RVA to be converted. @rtype: int @return: An integer value representing an offset in the PE file.
[ "def getOffsetFromRva(self, rva):\n \n offset = -1\n s = self.getSectionByRva(rva)\n \n if s != offset:\n offset = (rva - self.sectionHeaders[s].virtualAddress.value) + self.sectionHeaders[s].pointerToRawData.value\n else:\n offset = rva\n \n ...
[ "function MODERN( buffer, start, end ) {\n\n if( !(this instanceof MODERN) )\n return new MODERN( buffer, start, end )\n\n // In order to ensure the integrity of the MBR boot loader code,\n // it is important that the bytes at +0DAh to +0DFh are never changed,\n // unless either all six bytes represent a val...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Delete remote file @param string $path Remote Path @return bool @throws
[ "public function delete($path)\n {\n $path = trim($path, '/');\n\n if (!$this->isFile($path)) {\n $path = $this->bucket . \"/\" . $path;\n throw new ExceptionStorage(\"File {$path} Not found or Not Is File\", static::E_NOT_IS_FILE);\n }\n\n $response = $this->cli...
[ "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 Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Writes the index entry into memcache/apc DB.
[ "private function write_index()\n {\n if (!$this->db || $this->type == 'db') {\n return;\n }\n\n $this->load_index();\n\n // Make sure index contains new keys\n foreach ($this->cache as $key => $value) {\n if ($value !== null && !in_array($key, $this->inde...
[ "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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// NewConsulBackend constructs a Consul backend using the given API client // and the prefix in the KV store.
[ "func NewConsulBackend(conf map[string]string, logger log.Logger) (physical.Backend, error) {\n\t// Get the path in Consul\n\tpath, ok := conf[\"path\"]\n\tif !ok {\n\t\tpath = \"vault/\"\n\t}\n\tif logger.IsDebug() {\n\t\tlogger.Debug(\"config path set\", \"path\", path)\n\t}\n\n\t// Ensure path is suffixed but no...
[ "func (e *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {\n\t// This provider doesn't track instance -> controller.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Pulls out the (name: str, version:str, extras:(str)) tuple from the pinned InstallRequirement.
[ "def as_tuple(ireq):\n \n\n if not is_pinned_requirement(ireq):\n raise TypeError(\"Expected a pinned InstallRequirement, got {}\".format(ireq))\n\n name = key_from_req(ireq.req)\n version = first(ireq.specifier._specs)._spec[1]\n extras = tuple(sorted(ireq.extras))\n return name, version, ...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Connect the redis server and set redis options @return bool true on success, false on error
[ "public function connect()\n {\n if ($this->object) {\n return true;\n }\n\n $this->object = new \\Redis;\n $connect = $this->persistent ? 'pconnect' : 'connect';\n $result = $this->object->$connect($this->host, $this->port, $this->timeout);\n\n if ($result &&...
[ "private function cache(string $key, string $value, int $cacheTime = null)\n {\n try {\n $this->client->set($key, $value);\n\n if ($cacheTime !== null) {\n $this->client->expire($key, $cacheTime);\n }\n } catch (\\Exception $e) {\n // We do...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
// Append the peer.ID to the sorter's slice. It may no longer be sorted.
[ "func (pds *peerDistanceSorter) appendPeer(p peer.ID) {\n\tpds.peers = append(pds.peers, peerDistance{\n\t\tp: p,\n\t\tdistance: xor(pds.target, ConvertPeerID(p)),\n\t})\n}" ]
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Software development:" }
Invokes {@link #toMetaFunctions(Workbook, Class)} with {@link IDataModel} converted to {@link Workbook}.
[ "static <T extends FunctionMeta> Map<T, IDataModel> toMetaFunctions(IDataModel book, Class<T> metaClass) {\r\n return toMetaFunctions(DataModelConverters.toWorkbook(book), metaClass);\r\n }" ]
[ "@Override\n public List findByRange(byte[] muinVal, byte[] maxVal, EntityMetadata m, boolean isWrapReq, List<String> relations,\n List<String> columns, List<IndexExpression> conditions, int maxResults) throws Exception {\n throw new UnsupportedOperationException(\"Support available only for thrift...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Shortcut to check if complex exists in our database.
[ "def complex_exists(self, complex: str) -> bool:\n \n try:\n self.check_complex(complex)\n except exceptions.RumetrComplexNotFound:\n return False\n\n return True" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Simulate an ASCII cow saying text. :type text: string :param text: The text to print out. :type align: string :param algin: Where to align the cow. Can be 'left', 'centre' or 'right'
[ "def cowsay(text='', align='centre'):\n \n\n # Make align lowercase\n align = align.lower()\n\n # Set the cowtext\n cowtext = str(text)\n\n # Set top part of speech bubble to the length of the text plus 2\n topbar = ' ' * (len(text) + 2)\n\n # Set bottom part of speech bubble to the length o...
[ "def indent(self, value):\n \"\"\"\"\"\"\n # Explicit indent setting\n if isinstance(value, str):\n if value.isspace() or len(value) == 0:\n self._indent = value\n else:\n raise ValueError('String indentation can only contain '\n ...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// BuildBlockHeaderVerbose creates a *dcrjson.GetBlockHeaderVerboseResult from // an input *wire.BlockHeader and current best block height, which is used to // compute confirmations. The next block hash may optionally be provided.
[ "func BuildBlockHeaderVerbose(header *wire.BlockHeader, params *chaincfg.Params,\n\tcurrentHeight int64, nextHash ...string) *dcrjson.GetBlockHeaderVerboseResult {\n\tif header == nil {\n\t\treturn nil\n\t}\n\n\tdiffRatio := txhelpers.GetDifficultyRatio(header.Bits, params)\n\n\tvar next string\n\tif len(nextHash) ...
[ "@Override\n public Message deserialize(ByteBuffer in) throws ProtocolException, IOException {\n // A Bitcoin protocol message has the following format.\n //\n // - 4 byte magic number: 0xfabfb5da for the testnet or\n // 0xf9beb4d9 for production\n //...
codesearchnet
{ "query": "Represent the Github summarization about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Programming:" }