query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
// SetNextToken sets the NextToken field's value. | [
"func (s *SegmentsResponse) SetNextToken(v string) *SegmentsResponse {\n\ts.NextToken = &v\n\treturn s\n}"
] | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// Bool get cookie as bool | [
"func (c *cookies) Bool(key string) (bool, error) {\n\tck, err := c.req.Cookie(key)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn strconv.ParseBool(ck.Value)\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Initiate the module
@param config The configuration for the module | [
"function(config){\n \n if(isString(config)){\n this.config.appBase = config;\n }else if(isObject(config)){// If the config object is provided\n this.config = Object.assign(this.config, config);\n }\n\n // If the app base isn't provided\n if(!this.conf... | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Preferences. | [
"func (in *Preferences) DeepCopy() *Preferences {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Preferences)\n\tin.DeepCopyInto(out)\n\treturn out\n}"
] | [
"func (resource *Bundle) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Bundle\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Bundle), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Suffix unique index to slug
@param $slug
@param $list
@return string | [
"private function generateSuffix($slug, $list)\n {\n // loop through list and get highest index number\n $index = $list->map(function ($s) use ($slug) {\n // str_replace instead of explode('-');\n return intval(str_replace($slug . '-', '', $s));\n })->sort()->last();\n\... | [
"protected function map() {return df_map_0(df_sort_a(df_map_r(df_cms_blocks(), function(B $b) {return [\n\t\t$b->getId(), $b->getTitle()\n\t];})), '-- select a CMS block --');}"
] | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Sets self.input to inputs. Load order is by default random. Use setOrderedInputs() to order inputs. | [
"def setInputs(self, inputs):\n \n if not self.verifyArguments(inputs) and not self.patterned:\n raise NetworkError('setInputs() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', inputs)\n self.inputs = inputs\n self.loadOrder = [0] * len(self.inputs)\n for... | [
"function transformer (selection) {\n const type = quantum.isSelection(selection) ? selection.type() : undefined\n const entityTransform = transformMap[type] || defaultTransform\n return entityTransform(selection, transformer, meta) // bootstrap to itself to make the transformer accessible to children\n ... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Starts an HTTP {@link Operation} with the given method and {@link HttpUrl}.
@param method The uppercased HTTP method to use.
@param url An {@link HttpUrl} target.
@return An {@link Operation} builder. | [
"protected Operation httpOp(String method, HttpUrl url) {\n return new Operation(httpClient).method(method).httpUrl(url);\n }"
] | [
"public PluginEntry[] getCategorizedAvailables() {\n TreeSet<PluginEntry> entries = new TreeSet<>();\n for (Plugin p : getAvailables()) {\n if (p.categories==null || p.categories.length==0)\n entries.add(new PluginEntry(p, getCategoryDisplayName(null)));\n else\n ... | codesearchnet | {
"query": "Represent the comment about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about App development:"
} |
Evaluate processors on given value.
@param mixed $valueToProcess
@param array $configurationWithEventualProcessors
@param string $fusionPath
@param AbstractFusionObject $contextObject
@return mixed | [
"protected function evaluateProcessors($valueToProcess, $configurationWithEventualProcessors, $fusionPath, AbstractFusionObject $contextObject = null)\n {\n if (isset($configurationWithEventualProcessors['__meta']['process'])) {\n $processorConfiguration = $configurationWithEventualProcessors['... | [
"public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD... | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
new syntax for mapping routes | [
"public static function map(\n\t\tstring $url = null, string $destination, string $route_name = null, string $method = null\n\t) :Route {\n\t\t// We cannot allow duplicate route names for reversing reasons\n\t\tif($route_name && self::hasRoute($route_name)) {\n\t\t\t// throw an exception\n\t\t\tthrow new Exception(... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
setRootDir
Sets the application root directory
(This is typically unneeded except for tests)
@param string $rootDir
@return self $this | [
"public function setRootDir($rootDir)\n {\n if (!is_dir($rootDir)) {\n throw new \\InvalidArgumentException(\n sprintf('Invalid Application Configuration Directory: %s', $rootDir)\n );\n }\n\n $this->rootDir = $rootDir;\n }"
] | [
"public function help()\n {\n $style = new Eurekon\\Style(' *** RUN - HELP ***');\n Eurekon\\Out::std($style->color('fg', Eurekon\\Style::COLOR_GREEN)->get());\n Eurekon\\Out::std('');\n\n $help = new Eurekon\\Help('...', true);\n $help->addArgument('', 'directory', 'Config dir... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about NLP:"
} |
Sort by function.
@param string $function
@param string $order
@return SortBy | [
"public function byFunction(\n string $function,\n string $order\n ): SortBy {\n $this->sortsBy[] = [\n 'type' => self::TYPE_FUNCTION,\n 'function' => $function,\n 'order' => $order,\n ];\n\n return $this;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Return the sentences that led to the construction of a specified edge.
Args:
G
source: The source of the edge.
target: The target of the edge. | [
"def _get_edge_sentences(\n G: AnalysisGraph, source: str, target: str\n) -> List[str]:\n \n\n return chain.from_iterable(\n [\n [repr(e.text) for e in s.evidence]\n for s in G.edges[source, target][\"InfluenceStatements\"]\n ]\n )"
] | [
"function createGraph(options) {\n // Graph structure is maintained as dictionary of nodes\n // and array of links. Each node has 'links' property which\n // hold all links related to that node. And general links\n // array is used to speed up all links enumeration. This is inefficient\n // in terms of memory,... | codesearchnet | {
"query": "Represent the Github text about writing:",
"pos": "Represent the Github code about writing:",
"neg": "Represent the Github code:"
} |
Finds the path to the file where the class is defined.
@param string $class The name of the class
@return string|null The path, if found | [
"public function findFile($class)\n {\n if (false !== $pos = strrpos($class, '\\\\')) {\n // namespaced class name\n $namespace = substr($class, 0, $pos);\n $className = substr($class, $pos + 1);\n $normalizedClass = str_replace('\\\\', DIRECTORY_SEPARATOR, $nam... | [
"public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key.... | codesearchnet | {
"query": "Represent the text about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
// MethodsFromTypes create a method set from the include slice, excluding any
// method in exclude. | [
"func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.Type) Methods {\n\tc.parseSource()\n\n\tvar methods Methods\n\n\tvar excludes = make(map[string]bool)\n\n\tif len(exclude) > 0 {\n\t\tfor _, m := range c.MethodsFromTypes(exclude, nil) {\n\t\t\texcludes[m.Name] = true\n\t\t}\n\t}\n\n\t/... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Creates an ad group in the Shopping campaign. | [
"private static function createAdGroup(\n AdWordsServices $adWordsServices,\n AdWordsSession $session,\n Campaign $campaign\n ) {\n $adGroupService = $adWordsServices->get($session, AdGroupService::class);\n\n // Create ad group.\n $adGroup = new AdGroup();\n $adG... | [
"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:"
} |
Creates copies of the fields we are keeping
track of for the provided model, returning a
dictionary mapping field name to a copied field object. | [
"def copy_fields(self, model):\n \n fields = {'__module__' : model.__module__}\n\n for field in model._meta.fields:\n\n if not field.name in self._exclude:\n\n field = copy.deepcopy(field)\n\n if isinstance(field, models.AutoField):\n ... | [
"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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Convert to `Set-Cookie` headers
@return string[] | [
"public function toHeaders(): array\n {\n $headers = [];\n foreach ($this as $name => $properties) {\n $headers[] = $this->toHeaderLine($name, $properties);\n }\n\n return $headers;\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code:"
} |
Genera texto en markdown a partir de los metadatos de un `field`.
Args:
field (dict): Diccionario con metadatos de un `field`.
Returns:
str: Texto que describe un `field`. | [
"def field_to_markdown(field):\n \n if \"title\" in field:\n field_title = \"**{}**\".format(field[\"title\"])\n else:\n raise Exception(\"Es necesario un `title` para describir un campo.\")\n\n field_type = \" ({})\".format(field[\"type\"]) if \"type\" in field else \"\"\n field_desc =... | [
"def get_quote(options = {})\n ################### Optionals\n # will be removed from code\n # Ej: 20x2x10,20x2x10 indica que se envian 2 paquetes y cada uno tiene 20 cm de alto x 2 cm de ancho x 10 cm de largo.\n paquetes = options[:paquetes]\n correo = options[:correo] # ID, e.: \"oca\"\... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// RematchPointersToClusters will take a set of pointers and map them to the closest cluster.
// Basically creates a new cluster from that one point and does the ClusterDistance between them.
// Will return a new list. | [
"func RematchPointersToClusters(\n\tclusters []*clustering.Cluster,\n\tpointers []geo.Pointer,\n\tdistancer clustering.ClusterDistancer,\n\tthreshold float64,\n) []*clustering.Cluster {\n\tif len(clusters) == 0 {\n\t\treturn []*clustering.Cluster{}\n\t}\n\n\tnewClusters := make([]*clustering.Cluster, 0, len(cluster... | [
"@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:"
} |
// See cairo_rel_line_to().
//
// C API documentation: http://cairographics.org/manual/cairo-Paths.html#cairo-rel-line-to | [
"func (cr *Context) RelLineTo(dx, dy float64) {\n\tC.cairo_rel_line_to(cr.Ptr, C.double(dx), C.double(dy))\n\tif err := cr.status(); err != nil {\n\t\tpanic(err)\n\t}\n}"
] | [
"def merge(self, other):\n \n cairo.cairo_font_options_merge(self._pointer, other._pointer)\n _check_status(cairo.cairo_font_options_status(self._pointer))"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Return data to a mysql server | [
"def returner(ret):\n '''\n \n '''\n # if a minion is returning a standalone job, get a jobid\n if ret['jid'] == 'req':\n ret['jid'] = prep_jid(nocache=ret.get('nocache', False))\n save_load(ret['jid'], ret)\n\n try:\n with _get_serv(ret, commit=True) as cur:\n sql ... | [
"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 comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// WithPrefix returns a router that prefixes all registered routes with prefix. | [
"func (r *Router) WithPrefix(prefix string) *Router {\n\treturn &Router{rtr: r.rtr, prefix: r.prefix + prefix, instrh: r.instrh}\n}"
] | [
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ... | codesearchnet | {
"query": "Represent the comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
// Reallocate will avoid deleting all keys and reallocate a new
// map, this is useful if you believe you have a large map and
// will not need to grow back to a similar size. | [
"func (m *Map) Reallocate() {\n\tif m.initialSize > 0 {\n\t\tm.lookup = make(map[MapHash]MapEntry, m.initialSize)\n\t} else {\n\t\tm.lookup = make(map[MapHash]MapEntry)\n\t}\n}"
] | [
"func NewOnDemandStorer(s storage.Storer) (*OnDemandStorer, error) {\n\t// Track a small number of recent in-memory objects, to improve\n\t// performance without impacting memory too much.\n\t//\n\t// LRU is very helpful here because of the way delta compression\n\t// works. It first sorts the objects by type and d... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
Drag around label if visible. | [
"def _on_motion(self, event):\n \"\"\"\"\"\"\n if not self._visual_drag.winfo_ismapped():\n return\n\n if self._drag_cols and self._dragged_col is not None:\n self._drag_col(event)\n elif self._drag_rows and self._dragged_row is not None:\n self._drag_row... | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Utility method to invalidate Connection. Parameters passed to ConnectionInterface.invalidate
@param notifyPeer
@param throwable
@param debugReason | [
"protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason)\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, \"invalidateConnection\", new Object[]{new Boolean(notifyPeer),\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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Validate checks that the label does not include unexpected options | [
"func Validate(label string) error {\n\tif strings.Contains(label, \"z\") && strings.Contains(label, \"Z\") {\n\t\treturn ErrIncompatibleLabel\n\t}\n\treturn nil\n}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github comment about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code about programming:"
} |
Removes all from->to and to->from edges.
Note: the symmetric kwarg is unused. | [
"def remove_edges(self, from_idx, to_idx, symmetric=False, copy=False):\n ''''''\n flat_inds = self._pairs.dot((self._num_vertices, 1))\n # convert to sorted order and flatten\n to_remove = (np.minimum(from_idx, to_idx) * self._num_vertices\n + np.maximum(from_idx, to_idx))\n mask = n... | [
"public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }"
] | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public EClass getIfcLinearMomentMeasure() {\r\n\t\tif (ifcLinearMomentMeasureEClass == null) {\r\n\t\t\tifcLinearMomentMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(696);\r\n\t\t}\r\n\t\treturn ifcLinearMomentMeasureEClass;\r\n\t}"
] | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the post about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
// ParseCiphers parses ciphersuites from the comma-separated string into
// recognized slice | [
"func ParseCiphers(tlsConfig *config.TLSConfig) ([]uint16, error) {\n\tsuites := []uint16{}\n\n\tcipherStr := strings.TrimSpace(tlsConfig.TLSCipherSuites)\n\n\tvar parsedCiphers []string\n\tif cipherStr == \"\" {\n\t\tparsedCiphers = defaultTLSCiphers\n\n\t} else {\n\t\tparsedCiphers = strings.Split(tlsConfig.TLSCi... | [
"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 about Text analysis:",
"pos": "Represent the Github code about Text analysis:",
"neg": "Represent the Github code about programming:"
} |
<p>consume.</p>
@param args a {@link java.util.List} object.
@throws com.greenpepper.util.cli.WrongOptionUsageException if any. | [
"public void consume( List<String> args ) throws WrongOptionUsageException\n {\n if (wantsArg() && (args.isEmpty())) throw new WrongOptionUsageException( this );\n value = wantsArg() ? convert( CollectionUtil.shift( args ) ) : true;\n }"
] | [
"public void addValidator(com.andreabaccega.formedittextvalidator.Validator theValidator) throws IllegalArgumentException {\n editTextValidator.addValidator(theValidator);\n }"
] | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Determine if two models have the same ID and belong to the same table.
@param \Illuminate\Database\Eloquent\Model|null $model
@return bool | [
"public function is($model)\n {\n return ! is_null($model) &&\n $this->getKey() === $model->getKey() &&\n $this->getTable() === $model->getTable() &&\n $this->getConnectionName() === $model->getConnectionName();\n }"
] | [
"abstract public function __construct(DataAccessInterface $dataSource);\n \n /**\n * Returns an array with all entities for the given data request.\n * \n * @param \\Zepi\\DataSource\\Core\\DataRequest $dataRequest\n * @return false|array\n */\n public function find(DataRequest $dataReq... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Check if add-on was connected to install
@author Vova Feldman (@svovaf)
@since 1.1.7
@param string|number $id_or_slug
@return bool | [
"function is_addon_connected( $id_or_slug ) {\r\n $this->_logger->entrance();\r\n\r\n $sites = self::get_all_sites( WP_FS__MODULE_TYPE_PLUGIN );\r\n\r\n $addon_id = self::get_module_id( $id_or_slug );\r\n $addon = $this->get_addon( $addon_id );\r\n $slug ... | [
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Fisher's method for combining independent p-values. | [
"def fishers_method(pvals):\n \"\"\"\"\"\"\n pvals = np.asarray(pvals)\n degrees_of_freedom = 2 * pvals.size\n chisq_stat = np.sum(-2*np.log(pvals))\n fishers_pval = stats.chi2.sf(chisq_stat, degrees_of_freedom)\n return fishers_pval"
] | [
"def is_stationary(self):\n \"\"\"\n # for disconnected matrices, the stationary distribution depends on the estimator, so we can't compute\n # it directly. Therefore we test whether the initial distribution is stationary.\n return np.allclose(np.dot(self._Pi, self._Tij), self._Pi)"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetGrantWriteACP sets the GrantWriteACP field's value. | [
"func (s *PutObjectAclInput) SetGrantWriteACP(v string) *PutObjectAclInput {\n\ts.GrantWriteACP = &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 description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// SoftClip clips the constant to the range [-0.5, 0.5] | [
"func (c C) SoftClip() Input {\n\tif float32(c) < -0.5 {\n\t\treturn C(-0.5)\n\t} else if float32(c) > 0.5 {\n\t\treturn C(0.5)\n\t}\n\treturn c\n}"
] | [
"def getPixelValue(self, x, y):\n \"\"\"\"\"\"\n assert x < self.size, \"x: %d<%d\" % (x, self.size)\n assert y < self.size, \"y: %d<%d\" % (y, self.size)\n # Same as calcOffset, inlined for performance reasons\n offset = x + self.size * (self.size - y - 1)\n #print offset\... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Computer Science:"
} |
Adds parameters for the root expression only.
@param param The parameter to add, cannot be null or empty
@throws IllegalArgumentException if the parameter is null or empty | [
"public void addFunctionParameter(final String param) {\n if (param == null || param.isEmpty()) {\n throw new IllegalArgumentException(\"Parameter cannot be null or empty\");\n }\n if (func_params == null) {\n func_params = Lists.newArrayList();\n }\n func_params.add(param);\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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
icon ( or generic html if icon not available ) | [
"private String getSingleSlotHtml(TestSlot s, String icon) {\n StringBuilder builder = new StringBuilder();\n TestSession session = s.getSession();\n if (icon != null) {\n builder.append(\"<img \");\n builder.append(\"src='\").append(icon).append(\"' width='16' height='16'\");\n } else {\n ... | [
"def set_form form\n raise \"Form is nil in set_form\" if form.nil?\n @form = form\n @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget\n # 2009-10-29 15:04 use form.window, unless buffer created\n # should not use form.window so explicitly everywhere.\n # added... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
check if a feed is available from a peer apart from ignore_id | [
"function isAvailable(state, feed_id, ignore_id) {\n for(var peer_id in state.peers) {\n if(peer_id != ignore_id) {\n var peer = state.peers[peer_id]\n //BLOCK: check wether id has blocked this peer\n if((peer.clock && peer.clock[feed_id] || 0) > (state.clock[feed_id] || 0) && isShared(state, fee... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
thePu239_lamda is lamda in ANS-5.1-1979 Table 8. | [
"def thePu239_lamda\r\n array = Array.new(23)\r\n\r\n array[0] = 1.002E+01\r\n array[1] = 6.433E-01\r\n array[2] = 2.186E-01\r\n array[3] = 1.004E-01\r\n array[4] = 3.728E-02\r\n array[5] = 1.435E-02\r\n array[6] = 4.549E-03\r\n array[7] = 1.328E-03\r\n array[8] = 5... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Updates httpRequest with region. If region is not provided, then
the httpRequest will be updated based on httpRequest.region
@api private | [
"function updateReqBucketRegion(request, region) {\n var httpRequest = request.httpRequest;\n if (typeof region === 'string' && region.length) {\n httpRequest.region = region;\n }\n if (!httpRequest.endpoint.host.match(/s3(?!-accelerate).*\\.amazonaws\\.com$/)) {\n return;\n }\n var serv... | [
"@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 comment about host:",
"pos": "Represent the Github code about host:",
"neg": "Represent the Github code about Programming:"
} |
Run the migrations.
@return void | [
"public function up()\n {\n $this->down();\n Schema::create('tbl_widgets', function(Blueprint $table) {\n $table->increments('id');\n $table->integer('type_id')->unsigned()->index('type_id');\n $table->string('name')->index('name');\n $table->timestamps()... | [
"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 instruction about Database management:",
"pos": "Represent the code about Database management:",
"neg": "Represent the code about programming:"
} |
Accessor for the specifier's values. The values are URL encoded and
separated by commas.
@return The specifier's value. | [
"protected String getValuesString() {\n final StringBuilder builder = new StringBuilder();\n\n for(final String value : values) {\n builder.append(AciURLCodec.getInstance().encode(value)).append(',');\n }\n\n if(builder.length() > 0) {\n builder.deleteCharAt(builder... | [
"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 text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
} |
Show the form for editing the specified resource.
@param Category $category
@return Response | [
"public function edit(Category $category)\n {\n $categories = $this->category->all()->nest()->listsFlattened('name');\n\n return view('product::admin.categories.edit', compact('category', 'categories'));\n }"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Batch Keep Absolute (retrain)
xlabel = "Fraction of features kept"
ylabel = "ROC AUC"
transform = "identity"
sort_order = 13 | [
"def batch_keep_absolute_retrain__roc_auc(X, y, model_generator, method_name, num_fcounts=11):\n \n return __run_batch_abs_metric(measures.batch_keep_retrain, X, y, model_generator, method_name, sklearn.metrics.roc_auc_score, num_fcounts)"
] | [
"def FreqDist_chart (self):\n \n # Take a log of the data before plotting so that we can\n # reduce the number of points to plot evenly\n pdata = {}\n for idx, s_name in enumerate(self.tagdir_data['FreqDistribution']):\n pdata[s_name] = {}\n for x, y in self.... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Constructs the matrix A and the vector b from a timeseries of toy
action-angles AA to solve for the vector x = (J_0,J_1,J_2,S...) where
x contains all Fourier components of the generating function with |n|<N_max | [
"def solver(AA, N_max, symNx = 2, throw_out_modes=False):\n \n\n # Find all integer component n_vectors which lie within sphere of radius N_max\n # Here we have assumed that the potential is symmetric x->-x, y->-y, z->-z\n # This can be relaxed by changing symN to 1\n # Additionally due to time rever... | [
"def rsdl_rn(self, AX, Y):\n \"\"\"\"\"\"\n\n # The primal residual normalisation term is\n # max( ||A x^(k)||_2, ||B y^(k)||_2 ) and B = -(I I I ...)^T.\n # The scaling by sqrt(Nb) of the l2 norm of Y accounts for the\n # block replication introduced by multiplication by B\n ... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Gets the customField, null if the key does not exist.
@param object $owningEntity
@param string $key
@return CustomFieldBase|null | [
"public static function getField($owningEntity, $key)\n {\n $entity = $owningEntity->getNonemptyCustomFields()->get($key);\n\n if (!$entity) {\n self::checkCustomFieldExists($owningEntity, $key);\n }\n\n return $entity;\n }"
] | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// Take apart and rebuild the connection string. Also return the dbname. | [
"func rebuildConnectionString(connectionString string) (string, string) {\n\tusername, password, hasPassword, hostname, port, dbname := splitConnectionString(connectionString)\n\treturn buildConnectionString(username, password, hasPassword, hostname, port, dbname), dbname\n}"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
Change directory. It behaves like "cd directory". | [
"def cd(cls, directory):\n \"\"\"\"\"\"\n Log.debug('CMD: cd {0}'.format(directory))\n os.chdir(directory)"
] | [
"def _print_help(self):\n \"\"\"\"\"\"\n msg = \"\"\"Commands (type help <command> for details)\n\nCLI: help history exit quit\nSession, General: set load save reset\nSession, Access Control: allowaccess denyaccess clearaccess\nSession, Replication: allowrep denyrep prefe... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Return the textual representation of the given :class:`~taxi.timesheet.lines.DateLine` instance. The date
format is set by the `date_format` parameter given when instanciating the parser instance. | [
"def date_line_to_text(self, date_line):\n \n # Changing the date in a dateline is not supported yet, but if it gets implemented someday this will need to be\n # changed\n if date_line._text is not None:\n return date_line._text\n else:\n return date_utils.un... | [
"def _parse_filter_word(self, word):\n \n if isinstance(word, str):\n word = \"'{}'\".format(word)\n elif isinstance(word, dt.date):\n if isinstance(word, dt.datetime):\n if word.tzinfo is None:\n # if it's a naive datetime, localize the d... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// SetOutputDataConfig sets the OutputDataConfig field's value. | [
"func (s *HyperParameterTrainingJobDefinition) SetOutputDataConfig(v *OutputDataConfig) *HyperParameterTrainingJobDefinition {\n\ts.OutputDataConfig = 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:"
} |
// RunOnAllMachines attempts to run the specified command on all the machines. | [
"func (a *ActionAPI) RunOnAllMachines(run params.RunParams) (results params.ActionResults, err error) {\n\tif err := a.checkCanAdmin(); err != nil {\n\t\treturn results, err\n\t}\n\n\tif err := a.check.ChangeAllowed(); err != nil {\n\t\treturn results, errors.Trace(err)\n\t}\n\n\tmachines, err := a.state.AllMachine... | [
"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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Uses the $writer object to write the table definition $table for $tableName
@param string $tableName
@param ezcDbSchemaTable $table | [
"private function writeTable( $tableName, ezcDbSchemaTable $table )\n {\n $this->writer->startElement( 'table' );\n $this->writer->startElement( 'name' );\n $this->writer->text( $tableName );\n $this->writer->endElement();\n $this->writer->flush();\n\n $this->writer->sta... | [
"@Override\n public AccessPlan fromView(XsStringVal schema, XsStringVal view) {\n return new AccessPlanSubImpl(this, \"op\", \"from-view\", new Object[]{ schema, view });\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Extract Multiple fields for record | [
"def extract_multiple(record, field, tag)\n a = Array.new\n record.fields(field).each do |field|\n a.push field[tag]\n end\n return a\n end"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
First start of frame (SOFn) marker in this sequence. | [
"def sof(self):\n \n for m in self._markers:\n if m.marker_code in JPEG_MARKER_CODE.SOF_MARKER_CODES:\n return m\n raise KeyError('no start of frame (SOFn) marker in image')"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Removes a parameter by index, from the table's internal set and backing
maps and adjusts indices.
<p>
If no parameter exists for the specified index, this method is a no-op.
</p>
@param pid Table parameter index | [
"public void removeTableParameter(final int pid) {\n final TableParameter p = indexParameter.get(pid);\n if (p == null) return;\n\n // Pull the reference count\n final Integer pcount = count.get(p);\n\n // Alter maps and set only if 1 ref\n if (pcount == 1 && parameters.rem... | [
"function NDDBIndex(idx, nddb) {\n // The name of the index.\n this.idx = idx;\n // Reference to the whole nddb database.\n this.nddb = nddb;\n // Map indexed-item to a position in the original database.\n this.resolve = {};\n // List of all keys in `resolve` object.... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Add new divider item.
@param int $order
@param array $attributes
@return \Rinvex\Menus\Models\MenuItem | [
"public function divider(int $order = null, array $attributes = []): MenuItem\n {\n return $this->add(['type' => 'divider', 'order' => $order, 'attributes' => $attributes]);\n }"
] | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Create new vector of type variables from list of variables
changing all recursive bounds from old to new list. | [
"public List<Type> newInstances(List<Type> tvars) {\n List<Type> tvars1 = tvars.map(newInstanceFun);\n for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) {\n TypeVar tv = (TypeVar) l.head;\n tv.bound = subst(tv.bound, tvars, tvars1);\n }\n return tvars1;\n }"
... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Returns a temporary buffer of at least the given size | [
"static ByteBuffer getTemporaryDirectBuffer(int size) {\n BufferCache cache = bufferCache.get();\n ByteBuffer buf = cache.get(size);\n if (buf != null) {\n return buf;\n } else {\n // No suitable buffer in the cache so we need to allocate a new\n // one. ... | [
"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 sentence about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about File management:"
} |
We need to parse the padding and type as soon as possible,
else we won't be able to parse the message list... | [
"def pre_dissect(self, s):\n \n if len(s) < 1:\n raise Exception(\"Invalid InnerPlaintext (too short).\")\n\n tmp_len = len(s) - 1\n if s[-1] != b\"\\x00\":\n msg_len = tmp_len\n else:\n n = 1\n while s[-n] != b\"\\x00\" and n < tmp_len:... | [
"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 comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about File management:"
} |
Returns true if the value is truthy
@param mixed $value Value to check
@return bool | [
"public static function isTruthy($value)\n {\n if (!$value) {\n return $value === 0 || $value === '0';\n } elseif ($value instanceof \\stdClass) {\n return (bool) get_object_vars($value);\n } else {\n return true;\n }\n }"
] | [
"function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {\n /*\n * if expectations aren't met, args checker will throw appropriate exceptions\n * notifying the user regarding the errors of the arguments.\n * */\n \targs.expect(arguments, ['boolean|string', '*',... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Sets the parent control - this is important for link generation
@param Control $parentControl | [
"public function setParentControl(Control $parentControl = null)\n {\n $this->parentControl = $parentControl;\n $this->matcher->setParentControl($parentControl);\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 description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
@param string $subscriptionExtUid
@return \DVelopment\FastBill\Model\Subscription | [
"public function getSubscriptionByExtUid($subscriptionExtUid)\n {\n /** @var SubscriptionFbApi $response */\n $response = $this->call(new Request('subscription.get', array('subscription_ext_uid' => $subscriptionExtUid)), 'DVelopment\\FastBill\\Model\\SubscriptionFbApi');\n $subscriptions = $... | [
"public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
/*
This method does a run over all of the data keeps a list of the k smallest
indices that it has seen so far. At the end, it swaps those k elements and
moves them to the front.
*/ | [
"func naiveSelectionFinding(data Interface, k int) {\n\tsmallestIndices := make([]int, k)\n\tfor i := 0; i < k; i++ {\n\t\tsmallestIndices[i] = i\n\t}\n\tresetLargestIndex(smallestIndices, data)\n\n\tfor i := k; i < data.Len(); i++ {\n\t\tif data.Less(i, smallestIndices[k-1]) {\n\t\t\tsmallestIndices[k-1] = i\n\t\t... | [
"def _append(lst, indices, value):\n \n for i, idx in enumerate(indices):\n # We need to loop because sometimes indices can increment by more than 1 due to missing tokens.\n # Example: Sentence with no words after filtering words.\n while len(lst) <= idx:\n # Update max counts ... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
this function will iterate over each list elements
setting the one on key to true an all other on false
@param key String, the key to set as true
@param list Object, the object to search for the key to set to true
@return void | [
"function commutate(key, list) {\n _.each(list, function (v, k, l) {\n if (k === key) {\n l[key] = true\n }\n if (v === true && k !== key) {\n l[k] = false\n }\n })\n}"
] | [
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Marshall the given parameter object. | [
"public void marshall(DescribeParametersRequest describeParametersRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (describeParametersRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// getCode retrieves the next code using the provided
// huffman tree. It sets f.err on error. | [
"func (f *decompressor) getCode(h *huffman) uint16 {\n\tif h.maxbits > 0 {\n\t\tif f.nbits < maxTreePathLen {\n\t\t\tf.feed()\n\t\t}\n\n\t\t// For codes with length < tablebits, it doesn't matter\n\t\t// what the remainder of the bits used for table lookup\n\t\t// are, since entries with all possible suffixes were\... | [
"@Override public void dinvoke( H2ONode sender ) {\n _h2o = sender;\n Key k = _key;\n _key = null; // Not part of the return result\n assert k.home(); // Gets are always from home (less we do replication)\n // Shipping a result? Track replicas so we can invalidate. There's a\n // n... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Defines a template for the given media type.
@param string $type The media type
@param string|callable $template The template | [
"public function setTemplate($type, $template)\n {\n if (!is_callable($template)) {\n $template = (string) $template;\n }\n\n $this->templates[$type] = $template;\n }"
] | [
"public function getTemplateFile($filename, $data)\n {\n $data['getRegion'] = function($name) { \n return $this->getRegion($name); \n }; // This is for mustache compatibility\n\n // Push the data into regions and then pass a pointer to this class to the layout\n // $thi... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Consume a token from plannedTokens. | [
"function (stream, state) {\n var plannedToken = state.plannedTokens.shift();\n if (plannedToken === undefined) {\n return null;\n }\n stream.match(plannedToken.value);\n var tokens = plannedToken.type.split('.');\n return cmTokenFromAceTokens(tokens);\n }"
] | [
"def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetScheduledUpdateGroupActions sets the ScheduledUpdateGroupActions field's value. | [
"func (s *DescribeScheduledActionsOutput) SetScheduledUpdateGroupActions(v []*ScheduledUpdateGroupAction) *DescribeScheduledActionsOutput {\n\ts.ScheduledUpdateGroupActions = v\n\treturn s\n}"
] | [
"func (e *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {\n\t// This provider doesn't track instance -> controller.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// ok sets status to 200 and puts "OK" in response. | [
"func (c *requestContext) ok() {\n\tc.Writer.Header().Set(\"Content-Type\", \"text/plain; charset=utf-8\")\n\tc.Writer.WriteHeader(200)\n\tfmt.Fprintln(c.Writer, \"OK\")\n}"
] | [
"def delete_mockdata_url(service_name, implementation_name,\n url, headers,\n dir_base=dirname(__file__)):\n \n # Http response code 204 No Content:\n # The server has fulfilled the request but does not need to\n # return an entity-body\n response = MockH... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
//ExpireValidation removes a pending validation | [
"func (service *IYOEmailAddressValidationService) ExpireValidation(request *http.Request, key string) (err error) {\n\tif key == \"\" {\n\t\treturn\n\t}\n\tvalMngr := validation.NewManager(request)\n\terr = valMngr.RemoveEmailAddressValidationInformation(key)\n\treturn\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
{@inheritdoc}
@param string $key
@param mixed $steps
@return int|bool | [
"public function increment($key, $steps = 1)\n {\n $previous = $this->has($key) ? $this->get($key) : 0;\n $previous += $steps;\n $this->put($key, $previous);\n\n return $previous;\n }"
] | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Display the primary field.
@param $item
@param null $config
@return mixed | [
"public function displayPrimaryField($item, $config = null)\n {\n $field = $this->getPrimaryField($item, $config);\n\n return $item->$field;\n }"
] | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
A powerful spider system in python. | [
"def cli(ctx, **kwargs):\n \n if kwargs['add_sys_path']:\n sys.path.append(os.getcwd())\n\n logging.config.fileConfig(kwargs['logging_config'])\n\n # get db from env\n for db in ('taskdb', 'projectdb', 'resultdb'):\n if kwargs[db] is not None:\n continue\n if os.enviro... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// Quicksort, loosely following Bentley and McIlroy,
// ``Engineering a Sort Function,'' SP&E November 1993.
// medianOfThree moves the median of the three values data[m0], data[m1], data[m2] into data[m1]. | [
"func medianOfThree(data Interface, m1, m0, m2 int) {\n\t// sort 3 elements\n\tif data.Less(m1, m0) {\n\t\tdata.Swap(m1, m0)\n\t}\n\t// data[m0] <= data[m1]\n\tif data.Less(m2, m1) {\n\t\tdata.Swap(m2, m1)\n\t\t// data[m0] <= data[m2] && data[m1] < data[m2]\n\t\tif data.Less(m1, m0) {\n\t\t\tdata.Swap(m1, m0)\n\t\t... | [
"@Override\n\tpublic boolean apply(final URI url) {\n\n\t\tfinal String s = url.getRawPath();\n\t\tfinal int length = s.length();\n\t\tfinal boolean pathEndsWithSlash = s.charAt(length - 1) == '/';\n\n\t\tfinal char[] path = new char[length + 1 + (! pathEndsWithSlash? 1 : 0)];\n\t\tpath[path.length - 1] = EXTRA_SYM... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
{@link #close(Connection) Close} the connection and log any exceptions instead of throwing
them.
@param con
may be null | [
"public static void closeQuietly(@Nullable Connection con) {\n\t\ttry {\n\t\t\tclose(con);\n\t\t} catch (SQLException e) {\n\t\t\tLoggers.get(Connections.class).log(SEVERE, \"closing connection\", e);\n\t\t}\n\t}"
] | [
"public void close() throws IOException {\n guard.close();\n synchronized (this) {\n if (channel != null && channel.isOpen()) {\n channel.close();\n\n // j2objc: since a @RetainedWith field cannot be reassigned, the following line is\n // comment... | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
Returns all variant annotation sets on the server. | [
"def getAllAnnotationSets(self):\n \n for variantSet in self.getAllVariantSets():\n iterator = self._client.search_variant_annotation_sets(\n variant_set_id=variantSet.id)\n for variantAnnotationSet in iterator:\n yield variantAnnotationSet"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// LeftJoin LEFT JOIN the table | [
"func (qb *TiDBQueryBuilder) LeftJoin(table string) QueryBuilder {\n\tqb.Tokens = append(qb.Tokens, \"LEFT JOIN\", table)\n\treturn qb\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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// L259
/*
Expert: set the Similarity implementation used by this IndexWriter.
NOTE: the similarity cannot be nil.
Only takes effect when IndexWriter is first created.
*/ | [
"func (conf *IndexWriterConfig) SetSimilarity(similarity Similarity) *IndexWriterConfig {\n\tassert2(similarity != nil, \"similarity must not be nil\")\n\tconf.similarity = similarity\n\treturn conf\n}"
] | [
"protected synchronized CommittableIndexReader getIndexReader() throws IOException\n {\n if (indexWriter != null)\n {\n indexWriter.close();\n log.debug(\"closing IndexWriter.\");\n indexWriter = null;\n }\n\n if (indexReader == null || !indexReader.isCurrent())\n ... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software Development:"
} |
return differences from this catalog and right catalog
param [Cat] right
@return [CatOnYaml] | [
"def -(right)\n result = CatOnYaml.new\n @entries.each do |e|\n result.add_entry(e) unless right.contains(e)\n end\n result\n end"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Int64 returns the value of cell as 64-bit integer. | [
"func (c *Cell) Int64() (int64, error) {\n\tf, err := strconv.ParseInt(c.Value, 10, 64)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn f, nil\n}"
] | [
"func estimateUnknownSize(unk *runtime.Unknown, byteSize uint64) uint64 {\n\tsize := uint64(unk.Size())\n\t// protobuf uses 1 byte for the tag, a varint for the length of the array (at most 8 bytes - uint64 - here),\n\t// and the size of the array.\n\tsize += 1 + 8 + byteSize\n\treturn size\n}"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
// verifyPermittedHooks verifies all hooks are permitted in the project | [
"func (sc *syncContext) verifyPermittedHooks(hooks []*unstructured.Unstructured) bool {\n\tfor _, hook := range hooks {\n\t\tgvk := hook.GroupVersionKind()\n\t\tserverRes, err := kube.ServerResourceForGroupVersionKind(sc.disco, gvk)\n\t\tif err != nil {\n\t\t\tsc.setOperationPhase(appv1.OperationError, fmt.Sprintf(... | [
"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 comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Get the edit page.
@param \Arcanesoft\Seo\Models\Redirect $redirect
@return \Illuminate\View\View | [
"public function edit(Redirect $redirect)\n {\n $this->authorize(RedirectsPolicy::PERMISSION_UPDATE);\n\n $statuses = RedirectStatuses::all();\n\n $this->setTitle($title = trans('seo::redirects.titles.edit-redirection'));\n $this->addBreadcrumb($title);\n\n return $this->view('... | [
"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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
@param object $entity
@return boolean | [
"public function hasDocumentDeclaration($entity)\n {\n if ($rootDocument = $this->getClassAnnotation($entity, self::DOCUMENT_CLASS)) {\n return true;\n }\n\n if ($this->isNested($entity)) {\n return true;\n }\n\n return false;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Handle the compilation of the templates
@param $template | [
"public function parse($template)\n\t{\n\n\t\t$viewsFromConfig = $this->app['config']->get('view.paths');\n\n\t\t$views = array_merge((array)$viewsFromConfig, (array)$this->paths['theme']);\n\t\t$cache = $this->paths['storage'] . '/views';\n\n\t\t$blade = new BladeAdapter($views, $cache);\n\n\t\tif (!$blade->getCom... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Check the given plain value against a hash.
@param string $value
@param string $hashedValue
@param array $options
@return bool | [
"public function check($value, $hashedValue, array $options = array()) {\n\n return strtoupper($this->make($value)) === strtoupper($hashedValue);\n }"
] | [
"public function int($data, $default = 0, $options = [])\n {\n\n //check custom filters and flags in options array;\n list($filter, $flags, $parameters) = $this->readFiltersAndFlags(\n $options,\n static::FILTER_INTERGER\n );\n //push custom filters and flags fro... | codesearchnet | {
"query": "Represent the instruction about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
read the designated TOC file (toc.html) | [
"function(next) {\n fs.readFile(path.join(config.root_out, config.akashacmsEPUB.bookmetadata.toc.href), 'utf8',\n function(err, data) {\n if (err) next(err);\n else {\n // logger.info('read '+ path.join(config.root_out, config.ak... | [
"def document_examples(p):\n \n p.comment('maths_ml_algorithms.py', 'machine learning algorithms for toolbox in AIKIF')\n p.comment('algebra.py', 'toolbox module for based evaluation of maths problems')\n p.comment('crypt_utils.py', 'scripts to encode / decode data')\n p.comment('game_board_utils.py'... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Removes ignore fields from the data that we got from Solr. | [
"def _trim_fields(self, docs):\r\n '''\r\n \r\n '''\r\n for doc in docs:\r\n for field in self._ignore_fields:\r\n if field in doc:\r\n del(doc[field])\r\n return docs"
] | [
"@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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Obtain the number of centres adjacent to the atom at the index, i.
@param i atom index
@return number of adjacent centres | [
"private int nAdjacentCentres(int i) {\n int n = 0;\n for (IAtom atom : tetrahedralElements[i].getLigands())\n if (tetrahedralElements[atomToIndex.get(atom)] != null) n++;\n return n;\n }"
] | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Build link to local asset.
Detects packages links.
@param string $asset
@param string $dir
@return string the link | [
"protected function buildLocalLink($asset, $dir)\n {\n $collection = $this->assetIsFromCollection($asset);\n if ($collection !== false) {\n return $this->collections_dir.'/'.$collection[0].'/'.ltrim($dir, '/').'/'.$collection[1];\n }\n\n return parent::buildLocalLink($asset... | [
"public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
run before
@access public
@param array $aParams parameters
@return \Apollina\Template\HtmlOptions | [
"public function replaceBy($aParams = array()) \n\t{\n\t\t$aOptions = array();\n\t\t$mSelected = '';\n\n\t\tif (isset($aParams['options'])) { $aOptions = $aParams['options']; }\n\t\telse { new \\Exception('HtmlOptions: options obligatory');}\n\n\t\tif (isset($aParams['selected'])) { $mSelected = $aParams['selected'... | [
"final public static function sinfo(array $params):string\n {\n return (\\iumioFramework\\Core\\Base\\Server\\GlobalServer::getServerInfo($params['name']));\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// Action sets the command action. | [
"func Action(a func(*cli.Context)) Option {\n\treturn func(o *Options) {\n\t\to.Action = a\n\t}\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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
full_name => class | [
"def name2class(name)\n klass = Kernel\n name.to_s.split(%r{/}).each do |part|\n klass = klass.const_get(\n part.capitalize.gsub(/[_-](.)/) { |match| match[1].upcase }\n )\n end\n klass\n end"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// ImportSigningKey imports the raw signing key into the keyring. | [
"func (k *Keyring) ImportSigningKey(pub *[ed25519.PublicKeySize]byte, sec *[ed25519.PrivateKeySize]byte) {\n\tnk := NewSigningSecretKey(pub, sec)\n\tk.sigKeys[nk.pub] = nk\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Removes a contact from group. You need to supply the IDs of the group
and contact. Does not delete the contact. | [
"public void deleteGroupContact(final String groupId, final String contactId) throws NotFoundException, GeneralException, UnauthorizedException {\n if (groupId == null) {\n throw new IllegalArgumentException(\"Group ID must be specified.\");\n }\n if (contactId == null) {\n ... | [
"function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Prepare request params for POST request, convert to multipart when needed
@param array $data
@return array | [
"private function prepareRequestParams(array $data)\n {\n $has_resource = false;\n $multipart = [];\n\n foreach ($data as $key => $value) {\n if (!is_array($value)) {\n $multipart[] = ['name' => $key, 'contents' => $value];\n continue;\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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// tried in succession and the first to succeed is returned. If none succeed,
// a random high port is returned. | [
"func getFreePort(host string, ports ...int) (int, error) {\n\tfor _, port := range ports {\n\t\tc, err := net.Listen(\"tcp\", fmt.Sprintf(\"%s:%d\", host, port))\n\t\tif err == nil {\n\t\t\tc.Close()\n\t\t\treturn port, nil\n\t\t}\n\t}\n\n\tc, err := net.Listen(\"tcp\", host+\":0\")\n\tif err != nil {\n\t\treturn ... | [
"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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
@param User $user
@return array | [
"private function serializePublic(User $user)\n {\n $settingsProfile = $this->facetManager->getVisiblePublicPreference();\n $publicUser = [];\n\n foreach ($settingsProfile as $property => $isViewable) {\n if ($isViewable || $user === $this->tokenStorage->getToken()->getUser()) {\n... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// Error can be either of the following types:
//
// - InvalidObjectFault
// - RuntimeFault | [
"func (service *VboxPortType) IConsolereset(request *IConsolereset) (*IConsoleresetResponse, error) {\n\tresponse := new(IConsoleresetResponse)\n\terr := service.client.Call(\"\", request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the comment about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Creates an exception from an plan id and version.
@param planId the plan id
@param version the version id
@return the exception | [
"public static final PlanVersionNotFoundException planVersionNotFoundException(String planId, String version) {\n return new PlanVersionNotFoundException(Messages.i18n.format(\"PlanVersionDoesNotExist\", planId, version)); //$NON-NLS-1$\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 text about API documentation:",
"pos": "Represent the Github code about API documentation:",
"neg": "Represent the Github code about programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.