query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// SetTextTemplate changes the TextHandler's text formatting template
[ "func (h *TextHandler) SetTextTemplate(t *template.Template) {\n\th.mtx.Lock()\n\tdefer h.mtx.Unlock()\n\th.template = t\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Make a separator for a prose-like list with `,` between items except for `, and` after the second to last item.
[ "def _oxford_comma_separator(i, length):\n \n if length == 1:\n return None\n elif length < 3 and i == 0:\n return ' and '\n elif i < length - 2:\n return ', '\n elif i == length - 2:\n return ', and '\n else:\n return None" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Validates a directory according to the spec @param array $result @param string $spec @return bool
[ "public function validateDirectory($result, $spec)\n {\n $spec = explode('|', $spec);\n $valid = false;\n\n foreach ($spec as $s) {\n if (isset($result[$s]) && $result[$s]) {\n $valid = true;\n break;\n }\n }\n\n return $vali...
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// Calls Output to println to the logger.
[ "func (me *Logger) println(priority int, v ...interface{}) {\n\tif priority <= me.priority {\n\t\tme.setFullPrefix(priority)\n\t\tme.logger.Println(v...)\n\t}\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Delete a flow configuration @param flowId identifier of flow configuration to delete @throws RemoteInvocationException
[ "public void deleteFlowConfigWithStateStore(FlowId flowId)\n throws RemoteInvocationException {\n LOG.debug(\"deleteFlowConfig and state store with groupName \" + flowId.getFlowGroup() + \" flowName \" +\n flowId.getFlowName());\n\n DeleteRequest<FlowConfig> deleteRequest = _flowconfigsV2RequestBu...
[ "@Help(\n help =\n \"Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed.\"\n )\n public void resume(final String idNsr) throws SDKException {\n String url = idNsr + \"/resume\";\n requestPost(url);\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Validate a SIRET: check its length (14), its final code, and pass it through the Luhn algorithm.
[ "def siret_validator():\n \"\"\"\"\"\"\n\n def _validate_siret(form, field, siret=\"\"):\n \"\"\"SIRET validator.\n\n A WTForm validator wants a form and a field as parameters. We\n also want to give directly a siret, for a scripting use.\n \"\"\"\n if field is not None:\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return a formatted ResponseJson @param array $mdata @param array $mergedData @param null $status @param string $msg @param array $headers @param int $options @return JsonResponse
[ "public static function responseJsonMerge($mdata = array(), $mergedData, $status = null, $msg = '', array $headers = array(), $options = 0)\n {\n $response = self::responseMerge($mdata, $mergedData, $status, $msg);\n return Response::json($response, $response['status'], $headers, $options);\n }"...
[ "public function evaluateAnnotation(\n Request $request,\n Annotation $annotation,\n ReflectionMethod $method\n ) {\n /**\n * Annotation is only loaded if is typeof WorkAnnotation.\n */\n if ($annotation instanceof ToJsonResponse) {\n\n /**\n ...
codesearchnet
{ "query": "Represent the instruction about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about programming:" }
// New returns a new fully initialized Config struct
[ "func New() *Config {\n\tconfig := Config{}\n\tconfig.LogConfig.Config = make(map[string]string)\n\tconfig.ClusterOpts = make(map[string]string)\n\n\treturn &config\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// parseBaggageInt64 searches for the target key in the BaggageItems // and parses it as an int64. It treats keys as case-insensitive.
[ "func (c *spanContext) parseBaggageInt64(key string) int64 {\n\tvar val int64\n\tc.ForeachBaggageItem(func(k, v string) bool {\n\t\tif strings.ToLower(k) == strings.ToLower(key) {\n\t\t\ti, err := strconv.ParseInt(v, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\t// TODO handle err\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tval...
[ "def coerce_one(schema=str):\n \n def validate(val):\n \"\"\"Unpack a single item from the inputs sequence and run validation.\n\n NOTE(larsbutler): This code is highly opinionated for bottle, since\n bottle query params are wrapped in a list, even if there is just a\n single value...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns the host address for an instance of Blob Store service from environment inspection.
[ "def _get_host(self):\n \n if 'VCAP_SERVICES' in os.environ:\n services = json.loads(os.getenv('VCAP_SERVICES'))\n host = services['predix-blobstore'][0]['credentials']['host']\n else:\n host = predix.config.get_env_value(self, 'host')\n\n # Protocol may ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the comment about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about Programming:" }
// MarshalText implements encoding.TextMarshaler.
[ "func (b Uint64) MarshalText() ([]byte, error) {\n\tbuf := make([]byte, 2, 10)\n\tcopy(buf, `0x`)\n\tbuf = strconv.AppendUint(buf, uint64(b), 16)\n\treturn buf, nil\n}" ]
[ "func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder {\n\treturn decoder\n}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Calculate the complex acoth @returns {Complex}
[ "function() {\n\n // acoth(c) = log((c+1) / (c-1)) / 2\n\n var a = this['re'];\n var b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Math.PI / 2);\n }\n\n var d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a ...
[ "def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value
[ "def set(self, name, value):\n \n curr = self.values\n parts = name.split('.')\n\n for i, part in enumerate(parts[:-1]):\n try:\n curr = curr.setdefault(part, {})\n except AttributeError:\n raise InvalidPath('.'.join(parts[:i + 1]))\n\n...
[ "def _validate_none_or_type(t):\n \n def _validate(setting):\n \"\"\"\n Check the setting to make sure it's the right type.\n\n Args:\n setting (object): The setting to check.\n\n Returns:\n object: The unmodified object if it's the proper type.\n\n Rai...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software Engineering:" }
Marshall the given parameter object.
[ "public void marshall(ListConnectorDefinitionVersionsRequest listConnectorDefinitionVersionsRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (listConnectorDefinitionVersionsRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
/* CRUD is syntactic sugar and a shortcut for registering all JSON API CRUD routes for a compatible storage implementation: Registers handlers for: GET /resource POST /resource GET /resource/:id DELETE /resource/:id PATCH /resource/:id */
[ "func (res *Resource) CRUD(storage store.CRUD) {\n\tres.Get(storage.Get)\n\tres.Patch(storage.Update)\n\tres.Post(storage.Save)\n\tres.List(storage.List)\n\tres.Delete(storage.Delete)\n}" ]
[ "function initModelUpdate (args) {\n var controller = this\n var model = this.model\n // if model does not have id column then cannot use default controller\n if (!model.columnName('id') || !model.columnName('parentId')) {\n return\n }\n // get accountId column\n var accountIdColumn = mo...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Applies a order_by clause :param str attribute: attribute to apply on :param bool ascending: should it apply ascending order or descending :rtype: Query
[ "def order_by(self, attribute=None, *, ascending=True):\n \n attribute = self._get_mapping(attribute) or self._attribute\n if attribute:\n self._order_by[attribute] = None if ascending else 'desc'\n else:\n raise ValueError(\n 'Attribute property need...
[ "def _predicate(self, i):\n \n if isinstance(i, slice):\n if i.step is not None:\n raise TypeError(\"Slice step not permitted\")\n if ( (i.start is not None and not isinstance(i.start, datetime))\n or (i.stop is not None and not isinstance(i.stop, da...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software Development:" }
{@inheritDoc} @return \Generator
[ "public function iterable()\n {\n for ($i = $this->getStart(); $i < $this->getEnd(); $i += $this->step) {\n yield $i;\n }\n }" ]
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Pause all cluster nodes - ensure that we store data so that in the future the nodes can be restarted. :return: int - number of failures.
[ "def _pause_all_nodes(self, max_thread_pool_size=0):\n \n failed = 0\n\n def _pause_specific_node(node):\n if not node.instance_id:\n log.warning(\"Node `%s` has no instance id.\"\n \" It is either already stopped, or\"\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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Gets the auto-increment string. @return string @throws EngineException
[ "public function getAutoIncrementString()\n {\n if ($this->isAutoIncrement() && IDMethod::NATIVE === $this->getTable()->getIdMethod()) {\n return $this->getPlatform()->getAutoIncrement();\n } elseif ($this->isAutoIncrement()) {\n throw new EngineException(sprintf(\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Store an item in the cache for a given number of minutes. @param string $key @param mixed $value @param float|int $minutes @return void
[ "public function put($key, $value, $minutes)\n {\n $this->ensureCacheDirectoryExists($path = $this->path($key));\n\n $this->files->put(\n $path, $this->expiration($minutes).serialize($value), true\n );\n }" ]
[ "public function defaultTtl($ttl)\n {\n if (false === \\is_numeric($ttl) || $ttl<0) {\n throw new \\InvalidArgumentException('A TTL value must be a positive integer value');\n }\n\n $this->ttl = (int)$ttl;\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Create histogram collection with shared binnning.
[ "def collection(data, bins=10, *args, **kwargs):\n \"\"\"\"\"\"\n from physt.histogram_collection import HistogramCollection\n if hasattr(data, \"columns\"):\n data = {column: data[column] for column in data.columns}\n return HistogramCollection.multi_h1(data, bins, **kwargs)" ]
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the Github description about Data analysis:", "pos": "Represent the Github code about Data analysis:", "neg": "Represent the Github code:" }
Compute ground motion mean value.
[ "def _compute_mean(self, C, mag, rjb):\n \n # line 1686 in hazgridXnga2.f\n ffc = self._compute_finite_fault_correction(mag)\n d = np.sqrt(rjb ** 2 + (C['c7'] ** 2) * (ffc ** 2))\n\n # lines 1663, 1694-1696 in hazgridXnga2.f\n mean = (\n C['c1'] + C['c2'] * (mag ...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Get all of posible transitions. @param StatableInterface $object @param string $objectIdentifier @return array|null @throws \SM\SMException
[ "public function getPosibleTransitions(StatableInterface $object = null, $objectIdentifier = 'id')\n {\n if (empty($object)) {\n return;\n }\n\n $sm = $this->factory->get($object, $object->getStateGraph());\n\n if (empty($sm)) {\n return;\n }\n\n $...
[ "public function getTokenStatusDescriptionForBridge(\\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $addDescription = false)\n {\n return \\MUtil_Lazy::method($this, 'getStatusDescription', $bridge->getLazy('token_status'));\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns the ini file as an array. @param string $ini Full path to the ini file @return array List @throws \Cake\Core\Exception\Exception
[ "public static function parseFile($ini) {\n\t\tif (!file_exists($ini)) {\n\t\t\tthrow new Exception(sprintf('Missing TinyAuth config file (%s)', $ini));\n\t\t}\n\n\t\tif (function_exists('parse_ini_file')) {\n\t\t\t$iniArray = parse_ini_file($ini, true);\n\t\t} else {\n\t\t\t$content = file_get_contents($ini);\n\t\...
[ "public static function Strict(&$data, $key)\n {\n if ($data instanceof DataPacket)\n $data = $data->get();\n\n if (!(in_array($key, array_keys($data))))\n Throw New \\CatapultApiException(\"You must add $key to call this function\");\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software Development:" }
Get a single value in a position of the raster. @param coordinate the coordinate in which the value is read. @return the value read in the given coordinate.
[ "public double getValueAt( Coordinate coordinate ) {\n if (geodata == null) {\n throw new IllegalArgumentException(\"The data have first to be read!\");\n }\n int[] coordinateToNearestRowCol = GrassLegacyUtilities.coordinateToNearestRowCol(inWindow, coordinate);\n if (coordina...
[ "public String getDescriptiveName()\n {\n StringBuilder sb = new StringBuilder(getDistributionName());\n sb.append(\"(\");\n String[] vars = getVariables();\n double[] vals = getCurrentVariableValues();\n \n sb.append(vars[0]).append(\" = \").append(vals[0]);\n \n...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
@param int $row Current row @param array $tokens Tokens array @return array
[ "protected function getTokenStrings(int $row, array $tokens): array\n {\n $pieces = [];\n foreach ($tokens as $key => $token) {\n if ($token['line'] > $row) {\n break;\n }\n if ($token['line'] < $row) {\n continue;\n }\n ...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Adds a default {@link SizeOfEngine} configuration, that limits the max object size, to the returned builder. @param size the max object size @param unit the max object size unit @return a new builder with the added configuration
[ "public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectSize(long size, MemoryUnit unit) {\n DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class);\n if (configuration == null) {\n return new CacheManagerBuilder<>(this, ...
[ "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 description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// Required by http.Handler interface. This method is invoked by the // http server and will handle all page routing
[ "func (r *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request) {\n\tr.RLock()\n\tdefer r.RUnlock()\n\n\t//wrap the response writer in our custom interface\n\tw := &responseWriter{writer: rw, Router: r}\n\n\t//find a matching Route\n\tfor _, route := range r.routes {\n\n\t\t//if the methods don't match, skip...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Computes the area under the app curve.
[ "def app_score(self):\n \n # compute curve\n precisions, pct_pred_pos, taus = self.precision_pct_pred_pos_curve(interval=False)\n\n # compute area\n app = 0\n total = 0\n for k in range(len(precisions)-1):\n # read cur data\n cur_prec = precisio...
[ "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 text about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about Software development:" }
factor: relative length (1->no change, 2-> double, 0.5:half)
[ "def resize(line, factor):\n \n a = angle(line)\n mx, my = middle(line)\n d = length(line) * factor * 0.5\n dx = cos(a) * d\n dy = sin(a) * d\n return mx - dx, my - dy, mx + dx, my + dy" ]
[ "def _forney(self, omega, X):\n ''''''\n # XXX Is floor division okay here? Should this be ceiling?\n\n Y = [] # the final result, the error/erasures polynomial (contain the values that we should minus on the received message to get the repaired message)\n Xlength = len(X)\n for l...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Print all configuration parameters to the log.
[ "private void logParams(String header) {\r\n m_logger.debug(header);\r\n for (String paramName : m_serviceParamMap.keySet()) {\r\n Object paramValue = m_serviceParamMap.get(paramName);\r\n logParam(paramName, paramValue, \" \");\r\n }\r\n }" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// Generate accepts a path to an app.json file and generates a template from it
[ "func (g *Generator) Generate(body []byte) (*templatev1.Template, error) {\n\tappJSON := &AppJSON{}\n\tif err := json.Unmarshal(body, appJSON); err != nil {\n\t\treturn nil, err\n\t}\n\n\tklog.V(4).Infof(\"app.json: %#v\", appJSON)\n\n\tname := g.Name\n\tif len(name) == 0 && len(g.LocalPath) > 0 {\n\t\tname = filep...
[ "def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Deletes all files in directory. @internal for internal use only @param String $dir
[ "public static function deleteAllFilesInDirectory ($dir) {\n $dirIterator = new \\RecursiveDirectoryIterator($dir, \\FilesystemIterator::SKIP_DOTS);\n foreach (new \\RecursiveIteratorIterator($dirIterator, \\RecursiveIteratorIterator::CHILD_FIRST) as $file) {\n $file->isDir() ? rmdir($file)...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Helper that asserts the model_to_check is the model_reference or one of its subclasses. If not, raise an ImplementationError, using "obj_name" to describe the name of the argument.
[ "def _assert_correct_model(model_to_check, model_reference, obj_name):\n \n if not issubclass(model_to_check, model_reference):\n raise ConfigurationException('The %s model must be a subclass of %s'\n % (obj_name, model_reference.__name__))" ]
[ "def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Add another user to the conversation. @since 2.0.0 @access public @param int $ConversationID Unique ID of conversation effected. @param int $UserID Unique ID of current user.
[ "public function AddUserToConversation($ConversationID, $UserID) {\n if (!is_array($UserID))\n $UserID = array($UserID);\n \n // First define the current users in the conversation\n $OldContributorData = $this->GetRecipients($ConversationID);\n $OldContributorData = Gdn_DataSet::...
[ "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 sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Determine if this path is an ancestor of the supplied path. @param AbsolutePathInterface $path The child path. @return boolean True if this path is an ancestor of the supplied path.
[ "public function isAncestorOf(AbsolutePathInterface $path)\n {\n if (!$this->matchesDriveOrNull($this->pathDriveSpecifier($path))) {\n return false;\n }\n\n return parent::isAncestorOf($path);\n }" ]
[ "function Pointer ($ref, path, friendlyPath) {\n /**\n * The {@link $Ref} object that contains this {@link Pointer} object.\n * @type {$Ref}\n */\n this.$ref = $ref;\n\n /**\n * The file path or URL, containing the JSON pointer in the hash.\n * This path is relative to the path of the main JSON schema ...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Encode a list of integers representing Resource Records to a bitmap field used in the NSEC Resource Record.
[ "def RRlist2bitmap(lst):\n \n # RFC 4034, 4.1.2. The Type Bit Maps Field\n\n import math\n\n bitmap = b\"\"\n lst = [abs(x) for x in sorted(set(lst)) if x <= 65535]\n\n # number of window blocks\n max_window_blocks = int(math.ceil(lst[-1] / 256.))\n min_window_blocks = int(math.floor(lst[0] ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get all domains in a subscription. Get all domains in a subscription. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DomainInner&gt; object
[ "public Observable<Page<DomainInner>> listAsync() {\n return listWithServiceResponseAsync()\n .map(new Func1<ServiceResponse<Page<DomainInner>>, Page<DomainInner>>() {\n @Override\n public Page<DomainInner> call(ServiceResponse<Page<DomainInner>> response) {\n ...
[ "@Operation(name=\"$find-matches\", idempotent=true)\n public Parameters findMatchesAdvanced(\n @OperationParam(name=\"dateRange\") DateRangeParam theDate,\n @OperationParam(name=\"name\") List<StringParam> theName,\n @OperationParam(name=\"code\") TokenAndListParam theEnd) {\n \n Paramet...
codesearchnet
{ "query": "Represent the Github instruction about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code about Software development:" }
Generic handler for all HTTP verbs @return void
[ "protected function _handle()\n {\n list($finder, $options) = $this->_extractFinder();\n $query = $this->_table()->find($finder, $options);\n $subject = $this->_subject(['success' => true, 'query' => $query]);\n\n $this->_trigger('beforePaginate', $subject);\n $items = $this->_...
[ "@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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
// Columnize formats the given arguments as columns and returns the formatted output, // note that it appends a new line to the end.
[ "func Columnize(nowFormatted string, latency time.Duration, status, ip, method, path string, message interface{}, headerMessage interface{}) string {\n\n\ttitles := \"Time | Status | Latency | IP | Method | Path\"\n\tline := fmt.Sprintf(\"%s | %v | %4v | %s | %s | %s\", nowFormatted, status, latency, ip, method, pa...
[ "private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Populates the current Toml instance with values from tomlString. @param tomlString String to be read. @return this instance @throws IllegalStateException If tomlString is not valid TOML
[ "public Toml read(String tomlString) throws IllegalStateException {\n Results results = TomlParser.run(tomlString);\n if (results.errors.hasErrors()) {\n throw new IllegalStateException(results.errors.toString());\n }\n\n this.values = results.consume();\n\n return this;\n }" ]
[ "def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Creates a DiGraphIterator. It will iterate once for every node. @param root @param edges
[ "public static <T> DiGraphIterator<T> getInstance(T root, Function<? super T, ? extends Collection<T>> edges)\r\n {\r\n return new DiGraphIterator<>(root, (y)->edges.apply(y).stream());\r\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 Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Execute http get request on given request_url with optional headers
[ "def get_request(request_url, request_headers=dict()):\n \n request = Request(request_url)\n for key, val in request_headers.items():\n request.add_header(key, val)\n\n try:\n response = urlopen(request, timeout=_REQUEST_TIMEOUT)\n response_content = response.read()\n except (HTT...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Returns the tree for an annotation given the annotated element and the element's own tree. Returns null if the tree cannot be found.
[ "private JCTree matchAnnoToTree(AnnotationMirror findme,\n Element e, JCTree tree) {\n Symbol sym = cast(Symbol.class, e);\n class Vis extends JCTree.Visitor {\n List<JCAnnotation> result = null;\n public void visitPackageDef(JCPackageDecl tree) ...
[ "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:" }
Caches the commerce tier price entry in the entity cache if it is enabled. @param commerceTierPriceEntry the commerce tier price entry
[ "@Override\n\tpublic void cacheResult(CommerceTierPriceEntry commerceTierPriceEntry) {\n\t\tentityCache.putResult(CommerceTierPriceEntryModelImpl.ENTITY_CACHE_ENABLED,\n\t\t\tCommerceTierPriceEntryImpl.class,\n\t\t\tcommerceTierPriceEntry.getPrimaryKey(), commerceTierPriceEntry);\n\n\t\tfinderCache.putResult(FINDER...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// SetCustomErrorResponses sets the CustomErrorResponses field's value.
[ "func (s *DistributionSummary) SetCustomErrorResponses(v *CustomErrorResponses) *DistributionSummary {\n\ts.CustomErrorResponses = v\n\treturn s\n}" ]
[ "@NotNull\n @ApiModelProperty(required = true, value = \"Key-value pairs to add as custom property into alert. You can refer here for example values\")\n public Map<String, String> getDetails() {\n return details;\n }" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
// Write implements io.WriteCloser for WebSockWriter (that's the reason we're // wrapping the websocket) // // It replaces raw Write() with "Message.Send()"
[ "func (w *WebSockWrapper) Write(data []byte) (n int, err error) {\n\tn = len(data)\n\tif w.mode == WebSocketBinaryMode {\n\t\t// binary send:\n\t\terr = websocket.Message.Send(w.ws, data)\n\t\t// text send:\n\t} else {\n\t\tvar utf8 string\n\t\tutf8, err = w.encoder.String(string(data))\n\t\terr = websocket.Message...
[ "func (cn *connection) Post(msg pp.Message) {\n\ttorrent.Add(fmt.Sprintf(\"messages posted of type %s\", msg.Type.String()), 1)\n\t// We don't need to track bytes here because a connection.w Writer wrapper\n\t// takes care of that (although there's some delay between us recording\n\t// the message, and the connecti...
codesearchnet
{ "query": "Represent the Github description about writing:", "pos": "Represent the Github code about writing:", "neg": "Represent the Github code about programming:" }
Gets server. @return server, ${serverScheme}://${serverHost}:${serverPort}
[ "public static String getServer() {\n final StringBuilder serverBuilder = new StringBuilder(getServerScheme()).append(\"://\").append(getServerHost());\n final String port = getServerPort();\n if (StringUtils.isNotBlank(port) && !\"80\".equals(port) && !\"443\".equals(port)) {\n serv...
[ "def Delete(self):\n\t\t\n\t\tr = clc.v2.API.Call('DELETE','antiAffinityPolicies/%s/%s' % (self.alias,self.id),{},session=self.session)" ]
codesearchnet
{ "query": "Represent the Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Example shows quick and simple setup of a webhooks service. This example shows a single inline service that logs new messages.
[ "function startInlineServices() {\n // Provide a webhook definition\n var hook = {\n name: 'Inline Sample',\n events: ['message.sent'],\n path: '/inline_sample_message_sent',\n };\n\n // Register this webhook with Layer's Services\n webhooksServices.register({\n secret: SECRET,\n url: HOST + ':'...
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// CommitOnly is used to finalize the transaction and return a new tree, but // does not issue any notifications until Notify is called.
[ "func (t *Txn) CommitOnly() *Tree {\n\tnt := &Tree{t.root, t.size}\n\tt.writable = nil\n\treturn nt\n}" ]
[ "public void applyAndJournal(Supplier<JournalContext> context, DeleteFileEntry entry) {\n // Unlike most entries, the delete file entry must be applied *before* making the in-memory\n // change. This is because delete file and create file are performed with only a read lock on\n // the parent directory. As...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Parse a Pedigree file and return a list of Pedigree objects. @param pedigreePath Path to the Pedigree file @return List of Pedigree objects @throws IOException
[ "public static List<Pedigree> parse(Path pedigreePath) throws IOException {\n FileUtils.checkFile(pedigreePath);\n\n Map<String, Pedigree> pedigreeMap = new HashMap<>();\n Map<String, Member> individualMap = new HashMap<>();\n\n String pedigreeName, individualName;\n Member.Sex se...
[ "def usufyToCsvExport(d, fPath):\n \n\n from pyexcel_io import get_data\n try:\n oldData = {\"OSRFramework\": get_data(fPath) }\n except:\n # No information has been recovered\n oldData = {\"OSRFramework\":[]}\n\n # Generating the new tabular data.\n tabularData = _generateTab...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns next paragraph-like element or `null` if reached the end of range. @param {String} [blockTag='p'] Name of a block element which will be established by iterator in block-less elements (see {@link #enforceRealBlocks}).
[ "function( blockTag ) {\n\t\t\t// The block element to be returned.\n\t\t\tvar block;\n\n\t\t\t// The range object used to identify the paragraph contents.\n\t\t\tvar range;\n\n\t\t\t// Indicats that the current element in the loop is the last one.\n\t\t\tvar isLast;\n\n\t\t\t// Instructs to cleanup remaining BRs.\...
[ "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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Calls a class considering all routes. @param *string $class class name @param mixed[, mixed..] $arg arguments @return object
[ "public function call($class)\n {\n //argument 1 must be a string\n Argument::i()->test(1, 'string');\n\n $args = func_get_args();\n $class = array_shift($args);\n\n return $this->callArray($class, $args);\n }" ]
[ "final static function f($m, array $stages = []) {return dfcf(function(M $m, array $stages) {\n\t\t/** @var string $c */$c = df_con_hier($m, __CLASS__); return new $c($m, $stages ?: ['', '']);\n\t}, [dfpm($m), $stages]);}" ]
codesearchnet
{ "query": "Represent the post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
// SetStepName sets the StepName field's value.
[ "func (s *StepExecution) SetStepName(v string) *StepExecution {\n\ts.StepName = &v\n\treturn s\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Back returns the last Element of list l or nil.
[ "func (l *List) Back() *Element {\n\tif l.len == 0 {\n\t\treturn nil\n\t}\n\treturn l.root.prev\n}" ]
[ "function nodeClosed( ascent ) {\n\n emitNodeClosed( ascent);\n \n return tail( ascent) ||\n // If there are no nodes left in the ascent the root node\n // just closed. Emit a special event for this: \n emitRootClosed(nodeOf(head(ascent)));\n }" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set the unique command for this transaction type. @param string $command @return self
[ "public function setCommand($command)\n {\n if (! in_array($command, self::VALID_COMMANDS)) {\n throw new InvalidArgumentException('Invalid command sent');\n }\n\n $this->command = $command;\n\n return $this;\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 text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Implementation of put method (handles vacantChild; overriding methods handle everything else).
[ "void put(\n Conjunction selector,\n MatchTarget object,\n InternTable subExpr)\n throws MatchingException\n {\n vacantChild = nextMatcher(selector, vacantChild);\n vacantChild.put(selector, object, subExpr);\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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Set the supported extensions for this route. @param array $extensions The extensions to set. @return $this
[ "public function setExtensions(array $extensions)\n {\n $this->_extensions = [];\n foreach ($extensions as $ext) {\n $this->_extensions[] = strtolower($ext);\n }\n\n return $this;\n }" ]
[ "public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Checks if an update is available and applicable for the current installation. @since Symphony 2.3.1 @return boolean
[ "public static function isUpgradeAvailable()\n {\n if (self::isInstallerAvailable()) {\n $migration_version = self::getMigrationVersion();\n $current_version = Symphony::Configuration()->get('version', 'symphony');\n\n return version_compare($current_version, $migration_ve...
[ "public function setNotificationType($s) {\n if (is_string($s)){\n $this->options['Subscription.NotificationType'] = $s;\n $this->options['NotificationType'] = $s;\n } else {\n return false;\n }\n /*\n * List of valid Notification Types:\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Resolve view from given data with the structure. @param StructureInterface $structure @param array $data @return array
[ "private function resolveView(StructureInterface $structure, array $data)\n {\n $structure->setWebspaceKey($this->getWebspaceKey());\n\n $view = [];\n foreach ($structure->getProperties(true) as $child) {\n if (array_key_exists($child->getName(), $data)) {\n $child-...
[ "function resolve(){\n\t\tLRState::clear_index();\n\t\tLRStation::clear_index();\n\t\t// create Root Set\n\t\t// we SHOULD have a single etransition to an intial state\n\t\treturn LRStateSet::init( $this->etransitions[0], $this->Grammar );\n\t}" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Computer Science:" }
super_fn calls the old function which was overwritten by this mixin.
[ "function super_fn() {\n\t\t\t\t\tif (!oldFn) { return }\n\t\t\t\t\teach(arguments, function(arg, i) {\n\t\t\t\t\t\targs[i] = arg\n\t\t\t\t\t})\n\t\t\t\t\treturn oldFn.apply(self, args)\n\t\t\t\t}" ]
[ "def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns a new set containing the first n elements in this grouped and sorted {@link DataSet}. @param n The desired number of elements for each group. @return A GroupReduceOperator that represents the DataSet containing the elements.
[ "public GroupReduceOperator<T, T> first(int n) {\n\t\tif (n < 1) {\n\t\t\tthrow new InvalidProgramException(\"Parameter n of first(n) must be at least 1.\");\n\t\t}\n\n\t\treturn reduceGroup(new FirstReducer<T>(n));\n\t}" ]
[ "@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Get all the tags of this block with a specific tag name. @param string $name The tag name to search for. @return array<DocumentationTag> The tags with a matching tag name.
[ "public function tagsByName($name)\n {\n $tags = array();\n foreach ($this->tags() as $tag) {\n if ($name === $tag->name()) {\n $tags[] = $tag;\n }\n }\n\n return $tags;\n }" ]
[ "protected function checkSortableColumnHasAttribute(TableListColumn $column): void\n {\n if (! $column->getAttribute('attribute') && $column->getAttribute('isSortableColumn')) {\n $errorMessage = 'One of the sortable columns has no defined attribute. You have to define a column '\n ...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Writes a class' bytecode to an <code>OutputStream</code>. @param cl The <code>Class</code> to write. @param out The <code>OutputStream</code> to write to. @throws IOException If unable to write to <code>out</code>.
[ "public static void writeClassToStream(Class<?> cl, OutputStream out) throws IOException {\n InputStream in = getClassAsStream(cl);\n StreamUtil.writeStream(in, out);\n out.flush();\n }" ]
[ "public static String valueString(final Object value) {\n StringBuilder val = new StringBuilder(\"\"+value);\n if (null != value && value.getClass().isArray()) {\n val = new StringBuilder(\"{\");\n for (int i = 0; i < Array.getLength(value); i++)\n val.append(value...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Create a JSON schema validator for the given schema. Args: schema_path: The filename of the JSON schema. schema: A Python object representation of the same schema. Returns: An instance of Draft4Validator.
[ "def load_validator(schema_path, schema):\n \n # Get correct prefix based on OS\n if os.name == 'nt':\n file_prefix = 'file:///'\n else:\n file_prefix = 'file:'\n\n resolver = RefResolver(file_prefix + schema_path.replace(\"\\\\\", \"/\"), schema)\n validator = Draft4Validator(schema...
[ "def coerce_one(schema=str):\n \n def validate(val):\n \"\"\"Unpack a single item from the inputs sequence and run validation.\n\n NOTE(larsbutler): This code is highly opinionated for bottle, since\n bottle query params are wrapped in a list, even if there is just a\n single value...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Lifts a function to the current Observable and returns a new Observable that when subscribed to will pass the values of the current Observable through the Operator function. @param callable $operatorFactory @return AnonymousObservable
[ "public function lift(callable $operatorFactory)\n {\n return new AnonymousObservable(function (ObserverInterface $observer, SchedulerInterface $schedule) use ($operatorFactory) {\n $operator = $operatorFactory();\n return $operator($this, $observer, $schedule);\n });\n }" ...
[ "@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
// NewNode initializes a server node with connection parameters.
[ "func newNode(cluster *Cluster, nv *nodeValidator) *Node {\n\tnewNode := &Node{\n\t\tcluster: cluster,\n\t\tname: nv.name,\n\t\t// address: nv.primaryAddress,\n\t\thost: nv.primaryHost,\n\n\t\t// Assign host to first IP alias because the server identifies nodes\n\t\t// by IP address (not hostname).\n\t\tconnecti...
[ "@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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Executes the given update. @param query The update to execute. @throws DatabaseEngineException If something goes wrong executing the update.
[ "@Override\n public synchronized int executeUpdate(final Expression query) throws DatabaseEngineException {\n /*\n * Reconnection is already assured by \"void executeUpdate(final String query)\".\n */\n final String trans = translate(query);\n logger.trace(trans);\n re...
[ "function RowStatementPostExec(\n statementOptions, context, services, connectionConfig)\n{\n // call super\n BaseStatement.apply(this, arguments);\n\n // add the result request headers to the context\n context.resultRequestHeaders = buildResultRequestHeadersRow();\n\n /**\n * Called when the statement re...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Close cleans up the resources used by the Multiplexer
[ "func (mux *Multiplexer) Close() {\n\tsafeclose.Close(\n\t\tmux.Consumer,\n\t\tmux.hashSyncProducer,\n\t\tmux.hashAsyncProducer,\n\t\tmux.manSyncProducer,\n\t\tmux.manAsyncProducer)\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the post about Computer Networking:", "pos": "Represent the code about Computer Networking:", "neg": "Represent the code about programming:" }
Insert default terms.
[ "private function insert_default_terms() {\n\t\tglobal $wpdb;\n\n\t\t// Default category\n\t\t$cat_name = __( 'Uncategorized' );\n\n\t\t/* translators: Default category slug */\n\t\t$cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) );\n\n\t\tif ( global_terms_enabled() ) {\n\t\t\t$cat_id = ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Replies if the specified column could be replied or ignored. @param column the column. @return <code>true</code> if the given column is selectable, otherwise <code>false</code>
[ "@Pure\n\tpublic boolean isColumnSelectable(DBaseFileField column) {\n\t\treturn column != null && (this.selectedColumns.isEmpty()\n\t\t\t\t|| this.selectedColumns.contains(column));\n\t}" ]
[ "def _get_description(arg):\n \"\"\"\"\"\"\n desc = []\n otherwise = False\n if arg.can_be_inferred:\n desc.append('If left unspecified, it will be inferred automatically.')\n otherwise = True\n elif arg.is_flag:\n desc.append('This argument defaults to '\n '<c...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Get value in dictionary for dictionary[keys[0]][keys[1]][keys[..n]] :param dictionary: An input dictionary :param keys: Keys where to store data :return:
[ "def nested_get(dictionary, keys):\n \n return reduce(lambda d, k: d[k], keys, dictionary)" ]
[ "def _unpack_list(example):\n \n try:\n x = example[0]\n y = example[1]\n meta = None\n return x, y, meta\n except IndexError:\n raise IndicoError(\n \"Invalid input data. Please ensure input data is \"\n \"formatted as a list of `[data, target]` pa...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Send a bunch of zero-bytes to the YubiHSM, and flush the input buffer.
[ "def reset(stick):\n \n nulls = (pyhsm.defines.YSM_MAX_PKT_SIZE - 1) * '\\x00'\n res = YHSM_Cmd(stick, pyhsm.defines.YSM_NULL, payload = nulls).execute(read_response = False)\n unlock = stick.acquire()\n try:\n stick.drain()\n stick.flush()\n finally:\n unlock()\n return re...
[ "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 about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Save a value @param string|array $name Name of the value @param mixed $value The value to save
[ "public function set($name, $value = null)\n {\n if (is_array($name)) {\n $this->parameters = array_replace($this->parameters, $name);\n } else {\n $this->parameters[trim(strtolower($name))] = is_string($value) ? trim($value) : $value;\n }\n }" ]
[ "public function getStoreValue($data = null)\n {\n\n // If Overrite Value\n if (isset($this->value) && $this->overwriteValue) {\n return $this->value;\n }\n\n // If user have user input value\n if ($data != null && isset($data[$this->getName()])) {\n\n // ...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Removes a Product from the specified ProductSet. @param \Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest $argument input argument @param array $metadata metadata @param array $options call options
[ "public function RemoveProductFromProductSet(\\Google\\Cloud\\Vision\\V1\\RemoveProductFromProductSetRequest $argument,\n $metadata = [], $options = []) {\n return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet',\n $argument,\n ['\\Google\\Protobuf...
[ "public function SetLoggingService(\\Google\\Cloud\\Container\\V1\\SetLoggingServiceRequest $argument,\n $metadata = [], $options = []) {\n return $this->_simpleRequest('/google.container.v1.ClusterManager/SetLoggingService',\n $argument,\n ['\\Google\\Cloud\\Container\\V1\\Operation', 'de...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Set the required fields conditional @return void
[ "protected function setRequiredFieldsConditional()\n {\n $requiredFieldsConditional = [\n 'currency' => [\n 'IDR' => ['bank_code'],\n 'CNY' => ['bank_branch', 'bank_name'],\n 'THB' => ['bank_name']\n ]\n ];\n\n $this->require...
[ "@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 Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
// SetCharacterSetName sets the CharacterSetName field's value.
[ "func (s *CharacterSet) SetCharacterSetName(v string) *CharacterSet {\n\ts.CharacterSetName = &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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// IsProcessable returns true if decoder is able to decode provided file
[ "func (yd *YAMLDecoder) IsProcessable(file string) bool {\n\tfor _, ext := range yd.extensions {\n\t\tif strings.HasSuffix(file, ext) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\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:" }
// SetFramerateConversionAlgorithm sets the FramerateConversionAlgorithm field's value.
[ "func (s *Mpeg2Settings) SetFramerateConversionAlgorithm(v string) *Mpeg2Settings {\n\ts.FramerateConversionAlgorithm = &v\n\treturn s\n}" ]
[ "public final void setTemplateMode(final TemplateMode templateMode) {\n Validate.notNull(templateMode, \"Cannot set a null template mode value\");\n // We re-parse the specified template mode so that we make sure we get rid of deprecated values\n this.templateMode = TemplateMode.parse(templateM...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Ensures an error on the passed greenlet crashes self/main greenlet.
[ "def add_pending_greenlet(self, greenlet: Greenlet):\n \n\n def remove(_):\n self.greenlets.remove(greenlet)\n\n self.greenlets.append(greenlet)\n greenlet.link_exception(self.on_error)\n greenlet.link_value(remove)" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Stops the reporter and shuts down its thread of execution. Uses the shutdown pattern from http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html
[ "public void stop() {\n executor.shutdown(); // Disable new tasks from being submitted\n try {\n // Wait a while for existing tasks to terminate\n if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {\n executor.shutdownNow(); // Cancel currently executing tasks\n...
[ "public static <T> void deregisterProvider(final ServiceRegistry registry, final IIOServiceProvider provider, final Class<T> category) {\n // http://www.ibm.com/developerworks/java/library/j-jtp04298.html\n registry.deregisterServiceProvider(category.cast(provider), category);\n }" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Technical Support:" }
// convertStructDevices converts between a list of struct and proto Device
[ "func convertStructDevices(in []*Device) []*proto.DetectedDevice {\n\tif in == nil {\n\t\treturn nil\n\t}\n\n\tout := make([]*proto.DetectedDevice, len(in))\n\tfor i, d := range in {\n\t\tout[i] = convertStructDevice(d)\n\t}\n\n\treturn out\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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Return the value for the nth header field. Returns null if there are fewer than n fields. This can be used in conjunction with getHeaderFieldKey to iterate through all the headers in the message.
[ "public String getHeaderField(int n) {\n try {\n getInputStream();\n } catch (Exception e) {\n return null;\n }\n MessageHeader props = properties;\n return props == null ? null : props.getValue(n);\n }" ]
[ "public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d...
codesearchnet
{ "query": "Represent the Github sentence about Redis command documentation:", "pos": "Represent the Github code about Redis command documentation:", "neg": "Represent the Github code about programming:" }
// SetNextDue sets the next due timestamp and whether the task has a queue, // and records the source (the now value of the run who reported nextDue).
[ "func (ts *taskScheduler) SetNextDue(nextDue int64, hasQueue bool, source int64) {\n\t// TODO(mr): we may need some logic around source to handle if SetNextDue is called out of order.\n\tts.nextDueMu.Lock()\n\tdefer ts.nextDueMu.Unlock()\n\tts.nextDue = nextDue\n\tts.nextDueSource = source\n\tts.hasQueue = hasQueue...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Copy header into provided writer @param writer repository writer to verify @throws IllegalArgumentException if writer is 'null'
[ "public void copyHeader(LogRepositoryWriter writer) throws IllegalArgumentException {\n\t\tif (writer == null) {\n\t\t\tthrow new IllegalArgumentException(\"Parameter writer can't be null\");\n\t\t}\n\t\twriter.setHeader(headerBytes);\n\t}" ]
[ "def push(self, stream, value):\n \n\n raise ArgumentError(\"Attempting to push reading to an invalid stream walker that cannot hold data\", selector=self.selector, stream=stream)" ]
codesearchnet
{ "query": "Represent the text about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about Data processing:" }
Disconnect and cleanup.
[ "def _disconnect(self, exc_info=False):\n \"\"\"\"\"\"\n if self._stream:\n self._stream.close(exc_info=exc_info)" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
/* Render the report with the render modules supplied in the options. @param {Object} options Doctor options. @param {Object} report Report generated by doctor. @param {function} cb Function to call when rendering is complete.
[ "function render(options, report, cb) {\n var reportName = options.outputReportName || 'report.json';\n var files = {};\n files[reportName] = report;\n var renderFunctions = u.toArray(options.render || 'default');\n try {\n renderFunctions = u.findFunctions(renderFunctions, 'render');\n } catch (findError)...
[ "function(err, stdout, stderr) {\n if(err) return callback(err);\n // Get the transformed source\n var source = stdout;\n // Compile the function\n eval(source)\n // Return the validation function\n callback(null, {\n validate: func\n });\n }" ]
codesearchnet
{ "query": "Represent the post about Technical writing:", "pos": "Represent the code about Technical writing:", "neg": "Represent the code:" }
// SetCurrentGeneration sets the CurrentGeneration field's value.
[ "func (s *RedshiftInstanceDetails) SetCurrentGeneration(v bool) *RedshiftInstanceDetails {\n\ts.CurrentGeneration = &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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Find a Customer by id. @param mixed $id The customer id @return CanalTP\NmmPortalBundle\Entity\Customer
[ "private function findCustomerById ($id) {\n $customer = $this->getDoctrine()\n ->getManager()\n ->getRepository('CanalTPNmmPortalBundle:Customer')\n ->find($id);\n\n return $customer;\n }" ]
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// RegisterSourceAsSchema means you have a datasource, that is going to act // as a named schema. ie, this will not be a nested schema with sub-schemas // and the source will not be re-useable as a source-type.
[ "func RegisterSourceAsSchema(name string, source Source) error {\n\n\t// Since registry is a global, lets first lock that.\n\tregistryMu.Lock()\n\tdefer registryMu.Unlock()\n\n\ts := NewSchemaSource(name, source)\n\tsource.Init()\n\tsource.Setup(s)\n\tif err := registry.SchemaAdd(s); err != nil {\n\t\treturn err\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Send an erase device command to this object @param passcode[String] a six-char passcode, required for computers & computergroups @return (see .send_mdm_command)
[ "def erase_device(passcode = '', preserve_data_plan: false)\n self.class.erase_device @id, passcode: passcode, preserve_data_plan: preserve_data_plan, api: @api\n end" ]
[ "def cancel_link_unlink_mode(self):\n \"\"\"\"\"\"\n self.logger.info(\"cancel_link_unlink_mode\")\n self.scene_command('08')\n # should send http://0.0.0.0/0?08=I=0\n\n ## TODO check return status\n status = self.hub.get_buffer_status()\n return status" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Run implements distributor.D
[ "func (d *BoundDistributor) Run(desc *dm.Quest_Desc, exAuth *dm.Execution_Auth, prev *dm.JsonResult) (tok distributor.Token, pollbackTime time.Duration, err error) {\n\tif err = d.RunError; err != nil {\n\t\treturn\n\t}\n\tpollbackTime = d.PollbackTime\n\n\ttok = MakeToken(exAuth.Id)\n\n\ttsk := &DistributorData{\n...
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Replace rectangle with its transformation by matrix m.
[ "def transform(self, m):\n \"\"\"\"\"\"\n if not len(m) == 6:\n raise ValueError(\"bad sequ. length\")\n self.x0, self.y0, self.x1, self.y1 = TOOLS._transform_rect(self, m)\n return self" ]
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Load grid and calculate alpha values from the coverage/2.5.
[ "def load_grid(self, alpha):\n '''\n '''\n grid = CRGrid.crt_grid(self.dirs[0] + '/grid/elem.dat',\n self.dirs[0] + '/grid/elec.dat')\n self.plotman = CRPlot.plotManager(grid=grid)\n\n name = self.dirs[0] + '/inv/coverage.mag'\n content = np.ge...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Given a list or tuple of logging levels, add a logger instance to each.
[ "def add(self, levels, logger):\n \n if isinstance(levels, (list, tuple)):\n for lvl in levels:\n self.config[lvl].add(logger)\n else:\n self.config[levels].add(logger)" ]
[ "def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Loads the piwik configuration. @param array $config An array of configuration settings @param \Symfony\Component\DependencyInjection\ContainerBuilder $container A ContainerBuilder instance
[ "public function load(array $configs, ContainerBuilder $container)\n {\n $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));\n\n if (!$container->hasDefinition('piwik.client')) {\n $loader->load('piwik.xml');\n }\n\n $config = $this->me...
[ "public function postStartup(ApplicationInterface $application)\n {\n\n // load the object manager\n /** @var \\AppserverIo\\Psr\\Di\\ObjectManagerInterface $objectManager */\n $objectManager = $application->search(ObjectManagerInterface::IDENTIFIER);\n\n // register the beans found b...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Create a default Cocoa menu that shows 'Services', 'Hide', 'Hide Others', 'Show All', and 'Quit'. Will append the application name to some menu items if it's available.
[ "def _add_app_menu(self):\n \n # Set the main menu for the application\n mainMenu = AppKit.NSMenu.alloc().init()\n self.app.setMainMenu_(mainMenu)\n\n # Create an application menu and make it a submenu of the main menu\n mainAppMenuItem = AppKit.NSMenuItem.alloc().init()\n ...
[ "def onCopySelection(self, event):\n \n if self.df_slice is not None:\n pd.DataFrame.to_clipboard(self.df_slice, header=False, index=False)\n self.grid.ClearSelection()\n self.df_slice = None\n print('-I- You have copied the selected cells. You may paste th...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Compare version between installed and a new extensions @return void
[ "protected function compareVersion()\n {\n $manifest = $this->getManifest();\n $extensionEntity = $this->getExtensionEntity();\n\n if (isset($extensionEntity)) {\n $comparedVersion = version_compare($manifest['version'], $extensionEntity->get('version'), '>=');\n if ($c...
[ "@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:" }
// RemoveDuplicateField remove the duplicate field
[ "func RemoveDuplicateField(data string) string {\n\tfs := []string{}\n\n\tfor _, v := range strings.Split(data, \",\") {\n\t\tif strings.TrimSpace(v) != \"\" {\n\t\t\tfs = append(fs, v)\n\t\t}\n\t}\n\n\tfields := xslice.Unique(fs)\n\tresult := strings.Join(fields.([]string), \",\")\n\n\treturn result\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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Disables a reference to the service :return: True if the bundle was using this reference, else False
[ "def unget_service(self, reference):\n # type: (ServiceReference) -> bool\n \n # Lose the dependency\n return self.__framework._registry.unget_service(\n self.__bundle, reference\n )" ]
[ "def set_schema(self, schema_name, include_public=True):\n \n self.tenant = FakeTenant(schema_name=schema_name)\n self.schema_name = schema_name\n self.include_public_schema = include_public\n self.set_settings_schema(schema_name)\n self.search_path_set = False\n # C...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }