query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Called for every named Localization declared via <link name=…> elements. | [
"function createLocalization(defaultLocale, availableLangs, resIds, name) {\n // This function is called by `Localization` class to retrieve an array of\n // `ResourceBundle`s.\n function requestBundles(requestedLangs = navigator.languages) {\n const newLangs = negotiateLanguages(\n requestedLangs, avail... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// AddErrors adds errors to this validation result (if not already reported).
//
// Since the same check may be passed several times while exploring the
// spec structure (via $ref, ...) reported messages are kept
// unique. | [
"func (r *Result) AddErrors(errors ...error) {\n\tfor _, e := range errors {\n\t\tfound := false\n\t\tif e != nil {\n\t\t\tfor _, isReported := range r.Errors {\n\t\t\t\tif e.Error() == isReported.Error() {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\tr.Errors = append(r.... | [
"func (n *NodeApplyableModuleVariable) References() []*addrs.Reference {\n\n\t// If we have no value expression, we cannot depend on anything.\n\tif n.Expr == nil {\n\t\treturn nil\n\t}\n\n\t// Variables in the root don't depend on anything, because their values\n\t// are gathered prior to the graph walk and record... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Reset the content-type state. | [
"def get_tokens_unprocessed(self, text, stack=('root',)):\n \"\"\"\"\"\"\n self.content_type = None\n return RegexLexer.get_tokens_unprocessed(self, text, stack)"
] | [
"def _enter(self):\n \"\"\"\"\"\"\n command = self.command\n logger.log(5, \"Snippet keystroke `Enter`.\")\n # NOTE: we need to set back the actions (mode_off) before running\n # the command.\n self.mode_off()\n self.run(command)"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Bootstrap the application services.
@return void | [
"public function boot()\n {\n // Em modo de desenvolvimento, as views são sempre apagadas\n if (env('APP_DEBUG') || env('APP_ENV') === 'local') {\n\n \t$this->loadViewsFrom(__DIR__.'/resources/views', 'old-extended');\n $this->loadRoutesFrom(__DIR__.'/routes.php');\n }\n\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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
// BodyString defines the body parameters as a string. See documentation. | [
"func (s *TermvectorsService) BodyString(body string) *TermvectorsService {\n\ts.bodyString = body\n\treturn s\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 post about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
// Run start process filesystem | [
"func (loop *Loop) Run(path string) {\n\tif path == \"\" {\n\t\tpath = \"./\"\n\t}\n\t// lifecycle\n\tloop.lifecycle = jobsync.NewLifecycle(workers.DefaultTimeout, true)\n\tif loop.scope != nil {\n\t\tloop.scope.On(app.ErrorEvent, loop.KillSlot)\n\t\tloop.scope.On(app.KillEvent, loop.KillSlot)\n\t}\n\t// producer\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 description about File management:",
"pos": "Represent the code about File management:",
"neg": "Represent the code about programming:"
} |
// New creates a new instance of the CSCC.
// Typically, only one will be created per peer instance. | [
"func New(ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider, aclProvider aclmgmt.ACLProvider) *PeerConfiger {\n\treturn &PeerConfiger{\n\t\tpolicyChecker: policy.NewPolicyChecker(\n\t\t\tpeer.NewChannelPolicyManagerGetter(),\n\t\t\tmgmt.GetLocalMSP(),\n\t\t\tmgmt.NewLocalMSPPrincipalGette... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Instantiate the :class:`~admin_tools.dashboard.modules.RecentActions` module
for use in the appliation index page. | [
"def get_recent_actions_module(self):\n \n return modules.RecentActions(\n _('Recent Actions'),\n include_list=self.get_app_content_types(),\n limit=5,\n enabled=False,\n collapsible=False\n )"
] | [
"def index():\n \n # Reset current index values when the page is refreshed\n for k, v in current_index.items():\n current_index[k] = 0\n\n logging.info(\"Dashboard refreshed\")\n\n # render the template (below) that will use JavaScript to read the stream\n return render_template(\"crystal_d... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Fetches the memory usage information.
@return [Vmstat::Memory] the memory data like free, used und total.
@example
Vmstat.memory # => #<struct Vmstat::Memory ...> | [
"def memory\n @pagesize ||= Vmstat.pagesize\n has_available = false\n\n total = free = active = inactive = pageins = pageouts = available = 0\n procfs_file(\"meminfo\") do |file|\n content = file.read(2048) # the requested information is in the first bytes\n\n content.scan(/(\\w+):... | [
"def totalBytesSent()\n joinThread()\n v = MiniUPnP.UPNP_GetTotalBytesSent(@urls.controlURL_CIF,\n @data.servicetype_CIF)\n if v < 0 then\n raise UPnPException.new, \"Error while retriving total bytes sent.\"\n end\n return... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// SetSourceCodeUrl sets the SourceCodeUrl field's value. | [
"func (s *CreateApplicationRequest) SetSourceCodeUrl(v string) *CreateApplicationRequest {\n\ts.SourceCodeUrl = &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 summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
HFS, ext{2,3}, FAT do not, Node.js v0.10 does not | [
"function hasMillisResSync () {\n let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2))\n tmpfile = path.join(os.tmpdir(), tmpfile)\n\n // 550 millis past UNIX epoch\n const d = new Date(1435410243862)\n fs.writeFileSync(tmpfile, 'https://github.com/jprichardso... | [
"def initrd(self, initrd):\n \n\n initrd = self.manager.get_abs_image_path(initrd)\n\n log.info('QEMU VM \"{name}\" [{id}] has set the QEMU initrd path to {initrd}'.format(name=self._name,\n id=self._id,\n... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Appends a leaf node to the children of this node.
@param string $operator ("AND"|"OR"|"")
@param Criteria $criteria
@return $this | [
"public function append($operator, Criteria $criteria)\n {\n $this->children[] = new Node(self::TYPE_LEAF, $operator, $criteria);\n $this->mostRecentCriteria = $criteria;\n\n return $this;\n }"
] | [
"protected function parseExpressionHtmlLine( Line$line ):self\n\t{\n\t\t$content= $line->slice(1);\n\n\t\treturn $this->openNode(new StringNode($this,$line))->appendLine(\"<?$content?>\");\n\t}"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Creates figure, toolbar, layout, sets widget layout
Returns figure, canvas, layout
Reference: http://stackoverflow.com/questions/12459811 | [
"def get_matplotlib_layout(widget, flag_toolbar=True):\r\n \r\n fig = plt.figure()\r\n canvas = FigureCanvas(fig)\r\n # self.canvas.mpl_connect('button_press_event', self.on_plot_click)\r\n layout = QVBoxLayout(widget)\r\n if flag_toolbar:\r\n toolbar = NavigationToolbar2QT(canvas, w... | [
"def setup_project_view(self):\r\n \"\"\"\"\"\"\r\n for i in [1, 2, 3]:\r\n self.hideColumn(i)\r\n self.setHeaderHidden(True)\r\n # Disable the view of .spyproject. \r\n self.filter_directories()"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Get resources sub-URL.
@return string | [
"protected function getResourcesSubUrl(): string\n {\n if ($this->subUrl === null) {\n $this->subUrl = '/' . $this->getType();\n }\n\n return $this->subUrl;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// Close is used to terminate the client connection | [
"func (c *Client) Close() error {\n\tc.closedLock.Lock()\n\tdefer c.closedLock.Unlock()\n\n\tif c.closed {\n\t\treturn nil\n\t}\n\tc.closed = true\n\tc.client.GoAway() // Notify the other side of the close\n\treturn c.client.Close()\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 instruction about Computer Networking:",
"pos": "Represent the Github code about Computer Networking:",
"neg": "Represent the Github code about programming:"
} |
Verifies the input with the side effect that the background color of {@code input} to {@code background} if
returns {@code true}, or {@code warningBackground} otherwise
@param input component
@return if input is valid | [
"public boolean shouldYieldFocus(JComponent input) {\n boolean isValidInput = verify(input);\n if (isValidInput) {\n input.setBackground(background);\n } else {\n input.setBackground(warningBackground);\n }\n return isValidInput;\n }"
] | [
"public String getHeader()\n {\n if (this.header == null)\n {\n if (this.headerKeys == null)\n {\n this.headerKeys = new String[2];\n this.headerKeys[0] = getPropertyName() + \".header\";\n this.headerKeys[1] = getPropertyName();\n ... | codesearchnet | {
"query": "Represent the comment about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
@param [String] date_time The datetime pattern
Addition
@param [Numeric] other The seconds to add | [
"def +(other)\n moment = @date_time.to_time.localtime(zone) + other.to_f.round(1)\n\n self.class.new(moment.strftime('%Y-%m-%dT%H:%M:%S.%N%:z'))\n end"
] | [
"def normalize(self, timestamp, steps=0):\n '''\n \n '''\n # So far, the only commonality with RelativeTime\n return self.from_bucket( self.to_bucket(timestamp, steps) )"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// SetOriginalName sets the OriginalName field's value. | [
"func (s *ResourceMetadata) SetOriginalName(v string) *ResourceMetadata {\n\ts.OriginalName = &v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// EventWrite is used to determine if new events can be created
// (fired) by the policy. | [
"func (p *PolicyAuthorizer) EventWrite(name string) bool {\n\t// Longest-prefix match event names\n\tif rule, ok := getPolicy(name, p.eventRules); ok {\n\t\tif allow, recurse := enforce(rule.(string), PolicyWrite); !recurse {\n\t\t\treturn allow\n\t\t}\n\t}\n\n\t// No match, use parent\n\treturn p.parent.EventWrite... | [
"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:"
} |
getPackage
@param string $name
@return AbstractPackage | [
"public function getPackage($name = null)\n {\n if (!$name) {\n return $this->getCurrentPackage();\n }\n\n if (isset($this->packages[$name])) {\n return $this->packages[$name];\n }\n\n return null;\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 comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
@param string $family
@return \Interpro\Core\Contracts\Executor\BUpdateExecutor | [
"public function getBUpdateExecutor($family)\n {\n if(!array_key_exists($family, $this->updateExecutorsB))\n {\n throw new CoreException('Исполнитель изменений (update executor) агрегатных(B) типов пакета '.$family.' не найдена в медиаторе!');\n }\n\n return $this->updateEx... | [
"def DeserializeExclusiveData(self, reader):\n \n self.Type = TransactionType.StateTransaction\n\n self.Descriptors = reader.ReadSerializableArray('neo.Core.State.StateDescriptor.StateDescriptor')"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// Convert attempts to convert an ACLToken into an ACLCompat. | [
"func (tok *ACLToken) Convert() (*ACL, error) {\n\tif tok.Type == \"\" {\n\t\treturn nil, fmt.Errorf(\"Cannot convert ACLToken into compat token\")\n\t}\n\n\tcompat := &ACL{\n\t\tID: tok.SecretID,\n\t\tName: tok.Description,\n\t\tType: tok.Type,\n\t\tRules: tok.Rules,\n\t\tRaftIndex: tok.RaftIn... | [
"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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Set the bounce address for this message.
@param Address $address | [
"public function setBounce(Address $address): Email\n {\n $this->message->setReturnPath($address->getEmail(), $address->getName());\n\n return $this;\n }"
] | [
"def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence"
] | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Dumps {@code data} into a {@code Writer}.
@param data the data
@param output the writer
@see org.yaml.snakeyaml.Yaml#dumpAll(Iterator, Writer) | [
"public void dumpAll(Iterable<? extends YamlNode> data, Writer output) {\n dumpAll(data.iterator(), output);\n }"
] | [
"public static <T> Writer<T> writer(Format type, OutputStream out) {\n return writer(type, out, defaultDefaultWriteHandler());\n }"
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about writing:"
} |
For testing..
@param wf
For this workflow, the corresponding ticketPool is searched and then a ticket is obtained from this pool.
@return
id of the ticket pool. | [
"public String obtainAndReturnTicketPoolId(Workflow<?> wf) {\r\n TicketPool tp = findPool(wf.getClass().getName());\r\n tp.obtain();\r\n return tp.getId();\r\n }"
] | [
"def ObjectInitializedEventHandler(analysis, event):\n \n\n # Initialize the analysis if it was e.g. added by Manage Analysis\n wf.doActionFor(analysis, \"initialize\")\n\n # Try to transition the analysis_request to \"sample_received\". There are\n # some cases that can end up with an inconsistent s... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Encoding does NOT include 'buffer' itself. See {@link MessageEncoder}. | [
"@Override\n public void encode(ByteBuf buf) {\n Encoders.Strings.encode(buf, streamId);\n buf.writeLong(byteCount);\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 instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
remove a recognizer by name or instance
@param {Recognizer|String} recognizer
@returns {Manager} | [
"function (recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n var recognizers = this.recognizers;\n recognizer = this.get(recognizer);\n recognizers.splice(recognizers.indexOf(recognizer), 1);\n\n this.touchAction.update();\n return this;\n }"
] | [
"def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Main import page.
@since 2.0.0
@access public | [
"public function Index() {\r\n $this->Permission('Garden.Import'); // This permission doesn't exist, so only users with Admin == '1' will succeed.\r\n $Timer = new Gdn_Timer();\r\n\r\n // Determine the current step.\r\n $this->Form = new Gdn_Form();\r\n $Imp = new ImportModel();\r\n $I... | [
"protected function generateInfoYamlMetadata($version, $project, $datestamp)\n {\n $core = preg_replace('/^([0-9]).*$/', '$1.x', $version);\n $date = date('Y-m-d', $datestamp);\n $info = <<<METADATA\n\n# Information add by drustack/composer-generate-metadata on {$date}\ncore: \"{$core}\"\npr... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// IsErrNotFound returns true if the error is caused with an
// object (image, container, network, volume, …) is not found in the docker host. | [
"func IsErrNotFound(err error) bool {\n\tte, ok := err.(notFound)\n\treturn ok && te.NotFound()\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 Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Outputs to screen. If param is an array, then json headers + data are generated.
@param $o | [
"function output($o)\n\t{\n\n\t\tif (is_array($o)) {\n\t\t\t$this->response->setContent(json_encode($o));\n\t\t\t$this->response->headers->set('Content-Type', 'application/json');\n\t\t\tdie();\n\n\t\t} else {\n\t\t\t$this->response->setContent($o);\n\t\t}\n\t}"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public void setAnonymous(boolean newAnonymous)\n\t{\n\t\tboolean oldAnonymous = anonymous;\n\t\tanonymous = newAnonymous;\n\t\tif (eNotificationRequired())\n\t\t\teNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_GENERIC_TYPE__ANONYMOUS, oldAnonymous, anonymous));\n\t}"
] | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the Github comment about Text generation:",
"pos": "Represent the Github code about Text generation:",
"neg": "Represent the Github code:"
} |
activate plugins accordingly to config | [
"def setup_app_scope(name, scope):\n \"\"\"\"\"\"\n\n # load plugins\n plugins = []\n for plugin_name, active in get('settings').get('rw.plugins', {}).items():\n plugin = __import__(plugin_name)\n plugin_path = plugin_name.split('.')[1:] + ['plugin']\n for sub in plugin_path:\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Technology:"
} |
Check the content of a trusty URI (fetched from the web) or a trusty file (read from the
file system).
@param fileOrUrl the file name or URL | [
"public static void check(String fileOrUrl) throws IOException, TrustyUriException {\n\t\tCheckFile c;\n\t\ttry {\n\t\t\tURL url = new URL(fileOrUrl);\n\t\t\tc = new CheckFile(url);\n\t\t} catch (MalformedURLException ex) {\n\t\t\tc = new CheckFile(new File(fileOrUrl));\n\t\t}\n\n\t\tboolean valid = c.check();\n\t\... | [
"def spec(self):\n \"\"\"\"\"\"\n from ambry_sources.sources import SourceSpec\n\n d = self.dict\n d['url'] = self.url\n\n # Will get the URL twice; once as ref and once as URL, but the ref is ignored\n\n return SourceSpec(**d)"
] | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// Get returns the list of values associates with a field.
// It returns a slice of strings to keep backwards compatibility with old code. | [
"func (filters Args) Get(field string) []string {\n\tvalues := filters.fields[field]\n\tif values == nil {\n\t\treturn make([]string, 0)\n\t}\n\tslice := make([]string, 0, len(values))\n\tfor key := range values {\n\t\tslice = append(slice, key)\n\t}\n\treturn slice\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
@summary
Constructs a new TAP13Producer.
@description
Produces output conforming to the TAP13 specification.
@private
@constructor
@extends TAPProducer
@see {@link https://testanything.org/tap-version-13-specification.html|Specification} | [
"function TAP13Producer() {\n /**\n * Writes the TAP version to reporter output stream.\n * @override\n */\n this.writeVersion = function() {\n println('TAP version 13');\n };\n\n /**\n * Writes that test failed to reporter output stream, with error formatting.\n * @override\n */\n this.writeFai... | [
"public function createProject() {\n $this->cleanUpProjectTemplate();\n $this->initializeBlt();\n $this->setProjectName();\n $this->initAndCommitRepo();\n $this->displayArt();\n $this->yell(\"Your new BLT-based project has been created in {$this->getConfigValue('repo.root')}.\");\n $this->say(\... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
/*
functions
build stream interface
@function interfac
@param {Object} options - various options. Check README.md
@param {Integer} start - starting bytes
@param {Integer} [end] - ending bytes
@return {Objetc} | [
"function interfac(options, start, end) {\n\n var go;\n if (end >= 0) {\n go = fs.createReadStream(options.file, {\n flags: options.flag,\n mode: options.mode,\n encoding: options.encoding,\n autoClose: options.autoClose,\n start: start,\n end: end,\n fd: null,\n });\n } ... | [
"function logentriesJsonStream(pathname, query={}) {\n query = Object.assign({}, query);\n\n // Force query format to JSON.\n query.format = 'json';\n\n // Parse each array entry from raw stream and emit JSON objects.\n return pump(logentriesRawStream(pathname, query), JSONStream.parse('*'));\n}"
] | codesearchnet | {
"query": "Represent the instruction about Java programming:",
"pos": "Represent the code about Java programming:",
"neg": "Represent the code about Software development:"
} |
Marshall the given parameter object. | [
"public void marshall(DvbSubDestinationSettings dvbSubDestinationSettings, ProtocolMarshaller protocolMarshaller) {\n\n if (dvbSubDestinationSettings == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Sets the ETag value.
@param string|null $etag The ETag unique identifier or null to remove the header
@param Boolean $weak Whether you want a weak ETag or not
@return Response | [
"public function setEtag($etag = NULL, $weak = FALSE) {\n\n\t\tif (NULL === $etag) {\n\t\t\t$this->headers->remove('Etag');\n\t\t}\n\t\telse {\n\n\t\t\tif (0 !== strpos($etag, '\"')) {\n\t\t\t\t$etag = '\"' . $etag . '\"';\n\t\t\t}\n\n\t\t\t$this->headers->set('ETag', (TRUE === $weak ? 'W/' : '') . $etag);\n\t\t}\n... | [
"public function handleResponse(Response $response) : void\n {\n if ($this->id === null) {\n // The request was not associated with an existing session, and no session writes occurred.\n // Sending a session cookie is unnecessary.\n return;\n }\n\n // Note: w... | codesearchnet | {
"query": "Represent the sentence about Web development:",
"pos": "Represent the code about Web development:",
"neg": "Represent the code:"
} |
// ToBytes converts to value to a byte slice. | [
"func ToBytes(val interface{}) ([]byte, error) {\n\tswitch val.(type) {\n\tcase string:\n\t\treturn []byte(val.(string)), nil\n\tcase []byte:\n\t\tb := make([]byte, len(val.([]byte)))\n\t\tcopy(b, val.([]byte))\n\t\treturn b, nil\n\tdefault:\n\t\treturn json.Marshal(val)\n\t}\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 description about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about programming:"
} |
sets the root content
@param vfsStreamDirectory $root
@return vfsStreamDirectory | [
"public static function setRoot(vfsStreamDirectory $root): vfsStreamDirectory\n {\n self::$root = $root;\n clearstatcache();\n return self::$root;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// SetTaskArn sets the TaskArn field's value. | [
"func (s *ContainerDetail) SetTaskArn(v string) *ContainerDetail {\n\ts.TaskArn = &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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Checks if a given string is an url | [
"def is_valid_url(url):\n \"\"\"\"\"\"\n pieces = urlparse(url)\n return all([pieces.scheme, pieces.netloc])"
] | [
"def file_or_token(value):\n \n if isfile(value):\n with open(value) as fd:\n return fd.read().strip()\n\n if any(char in value for char in '/\\\\.'):\n # This chars will never be in a token value, but may be in a path\n # The error message will be handled by the parser\n ... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Add a distribution to the cache.
:param dist: The distribution to add. | [
"def add(self, dist):\n \n if dist.path not in self.path:\n self.path[dist.path] = dist\n self.name.setdefault(dist.key, []).append(dist)"
] | [
"@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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// UnmarshalJSON sets the object from the provided JSON representation | [
"func (l *BatchJobDefinitionVolumesList) UnmarshalJSON(buf []byte) error {\n\t// Cloudformation allows a single object when a list of objects is expected\n\titem := BatchJobDefinitionVolumes{}\n\tif err := json.Unmarshal(buf, &item); err == nil {\n\t\t*l = BatchJobDefinitionVolumesList{item}\n\t\treturn nil\n\t}\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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// Returns a slice of the subiterators, in order (primary iterator first). | [
"func (it *And) SubIterators() []graph.Iterator {\n\titers := make([]graph.Iterator, 0, len(it.internalIterators)+1)\n\tif it.primaryIt != nil {\n\t\titers = append(iters, it.primaryIt)\n\t}\n\titers = append(iters, it.internalIterators...)\n\treturn iters\n}"
] | [
"function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Obtain the {@link SearchManager} object for a cache. | [
"public static SearchManager getSearchManager(Cache<?, ?> cache) {\n if (cache == null || cache.getAdvancedCache() == null) {\n throw new IllegalArgumentException(\"cache parameter shall not be null\");\n }\n AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache();\n ensureAccessPer... | [
"@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 about Technology:",
"pos": "Represent the Github code about Technology:",
"neg": "Represent the Github code about programming:"
} |
Formats a message to be printed on the console
@param message The line to be formatted
@return The formatted version of {@code message} | [
"private static String getRequiredSpaces(String reference, String message) {\n StringBuilder res = new StringBuilder();\n int requiredSpaces = reference.length() - message.length() - 4;\n\n for (int i = 0; i < requiredSpaces; i++) {\n res.append(\" \");\n }\n\n return r... | [
"function formatMailBody(obj, order) {\n var result = \"\";\n if (!order) {\n order = Object.keys(obj);\n }\n \n // loop over all keys in the ordered form data\n for (var idx in order) {\n var key = order[idx];\n result += \"<h4 style='text-transform: capitalize; margin-bottom: 0'>\" + key + \"</h4><... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Get current connection config by key
@param string $key Config key
@param mixed $default
@return mixed | [
"public function getConfig($key = null, $default = null)\n {\n $name = $this->current ?: 'default';\n\n $configs = $this->configs[$name];\n if ($key === null) {\n return $configs;\n }\n\n return isset($configs[$key]) ? $configs[$key] : $default;\n }"
] | [
"private static function resource($resource)\n {\n exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \\''.$resource.'\\' is not supported by Vinala, only session or cookie');\n\n return Hash::make(config('auth.'.$resource));\n\n // F... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
/*
A custom require that searches some directories for the
module to be loaded. Null is returned if the module cannot
be found. | [
"function(kbox, id, app, callback) {\n\n if (typeof callback === 'undefined' && typeof app === 'function') {\n callback = app;\n app = undefined;\n }\n\n // Get global config.\n var globalConfig = kbox.core.deps.lookup('globalConfig');\n\n // List of dirs that we care about.\n var dirs = [\n globalCo... | [
"def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Show messages for the given query or day. | [
"def messages(request, year=None, month=None, day=None,\n template=\"gnotty/messages.html\"):\n \n\n query = request.REQUEST.get(\"q\")\n prev_url, next_url = None, None\n messages = IRCMessage.objects.all()\n if hide_joins_and_leaves(request):\n messages = messages.filter(join_or_... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Merge values from other CheckRestart over default values on this
// CheckRestart and return merged copy. | [
"func (c *CheckRestart) Merge(o *CheckRestart) *CheckRestart {\n\tif c == nil {\n\t\t// Just return other\n\t\treturn o\n\t}\n\n\tnc := c.Copy()\n\n\tif o == nil {\n\t\t// Nothing to merge\n\t\treturn nc\n\t}\n\n\tif o.Limit > 0 {\n\t\tnc.Limit = o.Limit\n\t}\n\n\tif o.Grace != nil {\n\t\tnc.Grace = o.Grace\n\t}\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Template method for fetching _mine_ records from the API.
record_id - An Integer or String representing the record ID on the API (optional).
params - A Hash of params to send to the API.
Returns Array
Returns {Evvnt::Base} | [
"def ours(record_id = nil, **params)\n id_segment = record_id.to_s\n segments = [plural_resource_path, \"ours\", id_segment].select(&:present?)\n path = File.join(*segments).to_s\n api_request(:get, path, params: params)\n end"
] | [
"@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
@param string $name
@return Type
@throws DBALException
@SuppressWarnings(PHPMD.StaticAccess) | [
"protected function getDbalType(string $name): Type\n {\n assert(Type::hasType($name), \"Type `$name` either do not exist or registered.\");\n $type = Type::getType($name);\n\n return $type;\n }"
] | [
"public static function getInstance($driverName = null): AbstractMySQL\n {\n if (!static::$initialized) {\n static::$baseClass = Base::getInstance();\n }\n $driverName = $driverName!==null\n ? '\\\\MS\\\\LightFramework\\\\Db\\\\MySQL\\\\Drivers\\\\'.$driverName\n ... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Set timer value
@param string $name Timer name
@param float $value value
@return $this | [
"public function setTimer(string $name, $value)\n {\n $this->timers[$name] = (string) $value;\n return $this;\n }"
] | [
"function set_font_size($size)\n {\n $this->__font_size_calculated = false;\n //see __set and __get, on all assignments clear cache, not needed on direct set through __set\n $this->_prop_cache[\"font_size\"] = null;\n $this->_props[\"font_size\"] = $size;\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Generates a STAR index.
Recommended machine type: "n1-highmem-8" (52 GB of RAM, 8 vCPUs)
TODO: docstring | [
"def generate_index(credentials, instance_config, instance_name,\n script_dir, genome_file, output_dir, annotation_file=None,\n splice_overhang=100,\n num_threads=8, chromosome_bin_bits=18,\n genome_memory_limit=31000000000,\n ... | [
"def initrd(self, initrd):\n \n\n initrd = self.manager.get_abs_image_path(initrd)\n\n log.info('QEMU VM \"{name}\" [{id}] has set the QEMU initrd path to {initrd}'.format(name=self._name,\n id=self._id,\n... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Auto Generated Code | [
"def openflow_controller_connection_address_connection_port(self, **kwargs):\n \n config = ET.Element(\"config\")\n openflow_controller = ET.SubElement(config, \"openflow-controller\", xmlns=\"urn:brocade.com:mgmt:brocade-openflow\")\n controller_name_key = ET.SubElement(openflow_control... | [
"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 text about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code about File management:"
} |
Exchange.request is the entry point for all generated methods | [
"def request(self, path, api='public', method='GET', params={}, headers=None, body=None):\n \"\"\"\"\"\"\n return self.fetch2(path, api, method, params, headers, body)"
] | [
"protected WsMessageRouterImpl getMessageRouter() {\n if (msgRouter == null) {\n // First activation.\n msgRouter = MessageRouterSingleton.singleton;\n\n // Pass the MessageRouter to the TrService via the TrConfigurator.\n TrConfigurator.setMessageRouter(msgRouter)... | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Throws out a {@link ConfigurationException} with cause and message specified.
@param cause
the cause of the configuration error.
@param message
the error message format pattern.
@param args
the error message format arguments. | [
"public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) {\n throw new ConfigurationException(cause, message, args);\n }"
] | [
"@SuppressWarnings(\"unused\")\n @Internal\n protected final void warnMissingProperty(Class type, String method, String property) {\n if (LOG.isWarnEnabled()) {\n LOG.warn(\"Configuration property [{}] could not be set as the underlying method [{}] does not exist on builder [{}]. This usuall... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
function calling convention. See
:class:CALLING_CONVENTION_TYPES class for possible values | [
"def calling_convention(self):\n \"\"\"\"\"\"\n if self._calling_convention is None:\n self._calling_convention = \\\n calldef_types.CALLING_CONVENTION_TYPES.extract(self.attributes)\n if not self._calling_convention:\n self._calling_convention = sel... | [
"def scopes(cls):\n \n # Why do we need this? This should either\n # * Be bubbled to the places where it is used (AcidXBlock).\n # * Be automatic. Look for all members of a type.\n return [cls.USAGE, cls.DEFINITION, cls.TYPE, cls.ALL]"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
patch system fn to draw debug information
@ignore | [
"function () {\n var hash = me.utils.getUriFragment();\n\n // add a few new debug flag (if not yet defined)\n me.debug.renderHitBox = me.debug.renderHitBox || hash.hitbox || false;\n me.debug.renderVelocity = me.debug.renderVelocity || hash.velocity || false;\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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
end FUNCTION filter()
FUNCTION: ones( len )
Creates a 1D array filled with 1s.
@private
@param {Number} len - array length
@returns {Number[]} ones array | [
"function ones( len ) {\n\tvar out = new Array( len ),\n\t\ti;\n\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout[ i ] = 1;\n\t}\n\treturn out;\n}"
] | [
"def narray=(image)\n raise ArgumentError, \"Invalid argument 'image'. Expected NArray, got #{image.class}.\" unless image.is_a?(NArray)\n raise ArgumentError, \"Invalid argument 'image'. Expected two-dimensional NArray, got #{image.shape.length} dimensions.\" unless image.shape.length == 2\n raise A... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// GetLastConfigFromBlock returns the LastConfig data from the given block | [
"func GetLastConfigFromBlock(block *common.Block) (*common.LastConfig, error) {\n\tif block.Metadata == nil {\n\t\treturn nil, errors.New(\"block metadata is nil\")\n\t}\n\tmetadata := &common.Metadata{}\n\terr := proto.Unmarshal(block.Metadata.Metadata[common.BlockMetadataIndex_LAST_CONFIG], metadata)\n\tif err !=... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// SearchEvents finds events. Results show up sorted by date (newest first),
// limit is used when set to value > 0 | [
"func (l *FileLog) SearchEvents(fromUTC, toUTC time.Time, query string, limit int) ([]EventFields, error) {\n\tl.Debugf(\"SearchEvents(%v, %v, query=%v, limit=%v)\", fromUTC, toUTC, query, limit)\n\tif limit <= 0 {\n\t\tlimit = defaults.EventsIterationLimit\n\t}\n\tif limit > defaults.EventsMaxIterationLimit {\n\t\... | [
"function normalizeLimit (options) {\n const limit = options.limit || options.resultRecordCount || options.count || options.maxFeatures\n // If there is a limit, add 1 to it so we can later calculate a limitExceeded. The result set will be resized accordingly, post SQL\n if (limit) return limit + 1\n}"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
capture atlas size | [
"@Inject(method = \"loadTextureAtlas\", at = @At(\"RETURN\"), locals = LocalCapture.CAPTURE_FAILSOFT)\n\tprivate void onLoadTextureAtlas(IResourceManager resourceManager, CallbackInfo ci, int i, Stitcher stitcher, int j, int k, ProgressManager.ProgressBar bar)\n\t{\n\t\tIcon.BLOCK_TEXTURE_WIDTH = stitcher.getCurren... | [
"def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
make data in list
if data enough, will return:
[0] is the times of high, low or equal
[1] is the serial of data.
or return '?'
資料數據 list 化,days 移動平均值
[0] 回傳次數
[1] 回傳數據 | [
"def make_serial(self,data,days,rev=0):\n \n raw = data[:]\n result = []\n try:\n while len(raw) >= days:\n result.append(float(sum(raw[-days:]) / days))\n raw.pop()\n self.debug_print(len(result))\n\n result.reverse()\n re = [self.cum_serial(result,rev), result]\n ... | [
"def list_results(self, number, username):\n \n # 取得新 API 的結果\n data = self.get_question_results(number, username)\n # 實作相容的結構\n result = []\n for number in data:\n # 儲存題目資訊\n result += [(number, data[number])]\n # 回傳結果\n return result"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Remove the :class:`Spot` by the given name. | [
"def rm_spot(self, name, *args):\n \"\"\"\"\"\"\n if name not in self.spot:\n raise KeyError(\"No Spot named {}\".format(name))\n spot = self.spot.pop(name)\n if spot in self.selection_candidates:\n self.selection_candidates.remove(spot)\n pawns_here = list(s... | [
"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 description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Find a potential previous date matching the rule as a minimum of previous
valid dates from all the filters. Subclasses should add a check of
recurrence pattern match | [
"def potential_previous(current, base)\n @filters.map { |f| f.previous(current) }.min || current\n end"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Checks a possible used Container object for global errors "@" and adds a new FormGoup object on top of the groups
stack. | [
"private function handleGlobalContainerErrors()\n {\n // No data of form with our id in session stored?\n if (empty($this->errors['@'])) {\n return;\n }\n\n // Add a group on top of exiting groups\n $group = $this->addGroup(true);\n\n $div = $group->addElement... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
loop with each satisfied terms.
@return [Enumerator] if block is not given.
@return [nil] if block is given. | [
"def each_sat\n return to_enum(:each_sat) unless block_given?\n sat_loop(self) do |sat, solver|\n yield sat\n negated_vars = sat.terms.map do |t|\n t.is_a?(NotTerm) ? t.terms[0] : ~t\n end\n solver << PropLogic.all_or(*negated_vars)\n end\n end"
] | [
"def new(*args, &block)\n procedure = find_procedure(:new)\n # in case of collections pass array of elements as one argument for constructor\n if collection? && !(args.size == 1 && args[0].is_a?(Array))\n args = [args]\n end\n result = procedure.exec_with_options(args, { skip_self: t... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Scan for {@link PreAuthorize} and {@link PostAuthorize} annotations
and create {@link Set} of {@link Privilege}.
@return set of privileges | [
"public Set<Privilege> scan() {\n StopWatch stopWatch = StopWatch.createStarted();\n Set<Privilege> preAuthPrivileges = reflections.getMethodsAnnotatedWith(PreAuthorize.class).stream()\n .map(element -> element.getAnnotation(PreAuthorize.class))\n .map(PreAuthorize::value)\n ... | [
"public Javalin addHandler(@NotNull HandlerType httpMethod, @NotNull String path, @NotNull Handler handler) {\n return addHandler(httpMethod, path, handler, new HashSet<>()); // no roles set for this route (open to everyone with default access manager)\n }"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
/*
Constants for easier comparing.
Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE | [
"function getKeyCodes(kcs) {\n var k = {};\n for (var kc in kcs) k[kcs[kc]] = kcs[kc];\n return k;\n}"
] | [
"def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Attach all event handlers. | [
"public function subscribe()\n {\n foreach (static::$eventHandlerMap as $eventName => $handler) {\n $this->events->listen($eventName, [$this, $handler]);\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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Updates the search root.<p>
@throws CmsException if CmsObject init fails | [
"protected void updateSearchRoot() throws CmsException {\n\n CmsObject newCms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());\n newCms.getRequestContext().setSiteRoot((String)m_siteSelect.getValue());\n m_searchRoot.setCmsObject(newCms);\n m_searchRoot.setValue(\"/\");\n\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
Returns an array of product classes
@return array | [
"protected function getListProductClass()\n {\n $id = $this->getParam(0);\n\n if (!isset($id)) {\n return $this->product_class->getList(array('limit' => $this->getLimit()));\n }\n\n if (!is_numeric($id)) {\n $this->errorAndExit($this->text('Invalid argument'));\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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Get requirements from pip requirement files. | [
"def get_requirements(*args):\n \"\"\"\"\"\"\n requirements = set()\n with open(get_absolute_path(*args)) as handle:\n for line in handle:\n # Strip comments.\n line = re.sub(r'^#.*|\\s#.*', '', line)\n # Ignore empty lines\n if line and not line.isspace()... | [
"def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Confirms user registration as an admin without using a confirmation
code. Works on any user.
:param username: User's username
:return: | [
"def admin_confirm_sign_up(self, username=None):\n \n if not username:\n username = self.username\n self.client.admin_confirm_sign_up(\n UserPoolId=self.user_pool_id,\n Username=username,\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// Context returns the corresponding RequestContext for the given Request. | [
"func Context(r *http.Request) *RequestContext {\n\tcontextMutex.RLock()\n\tdefer contextMutex.RUnlock()\n\treturn requestContextMap[r]\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 post about Go programming language:",
"pos": "Represent the Github code about Go programming language:",
"neg": "Represent the Github code:"
} |
Creates the xml tree for a `toast` notification
:param data: dict: The notification data to be converted to an xml tree.
{
"text": ["Title text", "Message Text", "Another message!"],
"image": ["src1", "src2"],
}
:return: str | [
"def _wns_prepare_toast(data, **kwargs):\n\t\n\troot = ET.Element(\"toast\")\n\tvisual = ET.SubElement(root, \"visual\")\n\tbinding = ET.SubElement(visual, \"binding\")\n\tbinding.attrib[\"template\"] = kwargs.pop(\"template\", \"ToastText01\")\n\tif \"text\" in data:\n\t\tfor count, item in enumerate(data[\"text\"... | [
"def man(self, **kwargs):\n \n\n str_man = 'commands'\n str_amount = 'full'\n\n for k, v in kwargs.items():\n if k == 'on': str_man = v\n if k == 'amount': str_amount = v\n\n if str_man == 'commands':\n str_commands = \"\"\"\n ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Computer Science:"
} |
Finds and returns template file or folder url
@param string $file File name
@param bool $admin Whether to force admin
@param bool $ssl Whether to force ssl
@param int $lang Language id
@return string | [
"public function getTemplateUrl($file = null, $admin = false, $ssl = null, $lang = null)\n {\n return $this->getShopMainUrl() . $this->getDir($file, $this->_sTemplateDir, $admin, $lang, null, null, false);\n }"
] | [
"public static function route($param = '')\n {\n $param = parent::route($param);\n\n switch ($param) {\n case 'types':\n return static::URL . '/' . $param;\n }\n\n // Otherwise, we may have been sent a longer path, e.g. types/manage/$type/fields\n if (... | codesearchnet | {
"query": "Represent the instruction about Metadata management:",
"pos": "Represent the code about Metadata management:",
"neg": "Represent the code about programming:"
} |
Compare HMACs
@param {String|Buffer} hmac1
@param {String|Buffer} hmac2
@returns {Boolean} | [
"function compareHmac(hmac1, hmac2) {\n var left = hmac1;\n if (Buffer.isBuffer(hmac1)) {\n left = hmac1.toString('base64');\n }\n var right = hmac2;\n if (Buffer.isBuffer(hmac2)) {\n right = hmac2.toString('base64');\n }\n return (left == right);\n}"
] | [
"function SHA1(source) { // @arg String - source string\n // @ret SHA1HashHexString\n//{@dev\n $valid($type(source, \"String\"), SHA1, \"source\");\n//}@dev\n\n var sha1 = DataType[\"Array\"][\"toHexStringArray\"](\n SHA1_encode(\n DataType[\"Ui... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
C#-style strings where "" escapes a quote. | [
"function tokenAtString(stream, state) {\n var next;\n while ((next = stream.next()) != null) {\n if (next == '\"' && !stream.eat('\"')) {\n state.tokenize = null;\n break;\n }\n }\n return \"string\";\n }"
] | [
"private static String dotsToRegex(String dotsName) {\n /*\n * oops, next line requires JDK 1.5 return dotsName.replace(\"$\",\n * \"\\\\$\").replace(\".\", SEP); could use String.replaceAll(regex, repl)\n * but that can be problematic--javadoc says \"Note that backslashes (\\)\n ... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
There is a syllable boundary within a VV sequence of two nonidentical
vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa]. | [
"def apply_T2(word):\n ''''''\n WORD = word\n offset = 0\n\n for vv in vv_sequences(WORD):\n seq = vv.group(2)\n\n if not is_diphthong(seq) and not is_long(seq):\n i = vv.start(2) + 1 + offset\n WORD = WORD[:i] + '.' + WORD[i:]\n offset += 1\n\n RULE = '... | [
"def wsp(word):\n ''''''\n violations = 0\n unstressed = []\n\n for w in extract_words(word):\n unstressed += w.split('.')[1::2] # even syllables\n\n # include extrametrical odd syllables as potential WSP violations\n if w.count('.') % 2 == 0:\n unstressed += [w.rsplit('... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about text processing:"
} |
// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). | [
"func (l *List) insertValue(v *Node, at *Element) *Element {\n\treturn l.insert(&Element{Value: v}, at)\n}"
] | [
"func (m *NamedMethod) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m.Name != \"\" {\n\t\tinfo = append(info, yaml.MapItem{Key: \"name\", Value: m.Name})\n\t}\n\t// &{Name:value Type:Method StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}\n\treturn info\n}"... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
Trims a FASTQ file.
TODO: docstring | [
"def trim_fastq(credentials, instance_config, instance_name,\n script_dir, input_file, output_file,\n trim_crop, trim_headcrop=0, self_destruct=True,\n **kwargs):\n \"\"\"\"\"\"\n template = _TEMPLATE_ENV.get_template('trim_fastq.sh')\n startup_script = template.re... | [
"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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Given a list of PathConfig objects, merges them into a single PathConfig,
giving priority in the order of the configs (first has highest priority). | [
"def merge_path_config(configs, config_dir_override):\n \n config_dir = None\n log_dir = None\n data_dir = None\n key_dir = None\n policy_dir = None\n\n for config in reversed(configs):\n if config.config_dir is not None:\n config_dir = config.config_dir\n if config.log... | [
"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 post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Adds any number of parameters to time_inv for this instance.
Parameters
----------
params : string
Any number of strings naming attributes to be added to time_inv
Returns
-------
None | [
"def addToTimeInv(self,*params):\n '''\n \n '''\n for param in params:\n if param not in self.time_inv:\n self.time_inv.append(param)"
] | [
"def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Remove empty `slaves` array from configured connections. | [
"private function cleanupSlaveConnections()\n {\n foreach ($this->config['database']['connections'] as $name => $connection) {\n if (count($connection['slaves']) <= 0) {\n unset($this->config['database']['connections'][$name]['slaves']);\n }\n }\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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
@param $config
@param $name
@return mixed
@throws \yii\base\InvalidConfigException
@throws \yii\web\ServerErrorHttpException | [
"public function generate($config, $name) {\n\t\t$config['class'] = self:: GENERATOR_DIR. $name;\n\t\treturn ScenarioHelper::run($config);\n\t}"
] | [
"protected function addSql($sql, array $params = [], array $types = [])\n {\n $message = 'Calling method \"addSql\" is not allowed. Use \"sql\" method instead';\n throw new \\Shopsys\\MigrationBundle\\Component\\Doctrine\\Migrations\\Exception\\MethodIsNotAllowedException($message);\n }"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Add item into list
@param string $item | [
"public function add($item)\n {\n // Disallow items outside of original boundaries\n if (!in_array($item, $this->originalList)) {\n return;\n }\n if (!in_array($item, $this->currentList)) {\n $this->currentList[] = $item;\n }\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Set the remote protocol
181802.2
@param newTargetTransportChain The remote protocol to use
@see com.ibm.websphere.sib.api.jms.JmsConnectionFactory#setRemoteProtocol(java.lang.String) | [
"@Override\n public void setTargetTransportChain(String newTargetTransportChain) throws JMSException {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(this, tc, \"setTargetTransportChain\", newTargetTransportChain);\n jcaManagedConnectionFactory.setTarget... | [
"protected InvokerExtensionProcessor getInvokerExtensionProcessor(com.ibm.ws.webcontainer.webapp.WebApp app)\n {\n return new com.ibm.ws.webcontainer.osgi.extension.InvokerExtensionProcessor(app, config.getInvokerAttributes());\n }"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Measure Min and Max labels width in percent | [
"function () {\n if (!this.coords.w_rs) {\n return;\n }\n\n this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100;\n this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100;\n }"
] | [
"@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Adds optional filters if required.
@since 1.0.0 | [
"public function boot()\n {\n // Whether to add 'defer' to enqueued scripts.\n if (Config::get('theme.defer_scripts')) {\n $this->add_filter('script_loader_tag', 'defer_scripts', 10, 2);\n }\n\n // Whether to remove asset version strings.\n if (Config::get('theme.rem... | [
"public static function toDebugReport()\n {\n $report = \"PHP SDK (SquareConnect) Debug Report:\\n\";\n $report .= \" OS: \".php_uname().\"\\n\";\n $report .= \" PHP Version: \".phpversion().\"\\n\";\n $report .= \" OpenAPI Spec Version: 2.0\\n\";\n $report .= \" S... | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
// ResolveIndices implements Plan interface. | [
"func (p *Insert) ResolveIndices() (err error) {\n\terr = p.baseSchemaProducer.ResolveIndices()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, asgn := range p.OnDuplicate {\n\t\tnewCol, err := asgn.Col.ResolveIndices(p.tableSchema)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tasgn.Col = newCol.(*expression... | [
"@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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
(non-PHPdoc)
@see Iterator::rewind() | [
"function rewind() {\n if (!$this->unmoved) {\n $this->classIterator->rewind();\n $this->ensureNotEmpty();\n $this->unmoved = true;\n }\n }"
] | [
"public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// Bind accepts a SassOptions and adds the registered
// importers in the context. | [
"func (p *Imports) Bind(opts libs.SassOptions) {\n\tentries := make([]libs.ImportEntry, p.Len())\n\ti := 0\n\n\tp.RLock()\n\tfor _, ent := range p.m {\n\t\tbs := ent.bytes\n\t\tentries[i] = libs.ImportEntry{\n\t\t\tParent: ent.Prev,\n\t\t\tPath: ent.Path,\n\t\t\tSource: string(bs),\n\t\t}\n\t\ti++\n\t}\n\tp.RUnlo... | [
"function (name) {\n // initialize module instance with default module configuration\n _.merge(this, defaultModuleConfig)\n // set app name\n this.name = name\n // set absolute path of base directory for module\n this.base = getBase()\n // store reference to global app\n this.immutableApp = ... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Get filr from absolute path
@param string $absolutepath Absolute path from file
@return string | [
"public static function getUriFromFile($absolutepath)\n\t{\n\t\tif (self::isWindowsOS())\n\t\t{\n\t\t\t$result = \"file:///\".$absolutepath;\n\n\t\t\t$search = \"\\\\\";\n\t\t\t$replace = \"/\";\n\n\t\t\t$result =str_replace($search, $replace, $result);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$result = \"file://\".$absolute... | [
"def _getpath(self, path):\n \"\"\n if is_blacklisted(path):\n raise JottaFuseError('Blacklisted file, refusing to retrieve it')\n\n return self.client.getObject(path)"
] | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about AWS S3:"
} |
replace stub text
@param string $stub
@param array $replacement
@return string | [
"protected function formatStub($stub, array $replacement)\n {\n foreach ($replacement as $src => $dest) {\n $stub = str_replace($src, $dest, $stub);\n }\n return $stub;\n }"
] | [
"def doc_uri(self, args, range=None):\n \"\"\"\"\"\"\n self.log.debug('doc_uri: in')\n self.send_at_position(\"DocUri\", False, \"point\")"
] | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Checks to see if the job errored out. | [
"def is_error(self):\n \n try:\n if self._task.is_alive():\n if len(self._task.stderr.readlines()) > 0:\n self._task.join()\n self._write_log()\n return True\n except AttributeError:\n pass\n 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 comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Calcula a quantidade de semanas que o ano informado tem.
@param int $y
Ano.
@return int | [
"public static function weeksInYear(int $y) : int\n {\n $lWeek = self::lastWeekOfYear($y);\n return (int)$lWeek->format(\"W\");\n }"
] | [
"def associar_assinatura(self, sequencia_cnpj, assinatura_ac):\n \n retorno = super(ClienteSATLocal, self).\\\n associar_assinatura(sequencia_cnpj, assinatura_ac)\n # (!) resposta baseada na redação com efeitos até 31-12-2016\n return RespostaSAT.associar_assinatura(retorn... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add a by PHP created Image Element
@param string $link
@param mixed $style
@return PHPWord_Section_MemoryImage | [
"public function addMemoryImage($link, $style = null) {\r\n\t\t$memoryImage = new PHPWord_Section_MemoryImage($link, $style);\r\n\t\tif(!is_null($memoryImage->getSource())) {\r\n\t\t\t$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);\r\n\t\t\t$memoryImage->setRelationId($rID);\r... | [
"protected final function AddCssIDField()\n {\n $name = 'CssID';\n $this->AddField(Input::Text($name, $this->Content()->GetCssID()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.