query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Get string given values. @param array $values @return string
[ "public static function arrayToString(array $values): string\n {\n if (self::ZERO == $values[0]) {\n $values[0] = '';\n }\n if (self::INFINITE == $values[1]) {\n $values[1] = '';\n }\n\n return implode(self::SEPARATOR, $values);\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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// SetState sets the State field's value.
[ "func (s *GetLifecyclePoliciesInput) SetState(v string) *GetLifecyclePoliciesInput {\n\ts.State = &v\n\treturn s\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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// addFormValues adds the parameters in opt as URL values parameters.
[ "func addFormValues(opt map[string]string) *url.Values {\n\tuv := url.Values{}\n\tfor k, v := range opt {\n\t\tuv.Set(k, v)\n\t}\n\treturn &uv\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 post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// insert inserts the given string template into the tree. The filter string is separated // on the template separator and each part is used as the path in the tree.
[ "func (n *node) insert(filter string, template *Template) {\n\tn.separator = template.separator\n\tn.recursiveInsert(strings.Split(filter, n.separator), template)\n}" ]
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return the closest zoom level for a given resolution Parameters: resolution -- max. resolution unit -- unit for output (default='meters')
[ "def getClosestZoom(self, resolution, unit='meters'):\n \n lo, hi = self._getZoomLevelRange(resolution, unit)\n if lo == 0:\n return lo\n if hi == len(self.RESOLUTIONS):\n return hi - 1\n before = self.RESOLUTIONS[lo - 1]\n if abs(self.RESOLUTIONS[lo] ...
[ "def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return a dictionary for which key are volume names according to the output of gluster volume info stored in volume_file.
[ "def get_volume_names(self, volume_file):\n \n out = []\n fp = open(volume_file, 'r')\n for line in fp.readlines():\n if not line.startswith(\"Volume Name:\"):\n continue\n volname = line[12:-1]\n out.append(volname)\n fp.close()\n ...
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the description about AWS Route 53:", "pos": "Represent the code about AWS Route 53:", "neg": "Represent the code about Technology:" }
@param array $exists @return array
[ "private function prepareExists(array $exists)\n {\n if ($exists['sql'] instanceof SelectQuery) {\n [$sql, $params] = $exists['sql']->toSql();\n\n $exists['sql'] = $sql;\n\n $exists['params'] = $params;\n }\n\n return $exists;\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:" }
If the Swagger Path was matched, but the HTTP method doesn't match any of the Swagger Operations, then an HTTP 405 (Method Not Allowed) error is thrown, and the "Allow" header is set to the list of valid methods
[ "function http405 (req, res, next) {\n if (req.swagger && req.swagger.path && !req.swagger.operation) {\n util.debug(\n 'Client attempted a %s operation on \"%s\", which is not allowed by the Swagger API. ' +\n \"Returning HTTP 405 (Method Not Allowed)\",\n req.method, req.path\n );\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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Given url where a Turi Create object is persisted, return the Turi Create object type: 'model', 'graph', 'sframe', or 'sarray'
[ "def get_turicreate_object_type(url):\n '''\n \n '''\n from .._connect import main as _glconnect\n ret = _glconnect.get_unity().get_turicreate_object_type(_make_internal_url(url))\n\n # to be consistent, we use sgraph instead of graph here\n if ret == 'graph':\n ret = 'sgraph'\n retur...
[ "def url(self):\n \n if self._href is not None:\n return self._href\n if self.identifier:\n # for some reason atlas does not use classifications here in the path when considering one classification\n path = '/'.join([self.parent.url.replace('classifications/', ...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Return data contained in a SockJS "message" and "close" frames. Otherwise for SockJS "open" and "close" frames, which do not contain data, return {@code null}. @return a {@link java.lang.String} object.
[ "public String getFrameData() {\n if (SockJsFrameType.OPEN == getType() || SockJsFrameType.HEARTBEAT == getType()) {\n return null;\n } else {\n return getContent().substring(1);\n }\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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Update the specified resource in storage. @param Request $request @param int $id @return Response
[ "public function update(SeoPagesRequest $request, $id)\n {\n $input = $request->all();\n\n $record = $this->model->findOrFail($id);\n\n $record->update($input);\n\n $this->notify([\n 'type' => 'success',\n 'title' => 'Successful update!',\n 'descriptio...
[ "@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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// submitRequest sends a request for either enabling or disabling a particular // outpoint and awaits an error response. The request type is dictated by the // reqChan passed in, which can be either of the enableRequests or // disableRequests channels.
[ "func (m *ChanStatusManager) submitRequest(reqChan chan statusRequest,\n\toutpoint wire.OutPoint) error {\n\n\treq := statusRequest{\n\t\toutpoint: outpoint,\n\t\terrChan: make(chan error, 1),\n\t}\n\n\tselect {\n\tcase reqChan <- req:\n\tcase <-m.quit:\n\t\treturn ErrChanStatusManagerExiting\n\t}\n\n\tselect {\n\...
[ "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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
[Input] _check_point_ shold be Vector3. [Output] return true if triangle contains _check_point_.
[ "def contains?( check_point )\n Util3D.check_arg_type(Vector3, check_point )\n plane = Plane.new( vertices[0], self.normal)\n distance, projected_point = plane.distance(check_point)\n return false if( distance > self.tolerance )\n g_coord = self.barycentric_coordinate(check_point)\n g_...
[ "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 about geometry:", "pos": "Represent the Github code about geometry:", "neg": "Represent the Github code:" }
Mark a migration as migrated. @param string $migrationName
[ "public function migrate($migrationName) {\n\t\t$this->createTable();\n\t\t$this->db->dal()->into('_migrations')->insert(['name'=>$migrationName, 'migrated'=>date('Y-m-d H:i:s')]);\n\t}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Build a parameter item. @param <O> the type of parameterized object @param parameterParams the primitive values for the color @return a new fresh color item object
[ "public static <O extends Object> ParameterItem<O> create(final ObjectParameter<O> parameterParams) {\n // Ensure that the uid will be unique at runtime\n return (ParameterItem<O>) ParameterItemImpl.create(parameterParams.object()).uid(parameterIdGenerator.incrementAndGet()).set(parameterParams); // F...
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Run the ready method on each of the components. @throws \Eddmash\PowerOrm\Exception\AppRegistryNotReady
[ "private function componentsReady()\n {\n $this->getRegistryCache()->isAppReady();\n\n if ($this->componentsloaded) {\n foreach ($this->components as $component) {\n $component->ready($this);\n }\n }\n }" ]
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
设置映射表 @param deprelTranslatorPath 映射表路径 @return
[ "public IDependencyParser setDeprelTranslater(String deprelTranslatorPath)\n {\n deprelTranslater = GlobalObjectPool.get(deprelTranslatorPath);\n if (deprelTranslater != null) return this;\n\n IOUtil.LineIterator iterator = new IOUtil.LineIterator(deprelTranslatorPath);\n deprelTransl...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Specifies keys that must exist
[ "def require(*keys)\n permitted_keys.merge keys\n required_keys = keys.to_set\n unless (missing_keys = required_keys - hash_keys).empty?\n error \"required #{terms} #{missing_keys.to_a} missing\" + postscript\n end\n self\n end" ]
[ "public static function get_contexts_for_userid(int $userid) : \\core_privacy\\local\\request\\contextlist {\n // We cannot associate files with a particular user as it would require to know all the details about\n // the source file, which only the component owning it knows about. And, the 'usermodif...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Load a factory and have it initialize in a particular directory :param name: the name of the plugin to load :param directory: the directory where the factory will reside :return:
[ "def load_factory(name, directory, configuration=None):\n \n for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT):\n if entry_point.name == name:\n factory_class = entry_point.load(require=False)\n return factory_class(directory, configuration)\n\n raise KeyError" ]
[ "def get_root_path(self, name):\n \n module = modules.get(name)\n if module is not None and hasattr(module, '__file__'):\n return dirname(abspath(module.__file__))\n\n # Flask keeps looking at this point. We instead set the root path to None,\n # assume that the user do...
codesearchnet
{ "query": "Represent the Github description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// SetName sets the Name field's value.
[ "func (s *AppSummary) SetName(v string) *AppSummary {\n\ts.Name = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Update a single resource @return array
[ "public function update($token, $_params = array()) \n\t{\n return $this->transform($this->master->put('resources/' . $token, $_params), true);\n }" ]
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about File management:" }
make taskId=0 and streamId empty and metricName remain the string after `.`.
[ "public static String task2MergeCompName(String old) {\n String[] parts = old.split(DELIM);\n if (parts.length >= 7) {\n parts[0] = MetaType.COMPONENT.getV() + parts[0].charAt(1);\n parts[parts.length - 3] = EMPTY;\n parts[parts.length - 4] = \"0\";\n\n Stri...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the md5-sum of this file. This is of course potentially expensive!
[ "def md5(self):\n \n hash_ = hashlib.md5()\n with self.open(\"rb\") as inf:\n block = inf.read(4096)\n while block:\n hash_.update(block)\n block = inf.read(4096)\n\n return hash_.hexdigest()" ]
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github post about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about Software development:" }
/* Convenience method for doing the verbose COW remove from the map
[ "private void removeForeignHost(final int hostId) {\n ImmutableCollection<ForeignHost> fhs = m_foreignHosts.get(hostId);\n synchronized (m_mapLock) {\n m_foreignHosts = ImmutableMultimap.<Integer, ForeignHost>builder()\n .putAll(Multimaps.filterKeys(m_foreignHosts, not(eq...
[ "@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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param InputInterface $input @param OutputInterface $output @throws InstallFailedException when version file is invalid
[ "protected function execute(InputInterface $input, OutputInterface $output): void\n {\n $config = $this->config;\n $tempDir = $config->get('dotfiles.temp_dir');\n\n $output->writeln('Start checking new version');\n $url = static::BASE_URL.'/dotfiles.phar.json';\n $versionFile =...
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Get FOLLOW set for a single given symbol @param int scalar symbol @return array set of terminal symbols
[ "function follow_set( $s ){\n\t\tif( ! isset($this->follows[$s]) ){\n\t\t\t$type = $this->is_terminal($s) ? 'terminal' : 'non-terminal';\n\t\t\ttrigger_error(\"No follow set for $type $s\", E_USER_WARNING );\n\t\t\treturn array();\n\t\t}\n\t\treturn $this->follows[$s];\n\t}" ]
[ "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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Closes all empty child entries.<p>
[ "public void closeAllEmptyChildren() {\n\n for (Widget child : m_children) {\n if (child instanceof CmsTreeItem) {\n CmsTreeItem item = (CmsTreeItem)child;\n if (item.isOpen()) {\n if (item.getChildCount() == 0) {\n item.setOp...
[ "final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n /...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Bucket retrieves the bucket named b.
[ "func (tx *Tx) Bucket(b []byte) (kv.Bucket, error) {\n\tbkt := tx.tx.Bucket(b)\n\tif bkt == nil {\n\t\treturn tx.createBucketIfNotExists(b)\n\t}\n\treturn &Bucket{\n\t\tbucket: bkt,\n\t}, nil\n}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about AWS S3:", "pos": "Represent the Github code about AWS S3:", "neg": "Represent the Github code:" }
Latex document generator visit handler
[ "def visit_snippet_latex(self, node):\n \n code = node.rawsource.rstrip('\\n')\n\n lang = self.hlsettingstack[-1][0]\n linenos = code.count('\\n') >= self.hlsettingstack[-1][1] - 1\n fname = node['filename']\n highlight_args = node.get('highlight_args', {})\n if 'language' in node:\n # c...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Create new objects of a class or interface with this method. It uses a mapping table to map the given $name to a implementing class, thus providing a kind of DIC. @param string $name @param array $arguments for constructor @return object
[ "public function get($name, array $arguments = null)\n {\n $this->load();\n if ($arguments === null) {\n $arguments = [$this->env];\n }\n if (isset($this->config[$name])) {\n $entry = $this->config[$name];\n if (is_callable($entry)) {\n ...
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Execute pandoc with the given arguments
[ "def pandoc(args, filein=None, fileout=None):\n \"\"\"\"\"\"\n cmd = [u'pandoc']\n\n if filein:\n cmd.append(filein)\n\n if fileout:\n cmd.append('-o')\n cmd.append(fileout)\n\n cmd.extend(args.split())\n\n proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)\n out, err = p...
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Technology:" }
Convert a .ini file into a Node object. :param ini_file: a filename or a file like object in read mode
[ "def node_from_ini(ini_file, nodefactory=Node, root_name='ini'):\n \n fileobj = open(ini_file) if isinstance(ini_file, str) else ini_file\n cfp = configparser.RawConfigParser()\n cfp.read_file(fileobj)\n root = nodefactory(root_name)\n sections = cfp.sections()\n for section in sections:\n ...
[ "def run(input, conf, filepath=None):\n \n if conf.is_file_ignored(filepath):\n return ()\n\n if isinstance(input, (type(b''), type(u''))): # compat with Python 2 & 3\n return _run(input, conf, filepath)\n elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase\n # ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Checks if the file extension is blacklisted in valid_extensions. :param str extension: a file extension to check :returns: flag indicating if the extension is valid based on list of valid extensions. :rtype: bool
[ "def _is_valid_extension(extension):\n \n if not cfg.CONF.valid_extensions:\n return True\n\n valid = False\n for cext in cfg.CONF.valid_extensions:\n if not cext.startswith('.'):\n cext = '.%s' % cext\n if extension == cext:\n valid = True\n break\n...
[ "def _is_process_filtered(self, process, key=None):\n \"\"\"\"\"\"\n if key is None:\n key = self.filter_key\n try:\n # If the item process[key] is a list, convert it to a string\n # in order to match it with the current regular expression\n if isinst...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Bottleneck nanmean function that handle tuple axis.
[ "def _nanmean(array, axis=None):\n \"\"\"\"\"\"\n\n if isinstance(axis, tuple):\n array = _move_tuple_axes_first(array, axis=axis)\n axis = 0\n return bottleneck.nanmean(array, axis=axis)" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
保存所有数据 @param pData @throws APPErrorException
[ "@Override\n public void update(Object pData) throws APPErrorException {\n valid(pData);\n mDao.updateByPrimaryKey(pData);\n }" ]
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the Github instruction about Encryption:", "pos": "Represent the Github code about Encryption:", "neg": "Represent the Github code about Software Development:" }
Return args object with new coordinates based on behavior @returns {Object} args
[ "function smartCoordinates(args) {\n var x = args.x,\n y = args.y;\n\n var paper = Origami.getPaper(),\n elmWidth = paper.element.width,\n elmHeight = paper.element.height,\n radius = (args.r || 0);\n\n var width = (args.width || radius),\n height = (args.height || width);\n\n var axis = {\n x...
[ "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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Does the specified BDA, or any of BDAs accessible by it, have any beans or it is an extension which could add beans @param bda the BDA @return true if the specified BDA, or any of BDAs accessible by it, have any beans
[ "private boolean isCDIEnabled(WebSphereBeanDeploymentArchive bda) {\n Boolean hasBeans = cdiStatusMap.get(bda.getId());\n if (hasBeans == null) {\n //it's enabled if it has beans or it is an extension which could add beans\n hasBeans = bda.hasBeans() || bda.isExtension();\n ...
[ "public static String getName(DistributedObject distributedObject) {\n /*\n * The motivation of this behaviour is that some distributed objects (`ICache`) can have prefixed name.\n * For example, for the point of view of cache,\n * it has pure name and full name which contains prefixe...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Check whether medium image must be generated while storing the image file. @param type $default @return string
[ "public function isGenerateMedium( $default = null ) {\n\n\t\t$prop = $this->properties[ self::PROP_GENERATE_MEDIUM ];\n\n\t\tif( isset( $prop ) && strlen( $prop ) > 0 ) {\n\n\t\t\treturn $prop;\n\t\t}\n\n\t\treturn $default;\n\t}" ]
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Connect. @param configuration the connection configuration @return the future connection @throws IOException
[ "public static IoFuture<Connection> connect(final ProtocolConnectionConfiguration configuration) throws IOException {\n return connect(configuration.getCallbackHandler(), configuration);\n }" ]
[ "def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t...
codesearchnet
{ "query": "Represent the sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about AWS Auto Scaling:" }
@param $identifier @param $className @return $this
[ "public function bindClassToRule ($className, $identifier)\n\t\t{\n\t\t\tif (! isset($this->rules[$identifier])) {\n\t\t\t\tthrow new Dependency('Class ' . $className . ' set into invalid rule ' . $identifier);\n\t\t\t}\n\n\t\t\t$this->classIndex->setClassToRule($identifier, $className);\n\n\t\t\treturn $this;\n\t\...
[ "private function prepareConstructor()\n {\n $fragment = new CNabuPHPConstructorBuilder($this);\n $fragment->addComment('Instantiates the class.');\n $fragment->addFragment(\"parent::__construct('$this->table_field_id');\");\n\n $this->addFragment($fragment);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Computer Science:" }
method iterated thru all documents in all job collections and builds a tree of known system state
[ "def _build_tree_by_level(self, time_qualifier, collection_name, since):\n \n invalid_tree_records = dict()\n invalid_tq_records = dict()\n\n try:\n job_records = self.job_dao.get_all(collection_name, since)\n for job_record in job_records:\n tree = s...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Redirects http-request to url @param url
[ "public static void redirect(String url, boolean copyParameters, ServletRequest req, ServletResponse res)\r\n\t{\r\n\t\tif(url == null)\r\n\t\t{\r\n\t\t\tthrow new IllegalArgumentException(\"URL cannot be null\");\r\n\t\t}\r\n\t\tString redirectUrl = url;\r\n\t\tchar separator = '?';\r\n\t\tif (redirectUrl.indexOf(...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// String returns the string value of PluralRule
[ "func (p PluralRule) String() string {\n\n\tswitch p {\n\tcase PluralRuleZero:\n\t\treturn pluralsString[7:11]\n\tcase PluralRuleOne:\n\t\treturn pluralsString[11:14]\n\tcase PluralRuleTwo:\n\t\treturn pluralsString[14:17]\n\tcase PluralRuleFew:\n\t\treturn pluralsString[17:20]\n\tcase PluralRuleMany:\n\t\treturn p...
[ "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 about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
restarts a dedicated process :return:
[ "def kill_process(modeladmin, request, queryset):\n \n for process in queryset:\n process.stop(signum=signal.SIGKILL)" ]
[ "def start(self, timeout=None):\n \n\n assert super(PyrosBase, self).start(timeout=timeout)\n # Because we currently use this to setup connection\n return self.name" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
cancel a created order specified by order id. Optional argument amount is to refund partially. @param mixed @return OrderIdRequest
[ "public function cancel($params = array())\n {\n $arr = array( \"id\" => $params[\"id\"]);\n $rawResponse = $this->client->request('delete', 'api/exchange/orders' . '/' . $arr['id'] , $arr);\n return $rawResponse;\n }" ]
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
/* getADate Returns a new DateTime object reference if possible, otherwise null. @return retDT A DateTime object reference.
[ "private DateTime getADate(String s) {\n DateTime retDT = null;\n try\n {\n retDT = new DateTime( s );\n } // the try\n catch(IllegalArgumentException pe)\n {\n // ignore it here, caller sees null\n } // the catch\n return retDT;\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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Embed resources for the given relation @param relation Embedded resource relation @param resources Resources to embed @return HAL resource
[ "public HalResource addEmbedded(String relation, HalResource... resources) {\n return addResources(HalResourceType.EMBEDDED, relation, true, resources);\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Updates limits so that circle is visible. @param x @param y @param radius
[ "public void update(double x, double y, double radius)\r\n {\r\n update(x, y);\r\n update(x-radius, y-radius);\r\n update(x+radius, y-radius);\r\n update(x-radius, y+radius);\r\n update(x+radius, y+radius);\r\n }" ]
[ "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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Media management command demonstrates multiple layers of sub-commands being handled by AutoCompleter
[ "def do_library(self, args):\n \"\"\"\"\"\"\n func = getattr(args, 'func', None)\n if func is not None:\n # Call whatever subcommand function was selected\n func(self, args)\n else:\n # No subcommand was provided, so call help\n self.do_help('l...
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Execute a procedure on each partition. The partition is indicated by its bounds on the backend array. @param p the procedure to execute
[ "public boolean forEachPartition(IterateProcedure<E> p) {\n int curIdx = index.get(values.get(0).id());\n int from;\n int to;\n for (from = 0, to = 0; to < values.size(); to++) {\n int cIdx = index.get(values.get(to).id());\n if (curIdx != cIdx) {\n i...
[ "@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:" }
// ServeConnContext is ServeConn with given context provided // within parameters for compatible RPC methods.
[ "func ServeConnContext(ctx context.Context, conn io.ReadWriteCloser) {\n\trpc.ServeCodec(NewServerCodecContext(ctx, conn, nil))\n}" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get an array of stores with unique AMQP configuration. @return Mage_Core_Model_Store[]
[ "public function getQueueConfigurationScopes()\n {\n // cache of seen, unique AMQP configurations\n $configurations = array();\n // list of stores to produce unique AMQP configuration\n $uniqueStores = array();\n foreach (Mage::app()->getStores(true) as $store) {\n $...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
HttpClient A HTTP request abstraction layer to be used in node.js / browsers environments. @class @memberof CamSDK.client
[ "function(config) {\n config = config || {};\n\n config.headers = config.headers || {};\n if (!config.headers.Accept) {\n config.headers.Accept = 'application/hal+json, application/json; q=0.5';\n }\n\n if (!config.baseUrl) {\n throw new Error('HttpClient needs a `baseUrl` configuration property.');\n }...
[ "function Virgilio(options) {\n if (!(this instanceof Virgilio)) {\n return new Virgilio(options);\n }\n EventEmitter.call(this);\n this.options$ = options = options || {};\n this.util$.validateArg('Virgilio', 'options', options, 'object');\n var logOptions = { level: 10, name: 'virgilio' }...
codesearchnet
{ "query": "Represent the Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Rules that apply to a class
[ "def class_rules\n [\n Rule.new(:error, 4..6, \"Description Markdown\", \"Above your class you need documentation that covers the scope, and the usage of your plugin.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 30, \"Tags\", \"This plug...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Bind variable when option is a super global @param string $option @param mixed $value OUTPUT @return boolean
[ "protected function bindVarSuperGlobal($option, ServerRequestInterface $request, &$value)\n {\n if (preg_match('/^\\$_(GET|POST|COOKIE)\\[([^\\[]*)\\]$/i', $option, $matches)) {\n list(, $var, $key) = $matches;\n\n $var = strtolower($var);\n $data = null;\n\n if...
[ "public static function insertTemplatePF ($parser, $template, $spot=''){\n //process additional arguments into a usable array\n $params = array();\n //sanitize the template name\n $template = preg_replace('/[^A-Za-z0-9_\\-]/', '_', $template);\n //this will be stripped out, assuming the skin is based...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Pass through to provider GradebookColumnAdminSession.get_gradebook_column_form_for_update
[ "def get_gradebook_column_form(self, *args, **kwargs):\n \"\"\"\"\"\"\n # Implemented from kitosid template for -\n # osid.resource.ResourceAdminSession.get_resource_form_for_update\n # This method might be a bit sketchy. Time will tell.\n if isinstance(args[-1], list) or 'gradebo...
[ "def single(self):\n \n return 'display: none;' not in self._looking_for_xpb.li(id='ajax_single').\\\n one_(self._profile.profile_tree).attrib['style']" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Creates a GraphQLDocument object from compiled code and the globals. This is used by the loaders and schema to create a document object.
[ "def from_code(\n cls,\n schema, # type: GraphQLSchema\n code, # type: Union[str, Any]\n uptodate=None, # type: Optional[bool]\n extra_namespace=None, # type: Optional[Dict[str, Any]]\n ):\n # type: (...) -> GraphQLCompiledDocument\n \n if isinstance(co...
[ "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:" }
converts a object to a QueryColumn, if possible @param o @return @throws PageException
[ "public static QueryColumn toQueryColumn(Object o) throws PageException {\n\tif (o instanceof QueryColumn) return (QueryColumn) o;\n\tthrow new CasterException(o, \"querycolumn\");\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Perform afterSave events: - flush needed caches - trigger afterPropertyModelSave event of corresponding PropertyHandler @param bool $insert @param array $changedAttributes
[ "public function afterSave($insert, $changedAttributes)\n {\n parent::afterSave($insert, $changedAttributes);\n if (isset($changedAttributes['key'])) {\n Yii::$app->cache->delete(\"PropertyKeyForId:{$this->id}\");\n }\n $handler = PropertyHandlerHelper::getInstance()->handl...
[ "@Override\n public void perform() throws PortalException {\n // push the change into the PLF\n if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {\n // remove the parm edit\n ParameterEditManager.removeParmEditDirective(nodeId, name, person);\n }\n // pu...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param Config $userConfig @throws ConfigException @throws RuntimeException
[ "public function run(Config $userConfig)\n {\n $state = new State();\n $state->config = new RunnerConfig($userConfig);\n\n foreach ($this->processors as $processor) {\n $processor->run($state, $this->logger);\n }\n }" ]
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
0 - hidden input of sku 1 - checkbox itemOffer 2 - actions 3 - status 4 - sku 5 - asin 6 - product name 7 - date created 8 - qty 9 - your price 10 - condition 11 - low price 12 - buy-box price 13 - fulfilled by
[ "def listing_row_to_object(row)\n l = Listing.new\n row.css('td').each_with_index do |td, i|\n\n txt = td.text.strip # yes, slightly slower to do this here, but I type less.\n\n case i\n when 4\n l.sku = txt\n when 5\n l.asin = txt\n w...
[ "function ItemsItem() {\n /**\n * The id value\n * @member\n */\n this.id = null;\n /**\n * The sku value\n * @member\n */\n this.sku = null;\n /**\n * The title value\n * @member\n */\n this.title = null;\n /**\n * The quantity value\n * @member\n ...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Search notes for a given (possibly abbreviated) hash
[ "def find_by_hash(self, hash=None, book=-1):\n ''''''\n if hash:\n self.fyi(\"nota.find_by_hash() with abbreviated hash %s; book=%s\" % (hash, book))\n try:\n if book < 0:\n rows = self.cur.execute(\"SELECT noteId, hash FROM note WHERE book > 0;\").fetchall(...
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Reduces the number of discrete components in the Domain if there are too many.
[ "public Domain simplify()\n {\n ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform(\n ranges -> {\n if (ranges.getOrderedRanges().size() <= 32) {\n return Optional.empty();\n }\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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Completes an operation.
[ "protected <T extends OperationResponse> void completeOperation(OperationResult result, OperationResponse.Builder<?, T> builder, Throwable error, CompletableFuture<T> future) {\n if (result != null) {\n builder.withIndex(result.index());\n builder.withEventIndex(result.eventIndex());\n if (result....
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// ParseSignal parses a given string into a syscall.Signal // the rawSignal can be a string with "SIG" prefix, // or a signal number in string format.
[ "func ParseSignal(rawSignal string) (syscall.Signal, error) {\n\ts, err := strconv.Atoi(rawSignal)\n\tif err == nil {\n\t\tsig := syscall.Signal(s)\n\t\tfor _, msig := range signalMap {\n\t\t\tif sig == msig {\n\t\t\t\treturn sig, nil\n\t\t\t}\n\t\t}\n\t\treturn -1, fmt.Errorf(\"unknown signal %q\", rawSignal)\n\t}...
[ "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 summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Runs a command and returns the exit code, stdout, stderr and possible any extra file. To get the stderr you have to add "2> file.txt"
[ "protected static function runCommand($cmd, $stderr_file = false, $extra_file = false) {\n $output = [];\n $exitcode = -1;\n exec($cmd, $output, $exitcode);\n return [\n 'code' => $exitcode,\n 'stdout' => implode(\"\\n\", $output),\n 'stderr' => $stderr_f...
[ "def _run_script(self, session, file_path):\n \n if file_path:\n # The 'run' command returns False in case of error\n # The 'execute' method returns False if the run command fails\n return self._shell.execute('run \"{0}\"'.format(file_path), session)\n\n return ...
codesearchnet
{ "query": "Represent the summarization about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
// presets link in /etc, which doesn't make sense for runtime units // Related: https://github.com/coreos/ignition/v2/issues/588
[ "func (ut Util) EnableRuntimeUnit(unit types.Unit, target string) error {\n\t// unless we're running tests locally, we want to affect /run, which will\n\t// be carried into the pivot, not a directory named /$DestDir/run\n\tif !distro.BlackboxTesting() {\n\t\tut.DestDir = \"/\"\n\t}\n\n\tnodePath, err := ut.JoinPath...
[ "func IsNotFoundError(err error) bool {\n\tes := err.Error()\n\tif strings.Contains(es, \"does not exist\") {\n\t\t// set with the same name already exists\n\t\t// xref: https://github.com/Olipro/ipset/blob/master/lib/errcode.c#L32-L33\n\t\treturn true\n\t}\n\tif strings.Contains(es, \"element is missing\") {\n\t\t...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
------------------------------------------------------------------------
[ "@Override\n\tpublic T copy(T from) {\n\t\tif (CONCURRENT_ACCESS_CHECK) {\n\t\t\tenterExclusiveThread();\n\t\t}\n\n\t\ttry {\n\t\t\tcheckAvroInitialized();\n\t\t\treturn avroData.deepCopy(runtimeSchema, from);\n\t\t}\n\t\tfinally {\n\t\t\tif (CONCURRENT_ACCESS_CHECK) {\n\t\t\t\texitExclusiveThread();\n\t\t\t}\n\t\t...
[ "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 about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code:" }
Set the current declaration and its doc comment.
[ "void setCurrent(TreePath path, DocCommentTree comment) {\n currPath = path;\n currDocComment = comment;\n currElement = trees.getElement(currPath);\n currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement);\n\n AccessKind ak = AccessKind.PUBLIC;\n fo...
[ "@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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Get translation by key . @param $key @param array $replacement @param null $locale @param null $driver @return mixed
[ "public function get($key, $replacement = array(), $locale = null, $driver = null) {\n $driver = ! is_null($driver) ? $this->getDriver($driver) : $this->driver();\n\n return $driver\n ->get($key, $replacement, $locale);\n }" ]
[ "private function addUsedIndex(string $index)\n {\n // add user index and detect default translate (default: index == translate)\n $this->listUsedIndex[$index] = (isset($this->dictionary[$index]) && $this->dictionary[$index] != $index);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Replace only once taken from http://www.php.net/manual/en/function.str-replace.php
[ "protected static function strReplaceOnce($search, $replace, $subject)\n {\n $firstChar = strpos($subject, $search);\n if (false !== $firstChar) {\n $beforeStr = substr($subject, 0, $firstChar);\n $afterStr = substr($subject, $firstChar + strlen($search));\n\n retur...
[ "private function writeFile($fileName, $value, $expires) {\n FS::mkDir(dirname($fileName));\n file_put_contents($fileName, serialize($value));\n\n // TODO: http://phpdevblog.niknovo.com/2009/11/serialize-vs-var-export-vs-json-encode.html\n return true;\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Merges all pdfs together into a single long PDF.
[ "def merge_pdfs(pdf_names, output) -> None:\n \n merger = PyPDF2.PdfFileMerger()\n\n for filename in pdf_names:\n merger.append(filename)\n merger.write(output)\n merger.close()" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
//FindKeyPairFromSKI finds key pair by SKI
[ "func (handle *ContextHandle) FindKeyPairFromSKI(session mPkcs11.SessionHandle, ski []byte, keyType bool) (*mPkcs11.ObjectHandle, error) {\n\thandle.lock.RLock()\n\tdefer handle.lock.RUnlock()\n\n\treturn cachebridge.GetKeyPairFromSessionSKI(&cachebridge.KeyPairCacheKey{Mod: handle.ctx, Session: session, SKI: ski, ...
[ "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:" }
Render an HTML tag with OG namespaces. @param array $options @param array $ns @return string
[ "public function html(array $options = array(), array $ns = array()) {\n if ($ns) {\n foreach ($ns as $key => $url) {\n $this->ns($key, $url);\n }\n }\n\n return $this->Html->tag('html', null, $this->_namespaces + $options);\n }" ]
[ "public function XML_val($field, $arguments = [], $cache = false)\n {\n $result = $this->obj($field, $arguments, $cache);\n // Might contain additional formatting over ->XML(). E.g. parse shortcodes, nl2br()\n return $result->forTemplate();\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
get a HTML formatted view of all Python programs in all subfolders of AIKIF, including imports and lists of functions and classes
[ "def get_program_list():\n \n colList = ['FileName','FileSize','Functions', 'Imports']\n\n txt = '<TABLE width=90% border=0>'\n txt += format_file_table_header(colList)\n fl = web.GetFileList(aikif_folder, ['*.py'], 'N')\n for f in fl:\n if '__init__.py' in f:\n txt += '<TR><TD c...
[ "def getFilenameSet(self):\n \n result = set(self._mergeFileTiming())\n # Ignore profiling code. __file__ does not always provide consistent\n # results with f_code.co_filename (ex: easy_install with zipped egg),\n # so inspect current frame instead.\n # Get current file fr...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
================================================================================================================
[ "static function swapValue(&$value, $c1, $c2) {\n\t\tif(!$value) {\n\t\t\t$value = $c1;\n\t\t}\n\t\n\t\t/* choose the next color */\n\t\tif($value == \"$c1\") {\n\t\t\t$value = \"$c2\";\n\t\t}\n\t\telse {\n\t\t\t$value = \"$c1\";\n\t\t}\n\t\n\t\treturn($value);\n\t}" ]
[ "public static function protect()\n\t{\n\t\t$eye = \\Cli::color(\"*\", 'green');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"PROTECT ALL HUMANS\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli:...
codesearchnet
{ "query": "Represent the sentence about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code about Programming:" }
Converts a file name into a Outputstream. Returns null if the file name is null.
[ "@GwtIncompatible(\"Unnecessary\")\n protected OutputStream filenameToOutputStream(String fileName) throws IOException {\n if (fileName == null){\n return null;\n }\n return new FileOutputStream(fileName);\n }" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// StartTimeout returns an Option that sets timeout for the start of Agent.
[ "func StartTimeout(timeout time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.StartTimeout = timeout\n\t}\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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// Values returns a copy of the values in the sample.
[ "func (s *ExpDecaySample) Values() []int64 {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\tvals := s.values.Values()\n\tvalues := make([]int64, len(vals))\n\tfor i, v := range vals {\n\t\tvalues[i] = v.v\n\t}\n\treturn values\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Create a status. @param severity the severity level, see {@link IStatus}. @param code the code of the error. @param cause the cause of the problem. @return the status.
[ "public IStatus createStatus(int severity, int code, Throwable cause) {\n\t\treturn createStatus(severity, code, null, cause);\n\t}" ]
[ "@Override\n public void onError(Session session, Throwable thr) {\n if (onError != null) {\n Object args[] = new Object[onError.getMethod().getParameterTypes().length];\n MethodData methodData = onError.getMethodData();\n //check if method has optional Session parameter\n...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// UpdateTarget updates a scraper target.
[ "func (s *Service) UpdateTarget(ctx context.Context, update *influxdb.ScraperTarget, userID influxdb.ID) (*influxdb.ScraperTarget, error) {\n\tvar target *influxdb.ScraperTarget\n\terr := s.kv.Update(ctx, func(tx Tx) error {\n\t\tvar err error\n\t\ttarget, err = s.updateTarget(ctx, tx, update, userID)\n\t\treturn e...
[ "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 instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// GetVersion returns a semver.Version object by querying /info
[ "func (c *ClusterInfo) GetVersion(addr string) (semver.Version, error) {\n\tendpoint := fmt.Sprintf(\"http://%s/info\", addr)\n\tvar resp struct {\n\t\tVersion string `json:\"version\"`\n\t}\n\terr := c.client.GETV1(endpoint, &resp)\n\tif err != nil {\n\t\treturn semver.Version{}, err\n\t}\n\tif resp.Version == \"\...
[ "function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns a 32 character string containing an MD5 hash of {@code s}.
[ "public static String md5Hex(String s) {\n try {\n MessageDigest messageDigest = MessageDigest.getInstance(\"MD5\");\n byte[] md5bytes = messageDigest.digest(s.getBytes(\"UTF-8\"));\n return ByteString.of(md5bytes).hex();\n } catch (NoSuchAlgorithmException e) {\n throw new AssertionError(...
[ "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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// makeReadRequests creates ReadRequest objects from metrics definitions.
[ "func makeReadRequests(metrics []Metric) []ReadRequest {\n\tvar requests []ReadRequest\n\tfor _, metric := range metrics {\n\n\t\tif len(metric.Paths) == 0 {\n\t\t\trequests = append(requests, ReadRequest{\n\t\t\t\tMbean: metric.Mbean,\n\t\t\t\tAttributes: []string{},\n\t\t\t})\n\t\t} else {\n\t\t\tattributes ...
[ "@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 post about software development:", "pos": "Represent the code about software development:", "neg": "Represent the code:" }
// GetAction returns the Action field if it's non-nil, zero value otherwise.
[ "func (m *MarketplacePurchaseEvent) GetAction() string {\n\tif m == nil || m.Action == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Action\n}" ]
[ "def _wrap_field(field):\n \"\"\"\"\"\"\n class WrappedField(field):\n def output(self, key, obj):\n value = _fields.get_value(key if self.attribute is None else self.attribute, obj)\n\n # For all fields, when its value was null (None), return null directly,\n # instea...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// getBinderFunc returns a func which returns an extender that supports bind or a default binder based on the given pod.
[ "func getBinderFunc(client clientset.Interface, extenders []algorithm.SchedulerExtender) func(pod *v1.Pod) Binder {\n\tvar extenderBinder algorithm.SchedulerExtender\n\tfor i := range extenders {\n\t\tif extenders[i].IsBinder() {\n\t\t\textenderBinder = extenders[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tdefaultBinder := &bin...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get response filter by name By default, the only one filter "download" is available.
[ "@SuppressWarnings(\"unchecked\")\n public <T extends ResponseFilter> T responseFilter(String name) {\n return (T) responseFilters.get(name);\n }" ]
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Technology:" }
Entry point. - Loads in Zeppelin notebook - Gets the version of the notebook - Converts it into markdown format
[ "def main():\n \n parser = argparse.ArgumentParser()\n parser.add_argument('-i', dest='in_filename', required=True,\n help='Zeppelin notebook input file (.json)')\n parser.add_argument('-o', dest='out_filename',\n help='Markdown output file (.md) (optional)'...
[ "def run(self, args): # pylint: disable=unused-argument\n \n logging.basicConfig(stream=sys.stdout, level=logging.INFO)\n\n # This is used as a tool only to segment translation files when adding a\n # new segment. In the regular workflow, the work is done by the extract\n # phas...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
标签管理 获取公众号已创建的标签 @since 2.8.1 @param access_token access_token @return result
[ "public static TagsGetResult tagsGet(String access_token){\n\t\tHttpUriRequest httpUriRequest = RequestBuilder.get()\n\t\t\t\t.setUri(BASE_URI+\"/cgi-bin/tags/get\")\n\t\t\t\t.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))\n\t\t\t\t.build();\n\t\treturn LocalHttpClient.executeJsonResult(httpUriRequ...
[ "public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Negotiate calls different Render according acceptable Accept format.
[ "func (c *Context) Negotiate(code int, config Negotiate) {\n\tswitch c.NegotiateFormat(config.Offered...) {\n\tcase binding.MIMEJSON:\n\t\tdata := chooseData(config.JSONData, config.Data)\n\t\tc.JSON(code, data)\n\n\tcase binding.MIMEHTML:\n\t\tdata := chooseData(config.HTMLData, config.Data)\n\t\tc.HTML(code, 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 Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Returns a ghosted distributed array class that derives from BaseClass @param BaseClass base class, e.g. DistArray or MaskedDistArray @return ghosted dist array class
[ "def ghostedDistArrayFactory(BaseClass):\n \n\n class GhostedDistArrayAny(BaseClass):\n \"\"\"\n Ghosted distributed array. Each process owns data and exposes the\n halo region to other processes. These are accessed with tuples\n such (1, 0) for north, (-1, 0) for south, etc.\n ...
[ "def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Removes all of the elements from this list. The list will be empty after this call returns.
[ "public void clear() {\n modCount++;\n\n // Let gc do its work\n for (int i = 0; i < size; i++)\n data[i] = null;\n\n size = 0;\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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Acquires the access token @param array $parameters @throws \Exception
[ "public function acquireToken($parameters)\n {\n $request = $this->createRequest($parameters);\n $response = Requests::execute($request);\n $this->parseToken($response);\n }" ]
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Returns filtered array of matched or unmatched declarations @param {postcss.Declaration[]} a @param {postcss.Declaration[]} b @param {boolean} [not=false] @return {postcss.Declaration[]}
[ "function intersect(a, b, not) {\n return a.filter((c) => {\n const index = ~indexOfDeclaration(b, c);\n return not ? !index : index;\n });\n}" ]
[ "function createInjection(fileId, categoryPrefix, declaration, idx, declarationResultHandler) {\n const fnName = `${FN_PREFIX}_${fileId}_${categoryPrefix}_${declaration.declarationClean}_${idx}`;\n\n const injectedFunction = function(sassValue) {\n const value = createStructuredValue(sassValue);\n declarati...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Start Python interpreter
[ "def start_interpreter(self, namespace):\r\n \"\"\"\"\"\"\r\n self.clear()\r\n \r\n if self.interpreter is not None:\r\n self.interpreter.closing()\r\n self.interpreter = Interpreter(namespace, self.exitfunc,\r\n SysOutput, WidgetPr...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetChat implements the Config interface for ConfigLocal.
[ "func (c *ConfigLocal) SetChat(ch Chat) {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\tc.chat = ch\n}" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
Low-level PUT request interface to mite. Takes a URL to request (relative), and optionally data to add to the request. Either returns the JSON body of the request or raises a HttpException.
[ "def put(self, url, data=None, params=None):\n \n return self.request(\"put\", url, data, params)" ]
[ "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 description about Web development:", "pos": "Represent the code about Web development:", "neg": "Represent the code about programming:" }
Test multi-column convergence with varying amount of proximal/distal sampling :return:
[ "def experimentVaryingSynapseSampling(expParams,\n sampleSizeDistalList,\n sampleSizeProximalList):\n \n numRpts = 20\n df = None\n args = []\n for sampleSizeProximal in sampleSizeProximalList:\n for sampleSizeDistal in sampleSizeDistal...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// TLFWriterKeyBundleIDFromString creates a new TLFWriterKeyBundleID from the given string. // If the returned error is nil, the returned TLFWriterKeyBundleID is valid.
[ "func TLFWriterKeyBundleIDFromString(id string) (TLFWriterKeyBundleID, error) {\n\tif len(id) == 0 {\n\t\treturn TLFWriterKeyBundleID{}, nil\n\t}\n\th, err := kbfshash.HashFromString(id)\n\tif err != nil {\n\t\treturn TLFWriterKeyBundleID{}, err\n\t}\n\treturn TLFWriterKeyBundleID{h}, nil\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n classLoaderIdentifier = (String) fields.get(CLASS_LOADER_IDENTIFIER, null);\n\n // Note that further processing is required in JEEMetadataContextProviderImp...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Include properties in the result map.
[ "public ClassSelector add(String... propertyNames) {\n if (ArrayUtils.isNotEmpty(propertyNames)) {\n for (String propertyNameToAdd : propertyNames) {\n addPropertySelector(propertyNameToAdd);\n }\n }\n return this;\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }