query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Format all locations to GitHub's URL API. :param locations: locations where to search users. :type locations: list(str).
[ "def __addLocationsToURL(self, locations):\n \n for l in self.__locations:\n self.__urlLocations += \"+location:\\\"\"\\\n + str(quote(l)) + \"\\\"\"" ]
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
根据JavaBean列表,向Excel中写入多行。 @param templateCell 模板单元格。 @param items 写入JavaBean列表。
[ "@SuppressWarnings(\"unchecked\")\n private void writeRows(Cell templateCell, List<Object> items) {\n val tmplRow = templateCell.getRow();\n val fromRow = tmplRow.getRowNum();\n\n val tmplCol = templateCell.getColumnIndex();\n for (int i = 0, ii = items.size(); i < ii; ++i) {\n ...
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// mail.Header Methods: // Date parses the Date header field.
[ "func (h Header) Date() (time.Time, error) {\n\treturn mail.Header(h).Date()\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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Initialize all targets. Necessary before targets can be looked up via the :class:`Target` class.
[ "def initialize_all_targets():\n \n ffi.lib.LLVMPY_InitializeAllTargetInfos()\n ffi.lib.LLVMPY_InitializeAllTargets()\n ffi.lib.LLVMPY_InitializeAllTargetMCs()" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
start the SO main loop @ignore
[ "function _switchState(state) {\n // clear previous interval if any\n _stopRunLoop();\n\n // call the stage destroy method\n if (_stages[_state]) {\n // just notify the object\n _stages[_state].stage.destroy();\n }\n\n i...
[ "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 Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
r"""Helps to interactively get user input.
[ "def gatherInput(**Config):\n \n \"\"\"\n _type = Config.get('type')\n\n while True:\n try:\n got = raw_input('%s: ' % getLabel(Config))\n\n except EOFError:\n got = None\n\n if not got and 'default' in Config:\n return Config['default']\n\n try:\n return _type(got) if _type else...
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "public function handle($request, Closure $next)\n {\n if ( ! $this->auth->check()) {\n return cms_api()->response('Unauthorized.', 401);\n }\n\n return $next($request);\n }" ]
[ "abstract public function __construct(Request $request, Translator $translator, View $view, GridContract $grid);\n\n /**\n * Extend decoration.\n *\n * @param callable $callback\n *\n * @return $this\n */\n public function extend(callable $callback = null)\n {\n // Run the ...
codesearchnet
{ "query": "Represent the instruction about Laravel:", "pos": "Represent the code about Laravel:", "neg": "Represent the code:" }
Returns element signature from splitted fragment. @param type $elementString @return string
[ "protected function extractSignature($elementString)\n\t{\n\t\t$match = array();\n\n\t\t$regexp = '@\\{/?(' . $this->getSignaturesRegexp() . ').*?/?\\}@ims';\n\n\t\tpreg_match($regexp, $elementString, $match);\n\n\t\tif (empty($match[1])) {\n\t\t\treturn null;\n\t\t\t//throw new Exception\\RuntimeException('Could n...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Retrieves the system table corresponding to the specified tableIndex value. <p> @param tableIndex int value identifying the system table to generate @return the system table corresponding to the specified tableIndex value
[ "protected Table generateTable(int tableIndex) {\n\n Table t = sysTables[tableIndex];\n\n// Please note that this class produces non-null tables for\n// just those absolutely essential to the JDBC 1 spec and the\n// HSQLDB core. Also, all table producing methods except\n// SYSTEM...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Create an ORM instance for a specific entity. @param \Asgard\Entity\Entity $entity @return ORMInterface
[ "protected function entityORM(\\Asgard\\Entity\\Entity $entity) {\r\n\t\tif($entity->isNew())\r\n\t\t\treturn $this->orm($entity->getClass());\r\n\t\telse\r\n\t\t\treturn $this->orm($entity->getClass())->where(['id' => $entity->id]);\r\n\t}" ]
[ "@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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Parses input according to pattern :param input: :param params: :return:
[ "def regexp(input, **params):\n \n PARAM_FIELD_TO_PARSE = 'input.field'\n PARAM_PATTERN = 'pattern'\n PARAM_OUTPUT = 'output'\n OUT_DESC_FIELD = 'field'\n OUT_DESC_IDX = 'idx'\n OUT_DESC_TYPE = 'type'\n\n res = []\n regex = re.compile(params.get(PARAM_PATTERN))\n field2parse = params.g...
[ "def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Takes friendly directive $friendlyDirective and returns the corresponding long (proper) directive. @param string $friendlyDirective @return string
[ "private function longDirective($friendlyDirective)\n {\n Types::assert(['string' => [$friendlyDirective]]);\n\n $friendlyDirective = strtolower($friendlyDirective);\n\n if (isset($this->cspDirectiveShortcuts[$friendlyDirective]))\n {\n $directive = $this->cspDirectiveShort...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
メッセージ中で利用可能な変数を作成する @param context コンテキスト @return メッセージ変数のマップ
[ "private Map<String, Object> createMessageVariables(final Context context) {\r\n \r\n final Map<String, Object> vars = new HashMap<>();\r\n \r\n if(context instanceof MessageInterpolatorContext) {\r\n MessageInterpolatorContext mic = (MessageInterpolatorContext)context;\r\n ...
[ "function GroupProfile(_id, _owner) {\n this._id = _id;\n this._owner = _owner;\n this._parent = null; //!< 親 GroupProfile インスタンス\n this._children = []; //!< 子 GroupProfile インスタンス\n this._expanded = false; //!< 開閉情報\n this._st...
codesearchnet
{ "query": "Represent the Github summarization about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about programming:" }
Delete a shortcut
[ "def action_rm(self):\n \n\n name = self.args['<name>']\n\n if self.args['all']:\n # delete all\n\n if ask_yes_no('Really delete ALL shortcuts?', default='no'):\n self.db_exec(''' DELETE FROM shortcuts ''')\n print_msg(\"All shortcuts deleted....
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get all rows @return \Illuminate\Database\Eloquent\Collection
[ "public function all()\n {\n $response = $this->model->with($this->with)->get();\n $this->with = [];\n return $response;\n }" ]
[ "public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
a simple contains helper method, checks if array contains a numToCheck @param array array of ints @param numToCheck value to find @return True if found, false otherwise
[ "public static boolean intArrayContains(int[] array, int numToCheck) {\n for (int i = 0; i < array.length; i++) {\n if (array[i] == numToCheck) {\n return true;\n }\n }\n return false;\n }" ]
[ "function newParam (columnName) {\n var i = 0\n // get placeholder name based on column name with counter\n // added if the same column name is used multiple times\n while (i < 99) {\n // use column name as base for param name\n var paramName = columnName+i\n // if param name is not...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns the value of the common property, or the default value if no value is defined instead. @param key the key of the property @param defaultValue the default value @return the value of the common property
[ "public String getCommonProperty(String key, String defaultValue) {\n\t\treturn props.getProperty(PropertiesBundleConstant.PROPS_PREFIX + key, defaultValue);\n\t}" ]
[ "function () {\n __objCount++;\n /**\n * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object.\n * @protected\n * @type Number\n */\n this._nextIndex = 0;\n /**\n ...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Toggle the connected status on/off
[ "function(e) {\n var t = this,\n statusBox = t.$('.nm-cv-status-box'),\n connected = statusBox.hasClass('connected');\n\n statusBox.addClass('connecting');\n t.connectMonitor(!connected);\n e.stopPropagation();\n }" ]
[ "protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Data synchronization:" }
Stores a floating point value into a memory address.
[ "def _storef(ins):\n \n output = _float_oper(ins.quad[2])\n\n op = ins.quad[1]\n\n indirect = op[0] == '*'\n if indirect:\n op = op[1:]\n\n immediate = op[0] == '#' # Might make no sense here?\n if immediate:\n op = op[1:]\n\n if is_int(op) or op[0] == '_':\n if is_int(...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Resolve the final property value from, 1. Request specific configuration 2. Default configuration 3. Default value @param key @param requestConfig @param defaultValue @return
[ "protected <S> S getProperty(IClientConfigKey<S> key, @Nullable IClientConfig requestConfig, S defaultValue) {\n if (requestConfig != null && requestConfig.get(key) != null) {\n return requestConfig.get(key);\n } else {\n return clientConfig.get(key, defaultValue);\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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
新增分组 @param accessToken accessToken @param deviceGroupAdd deviceGroupAdd @return result
[ "public static DeviceGroupAddResult deviceGroupAdd(String accessToken,\r\n DeviceGroupAdd deviceGroupAdd) {\r\n return deviceGroupAdd(accessToken,\r\n JsonUtil.toJSONString(deviceGroupAdd));\r\n }" ]
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Translate function, mimics the php gettext (alias _) function @access public @param string $string The string to translate @param boolean $jsSafe Make the result javascript safe @return string The translation of the string
[ "public function _($string, $jsSafe = false)\n\t{\n\t\t//$key = str_replace( ' ', '_', strtoupper( trim( $string ) ) );echo '<br />'.$key;\n $key = strtoupper($string);\n\t\t$key = (substr($key, 0, 1) === '_') ? substr($key, 1) : $key;\n\n\t\tif (isset($this->_strings[$key])) {\n\n $string = $this...
[ "public function XML_val($field, $arguments = [], $cache = false)\n {\n $result = $this->obj($field, $arguments, $cache);\n // Might contain additional formatting over ->XML(). E.g. parse shortcodes, nl2br()\n return $result->forTemplate();\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Add a value @param x x @param y y @param radius radius @param label label
[ "public void addValue(Integer x, Integer y, Integer radius, String label) {\n\t\tbubbleData.addValue(new BubbleItem(x, y, radius, label));\n\t}" ]
[ "def getPostStates(self):\n '''\n \n '''\n self.aNrmNow = self.mNrmNow - self.cNrmNow\n self.aLvlNow = self.aNrmNow*self.pLvlNow # Useful in some cases to precalculate asset level\n return None" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
修改分组商品 :param group_id: 商品分组ID :param product_data: 分组商品信息 :return: 返回的 JSON 数据包
[ "def update_group_product(self, group_id, product_data):\n \n product_data['group_id'] = group_id\n return self._post(\n 'merchant/group/productmod',\n data=product_data\n )" ]
[ "public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Return a WSDL instance loaded from a stream object.
[ "def loadFromStream(self, stream, name=None):\n \"\"\"\"\"\"\n document = DOM.loadDocument(stream)\n wsdl = WSDL()\n if name:\n wsdl.location = name\n elif hasattr(stream, 'name'):\n wsdl.location = stream.name\n wsdl.load(document)\n return wsd...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Returns the display name of the given section that the course prefers. @param int|stdClass $section Section object from database or just field section.section @return string Display name that the course format prefers, e.g. "Topic 2"
[ "public function get_section_name($section) {\n $section = $this->get_section($section);\n if ((string)$section->name !== '') {\n // Return the name the user set.\n return format_string($section->name, true, array('context' => context_course::instance($this->courseid)));\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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Checks if this is a special tag. @param tag a tagvalue @return true if tag is a HTML, HEAD, META, LINK or BODY tag (case insensitive)
[ "public static boolean isSpecialTag(String tag) {\n\t\treturn isHtml(tag) || isHead(tag) || isMeta(tag) || isLink(tag)\n\t\t\t\t|| isBody(tag);\n\t}" ]
[ "public final boolean isValidEndContextForContentKind(SanitizedContentKind contentKind) {\n if (templateNestDepth != 0) {\n return false;\n }\n switch (contentKind) {\n case CSS:\n return state == HtmlContext.CSS && elType == ElementType.NONE;\n case HTML:\n return state == Htm...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Parse column list for SQL add constraint statement @return null|string
[ "protected function _constraintsStatement()\n {\n $cons = $this->_sql->getConstraints();\n if (empty($cons)) {\n return null;\n }\n\n return $this->_parseConstraints();\n }" ]
[ "def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Resolve values For objects, do nothing. For strings, resolve placeholder. For arrays, call resolveValues() on each item. @param mixed $input
[ "protected function resolveValues(&$input = null)\n {\n if (is_array($input)) {\n foreach ($input as $idx => $value) {\n $this->resolveValues($value);\n $input[$idx] = $value;\n }\n } else {\n if (!is_object($input)) {\n ...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns a sequential ordered {@code LongStreamEx} whose elements are the unboxed elements of supplied array. @param array the array to create the stream from. @return the new stream @see Arrays#stream(Object[]) @since 0.5.0
[ "public static LongStreamEx of(Long[] array) {\r\n return seq(Arrays.stream(array).mapToLong(Long::longValue));\r\n }" ]
[ "public static void shuffle(final Object[] array) {\n synchronized (array) {\n // asList uses the backing array as store,\n // therefore changes to the list are reflected by the array.\n Collections.shuffle(Arrays.asList(array), random);\n }\n }" ]
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Get the first tag of a particular type
[ "def get_tag(self, tagtype):\n ''' '''\n for tag in self.__tags:\n if tag.tagtype == tagtype:\n return tag\n return None" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add the URL parameter to the Parameter's parent. @throws JspException if a JSP exception has occurred
[ "public void doTag()\n throws JspException\n {\n if (hasErrors()) {\n reportErrors();\n return;\n }\n\n JspTag tag = SimpleTagSupport.findAncestorWithClass(this, IAttributeConsumer.class);\n if (!(tag instanceof IAttributeConsumer)) {\n Stri...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// SetEmail sets the Email field's value.
[ "func (s *DeveloperInfo) SetEmail(v string) *DeveloperInfo {\n\ts.Email = &v\n\treturn s\n}" ]
[ "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 instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
TODO: was package-level originally
[ "public static <K, V> void registerCacheObject(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {\n //these can change during runtime, so always look it up\n MBeanServer mBeanServer = cache.getMBeanServer();\n if (mBeanServer != null) {\n ObjectName registeredObjectName = calculateO...
[ "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 sentence about Logistics:", "pos": "Represent the code about Logistics:", "neg": "Represent the code:" }
Gets filters arguments hard-coded in annotation @param int $index @return array|null
[ "public function getFiltersTargetedArgs($index = 0)\n {\n return $this->propertyFilters !== null ? $this->propertyFilters->getFiltersTargetedArgs($index) : null;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Verify a given source.
[ "public Source verify(Map<String, Object> params) throws StripeException {\n return verify(params, (RequestOptions) null);\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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
//AddMyColumn 添加本表字段
[ "func (table *Table) AddMyColumn(col *Column) {\n\ttable.myColumns = append(table.myColumns, col)\n}" ]
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Apply a watermark to a PDF file.
[ "def watermark_process():\n \"\"\"\"\"\"\n # Redirect to watermark page that contains form\n if not request.method == 'POST':\n abort(403)\n\n # Check if the post request has the file part\n if 'pdf' not in request.files:\n abort(403)\n\n # Retrieve PDF file and parameters\n file ...
[ "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 Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Count of nodes in a branch @method getNodeCount @return {int} number of nodes in the branch
[ "function() {\n for (var i = 0, count = 0;i< this.children.length;i++) {\n count += this.children[i].getNodeCount();\n }\n return count + 1;\n }" ]
[ "function nodeClosed( ascent ) {\n\n emitNodeClosed( ascent);\n \n return tail( ascent) ||\n // If there are no nodes left in the ascent the root node\n // just closed. Emit a special event for this: \n emitRootClosed(nodeOf(head(ascent)));\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Метод вызывается при проксировании прямых запросов к расширению
[ "function proxy()\n {\n if (!UserRights(EDITOR))\n die;\n\n $filename = Eresus_CMS::getLegacyKernel()->request['path'] .\n Eresus_CMS::getLegacyKernel()->request['file'];\n $filename = Eresus_CMS::getLegacyKernel()->froot . substr($filename,\n strlen(Eres...
[ "private function processA(array $result) {\n\t\ttry {\n\t\t\t$result = $this->processI($result);\n\t\t}\n\t\t/**\n\t\t * 2016-08-02\n\t\t * Исключительная ситуация может быть не только типа @see \\Df\\Core\\Exception,\n\t\t * но и типа @see \\Exception,\n\t\t * потому что чтение некорректных данных может приводить...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
decode image data to buffer, mapping to awt type byte. if rgb, r,g,b,r,g,b...,r,g,b,... if abgr, a,b,g,r.... if rgba, r,g,b,a.... @param buffer @param stride @param fmt @throws IOException
[ "private final void decode(ByteBuffer buffer, TextureFormat fmt) throws IOException {\n\t\tbyte[] curLine = new byte[width * bytesPerPixel + 1];\n\t\tbyte[] prevLine = new byte[width * bytesPerPixel + 1];\n\t\tfinal Inflater inflater = new Inflater();\n\t\ttry {\n\t\t\tfor (int y = 0; y < height; y++) {\n\t\t\t\tre...
[ "def render_image(self, rgbobj, dst_x, dst_y):\n \n if self.surface is None:\n return\n self.logger.debug(\"redraw surface\")\n\n # get window contents as an array and store it into the CV surface\n rgb_arr = self.viewer.getwin_array(order=self.rgb_order, dtype=np.uint8...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Computer Science:" }
Check a record belongs to the currently logged in user. This check is based on the author_id column. @param array $data The record data. Primary key must be present here. @param string $where A WHERE clause to find the record @return bool
[ "protected function _itemBelongsToUser($data, $where = false) {\n $userData = Garp_Auth::getInstance()->getUserData();\n $userId = $userData['id'];\n if (!array_key_exists('author_id', $data)) {\n if (!$where) {\n return false;\n }\n // fetch the ...
[ "protected function getSingleFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())\n {\n // booleans were handled here. They are now handled as complextypes\n\n // q: do we really want this to happen by default on all scalar field values?\n //...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Programming:" }
Set or get the returnMetadata flag @param boolean $returnMetadata Give this a value to set the returnMetadata flag @return boolean|self
[ "public function returnMetadata($returnMetadata = null) {\n if ($returnMetadata === null) {\n return $this->returnMetadata;\n }\n\n $this->returnMetadata = (bool) $returnMetadata;\n\n return $this;\n }" ]
[ "@Override\n public boolean setProperty(String name, Object value)\n {\n /* Note: can not call local method, since it'll return false for\n * recognized but non-mutable properties\n */\n return mConfig.setProperty(name, value);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// FromIncomingContext returns the incoming metadata in ctx if it exists. The // returned MD should not be modified. Writing to it may cause races. // Modification should be made to copies of the returned MD.
[ "func FromIncomingContext(ctx context.Context) (md MD, ok bool) {\n\tmd, ok = ctx.Value(mdIncomingKey{}).(MD)\n\treturn\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is...
codesearchnet
{ "query": "Represent the sentence about Go programming language:", "pos": "Represent the code about Go programming language:", "neg": "Represent the code about programming:" }
An iterator over the keys of each bin.
[ "def iterkeys(self):\n \"\"\"\"\"\"\n def _iterkeys(bin):\n for item in bin:\n yield item.key\n\n for bin in self.bins:\n yield _iterkeys(bin)" ]
[ "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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// NewStopAndTransferEvent creates a new StopAndTransferEvent
[ "func NewStopAndTransferEvent(snapshotch chan<- fab.EventSnapshot, errch chan<- error) *StopAndTransferEvent {\n\treturn &StopAndTransferEvent{\n\t\tErrCh: errch,\n\t\tSnapshotCh: snapshotch,\n\t}\n}" ]
[ "public <T extends DObject> void subscribeToObject (int oid, Subscriber<T> target)\n {\n // queue up an access object event\n postEvent(new AccessObjectEvent<T>(oid, target, AccessObjectEvent.SUBSCRIBE));\n }" ]
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Method determines if the next set of tokens matches one of the registered data type token sets. @param tokens @return is registered data type @throws ParsingException
[ "public final boolean isDatatype( DdlTokenStream tokens ) throws ParsingException {\n // Loop through the registered statement start string arrays and look for exact matches.\n\n for (String[] stmts : basicCharStringTypes) {\n if (tokens.matches(stmts)) return true;\n }\n\n fo...
[ "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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Deletes static url from DB. @param string $staticUrlId
[ "protected function deleteStaticUrlFromDb($staticUrlId)\n {\n // active shop id\n $shopId = $this->getEditObjectId();\n $db = \\OxidEsales\\Eshop\\Core\\DatabaseProvider::getDb();\n $db->execute(\"delete from oxseo where oxtype='static' and oxobjectid = \" . $db->quote($staticUrlId) ....
[ "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 Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// See http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_monthname
[ "func builtinMonthName(args []types.Datum, ctx context.Context) (types.Datum, error) {\n\td, err := builtinMonth(args, ctx)\n\tif err != nil || d.IsNull() {\n\t\treturn d, errors.Trace(err)\n\t}\n\n\tmon := int(d.GetInt64())\n\tif mon <= 0 || mon > len(types.MonthNames) {\n\t\td.SetNull()\n\t\tif mon == 0 {\n\t\t\t...
[ "public function execute($sql) {\n //\n // TODO: check mysql_unbuffered_query() with mysql_free_result() for larger result sets\n // @see https://www.percona.com/blog/2006/06/26/handling-of-big-parts-of-data/\n // @see https://dev.mysql.com/doc/refman/5.7/en/mysql-use-resul...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Reads the version (MAJOR.MINOR) from this module.
[ "def get_version():\n \"\"\"\"\"\"\n _release = get_release()\n split_version = _release.split(\".\")\n if len(split_version) == 3:\n return \".\".join(split_version[:2])\n return _release" ]
[ "@Override\n public VersionInfo getUCAVersion() {\n VersionInfo v = getVersion();\n // Note: This is tied to how the current implementation encodes the UCA version\n // in the overall getVersion().\n // Alternatively, we could load the root collator and get at lower-level data from th...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
2d convolution (aka the last 2 dimensions @param input the input to op @param kernel the kernel to convolve with @param type @return
[ "public static INDArray conv2d(INDArray input, INDArray kernel, Type type) {\n return Nd4j.getConvolution().conv2d(input, kernel, type);\n }" ]
[ "def inner(tensor0: BKTensor, tensor1: BKTensor) -> BKTensor:\n \"\"\"\"\"\"\n # Note: Relying on fact that vdot flattens arrays\n return np.vdot(tensor0, tensor1)" ]
codesearchnet
{ "query": "Represent the Github comment about Image processing:", "pos": "Represent the Github code about Image processing:", "neg": "Represent the Github code:" }
Generate unique document id for ElasticSearch.
[ "def generate_id(self, obj):\n \"\"\"\"\"\"\n object_type = type(obj).__name__.lower()\n return '{}_{}'.format(object_type, self.get_object_id(obj))" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Constructs a ES6/Promises A+ Promise instance. @constructor @param {function(function(*=), function (*=))} resolver
[ "function Promise(resolver) {\n if (!(this instanceof Promise)) {\n throw new TypeError('Constructor Promise requires `new`');\n }\n if (!isFunction(resolver)) {\n throw new TypeError('Must pass resolver function');\n }\n\n /**\n * @type {function(this:Promise,*=,function(*=),function(*=),Deferred):!Pr...
[ "def bind(self, fn: \"Callable[[Any], Reader]\") -> 'Reader':\n \n \"\"\"\n return Reader(lambda x: fn(self.run(x)).run(x))" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Delete a project's avatar. :param project: ID or key of the project to delete the avatar from :param avatar: ID of the avatar to delete
[ "def delete_project_avatar(self, project, avatar):\n \n url = self._get_url('project/' + project + '/avatar/' + avatar)\n return self._session.delete(url)" ]
[ "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 Github summarization about Work management:", "pos": "Represent the Github code about Work management:", "neg": "Represent the Github code about Software development:" }
// SetIBDComplete set the ibd_complete (Initial Block Download complete) flag in // the meta table.
[ "func SetIBDComplete(db *sql.DB, ibdComplete bool) error {\n\tnumRows, err := sqlExec(db, internal.SetMetaDBIbdComplete,\n\t\t\"failed to update ibd_complete in meta table: \", ibdComplete)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif numRows != 1 {\n\t\treturn fmt.Errorf(\"failed to update exactly 1 row in meta t...
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Applies one or more theme classes to a component. @param component Component to receive the theme classes. @param themeClasses A list of theme classes to apply.
[ "public static void applyThemeClass(BaseUIComponent component, IThemeClass... themeClasses) {\n StringBuilder sb = new StringBuilder();\n\n for (IThemeClass themeClass : themeClasses) {\n String cls = themeClass == null ? null : themeClass.getThemeClass();\n\n if (cls != null) {\...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Invokes a specific handler for the event class type if it exists. @param event an event @throws WakeRuntimeException
[ "@Override\n public void onNext(final T event) {\n final EventHandler<T> handler = (EventHandler<T>) map.get(event.getClass());\n if (handler == null) {\n throw new WakeRuntimeException(\"No event \" + event.getClass() + \" handler\");\n }\n handler.onNext(event);\n }" ]
[ "public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about N/A:" }
Message going downstream.
[ "def indication(self, pdu):\n \"\"\"\"\"\"\n if _debug: StreamToPacket._debug(\"indication %r\", pdu)\n\n # hack it up into chunks\n for packet in self.packetize(pdu, self.downstreamBuffer):\n self.request(packet)" ]
[ "public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A...
codesearchnet
{ "query": "Represent the post about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code about programming:" }
Detect the current breakpoint and update the element if necessary.
[ "function update(image) {\n if (image.lazyLoad) {\n return;\n }\n\n var rect = DOM.getRect(image.element);\n var foundBreakpoint;\n\n for (var i = 0; i < image.knownSizes.length; i++) {\n var s = image.knownSizes[i];\n\n if (rect.width <= s) {\n foundBreakpoint = s;\n } else {\n break;\n ...
[ "function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Run the callables in deferred using their associated scope stack.
[ "def run_deferred(self, deferred):\n \"\"\"\"\"\"\n for handler, scope, offset in deferred:\n self.scope_stack = scope\n self.offset = offset\n handler()" ]
[ "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:" }
Assignment ::= Identifier ':=' Assignment | Additive
[ "function parseAssignment() {\n var expr, value, token, content = [];\n\n expr = parseAdditive();\n\n if (typeof expr !== 'undefined' && expr.subtype === 'variable') {\n token = lexer.peek();\n if (matchOp(token, ...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Get an MD5 hash computed from the sorted type names of all initializers. @return string
[ "public function getHash()\n\t{\n\t\t$names = array_keys($this->initializers);\n\t\tsort($names);\n\t\t\n\t\treturn md5(implode('|', $names));\n\t}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Wrap a function into a layer
[ "def layerize(begin_update=None, predict=None, *args, **kwargs):\n \"\"\"\"\"\"\n if begin_update is not None:\n return FunctionLayer(begin_update, predict=predict, *args, **kwargs)\n\n def wrapper(begin_update):\n return FunctionLayer(begin_update, *args, **kwargs)\n\n return wrapper" ]
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Close this control node, and returning node closer. @access public @param \Htsl\ReadingBuffer\Line $closerLine The line when node closed. @return string
[ "public function close( Line$closerLine ):string\n\t{\n\t\tif( isset($this->config['close_by']) && $closerLine->indentLevel==$this->line->indentLevel ){\n\t\t\tforeach( $this->config['close_by'] as $key=>$value ){\n\t\t\t\tif( $closerLine->pregMatch($key) ){\n\t\t\t\t\treturn $this->withParam($value);\n\t\t\t\t}\n\...
[ "final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n /...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// obj must be a pointer to a marshalable object
[ "func marshalJSON(obj runtime.Object) ([]byte, error) {\n\tj, err := kopscodecs.ToVersionedJSON(obj)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling json: %v\", err)\n\t}\n\treturn j, nil\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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Select a particular season @param [Fixnum, String] season index number @return [Season] season with the index of number
[ "def season(number)\n seasons.detect { |sea| sea.index.to_i == number.to_i }\n end" ]
[ "def note(id, type, options = {})\n # Welguisz: No idea why this is here, but keeping it here because it follows other blocks\n _notes\n # Create a new note and place it in the notes 2-D Hash\n @_notes[id][type] = Note.new(id, type, options)\n end" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Helper function to convert a parameter value to a valid directory name.
[ "def convert_param_to_dirname(param):\n \n if type(param) == types.StringType:\n return param\n else:\n return re.sub(\"0+$\", '0', '%f'%param)" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get an access token from the local storage if available, otherwise request one from the API @return string the access token @throws Exceptions\AuthenticationException
[ "public function getAccessToken()\n {\n // check in the session\n $existing = $this->storage->getKey('authentication');\n\n // is it still valid\n if ($existing && $existing->expires > time()) {\n return $existing->access_token;\n }\n\n // make the call to the...
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Disconnects from the connected server
[ "public function disconnect()\n\t{ \t\n\t\t$this->exec('echo \"EXITING\" && exit;');\n\t\t\n\t\t$this->_conn_link = NULL;\n\t\t$this->_connected = FALSE;\n\t\t$this->_sftp = NULL;\n\t}" ]
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Close the subscriber: stop it and close the local subscribers.
[ "def close(self):\n \n self.stop()\n for sub in list(self.subscribers) + self._hooks:\n try:\n sub.setsockopt(LINGER, 1)\n sub.close()\n except ZMQError:\n pass" ]
[ "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 text about Computer Networking:", "pos": "Represent the Github code about Computer Networking:", "neg": "Represent the Github code about Software development:" }
// SetServerId sets the ServerId field's value.
[ "func (s *UpdateServerInput) SetServerId(v string) *UpdateServerInput {\n\ts.ServerId = &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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`.
[ "def container(self, name, length, type, *parameters):\n \n self.new_struct('Container', name, 'length=%s' % length)\n BuiltIn().run_keyword(type, *parameters)\n self.end_struct()" ]
[ "def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
<p>Setter for lang.</p> @param pLang reference
[ "@Override\n public final void setLang(final Languages pLang) {\n this.lang = pLang;\n if (this.itsId == null) {\n this.itsId = new IdI18nSpecificsOfItem();\n }\n this.itsId.setLang(this.lang);\n }" ]
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Documentation:" }
Client security layer @param transport {events.EventEmitter}
[ "function Client(transport, fastPathTransport) {\n\tSec.call(this, transport, fastPathTransport);\n\t// for basic RDP layer (in futur)\n\tthis.enableSecureCheckSum = false;\n\tvar self = this;\n\tthis.transport.on('connect', function(gccClient, gccServer, userId, channels) {\n\t\tself.connect(gccClient, gccServer, ...
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Sends headers to cache for the specified number of MINUTES @param int $expire Cache duration in MINUTES
[ "public static function _sendCacheHeaders($expire = 5) {\n if (!is_numeric($expire) || $expire < 1 || $expire > 240) {\n $expire = 5;\n _Log::warn(\"Attempt to send cache headers with invalid expiration\");\n }\n header(\"Cache-Control: public\"); // HTTP/1.1\n head...
[ "private static int getTimeToLive(final Ticket ticket) {\n val expTime = ticket.getExpirationPolicy().getTimeToLive().intValue();\n if (TimeUnit.SECONDS.toDays(expTime) >= MAX_EXP_TIME_IN_DAYS) {\n LOGGER.warn(\"Any expiration time larger than [{}] days in seconds is considered absolute (as...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Merge a single property from the other result object. @param Result $otherResult @param string $getterName @param string $adderName @return void
[ "protected function mergeProperty(Result $otherResult, string $getterName, string $adderName)\n {\n foreach ($otherResult->$getterName() as $messageInOtherResult) {\n $this->$adderName($messageInOtherResult);\n }\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Add a new element to 'ExtendedSigner' @param \AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\ExtendedSigner $value
[ "public function addExtendedSigner(\\AgentSIB\\Diadoc\\Api\\Proto\\Invoicing\\Signers\\ExtendedSigner $value)\n {\n if ($this->ExtendedSigner === null) {\n $this->ExtendedSigner = new \\Protobuf\\MessageCollection();\n }\n\n $this->ExtendedSigner->add($value);\n }" ]
[ "def DeserializeExclusiveData(self, reader):\n \n self.Type = TransactionType.StateTransaction\n\n self.Descriptors = reader.ReadSerializableArray('neo.Core.State.StateDescriptor.StateDescriptor')" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
*style* may be any marker style understood by ROOT or matplotlib. For full documentation of accepted *style* arguments, see :class:`rootpy.plotting.style.MarkerStyle`.
[ "def SetMarkerStyle(self, style):\n \n self._markerstyle = MarkerStyle(style)\n if isinstance(self, ROOT.TAttMarker):\n ROOT.TAttMarker.SetMarkerStyle(self, self._markerstyle('root'))" ]
[ "def series_contenthandler():\n \n from ligo.lw import (\n ligolw,\n array as ligolw_array,\n param as ligolw_param\n )\n\n @ligolw_array.use_in\n @ligolw_param.use_in\n class ArrayContentHandler(ligolw.LIGOLWContentHandler):\n \"\"\"`~xml.sax.handlers.ContentHandler` t...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
all_synonyms view is quite slow therefore this implementation is overriden in OCI connection with faster native OCI method
[ "def describe_synonym(schema_name, synonym_name) #:nodoc:\n select_first(\n \"SELECT table_owner, table_name FROM all_synonyms WHERE owner = :owner AND synonym_name = :synonym_name\",\n schema_name.to_s.upcase, synonym_name.to_s.upcase)\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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Execute the console command. @return mixed
[ "public function handle()\n {\n $repository_generator = new \\CroudTech\\Repositories\\RepositoryGenerator($this->argument('model-name'), $this->argument('repository-name'));\n\n try {\n if ($repository_generator->generateRepository()) {\n $this->info(sprintf('Generated %s...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Parses the header from a string @param string $data @return array @throws \InvalidArgumentException When an invalid header is informed
[ "protected function parseHeader($data)\n {\n $header = (array) $this->deserializer->fromJSON($this->deserializer->fromBase64URL($data));\n\n if (isset($header['enc'])) {\n throw new \\InvalidArgumentException('Encryption is not supported yet');\n }\n\n return $header;\n ...
[ "def check_input(self, token):\n \n if not isinstance(token.payload, ModelContainer):\n raise Exception(self.full_name + \": Input token is not a ModelContainer!\")" ]
codesearchnet
{ "query": "Represent the comment about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code about programming:" }
@param array $value @param array $rest @return bool
[ "private function validateByProperty(array $value, array &$rest)\n {\n $valid = true;\n foreach ($this->properties as $propertyName => $propertyValidator) {\n unset($rest[$propertyName]);\n $valid &= $propertyValidator->validate(\n isset($value[$propertyName]) ?...
[ "public function antiLight(array $req): void\n {\n $this->isConfigDebug ? print('anti light') : null;\n $this->log(configDefault('anti/light', 'log', 'anti', 'light'), $req);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Internal mechanism to set the FeaturedTutorial id @param Skill $model @param mixed $relatedId
[ "protected function doSetFeaturedTutorialId(Skill $model, $relatedId) {\n\t\tif ($model->getTutorialId() !== $relatedId) {\n\t\t\t$model->setTutorialId($relatedId);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}" ]
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the Vert.x Hazelcast instance if one exists. @param vertx The current Vert.x instance. @return The Vert.x Hazelcast instance if Vert.x is clustered.
[ "static HazelcastInstance getHazelcastInstance(Vertx vertx) {\n VertxInternal vertxInternal = (VertxInternal) vertx;\n ClusterManager clusterManager = vertxInternal.clusterManager();\n if (clusterManager != null) {\n Class<?> clazz = clusterManager.getClass();\n Field field;\n try {\n ...
[ "public int getPort() {\n final Connector[] connectors = this.server.getConnectors();\n checkState(connectors.length >= 1, \"Server must have at least 1 connector\");\n\n // The first connector is created upon initializing the server. That's the one that has the port.\n return connectors[0].getLocalPort...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Handle a login request to the application. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
[ "public function postLogin(Request $request)\n\t{\n\t\t$this->validate($request, [\n\t\t\t'email' => 'required|email', 'password' => 'required',\n\t\t]);\n\n\t\t$credentials = $request->only('email', 'password');\n\n\t\tif ($this->auth->attempt($credentials, $request->has('remember')))\n\t\t{\n\t\t\treturn redirect...
[ "public function register()\n {\n if (env('USE_JSON_EXCEPTION_HANDLER', false)) {\n $this->app->bind(\n \\Illuminate\\Contracts\\Debug\\ExceptionHandler::class,\n 'RobRogers3\\LaravelExceptionHandler\\JsonAwareExceptionHandler'\n );\n }\n \...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Entry point of rw cli
[ "def main():\n \"\"\"\"\"\"\n # check logging\n log_level = os.environ.get('LOG_LEVEL', 'INFO')\n logging.basicConfig(level=getattr(logging, log_level),\n format='%(asctime)s %(name)s[%(levelname)s] %(message)s',\n datefmt='%Y-%m-%d %H:%M:%S')\n\n current...
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Updates a version [Arguments] :details (required) Details of the version to be updated
[ "def update(details)\n details.each do |k, v|\n send(\"#{k}=\", v)\n end\n self.class.update(version_key, details)\n end" ]
[ "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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Converts a list of paths to environments to env_data. env_data is a structure {name -> (ressourcedir, kernel spec)}
[ "def convert_to_env_data(mgr, env_paths, validator_func, activate_func,\n name_template, display_name_template, name_prefix):\n \n env_data = {}\n for venv_dir in env_paths:\n venv_name = os.path.split(os.path.abspath(venv_dir))[1]\n kernel_name = name_template.format(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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns page information What is the page range available, and what is the selected page range.
[ "def GetPageInfo(self):\n \n\n return self.first_tab, self.last_tab, self.first_tab, self.last_tab" ]
[ "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 Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
This method returns the "List containing SIDestinationAddress" form of the reverse routing path.
[ "protected List getConvertedRRP() {\n\n List theList = null;\n StringArrayWrapper saw = (StringArrayWrapper) properties.get(REVERSE_ROUTING_PATH);\n if (saw != null)\n theList = saw.getCorePath();\n return theList;\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 description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
// GetAWSLogsLogStreamWithName retrieves all AWSLogsLogStream items from an AWS CloudFormation template // whose logical ID matches the provided name. Returns an error if not found.
[ "func (t *Template) GetAWSLogsLogStreamWithName(name string) (*resources.AWSLogsLogStream, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSLogsLogStream:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type AWS...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// NewPool returns a new connection pool that uses the given DialOptions
[ "func NewPool(ctx context.Context, dialOptions ...grpc.DialOption) *Pool {\n\treturn &Pool{\n\t\tbgCtx: ctx,\n\t\tdialOptions: dialOptions,\n\t\tconns: make(map[string]*conn),\n\t}\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Load View File @param string @param array @param boolean @return void|html;
[ "public static function load($_sky_name,$_sky_var = [],$_sky_return = false){\n\t\n\t\t$__prop = Loader::getName($_sky_name,'view');\n\n\t\tif(!file_exists($__prop->path)){\n\t\t\tExceptions::showError('Server Error','Missing View File: '.$__prop->path);\n\t\t\treturn;\n\t\t}\n\t\t// extract array to variable\n\t\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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Set the order of data. @return array
[ "public function order()\n {\n $columns = func_get_args();\n $order = '';\n $i = 0;\n //\n if ($columns) {\n foreach ($columns as $value) {\n if (!$i) {\n $order .= ' order by '.$value;\n } else {\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Creates CLI parser which can be used to extract Container's class name and its launch arguments. @param containerWorkDir @return
[ "private ExecJavaCliParser createExecCommandParser(String containerWorkDir) {\n String execLine =\n this.filterAndExecuteLaunchScriptAndReturnExecLine(containerWorkDir);\n String[] values = execLine.split(\"\\\"\");\n String javaCli = values[1];\n String[] javaCliValues = ...
[ "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 programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Convert an internal link. @param $url The url to convert @param $strategy The strategy used to check and create urls @return The converted url
[ "protected static function convertInternalLink($url, LinkProcessorStrategy $strategy) {\n $urlConv = $url;\n if (InternalLink::isLink($url)) {\n $oid = InternalLink::getReferencedOID($url);\n if ($oid != null) {\n $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');\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 text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about programming:" }
--- RECURSIVE WRITE ---
[ "protected static final void write(StringBuilder builder, Tree node, Tree zeroIndexes) {\r\n\t\tint startIndex = zeroIndexes == null ? 1 : Integer.MIN_VALUE;\r\n\t\tfor (Tree child : node) {\r\n\t\t\tif (child.isStructure()) {\r\n\t\t\t\twrite(builder, child, zeroIndexes);\r\n\t\t\t} else {\r\n\t\t\t\tif (startInde...
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Closes the record and index files.
[ "def close(self):\n \"\"\"\"\"\"\n if not self.is_open:\n return\n super(IndexCreator, self).close()\n self.fidx.close()" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Ordered iterator over dirty elements.
[ "def iterdirty(self):\r\n ''''''\r\n return iter(chain(itervalues(self._new), itervalues(self._modified)))" ]
[ "@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:" }
Sets the pagination for the list @return mixed
[ "public function actionPagination()\n {\n Yii::$app->session->set($this->MainModel . 'Pagination', Yii::$app->request->queryParams['records']);\n $this->redirect(['index']);\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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }