query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Generate a NurbGeometry from a node in FBXTree.Objects.Geometry | [
"function ( geoNode ) {\n\n\t\t\tif ( THREE.NURBSCurve === undefined ) {\n\n\t\t\t\tconsole.error( 'THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry.' );\n\t\t\t\treturn new THREE.BufferGeometry();\n\n\t\t\t}\n\n\t\t\tvar order = parseIn... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
save uploaded file(s)
@param mixed if int, $files element to move. if array, list of elements to move, if none, move all elements
@param string path to move to
@return void | [
"public static function save()\n\t{\n\t\t// storage for arguments\n\t\t$path = null;\n\t\t$ids = array();\n\n\t\t// do we have any arguments\n\t\tif (func_num_args())\n\t\t{\n\t\t\t// process them\n\t\t\tforeach (func_get_args() as $arg)\n\t\t\t{\n\t\t\t\tif (is_string($arg))\n\t\t\t\t{\n\t\t\t\t\t$path = $arg;\n\t... | [
"public function remove_field($name){\n\t\t$ind = $this->is_field($name);\n\t\tif ($ind==-1) throw new Exception('There was no such data field registered as: '.$name);\n\t\tarray_splice($this->text,$ind,1);\n\t\t//we not deleting field from $data collection, so it will not be included in data operation, but its dat... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
:param set_point: a float for the set point value in celsius
:return: nothing | [
"def set_temperature(self, set_point):\n \n response = self.api_interface.set_device_state(self, {\n \"desired_state\": {'set_point': set_point}\n })\n\n self._update_state_from_response(response)"
] | [
"def set_prop(self, prop, value, ef=None):\n \n if ef:\n # prop should be restricted to n_decoys, an int, the no. of decoys corresponding to a given FPF.\n # value is restricted to the corresponding enrichment factor and should be a float\n self.ef[prop] = value\n ... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// GetAllAWSAppSyncFunctionConfigurationResources retrieves all AWSAppSyncFunctionConfiguration items from an AWS CloudFormation template | [
"func (t *Template) GetAllAWSAppSyncFunctionConfigurationResources() map[string]*resources.AWSAppSyncFunctionConfiguration {\n\tresults := map[string]*resources.AWSAppSyncFunctionConfiguration{}\n\tfor name, untyped := range t.Resources {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSAppSyncFunct... | [
"@Override\n public List<EventExecution> getEventExecutions(String eventHandlerName, String eventName, String messageId, int max) {\n throw new UnsupportedOperationException(\"This method is not implemented in CassandraExecutionDAO. Please use ExecutionDAOFacade instead.\");\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// SetProductViewSummaries sets the ProductViewSummaries field's value. | [
"func (s *SearchProductsOutput) SetProductViewSummaries(v []*ProductViewSummary) *SearchProductsOutput {\n\ts.ProductViewSummaries = v\n\treturn s\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Check available name for service
@param string $serviceType
@return string
@throw RuntimeException | [
"protected function checkServiceType($serviceType)\n {\n $reflection = new \\ReflectionObject($this);\n $constants = $reflection->getConstants();\n if (!in_array($serviceType, $constants)) {\n throw new RuntimeException('The type of service does not support: ' . $serviceType);\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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
later when maps are built for variant box schemas. | [
"private void recordOnePair(JSField access, JSchema accSchema, JSField encoding,\n JSchema encSchema)\n {\n int acc = access.getAccessor(accSchema);\n if (acc >= indices.length)\n return;\n indices[acc] = encoding.getAccessor(encSchema);\n }"
] | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Get postcode from coordinates
@params string $lon, $lat the coordinates
@return object | null on Exception | [
"public function reverseGeocode($lon, $lat)\n {\n $url = '/postcodes?lon=' . (float) $lon . '&lat=' . (float) $lat;\n $request = new Request('GET', $url);\n\n return $this->httpTransport($request);\n }"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Runtime errors that do not require immediate action but should typically
be logged and monitored.
@param string|array $channel
@param string|array $message
@param array $context
@return static
@throws \Exception | [
"public function error($channel, $message, array $context = [])\n {\n $this->log($channel, LogLevel::ERROR, $message, $context);\n\n return $this;\n }"
] | [
"public function trace()\n {\n //====================================================================//\n // Safety Check\n if (!isset($this->debug) || !$this->debug) {\n return;\n }\n //====================================================================//\n ... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
{@inheritDoc}
@param VariantInterface[] $variants Variants to choose from | [
"public function chooseVariant($variants)\n {\n if (array_key_exists($this->choice, $variants)) {\n return $variants[$this->choice];\n }\n\n return null;\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the post about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code:"
} |
Initialize import context
@param DataProviderInterface $dataProvider
@throws Exception | [
"public function initialize(DataProviderInterface $dataProvider)\n {\n $this->dataProvider = $dataProvider;\n $contextConfiguration = ['workspaceName' => 'live', 'invisibleContentShown' => true];\n $context = $this->contextFactory->create($contextConfiguration);\n $this->rootNode = $c... | [
"@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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Add a global scope to the model. But we have to handle the different
scenario, as Laravel 5.1 has a different way compared to all other
versions.
@param string $type
@return void | [
"protected static function handleGlobalScope($type)\n {\n if (Eye::laravelVersionIs('>=', '5.2.0')) {\n static::addGlobalScope('type', function (Builder $builder) use ($type) {\n $builder->where('type', $type);\n });\n } else {\n static::addGlobalScop... | [
"public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //... | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software Development:"
} |
Produce a TopNumber, with a length to match the given assignment
class, based on an input hex string.
This can be used to create TopNumbers from a hash of a string. | [
"def from_hex(cls, h, space, assignment_class='self'):\n \n\n from math import log\n\n # Use the ln(N)/ln(base) trick to find the right number of hext digits\n # to use\n\n hex_digits = int(\n round(log(62 ** TopNumber.DLEN.DATASET_CLASSES[assignment_class]) / log(16),... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github post about Blockchain:",
"pos": "Represent the Github code about Blockchain:",
"neg": "Represent the Github code about programming:"
} |
Save the oembed data in the bag.
@param Response $response | [
"private function extractOembed(Response $response)\n {\n // extract from xml\n if (($response->getUrl()->getExtension() === 'xml') || ($response->getUrl()->getQueryParameter('format') === 'xml')) {\n if ($xml = $response->getXmlContent()) {\n foreach ($xml as $element) {\... | [
"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 sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Refresh the current page. | [
"public function refresh()\n {\n $this->getDriver()->curl($this->getDriver()->factoryCommand('refresh', WebDriver_Command::METHOD_POST));\n return $this;\n }"
] | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
For custom_json ops. | [
"def json_expand(json_op):\n \n if type(json_op) == dict and 'json' in json_op:\n return update_in(json_op, ['json'], safe_json_loads)\n\n return json_op"
] | [
"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:"
} |
从结果集中获取下一行
@param integer $fetchStyle
@param integer $cursorOrientation
@param integer $cursorOffset
@return mixed | [
"public function fetch(int $fetchStyle = \\PDO::FETCH_ASSOC, int $cursorOrientation = \\PDO::FETCH_ORI_NEXT, int $cursorOffset = 0)\n {\n return $this->statement->fetch($fetchStyle, $cursorOrientation, $cursorOffset);\n }"
] | [
"static function position($name, $value=null, $settings=[])\n {\n if (!isset($settings['description'])) {\n $settings['description'] = '位置可设为:1到9的数字表示九宫格的位置, 或100|30, 或 center|center, 或100|left';\n }\n \n return static::input('text', $name, $value, $settings);\n }"
] | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@SuppressWarnings(\"unchecked\")\r\n\t@Override\r\n\tpublic EList<IfcParameterValue> getList() {\r\n\t\treturn (EList<IfcParameterValue>) eGet(Ifc4Package.Literals.LIST_OF_IFC_PARAMETER_VALUE__LIST, true);\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 sentence about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Rename file.
@param String $bucketName
@param String $bucketId //For feature compatibility
@param String $fileName
@param String $targetBucketId
@param String $newFileName
@param bool $private
@return bool | [
"public function rename($bucketName, $bucketId, $fileName, $targetBucketId, $newFileName, $private = false)\n {\n $data = $this->get($bucketName, $fileName, $private, false);\n if (is_array($data) && array_key_exists('x-bz-file-id', $data['headers'])) {\n $result = $this->insert($targetB... | [
"public static function updateFolder($bucketName, $path, $bizAttr = null) {\n $path = self::normalizerPath($path, True);\n\n return self::updateBase($bucketName, $path, $bizAttr);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software Development:"
} |
This method reads all Sources from the eFapsDataBase and returns for each
Source a Instance of AbstractSource in a List.
@return List with AbstractSources
@throws EFapsException on error | [
"protected List<T> readSources()\n throws EFapsException\n {\n final List<T> ret = new ArrayList<>();\n final QueryBuilder queryBldr = new QueryBuilder(getClassName4Type());\n final MultiPrintQuery multi = queryBldr.getPrint();\n multi.addAttribute(CIAdminProgram.Abstract.Name)... | [
"@Override\n public List findByRange(byte[] muinVal, byte[] maxVal, EntityMetadata m, boolean isWrapReq, List<String> relations,\n List<String> columns, List<IndexExpression> conditions, int maxResults) throws Exception {\n throw new UnsupportedOperationException(\"Support available only for thrift... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Parse a font size keyword or numerical value | [
"private static Length parseFontSize(String val)\r\n {\r\n try {\r\n Length size = FontSizeKeywords.get(val);\r\n if (size == null)\r\n size = parseLength(val);\r\n return size;\r\n } catch (SVGParseException e) {\r\n return null;\r\n }\r\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 text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// Key returns the unique identifier for a VserverEntry. | [
"func (v *VserverEntry) Key() string {\n\treturn fmt.Sprintf(\"%d/%s\", v.Port, v.Proto)\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 Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
SagaModel constructor
@param {String} id The saga id.
@constructor | [
"function SagaModel (id) {\n if (!id || !_.isString(id)) {\n var err = new Error('No id injected!');\n debug(err);\n throw err;\n }\n\n this.attributes = {};\n\n this.id = id;\n\n this.destroyed = false;\n\n this.commandsToSend = [];\n\n this.actionOnCommit = 'create';\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
[TARGET listSinks(ListOption...)] | [
"public Page<Sink> listSinks() {\n // [START logging_list_sinks]\n Page<Sink> sinks = logging.listSinks(ListOption.pageSize(100));\n for (Sink sink : sinks.iterateAll()) {\n // do something with the sink\n }\n // [END logging_list_sinks]\n return sinks;\n }"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Step.
@param state the state
@param ch1 the ch 1
@param ch2 the ch 2
@return the double[][] | [
"private double[][] _step(double[][] state, char ch1, char ch2) {\n double cost;\n _shift(state);\n state[2][0] = state[1][0] + deletionDistance;\n for (int i = 0; i < morseBase.length(); i++) {\n cost = (morseBase.charAt(i) == ch1) ? 0 : replaceDistance;\n state[2][i + 1] = Math.min(state[2][... | [
"def getValue(words):\n \"\"\"\"\"\"\n value = 0\n for word in words:\n for letter in word:\n # shared.getConst will evaluate to the dictionary broadcasted by\n # the root Future\n value += shared.getConst('lettersValue')[letter]\n return value"
] | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Natural Language Processing:"
} |
The json must look like this:
{
"messages": 10,
"requested": 1,
"subscribers": 100,
"last_message_id": "1504818382:1"
}
@param string $json
@return ChannelInformation
@throws NchanException | [
"public static function fromJson(string $json): ChannelInformation\n {\n $response = json_decode($json, true);\n\n if (!is_array($response)) {\n throw new NchanException('Unable to parse JSON response: ' . json_last_error_msg());\n }\n\n // Check if required keys exists in ... | [
"def tempo_account_add_account(self, data=None):\n \n url = 'rest/tempo-accounts/1/account/'\n if data is None:\n return \"\"\"Please, provide data e.g.\n {name: \"12312312321\",\n key: \"1231231232\",\n lead: {name: \... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
修正矩形框位置,如果{@link Img#setPositionFromCentre(boolean)} 设为{@code true},则坐标修正为基于图形中心,否则基于左上角
@param rectangle 矩形
@param baseWidth 参考宽
@param baseHeight 参考高
@return 修正后的{@link Rectangle}
@since 4.1.15 | [
"private Rectangle fixRectangle(Rectangle rectangle, int baseWidth, int baseHeight) {\r\n\t\tif (this.positionBaseCentre) {\r\n\t\t\t// 修正图片位置从背景的中心计算\r\n\t\t\trectangle.setLocation(//\r\n\t\t\t\t\trectangle.x + (int) (Math.abs(baseWidth - rectangle.width) / 2), //\r\n\t\t\t\t\trectangle.y + (int) (Math.abs(baseHei... | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about text processing:"
} |
Report metrics about the volume space usage | [
"def _report_disk_stats(self):\n \"\"\"\"\"\"\n stats = {\n 'docker.data.used': None,\n 'docker.data.total': None,\n 'docker.data.free': None,\n 'docker.metadata.used': None,\n 'docker.metadata.total': None,\n 'docker.metadata.free': No... | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Send apidoc files from the apidoc folder to the browser.
:param path: the apidoc file. | [
"def __send_static_file(self, path=None):\n \n\n if not path:\n path = 'index.html'\n\n file_name = join(self.folder_path, path)\n\n # the api_project.js has the absolute url\n # hard coded so we replace them by the current url.\n if self.dynamic_url and path == ... | [
"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:"
} |
Searches through the file/dir entries of the current
directory, and returns True if a physical entry with the given
name could be found.
@see rentry_exists_on_disk | [
"def entry_exists_on_disk(self, name):\n \n try:\n d = self.on_disk_entries\n except AttributeError:\n d = {}\n try:\n entries = os.listdir(self._abspath)\n except OSError:\n pass\n else:\n for e... | [
"def new_dir(self, name):\n # type: (bytes) -> None\n '''\n \n '''\n if self._initialized:\n raise pycdlibexception.PyCdlibInternalError('Path Table Record already initialized')\n\n # Zero for the parent dir num is bogus, but that will get fixed later.\n s... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Get a list of all courses limited by ids if required.
@param array|false $limitcourseids An array of course ids to limit the search to. False for no limiting.
@return array | [
"protected function get_all_courses($limitcourseids) {\n global $DB;\n\n if ($limitcourseids) {\n list ($coursesql, $courseparams) = $DB->get_in_or_equal($limitcourseids);\n $coursesql = 'id ' . $coursesql;\n } else {\n $coursesql = '';\n $courseparam... | [
"public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// Open initializes the kafka source. | [
"func (s *Source) Open() error {\n\t// init (custom) config, enable errors and notifications\n\tsarama.Logger = log.New(ioutil.Discard, \"\", 0)\n\tconfig := cluster.NewConfig()\n\tconfig.Config.Version = sarama.V0_10_0_0\n\tconfig.Consumer.Return.Errors = true\n\tconfig.Consumer.Offsets.Initial = sarama.OffsetOlde... | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
新增校验规则
@param string $field
@param callable $rule
@param mixed $params
@param null|string $message
@return \Mellivora\Validation\Validator | [
"public function rule($field, callable $rule, $params = null, $message = null)\n {\n if ($message === null) {\n $message = $params;\n $params = [];\n }\n\n $this->rules[] = [$field, $rule, $params, $message];\n\n return $this;\n }"
] | [
"public function setNextName ($name) {\n\t\tif (!isset($this->rule->next[$name])) {\n\t\t\tthrow \\ickx\\fw2\\core\\exception\\CoreException::RaiseSystemError('実在しないnext nameを指定されました。name:%s', [$name]);\n\t\t}\n\t\t$this->nextName = $name;\n\t}"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Add turbolinks options when it's enabled
@see ActionView::Helpers::AssetTagHelper#stylesheet_link_tag
@param sources [Array<String>] source name under `app/assets/stylesheets`
@return [String] a list of stylesheet link tags | [
"def stylesheet_link_tag(*sources)\n default_options =\n if features.turbolinks_enabled then { 'data-turbolinks-track' => true }\n else {}\n end\n options = default_options.merge!(sources.extract_options!.stringify_keys)\n super(*sources, options)\n end"
] | [
"def attributes_properties(**options)\n options_set = Set.new options.keys.map(&:to_s)\n\n unless options_set.subset? Set.new(@fields)\n fail \"You have to provide correct attribute names in\" +\n \"'attributes_properties' for '#{@model}'.\"\n end\n\n # TODO: Check for valid v... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// InsertSpendingAddressRow inserts a new spending tx row, and updates any
// corresponding funding tx row. | [
"func InsertSpendingAddressRow(db *sql.DB, fundingTxHash string,\n\tfundingTxVoutIndex uint32, fundingTxTree int8, spendingTxHash string,\n\tspendingTxVinIndex uint32, vinDbID uint64, utxoData *dbtypes.UTXOData,\n\tchecked, updateExisting, isValidMainchain bool,\n\ttxType int16, updateFundingRow bool, spendingTXBlo... | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github description about Address:",
"pos": "Represent the Github code about Address:",
"neg": "Represent the Github code about Software development:"
} |
TODO 数据模型为对象而不仅仅是Map | [
"@Deprecated\n\tpublic static void debug(XWPFTemplate template, Map<String, Object> datas) {\n\t\tList<ElementTemplate> all = template.getElementTemplates();\n\t\tLOGGER.debug(\"Template tag number is:{}\", (null == all ? 0 : all.size()));\n\t\tif ((all == null || all.isEmpty()) && (null == datas || datas.isEmpty()... | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about text processing:"
} |
Write docProps/custom.xml to XML format
@param PHPExcel $pPHPExcel
@return string XML Output
@throws PHPExcel_Writer_Exception | [
"public function writeDocPropsCustom(PHPExcel $pPHPExcel = null)\n\t{\n\t\t$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();\n\t\tif (empty($customPropertyList)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Create XML writer\n\t\t$objWriter = null;\n\t\tif ($this->getParentWriter()->getUseDiskCaching()... | [
"public static function newDocumentPHP($markup = null, $contentType = \"text/html\") \n {\n // TODO pass charset to phpToMarkup if possible (use DOMDocumentWrapper function)\n $markup = phpQuery::phpToMarkup($markup, self::$defaultCharset);\n return self::newDocument($markup, $contentType);\... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Adds a label to the labels collection
@param string $text
@param bool $isPlain
@param string $lang
@return void | [
"public function addLabel($text, $isPlain = true, $lang = 'en')\n {\n $this->labels[$lang] = new Label($text, $this->getLocaleKey(), $isPlain, $lang, $this->name);\n }"
] | [
"function openTable()\n {\n $this->examples = [];\n $this->markdown = ''; // Clear table\n $this->declareAbstraction = true;\n $this->add('| Visibility | Function |');\n $this->add('|:-----------|:---------|');\n }"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Ensure that the View has a DOM element to render into. If `this.el` is a string, pass it through `$()`, take the first matching element, and re-assign it to `el`. Otherwise, create an element from the `id`, `className` and `tagName` properties. | [
"function() {\n\t if (!this.el) {\n\t var attrs = langx.mixin({}, langx.result(this, 'attributes'));\n\t if (this.id) attrs.id = langx.result(this, 'id');\n\t if (this.className) attrs['class'] = langx.result(this, 'className');\n\t this.setElement(this._createElement(langx.result(t... | [
"function (renderer, nodeName) {\n\t\tvar wrapper = this;\n\t\twrapper.element = nodeName === 'span' ?\n\t\t\tcreateElement(nodeName) :\n\t\t\tdoc.createElementNS(SVG_NS, nodeName);\n\t\twrapper.renderer = renderer;\n\t\t/**\n\t\t * A collection of attribute setters. These methods, if defined, are called right befo... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
// update applies changes from the provided config to the env config.
// Changes to any immutable attributes result in an error. | [
"func (c *environConfig) update(cfg *config.Config) error {\n\t// Validate the updates. newValidConfig does not modify the \"known\"\n\t// config attributes so it is safe to call Validate here first.\n\tif err := config.Validate(cfg, c.Config); err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\tupdates, err := ne... | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Generates Procfiles which can be used with honcho or foreman. | [
"def gen_procfile(ctx, wsgi, dev):\n \n if wsgi is None:\n if os.path.exists(\"wsgi.py\"):\n wsgi = \"wsgi.py\"\n elif os.path.exists(\"app.py\"):\n wsgi = \"app.py\"\n else:\n wsgi = \"app.py\"\n ctx.invoke(gen_apppy)\n\n def write_procfile(... | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
/*
Turn any data into element | [
"function anyToElem(data, ind) {\n // const type = typeof data;\n return (<span\n key={ind}\n style={defaultItemStyle}\n >\n <Inspector\n theme={{\n ...chromeDark,\n BASE_BACKGROUND_COLOR: '#4e4e4e',\n OBJECT_VALUE_NUMBER_COLOR: '#8c85bd',\n OBJECT_VALU... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Filters by user ID of collection (using the uID field).
@param mixed $uID | [
"public function filterByUserID($uID)\n {\n if ($this->includeAliases) {\n $db = Loader::db();\n $quID = $db->quote($uID);\n $this->filter(false, \"(p1.uID = {$quID} or p2.uID = {$quID})\");\n } else {\n $this->filter('p1.uID', $uID);\n }\n }"
] | [
"def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Check if is on test or installing WordPress
or not using themes (typically running inside Laravel)
@return bool | [
"private static function isUnableToRunPlugins()\n\t{\n\t\tif (defined('WELOQUENT_TEST_ENV')\n\t\t\t|| defined('WP_INSTALLING')\n\t\t\t|| (defined('WP_USE_THEMES') && WP_USE_THEMES === false)\n || (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST === true)\n )\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\tre... | [
"protected static function showOutro($projectRoot = 'n.a.')\n {\n \\cli\\line();\n \\cli\\line(\\cli\\Colors::colorize('%nEnjoy developing with %yDoozr%n'));\n \\cli\\line('To maintain your app you can now run %k%Uphp app/console%n%N from your project');\n \\cli\\line('root: %k%U'.$pr... | codesearchnet | {
"query": "Represent the instruction about NLP:",
"pos": "Represent the code about NLP:",
"neg": "Represent the code about Software development:"
} |
Removes rows that match a filter
@param *string|null $table The table name
@param array|string $filters Filters to test against
@return AbstractSql | [
"public function deleteRows($table, $filters = null)\n {\n $query = $this->getDeleteQuery($table);\n\n //array('post_id=%s AND post_title IN %s', 123, array('asd'));\n if (is_array($filters)) {\n //can be array of arrays\n if (is_array($filters[0])) {\n f... | [
"@Override\n\tpublic void showHelp(final Terminal terminal) {\n\t\tterminal.writer().println(\"\\t\" + this.toString() + \": generate sql to access the table.\");\n\t\tterminal.writer().println(\n\t\t\t\t\"\\t\\tex) generate [select/insert/update/delete] [table name]<Enter> : Show sql to access tables according to ... | codesearchnet | {
"query": "Represent the Github sentence about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Check that the configuration parameter are setted correctly.
@param {object} config - plugin configurations.
@returns {boolean} return true if the parameters are set correctly. | [
"function isConfigurationParametersDefinedCorrectly(config) {\n\t\tif (!config) {\n\t\t\tgutil.log('license-check', gutil.colors.red('Config must be defined to run the plugin'));\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!config.path) {\n\t\t\tgutil.log('license-check', gutil.colors.red('License header property {path}... | [
"function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L... | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
// UnmarshalJSON sets the object from the provided JSON representation | [
"func (l *IAMUserLoginProfileList) UnmarshalJSON(buf []byte) error {\n\t// Cloudformation allows a single object when a list of objects is expected\n\titem := IAMUserLoginProfile{}\n\tif err := json.Unmarshal(buf, &item); err == nil {\n\t\t*l = IAMUserLoginProfileList{item}\n\t\treturn nil\n\t}\n\tlist := []IAMUser... | [
"@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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
rebalanceMqList must run after commit
@throws MQClientException | [
"public void rebalanceMqList() throws Exception {\n\t\tLOG.info(\"Begin to do rebalance operation\");\n\t\tSet<MessageQueue> newMqs = getMQ();\n\t\t\n\t\tSet<MessageQueue> oldMqs = currentOffsets.keySet();\n\t\t\n\t\tif (oldMqs.equals(newMqs) == true) {\n\t\t\tLOG.info(\"No change of meta queues \" + newMqs);\n\t\t... | [
"public List<String> getScheduledNotificationMessage(ScheduledNotification notification) {\n return broker.callRPCList(\"RGCWXQ SCHMSG\", null, notification.getIen());\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Get a map of all plugins from all repos where key is plugin id.
@return List of plugin info | [
"public Map<String, PluginInfo> getPluginsMap() {\n Map<String, PluginInfo> pluginsMap = new HashMap<>();\n for (UpdateRepository repository : getRepositories()) {\n pluginsMap.putAll(repository.getPlugins());\n }\n\n return pluginsMap;\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Run the application and send the response.
@return void | [
"public function run()\n\t{\n\t\t// Start handling errors before doing anything else\n\t\tif ($this->has('error'))\n\t\t{\n\t\t\tarray_walk($this->serviceProviders, function($p)\n\t\t\t{\n\t\t\t\tif (method_exists($p, 'startHandling'))\n\t\t\t\t{\n\t\t\t\t\treturn $p->startHandling();\n\t\t\t\t}\n\t\t\t});\n\t\t}\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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Refresh entries in <b>PrintablePage</b>. It is called after change type
of view or check/uncheck any CalendarSource in Print dialog. | [
"private void updatePrintVisibility() {\n\t\tPrintablePage printablePage = printView.getPreviewPane()\n\t\t\t\t.getPrintablePage();\n\n\t\tif (printablePage.getViewType() == ViewType.DAY_VIEW) {\n\t\t\tprintablePage.getDayView().refreshData();\n\t\t} else if (printablePage.getViewType() == ViewType.WEEK_VIEW) {\n\t... | [
"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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Load compiler object
@throws \SmartyException | [
"public function loadCompiler()\n {\n if (!class_exists($this->source->handler->compiler_class)) {\n $this->smarty->loadPlugin($this->source->handler->compiler_class);\n }\n $this->compiler = new $this->source->handler->compiler_class($this->source->handler->template_lexer_class,\... | [
"public function logBanner($additions = null)\n {\n $this->addStatusMessage('FlexiBee '.str_replace('://',\n '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\\Ease\\Atom::$frameworkVersion.' '.$additio... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
we need to catch ZNONODE because children might be removed whilst we
are iterating (specially ephemeral znodes) | [
"def _watch(self, path, current_level, max_level):\n \n\n # ephemeral znodes can't have children, so skip them\n stat = self._client.exists(path)\n if stat is None or stat.ephemeralOwner != 0:\n return\n\n try:\n children = self._client.get_children(path, sel... | [
"def _wait_until_machine_finish(self):\n \n self.image._wait_for_machine_finish(self.name)\n # kill main run process\n self.start_process.kill()\n # TODO: there are some backgroud processes, dbus async events or something similar, there is better to wait\n # to provide enou... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param string $key
@return mixed
@throws OffsetNotFound | [
"public function getShared(string $key)\n {\n if(!$this->isShared($key)) {\n throw new OffsetNotFound(\"Trying to get a shared offset that doesn't exist\");\n }\n\n return $this[self::REFLECTOR_SHARED][$key];\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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Initialize all dates properties | [
"def _init_dates(self):\n \n if self.total_transactions == 0:\n return None\n self.epoch_start = Result.select(Result.epoch).order_by(Result.epoch.asc()).limit(1).get().epoch\n self.epoch_finish = Result.select(Result.epoch).order_by(Result.epoch.desc()).limit(1).get().epoch\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// NewStartWorkerArgs initializes StartWorkerArgs with the required arguments. | [
"func NewStartWorkerArgs(scopeURL string) *StartWorkerArgs {\n\targs := new(StartWorkerArgs)\n\targs.ScopeURL = scopeURL\n\treturn args\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 instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Update relation data.
@param array $relationsData
@return void | [
"protected function updateRelation($relationsData)\n {\n foreach ($relationsData as $name => $values) {\n if (!method_exists($this->model, $name)) {\n continue;\n }\n\n $relation = $this->model->$name();\n\n $oneToOneRelation = $relation instanceo... | [
"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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Redirect to shopping cart page upon successful login if the cart exists.
@param Action $subject
@param ResultInterface $result
@return ResultInterface | [
"public function afterExecute($subject, $result)\n {\n\n try {\n // Pass through the original result if the customer is not logged in or the cart is empty\n if (!$this->shouldRedirectToCartPage()) {\n return $result;\n }\n\n // Set the flag in ses... | [
"function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT... | codesearchnet | {
"query": "Represent the text about e-commerce:",
"pos": "Represent the code about e-commerce:",
"neg": "Represent the code:"
} |
private static final Log log = LogFactory.getLog(HtmlMenuRenderer.class); | [
"public void encodeEnd(FacesContext facesContext, UIComponent component)\n throws IOException\n {\n RendererUtils.checkParamValidity(facesContext, component, null);\n \n Map<String, List<ClientBehavior>> behaviors = null;\n if (component instanceof ClientBehaviorHolder)\n ... | [
"protected Object readResolve() throws ObjectStreamException {\n Logger logger = LoggerFactory.getLogger(this.name);\n return new SLF4JLocationAwareLog((LocationAwareLogger) logger);\n }"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Register bindings in the container.
@return void | [
"public function register()\n {\n $this->mergeConfigFrom(\n __DIR__.'/config/easychimp.php', 'easychimp'\n );\n\n $this->app->bind(Easychimp::class, function ($app) {\n $config = $app['config']['easychimp'];\n return new Easychimp(new Mailchimp($config['apike... | [
"@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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Handle scaling and rotation of the surface | [
"def __handle_scale_rot(self):\n \"\"\"\"\"\"\n if self.__is_rot_pending:\n self.__execute_rot(self.untransformed_image)\n self.__is_rot_pending = False\n\n # Scale the image using the recently rotated surface to keep the orientation correct\n self.__execute... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the set of skins to use. This implementation parses the skinList.xml file and returns
the set of skin-key element values. If there is an error parsing the XML file, return an
empty set. | [
"@Override\n public SortedSet<String> getSkinNames(PortletRequest request) {\n // Context to access the filesystem\n PortletContext ctx = request.getPortletSession().getPortletContext();\n\n // Determine the full path to the skins directory\n String skinsFilepath = ctx.getRealPath(loc... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
creates mx set of {@link denominator.model.rdata.MXData MX} records for the specified name and
ttl.
@param name ex. {@code denominator.io.}
@param mxdata {@code 1 mx1.denominator.io.} | [
"public static ResourceRecordSet<MXData> mx(String name, String mxdata) {\n return new MXBuilder().name(name).add(mxdata).build();\n }"
] | [
"def _init_prtfmt(self, key=\"fmta\"):\n \"\"\"\"\"\"\n prtfmt = self.gosubdag.prt_attr[key]\n return prtfmt.replace(\"{NS}\", \"{NS} {hdr1usr01:2} {num_usrgos:>4} uGOs\")"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
This method is intend to read a cookie with a previous stored locale-configuration (state).
@author Benjamin Carl <opensource@clickalicious.de>
@return bool TRUE on success, otherwise FALSE | [
"protected function readCookie()\n {\n if (isset($_COOKIE[self::$identifier])) {\n $storedSettings = explode(',', $_COOKIE[self::$identifier]);\n\n // locale\n if ($this->isValidLocaleCode($storedSettings[0]) &&\n $this->isValidLocaleCode($storedSettings[2])... | [
"public function check()\n {\n $result = false;\n\n $version = $this->dataService->getVersion();\n\n // Check the version. If this is > 0 then it seems to be a version number like 1.2.3\n // Because the getVersion method can return an error like\n // Warning: Identity file... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about NLP:"
} |
====Params
* <tt>options</tt> - Accepts the following options
** :type - 'Marriage', etc. REQUIRED
** :date - 'Utah, United States' (optional)
** :place - '16 Nov 1987' (optional) | [
"def add_event(options)\n self.events ||= []\n event = EventAssertion.new\n event.add_value(options)\n self.events << event\n end"
] | [
"def reminder_validator(input_str):\n \n match = re.match(REMINDER_REGEX, input_str)\n if match or input_str == '.':\n return input_str\n else:\n raise ValidationError('Expected format: <number><w|d|h|m> '\n '<popup|email|sms>. (Ctrl-C to exit)\\n')"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
https://developer.zendesk.com/rest_api/docs/core/user_fields#delete-user-field | [
"def user_field_delete(self, id, **kwargs):\n \"\"\n api_path = \"/api/v2/user_fields/{id}.json\"\n api_path = api_path.format(id=id)\n return self.call(api_path, method=\"DELETE\", **kwargs)"
] | [
"public static function get_metadata(collection $collection) : collection {\n $authfields = [\n 'timecreated' => 'privacy:metadata:auth_oauth2:timecreated',\n 'timemodified' => 'privacy:metadata:auth_oauth2:timemodified',\n 'usermodified' => 'privacy:metadata:auth_oauth2:user... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Remove duplicate GET parameters and clean & and duplicate &.
@param string $sUrl url to process.
@param string $sConnector GET elements connector.
@return string | [
"public function cleanUrlParams($sUrl, $sConnector = '&')\n {\n $aUrlParts = explode('?', $sUrl);\n\n // check for params part\n if (!is_array($aUrlParts) || count($aUrlParts) != 2) {\n return $sUrl;\n }\n\n $sUrl = $aUrlParts[0];\n $sUrlParams = $aUrlPart... | [
"public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Removes all of the elements of the specified collection from this queue.
:param items: (Collection), the specified collection.
:return: (bool), ``true`` if the call changed this queue, ``false`` otherwise. | [
"def remove_all(self, items):\n \n check_not_none(items, \"Value can't be None\")\n data_items = []\n for item in items:\n check_not_none(item, \"Value can't be None\")\n data_items.append(self._to_data(item))\n return self._encode_invoke(queue_compare_and_re... | [
"def node_iterator(self):\n \n return iter(self._node_attributes)\n\n\tdef has_hypernode(self, hypernode):\n \"\"\"Determines if a specific hypernode is present in the hypergraph.\n\n :param node: reference to hypernode whose presence is being checked.\n :returns: bool -- true iff... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// GetPartial fetches part of the blob in container.
// If length is negative, the rest of the object is returned.
// The caller must close rc. | [
"func (c *Client) GetPartial(ctx context.Context, container, key string, offset, length int64) (rc io.ReadCloser, err error) {\n\tif offset < 0 {\n\t\treturn nil, errors.New(\"invalid negative length\")\n\t}\n\n\treq := newReq(ctx, c.keyURL(container, key))\n\tif length >= 0 {\n\t\treq.Header.Set(\"Range\", fmt.Spr... | [
"function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ... | codesearchnet | {
"query": "Represent the Github instruction about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about File management:"
} |
Goes through, and assigns the value for each declared parameter to an accessor
with the same name, validating that required parameters are not missing | [
"def process_input(dest, args)\n # pass down predefined attributes.\n dest.parent = args[:parent]\n dest.test = args[:test]\n \n return unless validate_input(dest, args)\n\n @input.each do |param|\n sym = param[:symbol]\n if args.key? sym\n sym_assign = \"#{sym... | [
"def reify_from_row(row)\n #the tap method allows preconfigured methods and values to\n #be associated with the instance during instantiation while also automatically returning\n #the object after its creation is concluded.\n self.new.tap do |card|\n self.attributes.keys.each.with_index d... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Get value with optional default. | [
"def get(self, key, default=None):\n \"\"\"\"\"\"\n try:\n key = self.get_key(key)\n except KeyError:\n return default\n return super(DatasetDict, self).get(key, default)"
] | [
"def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))"
] | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Method
@param string $casing = 'upper'
@return string | [
"public static function method(String $casing = 'upper') : String\n {\n return mb_convert_case(Server::data('requestMethod'), Helper::toConstant($casing, 'MB_CASE_'));\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
//////////////////////////////////////////////////////////////////////////////////////////////////////////// | [
"function createReactClassName( artifact ) {\n 'use strict';\n return artifact.split( /[-_\\s]/ ).map( function( part, index ) {\n return part.charAt( 0 ).toUpperCase() + part.slice( 1 );\n } ).join( '' );\n}"
] | [
"private void readPacket(Results results) throws SQLException {\n Buffer buffer;\n try {\n buffer = reader.getPacket(true);\n } catch (IOException e) {\n throw handleIoException(e);\n }\n\n switch (buffer.getByteAt(0)) {\n\n //***********************************************************... | codesearchnet | {
"query": "Represent the Github sentence about language and writing:",
"pos": "Represent the Github code about language and writing:",
"neg": "Represent the Github code:"
} |
Explain aggregation
@deprecated use pipeline option 'explain' in Collection::aggregate() or method Pipeline::explain()
@param array|Pipeline $pipeline
@return array result
@throws Exception | [
"public function explainAggregate($pipeline)\n {\n if (version_compare($this->getDatabase()->getClient()->getDbVersion(), '2.6.0', '<')) {\n throw new Exception('Explain of aggregation implemented only from 2.6.0');\n }\n\n if ($pipeline instanceof Pipeline) {\n $pipeli... | [
"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:"
} |
@param array $fields
@return array | [
"private function parseQualityAndParameters(array $fields): array\n {\n $quality = 1;\n $qParamFound = false;\n $parameters = null;\n\n $count = \\count($fields);\n for ($idx = 1; $idx < $count; ++$idx) {\n $fieldValue = $fields[$idx];\n if (empty($fi... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
parse a string of acceptable colors into matplotlib, that is, either
strings, or three tuples of rgb. Don't quote strings. | [
"def parse_ctuple(s,length=2):\n '''\n '''\n if parse_utuple(s, colrx_s, length=length) is None:\n raise ValueError(\"{} is not a valid color tuple.\".format(s));\n #quote strings\n s=quote_subs(s,colorfix=True);\n return evalt(s);"
] | [
"def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i... | codesearchnet | {
"query": "Represent the Github instruction about Python programming:",
"pos": "Represent the Github code about Python programming:",
"neg": "Represent the Github code:"
} |
// AddSpread is used to add a new spread preference to a task group. | [
"func (g *TaskGroup) AddSpread(s *Spread) *TaskGroup {\n\tg.Spreads = append(g.Spreads, s)\n\treturn g\n}"
] | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Produce an Internet domain name with the specified number of
subdomain levels.
>>> domain_name()
nichols-phillips.com
>>> domain_name(2)
williamson-hopkins.jackson.com | [
"def domain_name(self, levels=1):\n \n if levels < 1:\n raise ValueError(\"levels must be greater than or equal to 1\")\n if levels == 1:\n return self.domain_word() + '.' + self.tld()\n else:\n return self.domain_word() + '.' + self.domain_name(levels - ... | [
"def cli(verbose):\n \n floyd.floyd_host = floyd.floyd_web_host = \"https://dev.floydhub.com\"\n floyd.tus_server_endpoint = \"https://upload-v2-dev.floydhub.com/api/v1/upload/\"\n configure_logger(verbose)\n check_cli_version()"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Returns the list of store defs as a map
@param storeDefs
@return | [
"private HashMap<String, StoreDefinition> makeStoreDefinitionMap(List<StoreDefinition> storeDefs) {\n HashMap<String, StoreDefinition> storeDefMap = new HashMap<String, StoreDefinition>();\n for(StoreDefinition storeDef: storeDefs)\n storeDefMap.put(storeDef.getName(), storeDef);\n r... | [
"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 about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Bootstrap the application services.
@return void | [
"public function boot()\n {\n $this->app->singleton('flasher', function () {\n return $this->app->make(Notifier::class);\n });\n\n Route::pushMiddlewareToGroup('web', ShareFlasherMessagesFromSession::class);\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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Matches streams with the metadata tag key having the specified value.
@param key The metadata tag
@param value The metatdata's value
@return A new StreamSpecifier | [
"public static StreamSpecifier tag(String key, String value) {\n checkValidKey(key);\n checkNotNull(value);\n return new StreamSpecifier(\"m:\" + key + \":\" + value);\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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Return a readable name from a URL path.
Useful to log requests on Piwik with categories tree structure.
See: http://piwik.org/faq/how-to/#faq_62 | [
"def extract_name_from_path(path):\n \n base_path, query_string = path.split('?')\n infos = base_path.strip('/').split('/')[2:] # Removes api/version.\n if len(infos) > 1: # This is an object.\n name = '{category} / {name}'.format(\n category=infos[0].title(),\n name=infos... | [
"def tempo_account_add_account(self, data=None):\n \n url = 'rest/tempo-accounts/1/account/'\n if data is None:\n return \"\"\"Please, provide data e.g.\n {name: \"12312312321\",\n key: \"1231231232\",\n lead: {name: \... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Returns all <code>method-permission</code> elements
@return list of <code>method-permission</code> | [
"public List<MethodPermissionType<AssemblyDescriptorType<T>>> getAllMethodPermission()\n {\n List<MethodPermissionType<AssemblyDescriptorType<T>>> list = new ArrayList<MethodPermissionType<AssemblyDescriptorType<T>>>();\n List<Node> nodeList = childNode.get(\"method-permission\");\n for(Node node: ... | [
"public function injectFieldOptions(InputDefinition $definition, $className)\n {\n list($fields, $associations) = $this->getConfigs($className);\n\n ObjectFieldUtil::addOptions($definition, $fields, 'The <comment>\"%s\"</comment> field');\n ObjectFieldUtil::addOptions($definition, $associati... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
// SetDBSubnetGroupDescription sets the DBSubnetGroupDescription field's value. | [
"func (s *DBSubnetGroup) SetDBSubnetGroupDescription(v string) *DBSubnetGroup {\n\ts.DBSubnetGroupDescription = &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:"
} |
// GoPackagePath returns the path to the provided Go package's
// source directory.
// pkg may be a path prefix without any *.go files.
// The error is os.ErrNotExist if GOPATH is unset. | [
"func GoPackagePath(pkg string) (path string, err error) {\n\tgp := os.Getenv(\"GOPATH\")\n\tif gp == \"\" {\n\t\tcmd := exec.Command(\"go\", \"env\", \"GOPATH\")\n\t\tout, err := cmd.Output()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"could not run 'go env GOPATH': %v, %s\", err, out)\n\t\t}\n\t\tgp = s... | [
"func DefaultServerURL(host, apiPath string, groupVersion schema.GroupVersion, defaultTLS bool) (*url.URL, string, error) {\n\tif host == \"\" {\n\t\treturn nil, \"\", fmt.Errorf(\"host must be a URL or a host:port pair\")\n\t}\n\tbase := host\n\thostURL, err := url.Parse(base)\n\tif err != nil || hostURL.Scheme ==... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
TODO faster and less new() | [
"public Number deserializeNumber(String s) {\n\t\tif(s.indexOf('.') >= 0 || s.indexOf('e') >= 0 || s.indexOf('E') >= 0) {\n\t\t\treturn Double.valueOf(s);\n\t\t} else {\n\t\t\tLong l = Long.valueOf(s);\n\t\t\tif(l > Integer.MAX_VALUE || l <Integer.MIN_VALUE) {\n\t\t\t\treturn l;\n\t\t\t} else {\n\t\t\t\treturn new ... | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Use base64 encoding on the bytes and then convert them to a string using
UTF-8 encoding.
@param bytes
@return String - null if input is null or an error happens during the conversion | [
"private static String convert_viewable_to_string(byte[] bytes) {\n String string = null;\n\n if (bytes != null) {\n if (bytes.length == 0) {\n string = EMPTY_STRING;\n } else {\n string = convert_to_string(Base64Coder.base64Encode(bytes));\n ... | [
"def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Align without penalizing end-gaps. Return alignment and score
@param sim the similarity matrix
@param params the structure alignment parameters to be used
@return an Alignable | [
"public static Alignable align_NPE(Matrix sim,StrucAligParameters params){\n\t\t//System.out.println(\"align_NPE\");\n\n\t\tfloat gapOpen = params.getGapOpen();\n\t\tfloat gapExtension = params.getGapExtension();\n\n\t\tint rows = sim.getRowDimension();\n\t\tint cols = sim.getColumnDimension();\n\n\t\tAlignable al ... | [
"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 Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetJobId sets the JobId field's value. | [
"func (s *DescribeTopicsDetectionJobInput) SetJobId(v string) *DescribeTopicsDetectionJobInput {\n\ts.JobId = &v\n\treturn s\n}"
] | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Clear cached images | [
"protected function clearCacheImageStyle()\n {\n $this->controlToken('clear');\n $style_id = $this->getQuery('clear');\n\n if (!empty($style_id)) {\n\n if ($this->image_style->clearCache($style_id)) {\n $this->redirect('', $this->text('Cache has been deleted'), 'suc... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
application : str
charm_url : str
constraints : Value
force_charm_url : bool
force_series : bool
min_units : int
settings : typing.Mapping[str, str]
settings_yaml : str
Returns -> None | [
"async def Update(self, application, charm_url, constraints, force_charm_url, force_series, min_units, settings, settings_yaml):\n '''\n \n '''\n # map input types to rpc msg\n _params = dict()\n msg = dict(type='Application',\n request='Update',\n ... | [
"def __store_config(self, args, kwargs):\n \n signature = (\n 'schema',\n 'ignore_none_values',\n 'allow_unknown',\n 'require_all',\n 'purge_unknown',\n 'purge_readonly',\n )\n for i, p in enumerate(signature[: len(args)])... | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
Return all unique namespaces
:returns: a list of all predicates
:rtype: list of ckan.model.semantictag.Predicate objects | [
"def list_unique(cls):\n\t\t'''\n\n\t\t'''\n\t\tquery = meta.Session.query(Predicate).distinct(Predicate.namespace)\n\t\treturn query.all()"
] | [
"def metadata(self):\n \n from ambry.metadata.schema import Top # cross-module import\n top = Top()\n top.build_from_db(self.dataset)\n return top"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Unmarks all frames.
@return the number of unmarked frames | [
"protected int unmarkFrames() {\n final int res = this.frames.size();\n while (!this.frames.empty()) {\n final CLFrame f = this.control.get(this.frames.back());\n this.frames.pop();\n assert f.mark();\n f.setMark(false);\n }\n return res;\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 post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// GenerateMounts maps MountPoint paths to volumes, returning a list of mounts,
// each with a parameter indicating if it's an implicit empty volume from a
// Docker image. | [
"func GenerateMounts(ra *schema.RuntimeApp, podVolumes []types.Volume, convertedFromDocker bool) ([]Mount, error) {\n\tapp := ra.App\n\n\tvar genMnts []Mount\n\n\tvols := make(map[types.ACName]types.Volume)\n\tfor _, v := range podVolumes {\n\t\tvols[v.Name] = v\n\t}\n\n\t// RuntimeApps have mounts, whereas Apps ha... | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the Github instruction about container management:",
"pos": "Represent the Github code about container management:",
"neg": "Represent the Github code about Software development:"
} |
// PackPacket packs a new packet
// the other controlFrames are sent in the next packet, but might be queued and sent in the next packet if the packet would overflow MaxPacketSize otherwise | [
"func (p *packetPacker) PackPacket() (*packedPacket, error) {\n\tpacket, err := p.maybePackCryptoPacket()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif packet != nil {\n\t\treturn packet, nil\n\t}\n\n\tencLevel, sealer := p.cryptoSetup.GetSealer()\n\theader := p.getHeader(encLevel)\n\theaderLen := header.GetLe... | [
"void writeRecord(EngineOutputRecord eor) throws IOException {\n // eventually compress as well.\n writer.writeRecord(eor, writeMAC, writeCipher);\n\n /*\n * Check the sequence number state\n *\n * Note that in order to maintain the connection I/O\n * properly, w... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
@param string $name
@param ColumnSchemaBuilder $definition
@return Table | [
"public function addField(string $name, ColumnSchemaBuilder $definition): Table\n {\n $this->fields[] = new Field($name, $definition);\n\n return $this;\n }"
] | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Calculate the minimum number of dimensions for n total samples with a
given maximum distortion using the Johnson-Lindenstrauss lemma.
@param int $n
@param float $maxDistortion
@return int | [
"public static function minDimensions(int $n, float $maxDistortion = 0.1) : int\n {\n return (int) round(4. * log($n)\n / ($maxDistortion ** 2 / 2. - $maxDistortion ** 3 / 3.));\n }"
] | [
"public Clustering<Model> run(Relation<V> relation) {\n final DBIDs ids = relation.getDBIDs();\n\n // Degenerate result:\n if(ids.size() < minpts) {\n Clustering<Model> result = new Clustering<>(\"DBSCAN Clustering\", \"dbscan-clustering\");\n result.addToplevelCluster(new Cluster<Model>(ids, tru... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Insert in database and return of inserted element
@param array $data array of columns and values
@param string $id field name of ID which must be returned
@return mixed | [
"public function insert(array $data, string $id = null)\n {\n // Prepare query\n $query = $this->genInsert($data);\n $statement = $this->getInstance()->prepare($query);\n\n // Bind values\n foreach ($data as $key => $value) {\n $statement->bindValue(\":$key\", $value... | [
"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:"
} |
The Drupal update system uses a pre-semver approach of version numbering.
Major versions must be in the form of "8.x", as opposed to other semver
ranges or version numbers. | [
"function toDrupalMajorVersion(version) {\n var regex = /^(\\d+)\\.\\d+\\.[x\\d+]/;\n var match = version.match(regex)\n if (match) {\n return match[1] + '.x';\n }\n\n return version;\n }"
] | [
"def has_stable_releases(self):\n \n nonzeroes = self.stable_families\n # Nothing but 0.x releases -> yup we're prehistory\n if not nonzeroes:\n return False\n # Presumably, if there's >1 major family besides 0.x, we're at least\n # one release into the 1.0 (or w... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
version as a command | [
"function bin(argv) {\n // setup config\n var config = require('../config/config.js')\n\n program\n .option('-d, --database <database>', 'Database')\n .parse(argv)\n\n var defaultDatabase = 'media'\n\n config.database = program.database || config.database || defaultDatabase\n var mediaURI = process.argv... | [
"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 text:",
"pos": "Represent the Github code:",
"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.