query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Marshall the given parameter object.
[ "public void marshall(GetExecutionHistoryRequest getExecutionHistoryRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (getExecutionHistoryRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshal...
[ "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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns a hash of current configuration options. @return [Hash]
[ "def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end" ]
[ "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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Connect the tcp client
[ "func (c *TCPClient) Connect() error {\n\tc.t.Go(func() error {\n\t\treturn c.runRequestQueue()\n\t})\n\tconnection, err := net.DialTimeout(\"tcp\", c.addr, c.timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.tls {\n\t\ttlsConn := tls.Client(connection, c.tlsConfig)\n\t\terr = tlsConn.Handshake()\n\t\tif err...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
{@inheritDoc} Serializes the property defined for this instance.
[ "public void serialize( JsonWriter writer, T bean, JsonSerializationContext ctx ) {\n Map map = getValue( bean, ctx );\n if ( null != map ) {\n ((MapJsonSerializer) getSerializer()).serializeValues( writer, map, ctx, getParameters() );\n }\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 about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
@version 1.0 @since 2013-10 @param string $nonce @param string $createdAt @param string $password @return string
[ "public function generateDigest($nonce, $createdAt, $password)\n {\n return base64_encode(sha1(base64_decode($nonce) . $createdAt . $password, true));\n }" ]
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// SetValue sets the Value field's value.
[ "func (s *AttributeValue) SetValue(v string) *AttributeValue {\n\ts.Value = &v\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 Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Register all of the base service providers. @return void
[ "protected function registerServiceProviders()\n {\n $this->register(new EventServiceProvider($this));\n $this->register(new RoutingServiceProvider($this));\n\n foreach ($this->make('config')->get('app.providers') as $provider) {\n $this->register($provider);\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:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@Override\n\tpublic boolean eIsSet(int featureID) {\n\t\tswitch (featureID) {\n\t\t\tcase XtextPackage.ACTION__TYPE:\n\t\t\t\treturn type != null;\n\t\t\tcase XtextPackage.ACTION__FEATURE:\n\t\t\t\treturn FEATURE_EDEFAULT == null ? feature != null : !FEATURE_EDEFAULT.equals(feature);\n\t\t\tcase XtextPackage.ACTIO...
[ "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 sentence about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
Performs an HTTP PUT on the given URL. (without BasicAuth) @param uriString String representing the URI to connect to @param body @param contentType @return @throws URISyntaxException @throws HttpException
[ "public static Response put(String uriString, String body, ContentType contentType) throws URISyntaxException, HttpException {\n return putBody(new HttpPut(uriString), body, contentType, null, null);\n }" ]
[ "public void sendGroupContact(final String groupId, final String[] contactIds) throws NotFoundException, GeneralException, UnauthorizedException {\n // reuestByID appends the \"ID\" to the base path, so this workaround\n // lets us add a query string.\n String path = String.format(\"%s%s?%s\", ...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
@param ArrayAccess|array $array @param array|string $keys @return void
[ "public static function remove(&$array, $keys)\n {\n $original = &$array;\n $keys = (array) $keys;\n\n if (!Arr::accessible($array)) {\n return;\n }\n if (count($keys) === 0) {\n return;\n }\n\n foreach ($keys as $key) {\n if (...
[ "public static function castDimensions(Image\\Dimensions $dimensions, array $a, Stub $stub, $isNested, $filter = 0)\n {\n $stub->class .= sprintf(' \"%s\"', (string) $dimensions);\n\n return $a;\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Make a view. @param string $file @param array $variables @return bool
[ "public static function make (string $file, array $variables=[]) : bool\n\t{\n\t\t$fileLocation = static::fileAnalyzer($file);\t\t\t\n\t\tif (file_exists($fileLocation)):\n\t\t\tob_start(getConstant('MINIFY_HTML_OUTPUT') ? 'minifyHTMLOutput' : NULL);\n\t\t\tif (!empty($variables)) self::with($variables);\n\t ...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Check if the bulk insertion buffer is full. @return true if the bulk insertion buffer is full, false otherwise
[ "protected boolean isBulkInsertionBufferFull() {\n if (insertionBufferSize >= insertionBuffer.length) {\n return true;\n }\n double sizeAsDouble = size + insertionBufferSize;\n return Math.getExponent(sizeAsDouble) + 3 >= insertionBuffer.length;\n }" ]
[ "public static long createFileId(long containerId) {\n long id = BlockId.createBlockId(containerId, BlockId.getMaxSequenceNumber());\n if (id == INVALID_FILE_ID) {\n // Right now, there's not much we can do if the file id we're returning is -1, since the file\n // id is completely determined by the ...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Downloading driver. @param $client @return bool|string
[ "protected function download($client)\n {\n $resource = base_path('vendor/bin/driver-file');\n\n if (is_file(base_path(\"vendor/bin/{$this->getFileName()}\"))) {\n if (!$this->confirm(ucfirst($this->argument('driver')).' web driver file already exists. Would you still like to download it...
[ "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:" }
Name Setter Set name with passed in variable. @param name: New name string. @type name: String
[ "def name(self, name: str):\n \n\n self.pathName = os.path.join(self.path, name)" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Returns a processor instance. @param string $id - Processor ID. @return callable
[ "public function getProcessor(string $id)\n {\n if (!isset($this->_processors[$id])) {\n throw new \\RuntimeException('Processor with ID \"'.$id.'\" is not registered on the logger factory.');\n }\n\n return $this->_processors[$id];\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Get ZonedDateTime from raw binary format. @param columnInfo column information @param clazz asked class @param timeZone time zone @return ZonedDateTime value @throws SQLException if column type doesn't permit conversion
[ "public ZonedDateTime getInternalZonedDateTime(ColumnInformation columnInfo, Class clazz,\n TimeZone timeZone) throws SQLException {\n if (lastValueWasNull()) {\n return null;\n }\n if (length == 0) {\n lastValueNull |= BIT_LAST_FIELD_NULL;\n return null;\n }\n\n switch (columnInf...
[ "@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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
parse a tuple of 3 uint8 values
[ "def uint8_3(self, name):\n \"\"\"\"\"\"\n self._assert_is_string(name)\n frame = self._next_frame()\n if len(frame) != 3:\n raise MessageParserError(\"Expected exacty 3 byte for 3 unit8 values\")\n vals = unpack(\"BBB\", frame)\n self.results.__dict__[name] = va...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Render a Text MessageElement as plain text :returns: The plain text representation of the row. :rtype: basestring
[ "def to_text(self):\n \n row = '---\\n'\n for index, cell in enumerate(self.cells):\n if index > 0:\n row += ', '\n row += cell.to_text()\n row += '---'\n\n return row" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// Show runs the show action.
[ "func (c *FeaturesController) Show(ctx *app.ShowFeaturesContext) error {\n\treturn proxy.RouteHTTP(ctx, c.config.GetTogglesServiceURL())\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
For creating a new workgroup or a new group/user relationship.
[ "@Override\n @Path(\"/{groupName}/{'users'}/{cuid}\")\n @ApiOperation(value=\"Create a workgroup or add a user to an existing workgroup\",\n notes=\"If users/{cuid} is present, user is added to workgroup.\", response=StatusMessage.class)\n @ApiImplicitParams({\n @ApiImplicitParam(name=\"Workg...
[ "def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Serializes the JSON for the Polling Event Model. :param account: :param group: :param region: :return:
[ "def serialize(self, account, group, region):\n \n return self.dumps({\n 'account': account,\n 'detail': {\n 'request_parameters': {\n 'groupId': group['GroupId']\n },\n 'region': region,\n 'collected'...
[ "def get_value_from_content(key):\n \n def value_from_content_function(service, message):\n \"\"\"Actual implementation of get_value_from_content function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Setting rows @param type $rows @return \Scopdrag\LaravelGoogleChart\ChartManager @throws \Exception
[ "public function setRows($rows = []) {\n\n if (!empty($this->cols)) {\n if (count($rows[0]) < 1) {\n throw new \\Exception('Expected 2 dimensional array for rows');\n } elseif (count($this->cols) != 0 && count($this->cols) != count($rows[0])) {\n throw new ...
[ "protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Mock factory method to create an EntityManager. {@inheritdoc}
[ "public static function create($conn, Configuration $config = null, EventManager $eventManager = null)\n {\n if (null === $config) {\n $config = new Configuration();\n $config->setProxyDir(__DIR__ . '/../Proxies');\n $config->setProxyNamespace('Doctrine\\Tests\\Proxies');\...
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// ValidateVolumeParams is specified on the storage.VolumeSource interface.
[ "func (v *azureVolumeSource) ValidateVolumeParams(params storage.VolumeParams) error {\n\tif mibToGib(params.Size) > volumeSizeMaxGiB {\n\t\treturn errors.Errorf(\n\t\t\t\"%d GiB exceeds the maximum of %d GiB\",\n\t\t\tmibToGib(params.Size),\n\t\t\tvolumeSizeMaxGiB,\n\t\t)\n\t}\n\treturn nil\n}" ]
[ "func (p *Provider) ValidateDataSourceConfig(providers.ValidateDataSourceConfigRequest) providers.ValidateDataSourceConfigResponse {\n\t// FIXME: move the backend configuration validate call that's currently\n\t// inside the read method into here so that we can catch provider configuration\n\t// errors in terrafor...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
(non-PHPdoc) @see Iterator::next()
[ "function next() {\n $this->unmoved = false;\n if ($this->valid()) {\n $this->currentInstance++;\n if (!isset($this->instanceCache[$this->currentInstance])) {\n // try to load next block (unless we know it's empty)\n $remainingInstances = !$this->end...
[ "public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Get Route @return array
[ "private function getRule()\n {\n $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : '';\n $routeRuleCustom = isset($this->rule[$requestMethod]) ? $this->rule[$requestMethod] : array();\n $routeRuleAny = isset($this->rule[RouteMethod::ANY]) ? $this-...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Attemps to load a ui using the key as a class name. @param key the registration key @return A WComponent if one could be loaded from the classpath, else it returns Boolean.FALSE.
[ "private static Object loadUI(final String key) {\n\t\tString classname = key.trim();\n\n\t\ttry {\n\t\t\tClass<?> clas = Class.forName(classname);\n\n\t\t\tif (WComponent.class.isAssignableFrom(clas)) {\n\t\t\t\tObject instance = clas.newInstance();\n\t\t\t\tLOG.debug(\"WComponent successfully loaded with class na...
[ "def get_app(self):\n \n # First see to connection stack\n ctx = connection_stack.top\n if ctx is not None:\n return ctx.app\n\n # Next return app from instance cache\n if self.app is not None:\n return self.app\n\n # Something went wrong, in mo...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Builds the message as it will appear in the log file @author Art <a.molcanovas@gmail.com> @param string $level Message level @param string $text User-supplied message text @return string The built message @since 1.4
[ "protected function buildMessage($level, $text) {\n $trace = Alo::ifnull($this->getBacktrace()[1], [], true);\n\n $file = isset($trace['file']) ? implode(DIRECTORY_SEPARATOR,\n array_slice(explode(DIRECTORY_SEPARATOR,\n ...
[ "public function init()\n\t{\n\t\t$this->help_str = 'Send a mail using the instance mail configuration. '.PHP_EOL;\n\n\t\t$this->setNewParam( 'S', 'subject', 'Mail subject.', true, true );\n\t\t$this->setNewParam( 'F', 'filecontent', 'Mail body. Don\\'t define this params to send the stdin', true, true );\n\t\t$th...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Send pending events. When the status is changed during a save operation, all the "after" events must be sent after the owner model has been saved. This method is invoked on events ActiveRecord::EVENT_AFTER_UPDATE and ActiveRecord::EVENT_AFTER_INSERT.
[ "private function firePendingEvents()\n\t{\n\t\tif ( ! empty($this->_pendingEvents)) {\n\t\t\tforeach ($this->_pendingEvents as $event) {\n\t\t\t\t$this->owner->trigger($event->name, $event);\n\t\t\t}\n\t\t\t$this->_pendingEvents = [];\n\n\t\t\tif ( $this->getStatusAccessor() != null) {\n\t\t\t\t$this->_statusAcces...
[ "def create\n upsert do\n # NOTE: create!() is not used because assign to @record to draw form.\n # Otherwise, @record would be in nil so failure at edgarj/_form rendering.\n #\n # NOTE2: valid? after create() calls validate_on_update. This is not\n # an expected behavior. ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public EClass getIfcDistributionControlElement() {\r\n\t\tif (ifcDistributionControlElementEClass == null) {\r\n\t\t\tifcDistributionControlElementEClass = (EClass) EPackage.Registry.INSTANCE\r\n\t\t\t\t\t.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(159);\r\n\t\t}\r\n\t\treturn ifcDistributionContr...
[ "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 summarization about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
// Extract tarballs
[ "func Extract(reader io.Reader, dest string) error {\n\ttarReader := tar.NewReader(reader)\n\n\tfor {\n\t\theader, err := tarReader.Next()\n\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif header.Name == \".\" {\n\t\t\tcontinue\n\t\t}\n\n\t\terr = extract(tarRea...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Make a dictionary of filenames for various types
[ "def make_filenames(self, **kwargs):\n \n out_dict = dict(ft1file=self.ft1file(**kwargs),\n ltcube=self.ltcube(**kwargs),\n ccube=self.ccube(**kwargs),\n bexpcube=self.bexpcube(**kwargs),\n srcmaps=self.srcmaps...
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Reorder the days property based on current language.
[ "private static function init()\n {\n $day = Calendar::getFirstWeekday();\n $day = $day == 0 ? 7 : $day;\n self::$weekStartsAt = $day;\n\n $days = self::$days;\n while (array_keys($days)[0] != $day) {\n $key = array_keys($days)[0];\n $value = $days[$key];\...
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the value of the text node
[ "function(el) {\n\n var text = '';\n\n for (var i = 0; i < el.childNodes.length; i++) {\n var curNode = el.childNodes[i];\n var whitespace = /^\\s*$/;\n\n if(curNode === undefined) {\n text = \"\";\n break;\n }\n\n if (curNode.nodeName ===...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Loads assets from the supplied node. @param \Twig_Node $node @return array An array of asset formulae indexed by name
[ "private function loadNode(\\Twig_Node $node)\n {\n $formulae = array();\n\n if ($node instanceof AsseticNode) {\n $formulae[$node->getAttribute('name')] = array(\n $node->getAttribute('inputs'),\n $node->getAttribute('filters'),\n array(\n ...
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Performs a Model creation commit and persists to the database. @param Model $model @return Model
[ "private function doCommitCreate(Model $model)\n {\n $this->dispatchLifecycleEvent(Events::preCreate, $model);\n\n $this->getPersisterFor($model->getType())->create($model);\n $model->getState()->setNew(false);\n // Should the model always reload? Or should the commit be assumed corre...
[ "@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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Bind annotated fields in the specified {@code target} from the {@link android.content.Intent}. @param target Target object to bind the extras. @param intent Intent containing the extras.
[ "public static <T> void bindExtras(T target, Intent intent) {\n @SuppressWarnings(\"unchecked\")\n IntentBinding<T> binding = (IntentBinding<T>) getIntentBinding(target.getClass().getClassLoader(), target.getClass());\n if (binding != null) {\n binding.bindExtras(target, intent);\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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Whether a given property is annotated with the appropriate bean annotation. @param string $propertyName The name of the property. @return boolean
[ "protected function isPropertyAnnotated($propertyName)\n {\n $target = $this->getClass();\n $isAnnotated = false;\n\n while ($target) {\n\n if ($target->hasProperty($propertyName)) {\n $comment = $target->getProperty($propertyName)->getDocComment();\n ...
[ "private void checkForValid(String paramName, Attribute<? super X, ?> attribute)\n {\n if (attribute == null)\n {\n throw new IllegalArgumentException(\n \"attribute of the given name and type is not present in the managed type, for name:\" + paramName);\n\n }\n...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Persists a user as currentUser to localStorage, and into the singleton. @private
[ "function(user) {\n var promise;\n if (AV.User._currentUser !== user) {\n promise = AV.User.logOut();\n } else {\n promise = Promise.resolve();\n }\n return promise.then(function() {\n user._isCurrentUser = true;\n AV.User._currentUser = user;\n...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
(PHP 5 &gt;= 5.1.0)<br/> Constructs the object @link http://php.net/manual/en/serializable.unserialize.php @param string $serialized <p> The string representation of the object. </p> @return void
[ "public function unserialize($serialized)\n {\n $array = unserialize($serialized);\n $this->container = $array[0];\n $this->userList = $array[1];\n $this->database = $array[2];\n $this->connection = $array[3];\n }" ]
[ "static function of($resource)\n {\n if (!is_resource($resource) && get_resource_type($resource) !== 'stream-context')\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid Context Resource Passed, given: \"%s\".'\n , \\Poirot\\Std\\flatten($resource)\n ...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Returns all available definitions for a specific environment. @param Environment $environment @return Transformation[]
[ "public function getEnvironmentTransformations(Environment $environment)\n {\n return array_filter(\n $this->environmentManager->readEnvironmentCallees($environment),\n function (Callee $callee) {\n return $callee instanceof Transformation;\n }\n );\n...
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the comment about Workspace management:", "pos": "Represent the code about Workspace management:", "neg": "Represent the code:" }
Create a new memoized method @return [undefined] @api private
[ "def create_memoized_method\n name, method, freezer = @method_name, @original_method, @freezer\n @descendant.module_eval do\n define_method(name) do |&block|\n fail BlockNotAllowedError.new(self.class, name) if block\n memoized_method_cache.fetch(name) do\n freezer.call...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
the message would cause high watermark the function returns false.
[ "public boolean checkWrite()\n {\n if (!outActive || state != State.ACTIVE) {\n return false;\n }\n\n // TODO DIFF V4 small change, it is done like this in 4.2.2\n boolean full = !checkHwm();\n\n if (full) {\n outActive = false;\n return false;\...
[ "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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
sanitize content from the user - trust no one ref: https://developers.google.com/apps-script/reference/html/html-output#appendUntrusted(String)
[ "function sanitizeInput(rawInput) {\n var placeholder = HtmlService.createHtmlOutput(\" \");\n placeholder.appendUntrusted(rawInput);\n \n return placeholder.getContent();\n }" ]
[ "function topLevelRedirect (url) {\n if (window === top) location.href = url\n else parent.postMessage('slackin-redirect:' + id + ':' + url, '*')\n // Q: Why can't we just `top.location.href = url;`?\n // A:\n // [sandboxing]: http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/\n // [CSP]: http...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Searches users. @return ActiveDataProvider
[ "public function search()\r\n {\r\n $query = static::find();\r\n if (Podium::getInstance()->user->isGuest) {\r\n $query->andWhere(['visible' => 1]);\r\n }\r\n $dataProvider = new ActiveDataProvider(['query' => $query]);\r\n $dataProvider->sort->defaultOrder = ['sort'...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github summarization about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code:" }
Deletes a cookie by name. @param string $name Cookie name.
[ "private function deleteCookie($name)\n {\n $path = $this->getCookiePath();\n $jar = $this->client->getCookieJar();\n\n do {\n if (null !== $jar->get($name, $path)) {\n $jar->expire($name, $path);\n }\n\n $path = preg_replace('/.$/', '', $path)...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Get a value from standard input. @param string $question The question you want to ask user. @return string The input string from standard input. @since 1.0
[ "public function in($question = null)\n\t{\n\t\t$question = $question ? : $this->question;\n\n\t\tif ($question)\n\t\t{\n\t\t\t$this->output->out()->out($question, false);\n\t\t}\n\n\t\t$value = rtrim(fread($this->inputStream, 8192), \"\\n\\r\");\n\n\t\t$this->output->out();\n\n\t\treturn $value;\n\t}" ]
[ "public function getParameters(array $additionnal_parameters = array())\n {\n $defaults = array(\n // ------------- USER TAG -------------\n /*\n * User name of the sender of the message.\n */\n 'USERNAME' => null,\n /*\n * Us...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// ControllerAPIPort returns the optional API port to be used for // the controllers to talk to each other. A zero value means that // it is not set.
[ "func (c Config) ControllerAPIPort() int {\n\tif value, ok := c[ControllerAPIPort].(float64); ok {\n\t\treturn int(value)\n\t}\n\t// If the value isn't an int, this conversion will fail and value\n\t// will be 0, which is what we want here.\n\tvalue, _ := c[ControllerAPIPort].(int)\n\treturn value\n}" ]
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Returns the decoded message. @return the decoded message.
[ "public String getDecodedMessage()\n {\n if (message == null)\n {\n return null;\n }\n return new String(Base64.base64ToByteArray(message), Charset.forName(\"UTF-8\"));\n }" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Dummy convert @param decision @return
[ "private String getStatusCode(DecisionType decision) {\n if (fXACMLParsingError) {\n return STATUS_CODE_SYNTAX_ERROR;\n } else if (fProcessingError) {\n return STATUS_CODE_PROCESSING_ERROR;\n } else if (decision == DecisionType.Deny ||\n decision == Decision...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Process the list of Commands. @param \ECL\SymbolTable $table The global SymbolTable. @return \ECL\ResultSet[] The result from the last Command or an empty array.
[ "public function process(\\ECL\\SymbolTable $table) {\n $results = [];\n\n // Loop over every Command and process it.\n for($i = 0; $i < count($this->commands); ++$i) {\n $command = $this->commands[$i];\n $curr_result = $command->process($table);\n $table[\\ECL\...
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Return key, value from given line if present, else return None.
[ "def extract_key_value(line, environ):\n \n segments = line.split(\"=\", 1)\n if len(segments) < 2:\n return None\n key, value = segments\n # foo passes through as-is (with spaces stripped)\n # '{foo}' passes through literally\n # \"{foo}\" substitutes from environ's foo\n value = val...
[ "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:" }
Transform .css files to sss syntax
[ "function cssToSss (css, file) {\n if (path.extname(file) === '.css') {\n return postcss().process(css, { stringifier: sugarss }).then(function (result) {\n return result.css\n })\n } else {\n return css\n }\n }" ]
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// SetPrompt sets the Prompt field's value.
[ "func (s *FollowUpPrompt) SetPrompt(v *Prompt) *FollowUpPrompt {\n\ts.Prompt = v\n\treturn s\n}" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Assigns indices to individuals in population.
[ "def _initialize_pop(self, pop_size):\n \"\"\"\"\"\"\n self.toolbox.register(\"individual\", self._generate)\n self.toolbox.register(\"population\", tools.initRepeat,\n list, self.toolbox.individual)\n self.population = self.toolbox.population(n=pop_size)\n ...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Get paginator @param mixed|null $where @param mixed|null $order @param mixed|null $columns @param mixed|null $joins @param mixed|null $quantifier @return \Zend\Paginator\Paginator
[ "public function getPaginator( $where = null,\n $order = null,\n $columns = null,\n $joins = null,\n $quantifier = null )\n {\n $joins = array_mer...
[ "abstract public function __construct(DataAccessInterface $dataSource);\n \n /**\n * Returns an array with all entities for the given data request.\n * \n * @param \\Zepi\\DataSource\\Core\\DataRequest $dataRequest\n * @return false|array\n */\n public function find(DataRequest $dataReq...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// ZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS) // // See: http://api.zeromq.org/4-1:zmq-setsockopt#toc44
[ "func (soc *Socket) SetTcpKeepaliveIdle(value int) error {\n\treturn soc.setInt(C.ZMQ_TCP_KEEPALIVE_IDLE, value)\n}" ]
[ "func (soc *Socket) SetRcvbuf(value int) error {\n\treturn soc.setInt(C.ZMQ_RCVBUF, value)\n}" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Makes a filter function to check if backends can handle given amount. @param int $amount @return function
[ "public function makeBackendFilterChargeAmount($amount)\n {\n $defMin = $this['limits']['charge_amount']['min'];\n $defMax = $this['limits']['charge_amount']['max'];\n return function ($backend) use ($amount, $defMin, $defMax) {\n // temporary hack for now to correct min value for...
[ "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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Store client's selection of a new translation
[ "def selectlanguage(self, event):\n \"\"\"\"\"\"\n\n self.log('Language selection event:', event.client, pretty=True)\n\n if event.data not in all_languages():\n self.log('Unavailable language selected:', event.data, lvl=warn)\n language = None\n else:\n ...
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Bundles up some useful properties of the statistic for convenience. @return array
[ "public function toArray()\n {\n $name = $this->name();\n\n $value = $this->computeValue();\n $delta = $this->computeDelta();\n\n return [\n 'name' => $name,\n 'key' => $this->key(),\n 'granularity' => $this->granularity(),\n 'prefix' => $th...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@Override\r\n\tpublic EClass getIfcClosedShell() {\r\n\t\tif (ifcClosedShellEClass == null) {\r\n\t\t\tifcClosedShellEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(98);\r\n\t\t}\r\n\t\treturn ifcClosedShellEClass;\r\n\t}" ]
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github text about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
// Helper function to ease appending path to a base URI
[ "func appendPath(base string, path string) string {\n\t// if path starts with `/` shave it off\n\tif path[0] == '/' {\n\t\tpath = path[1:]\n\t}\n\treturn base + path\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:" }
Builds the book .ent file that is a basic requirement to build the book. @param buildData Information and data structures for the build. @return The book .ent file filled with content from the Content Spec.
[ "protected String buildBookEntityFile(final BuildData buildData) throws BuildProcessingException {\n final ContentSpec contentSpec = buildData.getContentSpec();\n\n final StringBuilder retValue = new StringBuilder();\n\n if (!buildData.getBuildOptions().getUseOldBugLinks() && buildData.getBuild...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Writes a list of molecules to an OutputStream. @param som MoleculeSet that is written to an OutputStream
[ "public void writeAtomContainerSet(IAtomContainerSet som) {\n writeAtomContainer(som.getAtomContainer(0));\n for (int i = 1; i <= som.getAtomContainerCount() - 1; i++) {\n try {\n writeAtomContainer(som.getAtomContainer(i));\n } catch (Exception exc) {\n ...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
@param Goal $goal @param Event $event @param float $daily_budget @return float
[ "private function calcEvent(Goal $goal, Event $event, $daily_budget) {\n $days_to_event = $this->calcDiffDays($goal->date_start, $event->date_start);\n $days_of_event = $this->calcDiffDays($event->date_start, $event->date_end);\n\n $daily_budget = new Number($daily_budget);\n $variation ...
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// Set/Add/Replace a key/value pair in the cache.
[ "func (c *Client) setGeneric(op opCode, key, val string, ocas uint64, flags, exp uint32) (cas uint64, err error) {\n\t// Request : MUST key, value, extras ([0..3] flags, [4..7] expiration)\n\t// Response: MUST NOT key, value, extras\n\t// CAS: If a CAS is specified (non-zero), all sets only succeed if the key\n\t//...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
{@inheritDoc} @throws IllegalArgumentException {@inheritDoc}
[ "@Override\n public void validateUpdate(ResourcePool newPool) {\n // Replacement must be of the same ResourceType\n if (!this.getType().equals(newPool.getType())) {\n throw new IllegalArgumentException(\"ResourceType \" + newPool.getType() + \" can not replace \" + this.getType());\n }\n // Replac...
[ "public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {\n // in global.jelly, instance==descriptor\n return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);\n }" ]
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
//AddOffsetsToTxn sends a request to add offsets to txn and returns a response //or error
[ "func (b *Broker) AddOffsetsToTxn(request *AddOffsetsToTxnRequest) (*AddOffsetsToTxnResponse, error) {\n\tresponse := new(AddOffsetsToTxnResponse)\n\n\terr := b.sendAndReceive(request, response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response, nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Convert a given moduleId to an absolute path. @param {string} id The moduleId to normalize. @returns {string} The normalized path.
[ "function toAbsolute(id) {\n return id.startsWith(\"./\") ? path.resolve(id) : require.resolve(id)\n}" ]
[ "function Pointer ($ref, path, friendlyPath) {\n /**\n * The {@link $Ref} object that contains this {@link Pointer} object.\n * @type {$Ref}\n */\n this.$ref = $ref;\n\n /**\n * The file path or URL, containing the JSON pointer in the hash.\n * This path is relative to the path of the main JSON schema ...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Gets the layout that is requested to be removed @return Layout The removal layout
[ "protected function RemovalObject()\n {\n $id = Request::PostData('delete');\n return $id ? Layout::Schema()->ByID($id) : null;\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 summarization about Metadata management:", "pos": "Represent the code about Metadata management:", "neg": "Represent the code about programming:" }
Transforms / corrects the highlighting.<p> @return the highlighting
[ "private Map<String, Map<String, List<String>>> transformHighlighting() {\r\n\r\n Map<String, Map<String, List<String>>> result = new HashMap<String, Map<String, List<String>>>();\r\n if (m_queryResponse.getHighlighting() != null) {\r\n for (String key : m_queryResponse.getHighlighting().ke...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Find a gene based on the symbol or disambiguate using synonyms. If no gene is found, if the create is True, a new instance will be created with that symbol.
[ "def find(self, symbol, chrom=None, create=False):\n \n queryset = self.get_query_set()\n\n # Filter by chromosome if one is specified\n if chrom:\n queryset = queryset.filter(chr=chrom)\n\n # Look for direct match\n matches = queryset.filter(symbol__iexact=symbo...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetAction sets the Action field's value.
[ "func (s *AbortCriteria) SetAction(v string) *AbortCriteria {\n\ts.Action = &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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// WriteByte appends the byte c to the buffer, growing the buffer as needed. // The returned error is always nil, but is included to match bufio.Writer's // WriteByte. If the buffer becomes too large, WriteByte will panic with // ErrTooLarge.
[ "func (b *Builder) WriteByte(c byte) error {\n\tb.lastRead = opInvalid\n\tm := b.grow(1)\n\tb.buf[m] = c\n\treturn nil\n}" ]
[ "func NewPackageReader(r io.ReaderAt, size int64) (*PackageReader, error) {\n\tzr, err := zip.NewReader(r, size)\n\tif err != nil {\n\t\t// Note: we rely here (and in other places where we return errors) on\n\t\t// zip.Reader NOT wrapping errors from 'r', so they inherit transient tags\n\t\t// in case of transient ...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Internal method that creates a NamingException that contains helpful information regarding why a binding failed to resolve. <p> The returned exception will provide similar information as the CannotInstantiateObjectException from traditional WAS.
[ "private NamingException newCannotInstantiateObjectException(String name,\n Exception cause) {\n String msgTxt = Tr.formatMessage(tc, \"JNDI_CANNOT_INSTANTIATE_OBJECT_CWNEN1001E\", name);\n NamingException nex = new NamingException(msgTxt)...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Sets the fully qualified name of the organizational unit.<p> @param oufqn the fully qualified name of the organizational unit to set
[ "public void setOufqn(String oufqn) {\n\n if (oufqn != null) {\n if (!oufqn.endsWith(\"/\")) {\n oufqn += '/';\n }\n } else {\n oufqn = \"/\";\n }\n String name = m_project.getSimpleName();\n if (name == null) {\n name = \...
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
return info about member
[ "def member_info(self, member_id):\n \"\"\"\"\"\"\n info = self._shards[member_id].copy()\n info['id'] = member_id\n info['tags'] = self.tags.get(member_id, list())\n return info" ]
[ "function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic void eSet(int featureID, Object newValue)\n\t{\n\t\tswitch (featureID)\n\t\t{\n\t\t\tcase XtypePackage.XIMPORT_SECTION__IMPORT_DECLARATIONS:\n\t\t\t\tgetImportDeclarations().clear();\n\t\t\t\tgetImportDeclarations().addAll((Collection<? extends XImportDeclara...
[ "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 post about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
// validateTx checks whether a transaction is valid according to the consensus rules.
[ "func (pool *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error {\n\t// Validate sender\n\tvar (\n\t\tfrom common.Address\n\t\terr error\n\t)\n\n\t// Validate the transaction sender and it's sig. Throw\n\t// if the from fields is invalid.\n\tif from, err = types.Sender(pool.signer, tx); err != ni...
[ "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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
searches for an string in the trie. $isPrefix indicates whether the method should search for the entire word. @param string $key @param bool $isPrefix @return bool
[ "public function search(string $key, bool $isPrefix = false): bool {\n $length = \\strlen($key);\n $node = $this->root;\n\n for ($i = 0; $i < $length; $i++) {\n $charIndex = $this->getCharIndex($key[$i]);\n if (!$node->hasChild($charIndex)) {\n return false;...
[ "public static function optionalIsNotSuffix(Input $definition): self\n {\n $pointer = self::createPointerString($definition->getInput(), $definition->getIndex());\n\n return new self(\"Optional sequence cannot be followed by anything else:\\n$pointer\");\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Avro array. Represented as vanilla arrays.
[ "function ArrayType(attrs, opts) {\n Type.call(this);\n\n if (!attrs.items) {\n throw new Error(f('missing array items: %j', attrs));\n }\n this._items = createType(attrs.items, opts);\n}" ]
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Validates the URL :param url: :return:
[ "def validate_url(url):\n \n if validators.url(url):\n return url\n elif validators.domain(url):\n return \"http://{}\".format(url)\n return \"\"" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Checks that the resource is not locked by another user.<p> @param resource the resource @return true if the resource is not locked by another user @throws CmsException if something goes wrong
[ "private boolean checkLock(CmsResource resource) throws CmsException {\n\n CmsLock lock = m_cms.getLock(resource);\n return lock.isUnlocked() || lock.getUserId().equals(m_cms.getRequestContext().getCurrentUser().getId());\n }" ]
[ "protected static RuntimeException unsettable(String view, String attribute, boolean create) {\n // This matches the behavior of the real file system implementations: if the attempt to set the\n // attribute is being made during file creation, throw UOE even though the attribute is one\n // that cannot be ...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Computer Science:" }
// // // Batch Functions // //
[ "func LinearRegression(xData, yData []float64) (slope, intercept, rsquared float64,\n\tcount int, slopeStdErr, interceptStdErr float64) {\n\tvar r Regression\n\tr.UpdateArray(xData, yData)\n\tss_xy := r.n*r.sxy - r.sx*r.sy\n\tss_xx := r.n*r.sxx - r.sx*r.sx\n\tss_yy := r.n*r.syy - r.sy*r.sy\n\tslope = ss_xy / ss_xx\...
[ "public static function ws()\n {\n if (!isset(self::core()->soap)) {\n //====================================================================//\n // WEBSERVICE INITIALISATION\n //====================================================================//\n // Initial...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns the headers as a string. @return string
[ "public static function toHeader($headers, $options = [])\n {\n $data = [];\n foreach ($headers as $key => $header) {\n $data[] = $header->to('header', $options);\n }\n return $data ? join(self::EOL, $data) : '';\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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// getGodelVersion returns the Version returned by "{{projectDir}}/godelw version".
[ "func getGodelVersion(projectDir string) (godelVersion, error) {\n\tgodelw := path.Join(projectDir, \"godelw\")\n\tcmd := exec.Command(godelw, \"version\")\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\treturn godelVersion{}, errors.Wrapf(err, \"failed to execute command %v: %s\", cmd.Args, string(output))\...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
omega2 < omega < omega3
[ "def _n_2(self):\n \"\"\"\"\"\"\n return (self._f(3, 1) * self._f(2, 1) +\n self._f(3, 0) * self._f(1, 3) * self._f(2, 1) +\n self._f(3, 0) * self._f(2, 0) * self._f(1, 2))" ]
[ "final static function sn(M $m) {return dfcf(function(M $m) {return df_new(\n\t\tdf_con_heir($m, __CLASS__), $m\n\t);}, [$m]);}" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
-----------------------------------------------------------------------
[ "long calculateFirstDayOfYearMillis(int year) {\n // Java epoch is 1970-01-01 Gregorian which is 1686-04-23 Coptic.\n // Calculate relative to the nearest leap year and account for the\n // difference later.\n\n int relativeYear = year - 1687;\n int leapYears;\n if (relativ...
[ "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 instruction about language and writing:", "pos": "Represent the code about language and writing:", "neg": "Represent the code:" }
Remove the last action.
[ "public void removeLast() {\n\t\tif (this.numTypesProperty.get()>0) {\n\t\t\tswitch(this.types[this.numTypesProperty.get()-1]) {\n\t\t\tcase CLOSE:\n\t\t\t\t// no coord to remove\n\t\t\t\tbreak;\n\t\t\tcase MOVE_TO:\n\t\t\tcase LINE_TO:\n\t\t\t\tthis.numCoordsProperty.set(this.numCoordsProperty.get()-3);\n\t\t\t\tb...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add the viewport meta tag if not disabled from context-param @param root @param context @param isProduction
[ "private void addMetaTags(UIViewRoot root, FacesContext context) {\n\t\t// Check context-param\n\t\tString viewportParam = BsfUtils.getInitParam(C.P_VIEWPORT, context);\n\n\t\tviewportParam = evalELIfPossible(viewportParam);\n\t\tString content = \"width=device-width, initial-scale=1\";\n\t\tif (!viewportParam.isEm...
[ "def init():\n \"\"\"\"\"\"\n\n from metapack.appurl import SearchUrl\n import metapack as mp\n from os import environ\n\n SearchUrl.initialize() # This makes the 'index:\" urls work\n mp.Downloader.context.update(environ)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Extracted from https://github.com/romelgomez/angular-firebase-image-upload/blob/master/app/scripts/fileUpload.js#L89
[ "function (imagen, width, height, quality, type, ratio, centerCrop, resizeIf) {\n var deferred = $q.defer();\n var canvasElement = document.createElement('canvas');\n var imageElement = document.createElement('img');\n imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000'...
[ "def activate_script(self):\n \"\"\"\"\"\"\n\n # must be rethought\n # ./scripts\n # deploydir/./scripts\n self._add_scope(\"script\")\n self.scripts = {}\n self.script_files = [\n \"./scripts/script_*.txt\", \"~/.cloudmesh/scripts/script_*.txt\"]\n ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns all the cp definition grouped entries where CPDefinitionId = &#63;. @param CPDefinitionId the cp definition ID @return the matching cp definition grouped entries
[ "@Override\n\tpublic List<CPDefinitionGroupedEntry> findByCPDefinitionId(\n\t\tlong CPDefinitionId) {\n\t\treturn findByCPDefinitionId(CPDefinitionId, QueryUtil.ALL_POS,\n\t\t\tQueryUtil.ALL_POS, null);\n\t}" ]
[ "public List<Symbol> getSymbolList(final String param) {\n return get(param, new StringToSymbolList(\",\"),\n new AlwaysValid<List<Symbol>>(),\n \"comma-separated list of strings\");\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Documentation:" }
{dynamic_docstring}
[ "def Peripheral(self, data=None, subset=None):\n \"\"\"\"\"\"\n return self.factory.get_object(jssobjects.Peripheral, data, subset)" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Updates the progress bar to a new value.
[ "def update(self, value):\n \"\"\n if value <= 0.1:\n value = 0\n assert 0 <= value <= self.maxval\n self.currval = value\n if not self._need_update() or self.finished:\n return\n if not self.start_time:\n self.start_time = time.time()\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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Fire the event for the changes of the user data associated to a node. @param event is the event ot fire.
[ "void firePropertyDataChanged(TreeDataEvent event) {\n\t\tif (this.nodeListeners != null) {\n\t\t\tfor (final TreeNodeListener listener : this.nodeListeners) {\n\t\t\t\tif (listener != null) {\n\t\t\t\t\tlistener.treeNodeDataChanged(event);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinal N parent = getParentNode();\n\t\tif (...
[ "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:" }
Creates an auto-login key for the current user, this key is restricted by time and ip address. @return string the key @since Moodle 3.2
[ "public static function get_autologin_key() {\n global $USER;\n // Delete previous keys.\n delete_user_key('tool_mobile', $USER->id);\n\n // Create a new key.\n $iprestriction = getremoteaddr();\n $validuntil = time() + self::LOGIN_KEY_TTL;\n return create_user_key('...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// Kick mocks base method
[ "func (m *MockNetworkEntity) Kick(ctx context.Context) error {\n\tret := m.ctrl.Call(m, \"Kick\", ctx)\n\tret0, _ := ret[0].(error)\n\treturn ret0\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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Like distance_of_time_in_words, but where to_time is fixed to timestamp() @param $from_time String or DateTime @param bool $include_seconds @param bool $include_months @return mixed
[ "function timeAgoInWords($from_time, $include_seconds = false, $include_months = false)\n {\n return $this->distanceOfTimeInWordsFilter($from_time, new \\DateTime('now'), $include_seconds, $include_months);\n }" ]
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Removes an area. @param Area $area
[ "public function removeArea(Area $area)\n {\n if ($this->areas->contains($area)) {\n $this->areas->removeElement($area);\n }\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
error(message: string) Prints a usage message incorporating the message to stderr and exits. If you override this in a subclass, it should not return -- it should either exit or raise an exception.
[ "def error(self, message):\r\n \r\n self.print_usage(_sys.stderr)\r\n self.exit(2, _('%s: error: %s\\n') % (self.prog, message))" ]
[ "def __do_parse(self, pattern_str):\n \n in_ = antlr4.InputStream(pattern_str)\n lexer = STIXPatternLexer(in_)\n lexer.removeErrorListeners() # remove the default \"console\" listener\n token_stream = antlr4.CommonTokenStream(lexer)\n\n parser = STIXPatternParser(token_str...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }