();\n#endif\n}", "label_name": "Base", "label": 1.0}
-{"code": " def handle(self, command, kwargs=None):\n \"\"\"\n Dispatch and handle processing of the given command.\n\n :param command: Name of command to run.\n :type command: unicode\n :param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used.\n :type kwargs: dict\n :return: response.\n :rtype: HttpResponse\n \"\"\"\n\n kwargs = kwargs or dict(six.iteritems(self.request.POST))\n try:\n handler = self.get_command_handler(command)\n if not handler or not callable(handler):\n raise Problem(_(\"Error! Invalid command `%s`.\") % command)\n kwargs.pop(\"csrfmiddlewaretoken\", None) # The CSRF token should never be passed as a kwarg\n kwargs.pop(\"command\", None) # Nor the command\n kwargs.update(request=self.request, basket=self.basket)\n kwargs = self.preprocess_kwargs(command, kwargs)\n\n response = handler(**kwargs) or {}\n\n except (Problem, ValidationError) as exc:\n if not self.ajax:\n raise\n msg = exc.message if hasattr(exc, \"message\") else exc\n response = {\n \"error\": force_text(msg, errors=\"ignore\"),\n \"code\": force_text(getattr(exc, \"code\", None) or \"\", errors=\"ignore\"),\n }\n\n response = self.postprocess_response(command, kwargs, response)\n\n if self.ajax:\n return JsonResponse(response)\n\n return_url = response.get(\"return\") or kwargs.get(\"return\")\n if return_url and return_url.startswith(\"/\"):\n return HttpResponseRedirect(return_url)\n return redirect(\"shuup:basket\")", "label_name": "Base", "label": 1.0}
-{"code": " def write_data_table(self, report, report_data, has_totals=True):\n self.data.append([c[\"title\"] for c in report.schema])\n for datum in report_data:\n datum = report.read_datum(datum)\n self.data.append([format_data(data, format_iso_dates=True) for data in datum])\n\n if has_totals:\n for datum in report.get_totals(report_data):\n datum = report.read_datum(datum)\n self.data.append([format_data(data) for data in datum])", "label_name": "Base", "label": 1.0}
-{"code": " success: function success(data) {\n if ( data.change ) {\n if ( data.valid ) {\n confirmDialog(\n \"db_submit\",\n \"GeneralChangeModal\",\n 0,\n changeDbSettings\n );\n }\n else {\n $(\"#InvalidDialog\").modal('show');\n }\n } else { \t\n changeDbSettings();\n }\n }", "label_name": "Compound", "label": 4.0}
-{"code": " def initSession(self, expire_on_commit=True):\n self.session = self.session_factory()\n self.session.expire_on_commit = expire_on_commit\n self.update_title_sort(self.config)", "label_name": "Base", "label": 1.0}
-{"code": "def edit_book_languages(languages, book, upload=False, invalid=None):\n input_languages = languages.split(',')\n unknown_languages = []\n if not upload:\n input_l = isoLanguages.get_language_codes(get_locale(), input_languages, unknown_languages)\n else:\n input_l = isoLanguages.get_valid_language_codes(get_locale(), input_languages, unknown_languages)\n for l in unknown_languages:\n log.error(\"'%s' is not a valid language\", l)\n if isinstance(invalid, list):\n invalid.append(l)\n else:\n raise ValueError(_(u\"'%(langname)s' is not a valid language\", langname=l))\n # ToDo: Not working correct\n if upload and len(input_l) == 1:\n # If the language of the file is excluded from the users view, it's not imported, to allow the user to view\n # the book it's language is set to the filter language\n if input_l[0] != current_user.filter_language() and current_user.filter_language() != \"all\":\n input_l[0] = calibre_db.session.query(db.Languages). \\\n filter(db.Languages.lang_code == current_user.filter_language()).first().lang_code\n # Remove duplicates\n input_l = helper.uniq(input_l)\n return modify_database_object(input_l, book.languages, db.Languages, calibre_db.session, 'languages')", "label_name": "Base", "label": 1.0}
-{"code": "def check_send_to_kindle_with_converter(formats):\n bookformats = list()\n if 'EPUB' in formats and 'MOBI' not in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 1,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Epub',\n format='Mobi')})\n if 'AZW3' in formats and not 'MOBI' in formats:\n bookformats.append({'format': 'Mobi',\n 'convert': 2,\n 'text': _('Convert %(orig)s to %(format)s and send to Kindle',\n orig='Azw3',\n format='Mobi')})\n return bookformats", "label_name": "Base", "label": 1.0}
-{"code": "def check_unrar(unrarLocation):\n if not unrarLocation:\n return\n\n if not os.path.exists(unrarLocation):\n return _('Unrar binary file not found')\n\n try:\n unrarLocation = [unrarLocation]\n value = process_wait(unrarLocation, pattern='UNRAR (.*) freeware')\n if value:\n version = value.group(1)\n log.debug(\"unrar version %s\", version)\n\n except (OSError, UnicodeDecodeError) as err:\n log.error_or_exception(err)\n return _('Error excecuting UnRar')", "label_name": "Base", "label": 1.0}
-{"code": "def feed_unread_books():\n off = request.args.get(\"offset\") or 0\n result, pagination = render_read_books(int(off) / (int(config.config_books_per_page)) + 1, False, True)\n return render_xml_template('feed.xml', entries=result, pagination=pagination)", "label_name": "Base", "label": 1.0}
-{"code": "def feed_author(book_id):\n off = request.args.get(\"offset\") or 0\n entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0,\n db.Books,\n db.Books.authors.any(db.Authors.id == book_id),\n [db.Books.timestamp.desc()])\n return render_xml_template('feed.xml', entries=entries, pagination=pagination)", "label_name": "Base", "label": 1.0}
-{"code": "def feed_categoryindex():\n shift = 0\n off = int(request.args.get(\"offset\") or 0)\n entries = calibre_db.session.query(func.upper(func.substr(db.Tags.name, 1, 1)).label('id'))\\\n .join(db.books_tags_link).join(db.Books).filter(calibre_db.common_filters())\\\n .group_by(func.upper(func.substr(db.Tags.name, 1, 1))).all()\n elements = []\n if off == 0:\n elements.append({'id': \"00\", 'name':_(\"All\")})\n shift = 1\n for entry in entries[\n off + shift - 1:\n int(off + int(config.config_books_per_page) - shift)]:\n elements.append({'id': entry.id, 'name': entry.id})\n\n pagination = Pagination((int(off) / (int(config.config_books_per_page)) + 1), config.config_books_per_page,\n len(entries) + 1)\n return render_xml_template('feed.xml',\n letterelements=elements,\n folder='opds.feed_letter_category',\n pagination=pagination)", "label_name": "Base", "label": 1.0}
-{"code": "def render_downloaded_books(page, order, user_id):\n if current_user.role_admin():\n user_id = int(user_id)\n else:\n user_id = current_user.id\n if current_user.check_visibility(constants.SIDEBAR_DOWNLOAD):\n if current_user.show_detail_random():\n random = calibre_db.session.query(db.Books).filter(calibre_db.common_filters()) \\\n .order_by(func.random()).limit(config.config_random_books)\n else:\n random = false()\n\n entries, __, pagination = calibre_db.fill_indexpage(page,\n 0,\n db.Books,\n ub.Downloads.user_id == user_id,\n order[0],\n False, 0,\n db.books_series_link,\n db.Books.id == db.books_series_link.c.book,\n db.Series,\n ub.Downloads, db.Books.id == ub.Downloads.book_id)\n for book in entries:\n if not calibre_db.session.query(db.Books).filter(calibre_db.common_filters()) \\\n .filter(db.Books.id == book.id).first():\n ub.delete_download(book.id)\n user = ub.session.query(ub.User).filter(ub.User.id == user_id).first()\n return render_title_template('index.html',\n random=random,\n entries=entries,\n pagination=pagination,\n id=user_id,\n title=_(u\"Downloaded books by %(user)s\",user=user.name),\n page=\"download\",\n order=order[1])\n else:\n abort(404)", "label_name": "Base", "label": 1.0}
-{"code": " def nextRandomLong(min: Int = 0): Long = {\n require(min < Long.MaxValue / 2, \"TyE4KGKRY\")\n var result = 0L\n do {\n result = _random.nextLong()\n }\n while (result < min)\n result\n }\n\n\n /** Generates a 130 bit string, almost 26 chars long since each char in a 32 chars\n * alphabet has 5 bits (but we use 36 chars here).\n * Wikipedia says: \"128-bit keys are commonly used and considered very strong\".\n * Here: http://en.wikipedia.org/wiki/Key_(cryptography)\n */\n def nextRandomString(): String =", "label_name": "Base", "label": 1.0}
-{"code": " private def impersonateImpl(anyUserId: Opt[PatId], viewAsOnly: Bo,\n request: DebikiRequest[_]): p_Result = {\n\n // To view as another user, the session id should be amended so it includes info like:\n // \"We originally logged in as Nnn and now we're viewing as Nnn2.\" And pages should be shown\n // only if _both_ Nnn and Nnn2 may view them. \u2014 Not yet implemented, only view-as-stranger\n // supported right now.\n dieIf(anyUserId.isDefined && viewAsOnly, \"EdE6WKT0S\")\n\n val sidAndXsrfCookies = anyUserId.toList flatMap { userId =>\n createSessionIdAndXsrfToken(request.siteId, userId)._3\n }\n\n val logoutCookie =\n if (anyUserId.isEmpty) Seq(DiscardingSessionCookie)\n else Nil\n\n val impCookie = makeImpersonationCookie(request.siteId, viewAsOnly, request.theUserId)\n val newCookies = impCookie :: sidAndXsrfCookies\n\n request.dao.pubSub.unsubscribeUser(request.siteId, request.theRequester)\n\n // But don't subscribe to events for the user we'll be viewing the site as. Real\n // time events isn't the purpose of view-site-as. The client should resubscribe\n // the requester to hens *own* notfs, once done impersonating, though.\n\n Ok.withCookies(newCookies: _*).discardingCookies(logoutCookie: _*)\n }\n\n\n private def makeImpersonationCookie(siteId: SiteId, viewAsGroupOnly: Boolean,", "label_name": "Base", "label": 1.0}
-{"code": " def doLogout(request: GetRequest, redirectIfMayNotSeeUrlPath: Opt[St]): Result = {\n import request.{dao, requester, siteSettings}\n\n requester foreach { theRequester =>\n request.dao.logout(theRequester, bumpLastSeen = true)\n }\n\n val goToNext: Opt[St] = siteSettings.effSsoLogoutAllRedirUrl orElse {\n redirectIfMayNotSeeUrlPath flatMap { urlPath =>\n // May-not-see tested here: [TyT503KRDHJ2]. (May-see: Tested \"everywhere\".)\n // (For embedded comments, maySee will be true.)\n val maySee = dao.mayStrangerProbablySeeUrlPathUseCache(urlPath)\n if (maySee) None\n else siteSettings.effSsoLogoutFromTyRedirUrlIfAuthnReq orElse Some(\"/\")\n }\n }\n\n val response =\n if (request.isAjax) {\n // (For embedded comments, we'll redirect the top window [sso_redir_par_win]\n OkSafeJson(\n Json.obj(\n \"goToUrl\" -> JsX.JsStringOrNull(goToNext)))\n }\n else {\n TemporaryRedirect(\n goToNext.orElse(\n // Then we may see this path: (if any)\n redirectIfMayNotSeeUrlPath) getOrElse \"/\")\n }\n\n // Keep the xsrf cookie, so the login dialog will work.\n response.discardingCookies(DiscardingSessionCookie)\n }\n\n\n def resendSiteOwnerAddrVerifEmail: Action[Unit] =", "label_name": "Base", "label": 1.0}
-{"code": " def listUsernames(pageId: PageId, prefix: String): Action[Unit] = GetAction { request =>\n import request.dao\n\n val pageMeta = dao.getPageMeta(pageId) getOrElse throwIndistinguishableNotFound(\"EdE4Z0B8P5\")\n val categoriesRootLast = dao.getAncestorCategoriesRootLast(pageMeta.categoryId)\n\n SECURITY // Later: skip authors of hidden / deleted / whisper posts. [whispers]\n // Or if some time in the future there will be \"hidden\" accounts [hdn_acts]\n // \u2014 someone who don't want strangers and new members to see hens profile \u2014\n // then, would need to exclude those accounts here.\n\n throwNoUnless(Authz.maySeePage(\n pageMeta, request.user, dao.getGroupIdsOwnFirst(request.user),\n dao.getAnyPrivateGroupTalkMembers(pageMeta), categoriesRootLast,\n tooManyPermissions = dao.getPermsOnPages(categoriesRootLast)), \"EdEZBXKSM2\")\n\n // Also load deleted anon12345 members. Simpler, and they'll typically be very few or none. [5KKQXA4]\n val names = dao.listUsernames(\n pageId = pageId, prefix = prefix, caseSensitive = false, limit = 50)\n\n val json = JsArray(\n names map { nameAndUsername =>\n Json.obj(\n \"id\" -> nameAndUsername.id,\n \"username\" -> nameAndUsername.username,\n \"fullName\" -> nameAndUsername.fullName)\n })\n OkSafeJson(json)\n }\n\n\n /** maxBytes = 3000 because the about text might be fairly long.\n */\n def saveAboutMemberPrefs: Action[JsValue] = PostJsonAction(RateLimits.ConfigUser,", "label_name": "Base", "label": 1.0}
-{"code": " def snoozeNotifications(): Action[JsValue] =\n PostJsonAction(RateLimits.ConfigUser, 200) { request =>", "label_name": "Base", "label": 1.0}
-{"code": " def userNoPageToJson(request: DebikiRequest[_]): Opt[MeAndStuff] = Some {\n import request.authzContext\n require(request.dao == dao, \"TyE4JK5WS2\")\n val requester = request.user getOrElse {\n return None\n }\n val permissions = authzContext.tooManyPermissions\n val permsOnSiteTooMany = dao.getPermsOnSiteForEveryone()\n val watchbar = dao.getOrCreateWatchbar(requester.id)\n val watchbarWithTitles = dao.fillInWatchbarTitlesEtc(watchbar)\n val myGroupsEveryoneLast: Seq[Group] =\n request.authzContext.groupIdsEveryoneLast map dao.getTheGroup\n\n val site = if (requester.isStaffOrCoreMember) dao.getSite else None\n\n dao.readOnlyTransaction { tx =>\n requestersJsonImpl(requester, anyPageId = None, watchbarWithTitles,\n RestrTopicsCatsLinks(JsArray(), Nil, Nil, Nil, Set.empty),\n permissions, permsOnSiteTooMany,\n unapprovedPostAuthorIds = Set.empty, myGroupsEveryoneLast, site, tx)\n }\n }\n\n\n private def requestersJsonImpl(requester: Participant, anyPageId: Option[PageId],", "label_name": "Base", "label": 1.0}
-{"code": "declare function getSetCookie(cookieName: string, value?: string, options?: any): string;\n\n\n// backw compat, later, do once per file instead (don't want a global 'r').\n//\n// ReactDOMFactories looks like:\n//\n// var ReactDOMFactories = {\n// a: createDOMFactory('a'),\n// abbr: ...\n//\n// function createDOMFactory(type) {\n// var factory = React.createElement.bind(null, type);\n// factory.type = type; // makes: `.type === Foo` work\n// return factory;\n// };\n//\n// and React.createElement(type: keyof ReactHTML, props, ...children) returns:\n// DetailedReactHTMLElement\n//\nconst r: { [elmName: string]: (props?: any, ...children) => RElm } = ReactDOMFactories;", "label_name": "Base", "label": 1.0}
-{"code": " it 'returns correct link' do\n data = {\n cutoff: false,\n user: 'Julia Nguyen',\n comment: 'Hello',\n typename: 'typename',\n type: 'type_comment_moment',\n typeid: 1,\n commentable_id: 1\n }\n expect(comment_link(uniqueid, data)).to eq('Julia Nguyen commented \"Hello\" on typename')\n end", "label_name": "Base", "label": 1.0}
-{"code": "error_t coapServerInitResponse(CoapServerContext *context)\n{\n CoapMessageHeader *requestHeader;\n CoapMessageHeader *responseHeader;\n\n //Point to the CoAP request header\n requestHeader = (CoapMessageHeader *) context->request.buffer;\n //Point to the CoAP response header\n responseHeader = (CoapMessageHeader *) context->response.buffer;\n\n //Format message header\n responseHeader->version = COAP_VERSION_1;\n responseHeader->tokenLen = requestHeader->tokenLen;\n responseHeader->code = COAP_CODE_INTERNAL_SERVER;\n responseHeader->mid = requestHeader->mid;\n\n //If immediately available, the response to a request carried in a\n //Confirmable message is carried in an Acknowledgement (ACK) message\n if(requestHeader->type == COAP_TYPE_CON)\n {\n responseHeader->type = COAP_TYPE_ACK;\n }\n else\n {\n responseHeader->type = COAP_TYPE_NON;\n }\n\n //The token is used to match a response with a request\n osMemcpy(responseHeader->token, requestHeader->token,\n requestHeader->tokenLen);\n\n //Set the length of the CoAP message\n context->response.length = sizeof(CoapMessageHeader) + responseHeader->tokenLen;\n context->response.pos = 0;\n\n //Sucessful processing\n return NO_ERROR;\n}", "label_name": "Class", "label": 2.0}
-{"code": "void lpc546xxEthInitDmaDesc(NetInterface *interface)\n{\n uint_t i;\n\n //Initialize TX DMA descriptor list\n for(i = 0; i < LPC546XX_ETH_TX_BUFFER_COUNT; i++)\n {\n //The descriptor is initially owned by the application\n txDmaDesc[i].tdes0 = 0;\n txDmaDesc[i].tdes1 = 0;\n txDmaDesc[i].tdes2 = 0;\n txDmaDesc[i].tdes3 = 0;\n }\n\n //Initialize TX descriptor index\n txIndex = 0;\n\n //Initialize RX DMA descriptor list\n for(i = 0; i < LPC546XX_ETH_RX_BUFFER_COUNT; i++)\n {\n //The descriptor is initially owned by the DMA\n rxDmaDesc[i].rdes0 = (uint32_t) rxBuffer[i];\n rxDmaDesc[i].rdes1 = 0;\n rxDmaDesc[i].rdes2 = 0;\n rxDmaDesc[i].rdes3 = ENET_RDES3_OWN | ENET_RDES3_IOC | ENET_RDES3_BUF1V;\n }\n\n //Initialize RX descriptor index\n rxIndex = 0;\n\n //Start location of the TX descriptor list\n ENET->DMA_CH[0].DMA_CHX_TXDESC_LIST_ADDR = (uint32_t) &txDmaDesc[0];\n //Length of the transmit descriptor ring\n ENET->DMA_CH[0].DMA_CHX_TXDESC_RING_LENGTH = LPC546XX_ETH_TX_BUFFER_COUNT - 1;\n\n //Start location of the RX descriptor list\n ENET->DMA_CH[0].DMA_CHX_RXDESC_LIST_ADDR = (uint32_t) &rxDmaDesc[0];\n //Length of the receive descriptor ring\n ENET->DMA_CH[0].DMA_CHX_RXDESC_RING_LENGTH = LPC546XX_ETH_RX_BUFFER_COUNT - 1;\n}", "label_name": "Class", "label": 2.0}
-{"code": "error_t httpClientSetUri(HttpClientContext *context, const char_t *uri)\n{\n size_t m;\n size_t n;\n char_t *p;\n char_t *q;\n\n //Check parameters\n if(context == NULL || uri == NULL)\n return ERROR_INVALID_PARAMETER;\n\n //The resource name must not be empty\n if(uri[0] == '\\0')\n return ERROR_INVALID_PARAMETER;\n\n //Check HTTP request state\n if(context->requestState != HTTP_REQ_STATE_FORMAT_HEADER)\n return ERROR_WRONG_STATE;\n\n //Make sure the buffer contains a valid HTTP request\n if(context->bufferLen > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_INVALID_SYNTAX;\n\n //Properly terminate the string with a NULL character\n context->buffer[context->bufferLen] = '\\0';\n\n //The Request-Line begins with a method token\n p = strchr(context->buffer, ' ');\n //Any parsing error?\n if(p == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //The method token is followed by the Request-URI\n p++;\n\n //Point to the end of the Request-URI\n q = strpbrk(p, \" ?\");\n //Any parsing error?\n if(q == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Compute the length of the current URI\n m = q - p;\n //Compute the length of the new URI\n n = osStrlen(uri);\n\n //Make sure the buffer is large enough to hold the new resource name\n if((context->bufferLen + n - m) > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_BUFFER_OVERFLOW;\n\n //Make room for the new resource name\n osMemmove(p + n, q, context->buffer + context->bufferLen + 1 - q);\n //Copy the new resource name\n osStrncpy(p, uri, n);\n\n //Adjust the length of the request header\n context->bufferLen = context->bufferLen + n - m;\n\n //Successful processing\n return NO_ERROR;\n}", "label_name": "Class", "label": 2.0}
+{"code": " protected function parseChunkedRequest(Request $request)\n {\n $index = $request->get('qqpartindex');\n $total = $request->get('qqtotalparts');\n $uuid = $request->get('qquuid');\n $orig = $request->get('qqfilename');\n $last = ((int) $total - 1) === (int) $index;\n\n return [$last, $uuid, $index, $orig];\n }", "label_name": "Base", "label": 1.0}
+{"code": " protected function parseChunkedRequest(Request $request)\n {\n $session = $this->container->get('session');\n\n $orig = $request->get('name');\n $index = $request->get('chunk');\n $last = (int) $request->get('chunks') - 1 === (int) $request->get('chunk');\n\n // it is possible, that two clients send a file with the\n // exact same filename, therefore we have to add the session\n // to the uuid otherwise we will get a mess\n $uuid = md5(sprintf('%s.%s', $orig, $session->getId()));\n\n return [$last, $uuid, $index, $orig];\n }", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\t$searches[] = $wpdb->prepare( \"u.{$field} LIKE %s\", '%' . trim( $_POST['search'] ) . '%' );\n\t\t\t\t}\n\n\t\t\t\t$core_search = implode( ' OR ', $searches );\n\n\t\t\t\t$this->joins[] = \"LEFT JOIN {$wpdb->prefix}um_metadata umm_search ON umm_search.user_id = u.ID\";\n\t\t\t\t$this->sql_where .= \" AND ( umm_search.um_value = '\" . trim( $_POST['search'] ) . \"' OR umm_search.um_value LIKE '%\" . trim( $_POST['search'] ) . \"%' OR umm_search.um_value LIKE '%\" . trim( serialize( strval( $_POST['search'] ) ) ) . \"%' OR {$core_search})\";\n\n\t\t\t\t$this->is_search = true;\n\t\t\t}", "label_name": "Base", "label": 1.0}
+{"code": " public static function getNameWithCase($name, $surname, $title = false, $id = false, $nick = false)\n {\n $str = '';\n\n if ($title !== false && $title instanceof Title) {\n $str .= $title->tshort . ' ';\n }\n\n $str .= mb_strtoupper($name, 'UTF-8') . ' ' .\n ucwords(mb_strtolower($surname, 'UTF-8'), \" \\t\\r\\n\\f\\v-_|\");\n\n if ($id !== false || $nick !== false) {\n $str .= ' (';\n }\n if ($nick !== false) {\n $str .= $nick;\n }\n if ($id !== false) {\n if ($nick !== false && !empty($nick)) {\n $str .= ', ';\n }\n $str .= $id;\n }\n if ($id !== false || $nick !== false) {\n $str .= ')';\n }\n return $str;\n }", "label_name": "Base", "label": 1.0}
+{"code": " public function getName($translated = true)\n {\n if ($translated === true) {\n return _T($this->name);\n } else {\n return $this->name;\n }\n }", "label_name": "Base", "label": 1.0}
+{"code": " protected function load($id, $init = true)\n {\n global $login;\n\n try {\n $select = $this->zdb->select(self::TABLE);\n $select->limit(1)\n ->where(self::PK . ' = ' . $id);\n\n $results = $this->zdb->execute($select);\n\n $count = $results->count();\n if ($count === 0) {\n if ($init === true) {\n $models = new PdfModels($this->zdb, $this->preferences, $login);\n $models->installInit();\n $this->load($id, false);\n } else {\n throw new \\RuntimeException('Model not found!');\n }\n } else {\n $this->loadFromRs($results->current());\n }\n } catch (Throwable $e) {\n Analog::log(\n 'An error occurred loading model #' . $id . \"Message:\\n\" .\n $e->getMessage(),\n Analog::ERROR\n );\n throw $e;\n }\n }", "label_name": "Base", "label": 1.0}
{"code": "function db_properties($table)\n{\n\tglobal $DatabaseType, $DatabaseUsername;\n\n\tswitch ($DatabaseType) {\n\t\tcase 'mysqli':\n\t\t\t$result = DBQuery(\"SHOW COLUMNS FROM $table\");\n\t\t\twhile ($row = db_fetch_row($result)) {\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));\n\t\t\t\tif (!$pos = strpos($row['TYPE'], ','))\n\t\t\t\t\t$pos = strpos($row['TYPE'], ')');\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);\n\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);\n\n\t\t\t\tif ($row['NULL'] != '')\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn $properties;\n}", "label_name": "Base", "label": 1.0}
-{"code": "function db_start()\n{\n\tglobal $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType, $connection;\n\n\n\tswitch ($DatabaseType) {\n\t\tcase 'mysqli':\n\t\t\t$connection = new ConnectDBOpensis();\n\t\t\tif ($connection->auto_init == true) {\n\t\t\t\t$connection = $connection->init($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n\t\t\t\tmysqli_set_charset($connection, \"utf8\");\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\t// Error code for both.\n\tif ($connection === false) {\n\t\tswitch ($DatabaseType) {\n\t\t\tcase 'mysqli':\n\t\t\t\t$errormessage = mysqli_error($connection);\n\t\t\t\tbreak;\n\t\t}\n\t\tdb_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errstring);\n\t}\n\treturn $connection;\n}", "label_name": "Base", "label": 1.0}
-{"code": "function db_seq_nextval($seqname)\n{\n\tglobal $DatabaseType;\n\n\tif ($DatabaseType == 'mysqli')\n\t\t$seq = \"fn_\" . strtolower($seqname) . \"()\";\n\n\treturn $seq;\n}", "label_name": "Base", "label": 1.0}
-{"code": "\t\t\t\t\t\tunset($return[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn @array_change_key_case($return, CASE_UPPER);\n}", "label_name": "Base", "label": 1.0}
-{"code": "\t\t\t\t\t\tunset($return[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn @array_change_key_case($return, CASE_UPPER);\n}", "label_name": "Base", "label": 1.0}
-{"code": "function db_start()\n{\n\tglobal $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n\tswitch ($DatabaseType) {\n\t\tcase 'mysqli':\n\t\t\t$connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n\t\t\tbreak;\n\t}\n\n\t// Error code for both.\n\tif ($connection === false) {\n\t\tswitch ($DatabaseType) {\n\t\t\tcase 'mysqli':\n\t\t\t\t$errormessage = mysqli_error($connection);\n\t\t\t\tbreak;\n\t\t}\n\t\tdb_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n\t}\n\treturn $connection;\n}", "label_name": "Base", "label": 1.0}
-{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label_name": "Base", "label": 1.0}
{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\t$dt = date('Y-m-d', strtotime($match));\n\t\t\t\t\t$sql = par_rep(\"/'$match'/\", \"'$dt'\", $sql);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (substr($sql, 0, 6) == \"BEGIN;\") {\n\t\t\t\t$array = explode(\";\", $sql);\n\t\t\t\tforeach ($array as $value) {\n\t\t\t\t\tif ($value != \"\") {\n\t\t\t\t\t\t$result = $connection->query($value);\n\t\t\t\t\t\tif (!$result) {\n\t\t\t\t\t\t\t$connection->query(\"ROLLBACK\");\n\t\t\t\t\t\t\tdie(db_show_error($sql, _dbExecuteFailed, mysql_error()));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error()));\n\t\t\t}\n\t\t\tbreak;\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "function db_properties($table)\n{\n\tglobal $DatabaseType, $DatabaseUsername;\n\n\tswitch ($DatabaseType) {\n\t\tcase 'mysqli':\n\t\t\t$result = DBQuery(\"SHOW COLUMNS FROM $table\");\n\t\t\twhile ($row = db_fetch_row($result)) {\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));\n\t\t\t\tif (!$pos = strpos($row['TYPE'], ','))\n\t\t\t\t\t$pos = strpos($row['TYPE'], ')');\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);\n\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);\n\n\t\t\t\tif ($row['NULL'] != '')\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn $properties;\n}", "label_name": "Base", "label": 1.0}
{"code": "function db_properties($table)\n{\n global $DatabaseType, $DatabaseUsername;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $result = DBQuery(\"SHOW COLUMNS FROM $table\");\n while ($row = db_fetch_row($result)) {\n $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));\n if (!$pos = strpos($row['TYPE'], ','))\n $pos = strpos($row['TYPE'], ')');\n else\n $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);\n\n $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);\n\n if ($row['NULL'] != '')\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n else\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n }\n break;\n }\n return $properties;\n}", "label_name": "Base", "label": 1.0}
{"code": "function db_properties($table)\n{\n global $DatabaseType, $DatabaseUsername;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $result = DBQuery(\"SHOW COLUMNS FROM $table\");\n while ($row = db_fetch_row($result)) {\n $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));\n if (!$pos = strpos($row['TYPE'], ','))\n $pos = strpos($row['TYPE'], ')');\n else\n $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);\n\n $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);\n\n if ($row['NULL'] != '')\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n else\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n }\n break;\n }\n return $properties;\n}", "label_name": "Base", "label": 1.0}
+{"code": "function db_case($array)\n{\n global $DatabaseType;\n\n $counter = 0;\n if ($DatabaseType == 'mysqli') {\n $array_count = count($array);\n $string = \" CASE WHEN $array[0] =\";\n $counter++;\n $arr_count = count($array);\n for ($i = 1; $i < $arr_count; $i++) {\n $value = $array[$i];\n\n if ($value == \"''\" && substr($string, -1) == '=') {\n $value = ' IS NULL';\n $string = substr($string, 0, -1);\n }\n\n $string .= \"$value\";\n if ($counter == ($array_count - 2) && $array_count % 2 == 0)\n $string .= \" ELSE \";\n elseif ($counter == ($array_count - 1))\n $string .= \" END \";\n elseif ($counter % 2 == 0)\n $string .= \" WHEN $array[0]=\";\n elseif ($counter % 2 == 1)\n $string .= \" THEN \";\n\n $counter++;\n }\n }\n return $string;\n}", "label_name": "Base", "label": 1.0}
+{"code": " foreach ($val as $vkey => $value) {\n if ($vkey != 'LAST_UPDATED') {\n if ($vkey != 'UPDATED_BY') {\n if ($vkey == 'ID')\n echo '' . htmlentities($value) . '';\n else if ($vkey == 'SYEAR')\n echo '' . htmlentities($value) . '';\n else if ($vkey == 'TITLE')\n echo '' . htmlentities($value) . '';\n else if ($vkey == 'WWW_ADDRESS')\n echo '' . htmlentities($value) . '';\n else\n echo '<' . $vkey . '>' . htmlentities($value) . '' . $vkey . '>';\n }\n }\n }", "label_name": "Base", "label": 1.0}
+{"code": " foreach ($value as $k => $val) {\n if ($k != 'LAST_UPDATED') {\n if ($k != 'UPDATED_BY') {\n if ($k == 'ID')\n $data['data'][$i]['SCHOOL_ID'] = $val;\n else if ($k == 'SYEAR')\n $data['data'][$i]['SCHOOL_YEAR'] = $val;\n else if ($k == 'TITLE')\n $data['data'][$i]['SCHOOL_NAME'] = $val;\n else if ($k == 'WWW_ADDRESS')\n $data['data'][$i]['URL'] = $val;\n else\n $data['data'][$i][$k] = $val;\n }\n }\n }", "label_name": "Base", "label": 1.0}
{"code": " echo '';\n $i++;\n }\n echo '';\n // }\n echo '';\n $j++;\n }", "label_name": "Base", "label": 1.0}
-{"code": "function db_properties($table)\n{\n global $DatabaseType, $DatabaseUsername;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $result = DBQuery(\"SHOW COLUMNS FROM $table\");\n while ($row = db_fetch_row($result)) {\n $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));\n if (!$pos = strpos($row['TYPE'], ','))\n $pos = strpos($row['TYPE'], ')');\n else\n $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);\n\n $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);\n\n if ($row['NULL'] != '')\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n else\n $properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n }\n break;\n }\n return $properties;\n}", "label_name": "Base", "label": 1.0}
-{"code": "function db_seq_nextval($seqname)\n{\n global $DatabaseType;\n\n if ($DatabaseType == 'mysqli')\n $seq = \"fn_\" . strtolower($seqname) . \"()\";\n\n return $seq;\n}", "label_name": "Base", "label": 1.0}
-{"code": " $percent = round($percent, 0);\n } else {\n $percent = round($percent, 2); // school default\n }\n if ($ret == '%')\n return $percent;\n\n if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id])\n $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\\'' . $cp[1]['SYEAR'] . '\\' AND SCHOOL_ID=\\'' . $cp[1]['SCHOOL_ID'] . '\\' AND GRADE_SCALE_ID=\\'' . $grade_scale_id . '\\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER'));\n\n foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) {\n if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF'])\n return $ret == 'ID' ? $grade['ID'] : $grade['TITLE'];\n }\n}", "label_name": "Base", "label": 1.0}
-{"code": "function VerifyVariableSchedule_Update($columns)\n{\n\n\n// $teacher=$columns['TEACHER_ID'];\n// $secteacher=$columns['SECONDARY_TEACHER_ID'];\n// if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')\n// {\n// $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');\n// }\n// else\n// //$all_teacher=($secteacher!=''?$secteacher:'');\n// $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');\n \n \n \n $teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$columns['TEACHER_ID']);\n $secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$columns['SECONDARY_TEACHER_ID']);\n // $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID'];\n\n if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')\n $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');", "label_name": "Base", "label": 1.0}
+{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label_name": "Base", "label": 1.0}
+{"code": " foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) {\n echo '';\n echo '' . htmlentities($ed['SCHOOL_ID']) . '';\n echo '' . htmlentities($ed['CALENDAR']) . '';\n echo '' . htmlentities($ed['GRADE']) . '';\n echo '' . htmlentities($ed['SECTION']) . '';\n echo '' . htmlentities($ed['START_DATE']) . '';\n echo '' . htmlentities($ed['DROP_DATE']) . '';\n echo '' . htmlentities($ed['ENROLLMENT_CODE']) . '';\n echo '' . htmlentities($ed['DROP_CODE']) . '';\n echo '';\n }", "label_name": "Base", "label": 1.0}
+{"code": "function db_case($array)\n{\n global $DatabaseType;\n\n $counter = 0;\n if ($DatabaseType == 'mysqli') {\n $array_count = count($array);\n $string = \" CASE WHEN $array[0] =\";\n $counter++;\n $arr_count = count($array);\n for ($i = 1; $i < $arr_count; $i++) {\n $value = $array[$i];\n\n if ($value == \"''\" && substr($string, -1) == '=') {\n $value = ' IS NULL';\n $string = substr($string, 0, -1);\n }\n\n $string .= \"$value\";\n if ($counter == ($array_count - 2) && $array_count % 2 == 0)\n $string .= \" ELSE \";\n elseif ($counter == ($array_count - 1))\n $string .= \" END \";\n elseif ($counter % 2 == 0)\n $string .= \" WHEN $array[0]=\";\n elseif ($counter % 2 == 1)\n $string .= \" THEN \";\n\n $counter++;\n }\n }\n return $string;\n}", "label_name": "Base", "label": 1.0}
{"code": " foreach($course_RET as $period_date)\n {\n // $period_days_append_sql .=\"(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR \";\n $period_days_append_sql .=\"(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND (cpv.course_period_date IS NULL OR cpv.course_period_date='$period_date[COURSE_PERIOD_DATE]') AND cpv.DAYS LIKE '%$period_date[DAYS]%') OR \";\n\n }", "label_name": "Base", "label": 1.0}
-{"code": "function formcheck_Timetable_course_F3(this_DET) {\n var this_button_id = this_DET.id;\n\n var frmvalidator = new Validator(\"F3\", this_button_id);\n\n var course_id = document.getElementById(\"course_id_div\").value;\n if (course_id == \"new\") {\n frmvalidator.addValidation(\n \"tables[courses][new][TITLE]\",\n \"req\",\n \"Please enter the course title \"\n );\n frmvalidator.addValidation(\n \"tables[courses][new][TITLE]\",\n \"maxlen=100\",\n \"Max length for course title is 100 characters \"\n );\n\n frmvalidator.addValidation(\n \"tables[courses][new][SHORT_NAME]\",\n \"maxlen=25\",\n \"Max length for short name is 25 characters \"\n );\n } else {\n frmvalidator.addValidation(\n \"inputtables[courses][\" + course_id + \"][TITLE]\",\n \"req\",\n \"Please enter the course title \"\n );\n frmvalidator.addValidation(\n \"inputtables[courses][\" + course_id + \"][TITLE]\",\n \"maxlen=100\",\n \"Max length for course title is 100 characters\"\n );\n\n frmvalidator.addValidation(\n \"inputtables[courses][\" + course_id + \"][SHORT_NAME]\",\n \"maxlen=25\",\n \"Max length for short name is 25 characters\"\n );\n }\n}", "label_name": "Base", "label": 1.0}
-{"code": " private ZonedDateTime toZonedDateTime(XMLGregorianCalendar instant) {\n if (instant == null) {\n return null;\n }\n\n return instant.toGregorianCalendar().toZonedDateTime();\n }", "label_name": "Base", "label": 1.0}
-{"code": "export function getExtensionPath(): string {\n\treturn extensionPath;\n}", "label_name": "Class", "label": 2.0}
-{"code": "cs.get.hsl = function (string) {\n\tif (!string) {\n\t\treturn null;\n\t}\n\n\tvar hsl = /^hsla?\\(\\s*([+-]?(?:\\d*\\.)?\\d+)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)$/;\n\tvar match = string.match(hsl);\n\n\tif (match) {\n\t\tvar alpha = parseFloat(match[4]);\n\t\tvar h = (parseFloat(match[1]) + 360) % 360;\n\t\tvar s = clamp(parseFloat(match[2]), 0, 100);\n\t\tvar l = clamp(parseFloat(match[3]), 0, 100);\n\t\tvar a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);\n\n\t\treturn [h, s, l, a];\n\t}\n\n\treturn null;\n};", "label_name": "Base", "label": 1.0}
-{"code": " def oauth_authorized(self, provider):\n log.debug(\"Authorized init\")\n resp = self.appbuilder.sm.oauth_remotes[provider].authorize_access_token()\n if resp is None:\n flash(u\"You denied the request to sign in.\", \"warning\")\n return redirect(self.appbuilder.get_url_for_login)\n log.debug(\"OAUTH Authorized resp: {0}\".format(resp))\n # Retrieves specific user info from the provider\n try:\n self.appbuilder.sm.set_oauth_session(provider, resp)\n userinfo = self.appbuilder.sm.oauth_user_info(provider, resp)\n except Exception as e:\n log.error(\"Error returning OAuth user info: {0}\".format(e))\n user = None\n else:\n log.debug(\"User info retrieved from {0}: {1}\".format(provider, userinfo))\n # User email is not whitelisted\n if provider in self.appbuilder.sm.oauth_whitelists:\n whitelist = self.appbuilder.sm.oauth_whitelists[provider]\n allow = False\n for e in whitelist:\n if re.search(e, userinfo[\"email\"]):\n allow = True\n break\n if not allow:\n flash(u\"You are not authorized.\", \"warning\")\n return redirect(self.appbuilder.get_url_for_login)\n else:\n log.debug(\"No whitelist for OAuth provider\")\n user = self.appbuilder.sm.auth_user_oauth(userinfo)\n\n if user is None:\n flash(as_unicode(self.invalid_login_message), \"warning\")\n return redirect(self.appbuilder.get_url_for_login)\n else:\n login_user(user)\n try:\n state = jwt.decode(\n request.args[\"state\"],\n self.appbuilder.app.config[\"SECRET_KEY\"],\n algorithms=[\"HS256\"],\n )\n except jwt.InvalidTokenError:\n raise Exception(\"State signature is not valid!\")\n\n try:\n next_url = state[\"next\"][0] or self.appbuilder.get_url_for_index\n except (KeyError, IndexError):\n next_url = self.appbuilder.get_url_for_index\n\n return redirect(next_url)", "label_name": "Base", "label": 1.0}
-{"code": "func (m *ContainsNestedMap) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowTheproto3\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: ContainsNestedMap: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: ContainsNestedMap: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipTheproto3(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthTheproto3\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthTheproto3\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label_name": "Variant", "label": 0.0}
-{"code": "void * pvPortMalloc( size_t xWantedSize )\r\n{\r\n void * pvReturn = NULL;\r\n static uint8_t * pucAlignedHeap = NULL;\r\n\r\n /* Ensure that blocks are always aligned to the required number of bytes. */\r\n #if ( portBYTE_ALIGNMENT != 1 )\r\n {\r\n if( xWantedSize & portBYTE_ALIGNMENT_MASK )\r\n {\r\n /* Byte alignment required. */\r\n xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );\r\n }\r\n }\r\n #endif\r\n\r\n vTaskSuspendAll();\r\n {\r\n if( pucAlignedHeap == NULL )\r\n {\r\n /* Ensure the heap starts on a correctly aligned boundary. */\r\n pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) & ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );\r\n }\r\n\r\n /* Check there is enough room left for the allocation. */\r\n if( ( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE ) &&\r\n ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) ) /* Check for overflow. */\r\n {\r\n /* Return the next free byte then increment the index past this\r\n * block. */\r\n pvReturn = pucAlignedHeap + xNextFreeByte;\r\n xNextFreeByte += xWantedSize;\r\n }\r\n\r\n traceMALLOC( pvReturn, xWantedSize );\r\n }\r\n ( void ) xTaskResumeAll();\r\n\r\n #if ( configUSE_MALLOC_FAILED_HOOK == 1 )\r\n {\r\n if( pvReturn == NULL )\r\n {\r\n extern void vApplicationMallocFailedHook( void );\r\n vApplicationMallocFailedHook();\r\n }\r\n }\r\n #endif\r\n\r\n return pvReturn;\r\n}\r", "label_name": "Class", "label": 2.0}
-{"code": " private Job startCreateJob(EntityReference entityReference, EditForm editForm) throws XWikiException\n {\n if (StringUtils.isBlank(editForm.getTemplate())) {\n // No template specified, nothing more to do.\n return null;\n }\n\n // If a template is set in the request, then this is a create action which needs to be handled by a create job,\n // but skipping the target document, which is now already saved by the save action.\n\n RefactoringScriptService refactoring =\n (RefactoringScriptService) Utils.getComponent(ScriptService.class, \"refactoring\");\n\n CreateRequest request = refactoring.getRequestFactory().createCreateRequest(Arrays.asList(entityReference));\n request.setCheckAuthorRights(false);\n // Set the target document.\n request.setEntityReferences(Arrays.asList(entityReference));\n // Set the template to use.\n DocumentReferenceResolver resolver =\n Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, \"currentmixed\");\n EntityReference templateReference = resolver.resolve(editForm.getTemplate());\n request.setTemplateReference(templateReference);\n // We`ve already created and populated the fields of the target document, focus only on the remaining children\n // specified in the template.\n request.setSkippedEntities(Arrays.asList(entityReference));\n\n Job createJob = refactoring.create(request);\n if (createJob != null) {\n return createJob;\n } else {\n throw new XWikiException(String.format(\"Failed to schedule the create job for [%s]\", entityReference),\n refactoring.getLastError());\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void newDocumentWebHomeFromURLTemplateProviderSpecifiedButOldPageTypeButOverriddenFromUIToNonTerminal()\n throws Exception\n {\n // new document = xwiki:X.Y.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"X\", \"Y\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(true);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Specifying a template provider in the URL: templateprovider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n when(mockRequest.getParameter(\"tocreate\")).thenReturn(\"nonterminal\");\n\n // Mock 1 existing template provider\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"), Collections.EMPTY_LIST, null,\n \"page\");\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating the document X.Y.WebHome as non-terminal, since even if the template provider did not\n // specify a \"terminal\" property and it used the old \"page\" type, the UI explicitly asked for a non-terminal\n // document. Also using a template, as specified in the template provider.\n verify(mockURLFactory).createURL(\"X.Y\", \"WebHome\", \"edit\",\n \"template=XWiki.MyTemplate&parent=Main.WebHome&title=Y\", null, \"xwiki\", context);\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void newDocumentFromURLTemplateProviderSpecifiedButNotAllowed() throws Exception\n {\n // new document = xwiki:X.Y\n DocumentReference documentReference =\n new DocumentReference(\"Y\", new SpaceReference(\"X\", new WikiReference(\"xwiki\")));\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(true);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Specifying a template provider in the URL: templateprovider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n\n // Mock 1 existing template provider\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"),\n Arrays.asList(\"AnythingButX\"));\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify that the create template is rendered, so the UI is displayed for the user to see the error.\n assertEquals(\"create\", result);\n\n // Check that the exception is properly set in the context for the UI to display.\n XWikiException exception = (XWikiException) this.oldcore.getScriptContext().getAttribute(\"createException\");\n assertNotNull(exception);\n assertEquals(XWikiException.ERROR_XWIKI_APP_TEMPLATE_NOT_AVAILABLE, exception.getCode());\n\n // We should not get this far so no redirect should be done, just the template will be rendered.\n verify(mockURLFactory, never()).createURL(any(), any(), any(), any(), any(),\n any(), any(XWikiContext.class));\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void existingDocumentFromUIDeprecatedCheckEscaping() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI space=X.Y&page=Z\n when(mockRequest.getParameter(\"space\")).thenReturn(\"X.Y\");\n when(mockRequest.getParameter(\"page\")).thenReturn(\"Z\");\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note1: The space parameter was previously considered as space name, not space reference, so it is escaped.\n // Note2: We are creating X\\.Y.Z since the deprecated parameters were creating terminal documents by default.\n verify(mockURLFactory).createURL(\"X\\\\.Y\", \"Z\", \"edit\", \"template=&parent=Main.WebHome&title=Z\", null, \"xwiki\",\n context);\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void existingDocumentFromUITemplateProviderSpecifiedButNotAllowed() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI spaceReference=X&name=Y&templateProvider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n when(mockRequest.getParameter(\"spaceReference\")).thenReturn(\"X\");\n when(mockRequest.getParameter(\"name\")).thenReturn(\"Y\");\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n\n // Mock 1 existing template provider\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"),\n Arrays.asList(\"AnythingButX\"));\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify that the create template is rendered, so the UI is displayed for the user to see the error.\n assertEquals(\"create\", result);\n\n // Check that the exception is properly set in the context for the UI to display.\n XWikiException exception = (XWikiException) this.oldcore.getScriptContext().getAttribute(\"createException\");\n assertNotNull(exception);\n assertEquals(XWikiException.ERROR_XWIKI_APP_TEMPLATE_NOT_AVAILABLE, exception.getCode());\n\n // We should not get this far so no redirect should be done, just the template will be rendered.\n verify(mockURLFactory, never()).createURL(any(), any(), any(), any(), any(),\n any(), any(XWikiContext.class));\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void resetPassword(UserReference userReference, String newPassword)\n throws ResetPasswordException\n {\n this.checkUserReference(userReference);\n XWikiContext context = this.contextProvider.get();\n\n DocumentUserReference documentUserReference = (DocumentUserReference) userReference;\n DocumentReference reference = documentUserReference.getReference();\n\n try {\n XWikiDocument userDocument = context.getWiki().getDocument(reference, context);\n userDocument.removeXObjects(RESET_PASSWORD_REQUEST_CLASS_REFERENCE);\n BaseObject userXObject = userDocument.getXObject(USER_CLASS_REFERENCE);\n userXObject.setStringValue(\"password\", newPassword);\n\n String saveComment = this.localizationManager.getTranslationPlain(\n \"xe.admin.passwordReset.step2.versionComment.passwordReset\");\n context.getWiki().saveDocument(userDocument, saveComment, true, context);\n } catch (XWikiException e) {\n throw new ResetPasswordException(\"Cannot open user document to perform reset password.\", e);\n }\n }", "label_name": "Base", "label": 1.0}
-{"code": " public ResetPasswordRequestResponse requestResetPassword(UserReference userReference) throws ResetPasswordException\n {\n this.checkUserReference(userReference);\n\n UserProperties userProperties = this.userPropertiesResolver.resolve(userReference);\n InternetAddress email = userProperties.getEmail();\n\n if (email == null) {\n String exceptionMessage =\n this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.error.noEmail\");\n throw new ResetPasswordException(exceptionMessage);\n }\n\n DocumentUserReference documentUserReference = (DocumentUserReference) userReference;\n DocumentReference reference = documentUserReference.getReference();\n XWikiContext context = this.contextProvider.get();\n\n try {\n XWikiDocument userDocument = context.getWiki().getDocument(reference, context);\n\n if (userDocument.getXObject(LDAP_CLASS_REFERENCE) != null) {\n String exceptionMessage =\n this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.error.ldapUser\",\n userReference.toString());\n throw new ResetPasswordException(exceptionMessage);\n }\n\n BaseObject xObject = userDocument.getXObject(RESET_PASSWORD_REQUEST_CLASS_REFERENCE, true, context);\n String verificationCode = context.getWiki().generateRandomString(30);\n xObject.set(VERIFICATION_PROPERTY, verificationCode, context);\n\n String saveComment =\n this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.versionComment\");\n context.getWiki().saveDocument(userDocument, saveComment, true, context);\n\n return new DefaultResetPasswordRequestResponse(userReference, email, verificationCode);\n } catch (XWikiException e) {\n throw new ResetPasswordException(\"Error when reading user document to perform reset password request.\", e);\n }\n }", "label_name": "Base", "label": 1.0}
-{"code": " void requestResetPasswordUnexistingUser()\n {\n when(this.userReference.toString()).thenReturn(\"user:Foobar\");\n when(this.userManager.exists(this.userReference)).thenReturn(false);\n String exceptionMessage = \"User [user:Foobar] doesn't exist\";\n when(this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.error.noUser\",\n \"user:Foobar\")).thenReturn(exceptionMessage);\n ResetPasswordException resetPasswordException = assertThrows(ResetPasswordException.class,\n () -> this.resetPasswordManager.requestResetPassword(this.userReference));\n assertEquals(exceptionMessage, resetPasswordException.getMessage());\n }", "label_name": "Base", "label": 1.0}
-{"code": " void sendResetPasswordEmailRequest() throws Exception\n {\n when(this.referenceSerializer.serialize(this.userReference)).thenReturn(\"user:Foobar\");\n when(this.userProperties.getFirstName()).thenReturn(\"Foo\");\n when(this.userProperties.getLastName()).thenReturn(\"Bar\");\n\n AuthenticationResourceReference resourceReference =\n new AuthenticationResourceReference(AuthenticationAction.RESET_PASSWORD);\n\n String verificationCode = \"foobar4242\";\n resourceReference.addParameter(\"u\", \"user:Foobar\");\n resourceReference.addParameter(\"v\", verificationCode);\n ExtendedURL firstExtendedURL =\n new ExtendedURL(Arrays.asList(\"authenticate\", \"reset\"), resourceReference.getParameters());\n when(this.resourceReferenceSerializer.serialize(resourceReference)).thenReturn(firstExtendedURL);\n when(this.urlNormalizer.normalize(firstExtendedURL)).thenReturn(\n new ExtendedURL(Arrays.asList(\"xwiki\", \"authenticate\", \"reset\"), resourceReference.getParameters())\n );\n XWikiURLFactory urlFactory = mock(XWikiURLFactory.class);\n when(this.context.getURLFactory()).thenReturn(urlFactory);\n when(urlFactory.getServerURL(this.context)).thenReturn(new URL(\"http://xwiki.org\"));\n\n InternetAddress email = new InternetAddress(\"foobar@xwiki.org\");\n DefaultResetPasswordRequestResponse requestResponse =\n new DefaultResetPasswordRequestResponse(this.userReference, email,\n verificationCode);\n this.resetPasswordManager.sendResetPasswordEmailRequest(requestResponse);\n verify(this.resetPasswordMailSender).sendResetPasswordEmail(\"Foo Bar\", email,\n new URL(\"http://xwiki.org/xwiki/authenticate/reset?u=user%3AFoobar&v=foobar4242\"));\n }", "label_name": "Base", "label": 1.0}
-{"code": " void checkVerificationCode() throws Exception\n {\n when(this.userManager.exists(this.userReference)).thenReturn(true);\n InternetAddress email = new InternetAddress(\"foobar@xwiki.org\");\n when(this.userProperties.getEmail()).thenReturn(email);\n String verificationCode = \"abcd1245\";\n BaseObject xObject = mock(BaseObject.class);\n when(this.userDocument\n .getXObject(DefaultResetPasswordManager.RESET_PASSWORD_REQUEST_CLASS_REFERENCE))\n .thenReturn(xObject);\n String encodedVerificationCode = \"encodedVerificationCode\";\n when(xObject.getStringValue(DefaultResetPasswordManager.VERIFICATION_PROPERTY))\n .thenReturn(encodedVerificationCode);\n BaseClass baseClass = mock(BaseClass.class);\n when(xObject.getXClass(context)).thenReturn(baseClass);\n PasswordClass passwordClass = mock(PasswordClass.class);\n when(baseClass.get(DefaultResetPasswordManager.VERIFICATION_PROPERTY)).thenReturn(passwordClass);\n when(passwordClass.getEquivalentPassword(encodedVerificationCode, verificationCode))\n .thenReturn(encodedVerificationCode);\n String newVerificationCode = \"foobartest\";\n when(xWiki.generateRandomString(30)).thenReturn(newVerificationCode);\n String saveComment = \"Save new verification code\";\n when(this.localizationManager\n .getTranslationPlain(\"xe.admin.passwordReset.step2.versionComment.changeValidationKey\"))\n .thenReturn(saveComment);\n DefaultResetPasswordRequestResponse expected =\n new DefaultResetPasswordRequestResponse(this.userReference, email,\n newVerificationCode);\n\n assertEquals(expected, this.resetPasswordManager.checkVerificationCode(this.userReference, verificationCode));\n verify(this.xWiki).saveDocument(this.userDocument, saveComment, true, context);\n }", "label_name": "Base", "label": 1.0}
-{"code": " void requestResetPasswordWithoutPR() throws Exception\n {\n when(this.authorizationManager.hasAccess(Right.PROGRAM)).thenReturn(false);\n\n assertNull(this.scriptService.requestResetPassword(mock(UserReference.class)));\n verify(this.resetPasswordManager, never()).requestResetPassword(any());\n verify(this.resetPasswordManager, never()).sendResetPasswordEmailRequest(any());\n }", "label_name": "Base", "label": 1.0}
-{"code": " protected String getContent(SxSource sxSource, FilesystemExportContext exportContext)\n {\n String content;\n\n // We know we're inside a SX file located at \"sx///sx.\". Inside this CSS\n // there can be URLs and we need to ensure that the prefix for these URLs lead to the root of the path, i.e.\n // 3 levels up (\"../../../\").\n // To make this happen we reuse the Doc Parent Level from FileSystemExportContext to a fixed value of 3.\n // We also make sure to put back the original value\n int originalDocParentLevel = exportContext.getDocParentLevel();\n try {\n exportContext.setDocParentLevels(3);\n content = sxSource.getContent();\n } finally {\n exportContext.setDocParentLevels(originalDocParentLevel);\n }\n\n return content;\n }", "label_name": "Base", "label": 1.0}
-{"code": " public String invokeServletAndReturnAsString(String url)\n {\n return this.xwiki.invokeServletAndReturnAsString(url, getXWikiContext());\n }", "label_name": "Class", "label": 2.0}
-{"code": " void setErrorCount(final int c) {\n this.errorCount = c;\n }", "label_name": "Base", "label": 1.0}
-{"code": " public static Object deserialize(final String s) {\n ObjectInputStream ois = null;\n try {\n ois = new ObjectInputStream(new ByteArrayInputStream(s.getBytes(\"8859_1\")));\n return ois.readObject();\n } catch (Exception e) {\n logger.error(\"Cannot deserialize payload using \" + (s == null ? -1 : s.length()) + \" bytes\", e);\n throw new IllegalArgumentException(\"Cannot deserialize payload\");\n } finally {\n if (ois != null) {\n try {\n ois.close();\n } catch (IOException ignore) {\n // empty catch block\n }\n }\n }\n }", "label_name": "Base", "label": 1.0}
-{"code": " completeUpgrade(key, extensions, req, socket, head, cb) {\n //\n // Destroy the socket if the client has already sent a FIN packet.\n //\n if (!socket.readable || !socket.writable) return socket.destroy();\n\n if (socket[kWebSocket]) {\n throw new Error(\n 'server.handleUpgrade() was called more than once with the same ' +\n 'socket, possibly due to a misconfiguration'\n );\n }\n\n const digest = createHash('sha1')\n .update(key + GUID)\n .digest('base64');\n\n const headers = [\n 'HTTP/1.1 101 Switching Protocols',\n 'Upgrade: websocket',\n 'Connection: Upgrade',\n `Sec-WebSocket-Accept: ${digest}`\n ];\n\n const ws = new WebSocket(null);\n let protocol = req.headers['sec-websocket-protocol'];\n\n if (protocol) {\n protocol = protocol.trim().split(/ *, */);\n\n //\n // Optionally call external protocol selection handler.\n //\n if (this.options.handleProtocols) {\n protocol = this.options.handleProtocols(protocol, req);\n } else {\n protocol = protocol[0];\n }\n\n if (protocol) {\n headers.push(`Sec-WebSocket-Protocol: ${protocol}`);\n ws._protocol = protocol;\n }\n }\n\n if (extensions[PerMessageDeflate.extensionName]) {\n const params = extensions[PerMessageDeflate.extensionName].params;\n const value = format({\n [PerMessageDeflate.extensionName]: [params]\n });\n headers.push(`Sec-WebSocket-Extensions: ${value}`);\n ws._extensions = extensions;\n }\n\n //\n // Allow external modification/inspection of handshake headers.\n //\n this.emit('headers', headers, req);\n\n socket.write(headers.concat('\\r\\n').join('\\r\\n'));\n socket.removeListener('error', socketOnError);\n\n ws.setSocket(socket, head, this.options.maxPayload);\n\n if (this.clients) {\n this.clients.add(ws);\n ws.on('close', () => this.clients.delete(ws));\n }\n\n cb(ws, req);\n }", "label_name": "Class", "label": 2.0}
+{"code": " foreach ($cf_d as $cfd_i => $cfd_d) {\n if ($cfd_i == 'TYPE') {\n $fc = substr($cfd_d, 0, 1);\n $lc = substr($cfd_d, 1);\n $cfd_d = strtoupper($fc) . $lc;\n $get_schools_cf[$cf_i][$cfd_i] = $cfd_d;\n unset($fc);\n unset($lc);\n }\n if ($cfd_i == 'SELECT_OPTIONS' && $cf_d['TYPE'] != 'text') {\n\n for ($i = 0; $i < strlen($cfd_d); $i++) {\n $char = substr($cfd_d, $i, 1);\n if (ord($char) == '13')\n $char = '
';\n $new_char[] = $char;\n }\n\n $cfd_d = implode('', $new_char);\n $get_schools_cf[$cf_i][$cfd_i] = $cfd_d;\n unset($char);\n unset($new_char);\n }\n if ($cfd_i == 'SYSTEM_FIELD' || $cfd_i == 'REQUIRED') {\n if ($cfd_d == 'N')\n $get_schools_cf[$cf_i][$cfd_i] = 'No';\n if ($cfd_d == 'Y')\n $get_schools_cf[$cf_i][$cfd_i] = 'Yes';\n }\n }", "label_name": "Base", "label": 1.0}
+{"code": " protected function __construct() {\n parent::__construct();\n self::$locale = fusion_get_locale('', LOCALE.LOCALESET.'search.php');\n }", "label_name": "Compound", "label": 4.0}
+{"code": "\tpublic static function RemoveTransaction($id)\n\t{\n\t\t$sFilepath = APPROOT.'data/transactions/'.$id;\n\t\tclearstatcache(true, $sFilepath);\n\t\tif (!file_exists($sFilepath)) {\n\t\t\t$bSuccess = false;\n\t\t\tself::Error(\"RemoveTransaction: Transaction '$id' not found. Pending transactions for this user:\\n\"\n\t\t\t\t.implode(\"\\n\", self::GetPendingTransactions()));\n\t\t} else {\n\t\t\t$bSuccess = @unlink($sFilepath);\n\t\t}\n\n\t\tif (!$bSuccess) {\n\t\t\tself::Error('RemoveTransaction: FAILED to remove transaction '.$id);\n\t\t} else {\n\t\t\tself::Info('RemoveTransaction: OK '.$id);\n\t\t}\n\n\t\treturn $bSuccess;\n\t}", "label_name": "Compound", "label": 4.0}
{"code": " public static function ListProfiles($oUser = null)\n\t{\n\t\tif (is_null($oUser))\n\t\t{\n\t\t\t$oUser = self::$m_oUser;\n\t\t}\n\t\tif ($oUser === null)\n\t\t{\n\t\t\t// Not logged in: no profile at all\n\t\t\t$aProfiles = array();\n\t\t}\n\t\telseif ((self::$m_oUser !== null) && ($oUser->GetKey() == self::$m_oUser->GetKey()))\n\t\t{\n\t\t\t// Data about the current user can be found into the session data\n\t\t\tif (array_key_exists('profile_list', $_SESSION))\n\t\t\t{\n\t\t\t\t$aProfiles = $_SESSION['profile_list'];\n\t\t\t}\n\t\t}\n\n\t\tif (!isset($aProfiles))\n\t\t{\n\t\t\t$aProfiles = self::$m_oAddOn->ListProfiles($oUser);\n\t\t}\n\t\treturn $aProfiles;\n\t}", "label_name": "Compound", "label": 4.0}
-{"code": "\tfunction json_decode($json, $assoc=null)\n\t{\n\t\treturn array();\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "module.exports = (yargs) => {\n yargs.command('exec [commands...]', 'Execute command in docker container', () => {}, async (argv) => {\n const containers = docker.getContainers();\n const services = Object.keys(containers);\n\n if (services.includes(argv.containername) || services.some((service) => service.includes(argv.containername))) {\n const container = containers[argv.containername]\n ? containers[argv.containername]\n : Object.entries(containers).find(([key]) => key.includes(argv.containername))[1];\n\n if (argv.commands.length === 0) {\n // if we have default connect command then use it\n if (container.connectCommand) {\n // eslint-disable-next-line no-param-reassign\n argv.commands = container.connectCommand;\n } else {\n // otherwise fall back to bash (if it exists inside container)\n argv.commands.push('bash');\n }\n }\n await executeInContainer({\n containerName: container.name,\n commands: argv.commands\n });\n\n return;\n }\n\n logger.error(`No container found \"${argv.containername}\"`);\n });\n};", "label_name": "Class", "label": 2.0}
-{"code": " public function __construct(public Request $Request, public SessionInterface $Session, public Config $Config, public Logger $Log, public Csrf $Csrf)\n {\n $flashBag = $this->Session->getBag('flashes');\n // add type check because SessionBagInterface doesn't have get(), only FlashBag has it\n if ($flashBag instanceof FlashBag) {\n $this->ok = $flashBag->get('ok');\n $this->ko = $flashBag->get('ko');\n $this->warning = $flashBag->get('warning');\n }\n\n $this->Log->pushHandler(new ErrorLogHandler());\n $this->Users = new Users();\n $this->Db = Db::getConnection();\n // UPDATE SQL SCHEMA if necessary or show error message if version mismatch\n $Update = new Update($this->Config, new Sql());\n $Update->checkSchema();\n }", "label_name": "Base", "label": 1.0}
-{"code": " public function __construct($message = null, $code = 0, Exception $previous = null)\n {\n if ($message === null) {\n $message = _('Authentication required');\n }\n parent::__construct($message, $code, $previous);\n }", "label_name": "Base", "label": 1.0}
-{"code": " public static HttpURLConnection createHttpUrlConnection(URL url, String proxyHost, int proxyPort,\n String proxyUsername, String proxyPassword) {\n try {\n Proxy proxy = getProxy(proxyHost, proxyPort, proxyUsername, proxyPassword);\n // set proxy if exists.\n if (proxy == null) {\n return (HttpURLConnection) url.openConnection();\n } else {\n return (HttpURLConnection) url.openConnection(proxy);\n }\n } catch (IOException e) {\n throw ErrorUtil.createCommandException(e.getMessage());\n }\n }", "label_name": "Base", "label": 1.0}
-{"code": " getDownloadUrl(file) {\n return this.importExport.getDownloadUrl(file.id, file.accessToken);\n },", "label_name": "Base", "label": 1.0}
-{"code": " private function getStateId(string $state, string $machine)\n {\n return $this->getContainer()->get(Connection::class)\n ->fetchColumn('\n SELECT LOWER(HEX(state_machine_state.id))\n FROM state_machine_state\n INNER JOIN state_machine\n ON state_machine.id = state_machine_state.state_machine_id\n AND state_machine.technical_name = :machine\n WHERE state_machine_state.technical_name = :state\n ', [\n 'state' => $state,\n 'machine' => $machine,\n ]);\n }", "label_name": "Class", "label": 2.0}
-{"code": "\tfunction formatValue( $name, $value ) {\n\t\t$row = $this->mCurrentRow;\n\n\t\t$wiki = $row->files_dbname;\n\n\t\tswitch ( $name ) {\n\t\t\tcase 'files_timestamp':\n\t\t\t\t$formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->files_timestamp, $this->getUser() ) );\n\t\t\t\tbreak;\n\t\t\tcase 'files_dbname':\n\t\t\t\t$formatted = $row->files_dbname;\n\t\t\t\tbreak;\n\t\t\tcase 'files_url':\n\t\t\t\t$formatted = \"
files_url}\\\" style=\\\"width:135px;height:135px;\\\">\";\n\t\t\t\tbreak;\n\t\t\tcase 'files_name':\n\t\t\t\t$formatted = \"files_page}\\\">{$row->files_name}\";\n\t\t\t\tbreak;\n\t\t\tcase 'files_user':\n\t\t\t\t$formatted = \"files_user}\\\">{$row->files_user}\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$formatted = \"Unable to format $name\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn $formatted;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate async Task ResponseLootByRealAppIDs(EAccess access, string realAppIDsText, bool exclude = false) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(realAppIDsText)) {\n\t\t\tthrow new ArgumentNullException(nameof(realAppIDsText));\n\t\t}\n\n\t\tif (access < EAccess.Master) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!Bot.IsConnectedAndLoggedOn) {\n\t\t\treturn FormatBotResponse(Strings.BotNotConnected);\n\t\t}\n\n\t\tif (Bot.BotConfig.LootableTypes.Count == 0) {\n\t\t\treturn FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(Bot.BotConfig.LootableTypes)));\n\t\t}\n\n\t\tstring[] appIDTexts = realAppIDsText.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);\n\n\t\tif (appIDTexts.Length == 0) {\n\t\t\treturn FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(appIDTexts)));\n\t\t}\n\n\t\tHashSet realAppIDs = new();\n\n\t\tforeach (string appIDText in appIDTexts) {\n\t\t\tif (!uint.TryParse(appIDText, out uint appID) || (appID == 0)) {\n\t\t\t\treturn FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(appID)));\n\t\t\t}\n\n\t\t\trealAppIDs.Add(appID);\n\t\t}\n\n\t\t(bool success, string message) = await Bot.Actions.SendInventory(filterFunction: item => Bot.BotConfig.LootableTypes.Contains(item.Type) && (exclude ^ realAppIDs.Contains(item.RealAppID))).ConfigureAwait(false);\n\n\t\treturn FormatBotResponse(success ? message : string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, message));\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate async Task ResponseTransferByRealAppIDs(EAccess access, string realAppIDsText, string botNameTo, bool exclude = false) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(realAppIDsText)) {\n\t\t\tthrow new ArgumentNullException(nameof(realAppIDsText));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNameTo)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNameTo));\n\t\t}\n\n\t\tif (access < EAccess.Master) {\n\t\t\treturn null;\n\t\t}\n\n\t\tBot? targetBot = Bot.GetBot(botNameTo);\n\n\t\tif (targetBot == null) {\n\t\t\treturn access >= EAccess.Owner ? FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNameTo)) : null;\n\t\t}\n\n\t\tstring[] appIDTexts = realAppIDsText.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);\n\n\t\tif (appIDTexts.Length == 0) {\n\t\t\treturn FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(appIDTexts)));\n\t\t}\n\n\t\tHashSet realAppIDs = new();\n\n\t\tforeach (string appIDText in appIDTexts) {\n\t\t\tif (!uint.TryParse(appIDText, out uint appID) || (appID == 0)) {\n\t\t\t\treturn FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(appID)));\n\t\t\t}\n\n\t\t\trealAppIDs.Add(appID);\n\t\t}\n\n\t\treturn await ResponseTransferByRealAppIDs(access, realAppIDs, targetBot, exclude).ConfigureAwait(false);\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseStart(EAccess access, string botNames) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => Task.Run(() => bot.Commands.ResponseStart(access)))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseLevel(EAccess access, string botNames) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponseLevel(access))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseUnpackBoosters(EAccess access, string botNames) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponseUnpackBoosters(access))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseFarmingBlacklistAdd(EAccess access, string botNames, string targetAppIDs) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(targetAppIDs)) {\n\t\t\tthrow new ArgumentNullException(nameof(targetAppIDs));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => Task.Run(() => bot.Commands.ResponseFarmingBlacklistAdd(access, targetAppIDs)))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseStop(EAccess access, string botNames) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => Task.Run(() => bot.Commands.ResponseStop(access)))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static async Task ResponseReset(EAccess access, string botNames) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponseReset(access))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\t\tprivate void ExtractEntry(string destDir, TarEntry entry, bool allowParentTraversal)\n\t\t{\n\t\t\tOnProgressMessageEvent(entry, null);\n\n\t\t\tstring name = entry.Name;\n\n\t\t\tif (Path.IsPathRooted(name))\n\t\t\t{\n\t\t\t\t// NOTE:\n\t\t\t\t// for UNC names... \\\\machine\\share\\zoom\\beet.txt gives \\zoom\\beet.txt\n\t\t\t\tname = name.Substring(Path.GetPathRoot(name).Length);\n\t\t\t}\n\n\t\t\tname = name.Replace('/', Path.DirectorySeparatorChar);\n\n\t\t\tstring destFile = Path.Combine(destDir, name);\n\n\t\t\tif (!allowParentTraversal && !Path.GetFullPath(destFile).StartsWith(destDir, StringComparison.InvariantCultureIgnoreCase))\n\t\t\t{\n\t\t\t\tthrow new InvalidNameException(\"Parent traversal in paths is not allowed\");\n\t\t\t}\n\n\t\t\tif (entry.IsDirectory)\n\t\t\t{\n\t\t\t\tEnsureDirectoryExists(destFile);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tstring parentDirectory = Path.GetDirectoryName(destFile);\n\t\t\t\tEnsureDirectoryExists(parentDirectory);\n\n\t\t\t\tbool process = true;\n\t\t\t\tvar fileInfo = new FileInfo(destFile);\n\t\t\t\tif (fileInfo.Exists)\n\t\t\t\t{\n\t\t\t\t\tif (keepOldFiles)\n\t\t\t\t\t{\n\t\t\t\t\t\tOnProgressMessageEvent(entry, \"Destination file already exists\");\n\t\t\t\t\t\tprocess = false;\n\t\t\t\t\t}\n\t\t\t\t\telse if ((fileInfo.Attributes & FileAttributes.ReadOnly) != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tOnProgressMessageEvent(entry, \"Destination file already exists, and is read-only\");\n\t\t\t\t\t\tprocess = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (process)\n\t\t\t\t{\n\t\t\t\t\tusing (var outputStream = File.Create(destFile))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (this.asciiTranslate)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// May need to translate the file.\n\t\t\t\t\t\t\tExtractAndTranslateEntry(destFile, outputStream);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// If translation is disabled, just copy the entry across directly.\n\t\t\t\t\t\t\ttarIn.CopyEntryContents(outputStream);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "label_name": "Base", "label": 1.0}
-{"code": " AnsiUp.prototype.transform_to_html = function (fragment) {\n var txt = fragment.text;\n if (txt.length === 0)\n return txt;\n if (this._escape_for_html)\n txt = this.escape_txt_for_html(txt);\n if (!fragment.bold && fragment.fg === null && fragment.bg === null)\n return txt;\n var styles = [];\n var classes = [];\n var fg = fragment.fg;\n var bg = fragment.bg;\n if (fragment.bold)\n styles.push('font-weight:bold');\n if (!this._use_classes) {\n if (fg)\n styles.push(\"color:rgb(\" + fg.rgb.join(',') + \")\");\n if (bg)\n styles.push(\"background-color:rgb(\" + bg.rgb + \")\");\n }\n else {\n if (fg) {\n if (fg.class_name !== 'truecolor') {\n classes.push(fg.class_name + \"-fg\");\n }\n else {\n styles.push(\"color:rgb(\" + fg.rgb.join(',') + \")\");\n }\n }\n if (bg) {\n if (bg.class_name !== 'truecolor') {\n classes.push(bg.class_name + \"-bg\");\n }\n else {\n styles.push(\"background-color:rgb(\" + bg.rgb.join(',') + \")\");\n }\n }\n }\n var class_string = '';\n var style_string = '';\n if (classes.length)\n class_string = \" class=\\\"\" + classes.join(' ') + \"\\\"\";\n if (styles.length)\n style_string = \" style=\\\"\" + styles.join(';') + \"\\\"\";\n return \"\" + txt + \"\";\n };", "label_name": "Base", "label": 1.0}
-{"code": " def handleConfigPacket(m: MsgOutputCfgPayload): Unit = m match {\n case MsgOutputCfgRSMode(r) => rsMode = r\n case _ => sys.error(\"Invalid output config packet %s to config %s\".format(m, this))\n }\n\n}", "label_name": "Base", "label": 1.0}
-{"code": " def handleConfigPacket(m: MsgOutputCfgPayload): Unit = m match {\n case MsgOutputCfgRSMode(r) => rsMode = r\n case _ => sys.error(\"Invalid output config packet %s to config %s\".format(m, this))\n }\n}", "label_name": "Base", "label": 1.0}
-{"code": " def __eq__(self, other):\n return (argparse.Namespace.__eq__(self, other) and\n self.uname == other.uname and self.lang_code == other.lang_code and\n self.timestamp == other.timestamp and self.font_config_cache == other.font_config_cache and\n self.fonts_dir == other.fonts_dir and self.max_pages == other.max_pages and\n self.save_box_tiff == other.save_box_tiff and self.overwrite == other.overwrite and\n self.linedata == other.linedata and self.run_shape_clustering == other.run_shape_clustering and\n self.extract_font_properties == other.extract_font_properties and\n self.distort_image == other.distort_image)", "label_name": "Variant", "label": 0.0}
-{"code": "bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) {\n\n CHECK_STATE(s_shares);\n CHECK_STATE(encryptedKeyHex);\n\n vector errMsg(BUF_LEN,0);\n int errStatus = 0;\n\n uint64_t decKeyLen;\n SAFE_UINT8_BUF(encr_bls_key,BUF_LEN);\n SAFE_UINT8_BUF(encr_key,BUF_LEN);\n if (!hex2carray(encryptedKeyHex, &decKeyLen, encr_key, BUF_LEN)) {\n throw SGXException(INVALID_HEX, \"Invalid encryptedKeyHex\");\n }\n\n uint32_t enc_bls_len = 0;\n\n sgx_status_t status = trustedCreateBlsKeyAES(eid, &errStatus, errMsg.data(), s_shares, encr_key, decKeyLen, encr_bls_key,\n &enc_bls_len);\n\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());\n\n SAFE_CHAR_BUF(hexBLSKey,2 * BUF_LEN)\n\n carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey, 2 * BUF_LEN);\n\n SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey);\n\n return true;\n\n}", "label_name": "Base", "label": 1.0}
-{"code": " public void OnActionExecuted(ActionExecutedContext context)\n {\n\n }", "label_name": "Base", "label": 1.0}
-{"code": " render() {},", "label_name": "Base", "label": 1.0}
+{"code": " public function __construct($message = null, $code = 404, Exception $previous = null)\n {\n if ($message === null) {\n $message = _('Nothing to show with this id');\n }\n parent::__construct($message, $code, $previous);\n }", "label_name": "Base", "label": 1.0}
+{"code": "function global_cache_key($dir = true)\r\n{\r\n\t$cache_key = $_SERVER['REQUEST_URI'];\r\n\t$cache_key = str_replace('/', '-', $cache_key);\r\n\t$cache_key = mso_slug(' ' . $cache_key);\r\n\t\r\n\tif (!$cache_key) $cache_key = 'home'; // \u0433\u043b\u0430\u0432\u043d\u0430\u044f\r\n\t\r\n\tif ($dir) $cache_key = 'html/' . $cache_key . '.html';\r\n\t\telse $cache_key = $cache_key . '.html';\r\n\t\r\n\treturn $cache_key;\r\n}\r", "label_name": "Base", "label": 1.0}
{"code": "function create_thumbs($updir, $img, $name, $thumbnail_width, $thumbnail_height, $quality){\n\t$arr_image_details\t= GetImageSize(\"$updir/$img\");\n\t$original_width\t\t= $arr_image_details[0];\n\t$original_height\t= $arr_image_details[1];\n\t$a = $thumbnail_width / $thumbnail_height;\n $b = $original_width / $original_height;\n\t\n\t\n\tif ($a<$b) {\n $new_width = $thumbnail_width;\n $new_height\t= intval($original_height*$new_width/$original_width);\n } else {\n $new_height = $thumbnail_height;\n $new_width\t= intval($original_width*$new_height/$original_height);\n }\n\t\n\tif(($original_width <= $thumbnail_width) AND ($original_height <= $thumbnail_height)) {\n\t $new_width = $original_width;\n\t $new_height = $original_height;\n }\t\n\tif($arr_image_details[2]==1) { $imgt = \"imagegif\"; $imgcreatefrom = \"imagecreatefromgif\"; }\n\tif($arr_image_details[2]==2) { $imgt = \"imagejpeg\"; $imgcreatefrom = \"imagecreatefromjpeg\"; }\n\tif($arr_image_details[2]==3) { $imgt = \"imagepng\"; $imgcreatefrom = \"imagecreatefrompng\"; }\n\tif($imgt) { \n\t\t$old_image\t= $imgcreatefrom(\"$updir/$img\");\n\t\t$new_image\t= imagecreatetruecolor($new_width, $new_height);\n\t\timagecopyresampled($new_image,$old_image,0,0,0,0,$new_width,$new_height,$original_width,$original_height);\n\t\timagejpeg($new_image,\"$updir/$name\",$quality);\n\t\timagedestroy($new_image);\n\t}\n}", "label_name": "Base", "label": 1.0}
-{"code": " public function setPassword(Request $request, string $token)\n {\n $this->validate($request, [\n 'password' => ['required', 'min:8'],\n ]);\n\n try {\n $userId = $this->inviteService->checkTokenAndGetUserId($token);\n } catch (Exception $exception) {\n return $this->handleTokenException($exception);\n }\n\n $user = $this->userRepo->getById($userId);\n $user->password = bcrypt($request->get('password'));\n $user->email_confirmed = true;\n $user->save();\n\n $this->inviteService->deleteByUser($user);\n $this->showSuccessNotification(trans('auth.user_invite_success', ['appName' => setting('app-name')]));\n $this->loginService->login($user, auth()->getDefaultDriver());\n\n return redirect('/');\n }", "label_name": "Compound", "label": 4.0}
-{"code": " $query->whereExists(function ($permissionQuery) use (&$tableDetails, $morphClass) {\n /** @var Builder $permissionQuery */\n $permissionQuery->select('id')->from('joint_permissions')\n ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->where('entity_type', '=', $morphClass)\n ->where('action', '=', 'view')\n ->whereIn('role_id', $this->getCurrentUserRoles())\n ->where(function (QueryBuilder $query) {\n $this->addJointHasPermissionCheck($query, $this->currentUser()->id);\n });\n });", "label_name": "Class", "label": 2.0}
-{"code": " public function setBaseUri(Response $response)\n {\n $response->headers->set('Content-Security-Policy', 'base-uri \\'self\\'', false);\n }", "label_name": "Base", "label": 1.0}
-{"code": "def main(req: func.HttpRequest, connectionInfoJson: str) -> func.HttpResponse:\n return func.HttpResponse(\n connectionInfoJson,\n status_code=200,\n headers={\"Content-type\": \"application/json\"},\n )", "label_name": "Class", "label": 2.0}
-{"code": " def test_modify_config(self) -> None:\n user1 = uuid4()\n user2 = uuid4()\n\n # no admins set\n self.assertTrue(can_modify_config_impl(InstanceConfig(), UserInfo()))\n\n # with oid, but no admin\n self.assertTrue(\n can_modify_config_impl(InstanceConfig(), UserInfo(object_id=user1))\n )\n\n # is admin\n self.assertTrue(\n can_modify_config_impl(\n InstanceConfig(admins=[user1]), UserInfo(object_id=user1)\n )\n )\n\n # no user oid set\n self.assertFalse(\n can_modify_config_impl(InstanceConfig(admins=[user1]), UserInfo())\n )\n\n # not an admin\n self.assertFalse(\n can_modify_config_impl(\n InstanceConfig(admins=[user1]), UserInfo(object_id=user2)\n )\n )", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ShowCreditsPacket packet, GeyserSession session) {\n if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) {\n ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);\n session.sendDownstreamPacket(javaRespawnPacket);\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ServerEntityVelocityPacket packet, GeyserSession session) {\n Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());\n if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {\n entity = session.getPlayerEntity();\n }\n if (entity == null) return;\n\n entity.setMotion(Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()));\n\n if (entity == session.getRidingVehicleEntity() && entity instanceof AbstractHorseEntity) {\n // Horses for some reason teleport back when a SetEntityMotionPacket is sent while\n // a player is riding on them. Java clients seem to ignore it anyways.\n return;\n }\n\n if (entity instanceof ItemEntity) {\n // Don't bother sending entity motion packets for items\n // since the client doesn't seem to care\n return;\n }\n\n SetEntityMotionPacket entityMotionPacket = new SetEntityMotionPacket();\n entityMotionPacket.setRuntimeEntityId(entity.getGeyserId());\n entityMotionPacket.setMotion(entity.getMotion());\n\n session.sendUpstreamPacket(entityMotionPacket);\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ServerUpdateScorePacket packet, GeyserSession session) {\n WorldCache worldCache = session.getWorldCache();\n Scoreboard scoreboard = worldCache.getScoreboard();\n int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond();\n\n Objective objective = scoreboard.getObjective(packet.getObjective());\n if (objective == null && packet.getAction() != ScoreboardAction.REMOVE) {\n logger.info(LanguageUtils.getLocaleStringLog(\"geyser.network.translator.score.failed_objective\", packet.getObjective()));\n return;\n }\n\n switch (packet.getAction()) {\n case ADD_OR_UPDATE:\n objective.setScore(packet.getEntry(), packet.getValue());\n break;\n case REMOVE:\n if (objective != null) {\n objective.removeScore(packet.getEntry());\n } else {\n for (Objective objective1 : scoreboard.getObjectives().values()) {\n objective1.removeScore(packet.getEntry());\n }\n }\n break;\n }\n\n // ScoreboardUpdater will handle it for us if the packets per second\n // (for score and team packets) is higher then the first threshold\n if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) {\n scoreboard.onUpdate();\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ServerUnloadChunkPacket packet, GeyserSession session) {\n session.getChunkCache().removeChunk(packet.getX(), packet.getZ());\n\n //Checks if a skull is in an unloaded chunk then removes it\n Iterator iterator = session.getSkullCache().keySet().iterator();\n while (iterator.hasNext()) {\n Vector3i position = iterator.next();\n if ((position.getX() >> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) {\n session.getSkullCache().get(position).despawnEntity(session);\n iterator.remove();\n }\n }\n\n // Do the same thing with lecterns\n iterator = session.getLecternCache().iterator();\n while (iterator.hasNext()) {\n Vector3i position = iterator.next();\n if ((position.getX() >> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) {\n iterator.remove();\n }\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ServerUpdateTileEntityPacket packet, GeyserSession session) {\n String id = BlockEntityUtils.getBedrockBlockEntityId(packet.getType().name());\n if (packet.getNbt().isEmpty()) { // Fixes errors in servers sending empty NBT\n BlockEntityUtils.updateBlockEntity(session, NbtMap.EMPTY, packet.getPosition());\n return;\n }\n\n BlockEntityTranslator translator = BlockEntityUtils.getBlockEntityTranslator(id);\n // The Java block state is used in BlockEntityTranslator.translateTag() to make up for some inconsistencies\n // between Java block states and Bedrock block entity data\n int blockState;\n if (translator instanceof RequiresBlockState) {\n blockState = session.getConnector().getWorldManager().getBlockAt(session, packet.getPosition());\n } else {\n blockState = BlockStateValues.JAVA_AIR_ID;\n }\n BlockEntityUtils.updateBlockEntity(session, translator.getBlockEntityTag(id, packet.getNbt(), blockState), packet.getPosition());\n // Check for custom skulls.\n if (SkullBlockEntityTranslator.ALLOW_CUSTOM_SKULLS && packet.getNbt().contains(\"SkullOwner\")) {\n SkullBlockEntityTranslator.spawnPlayer(session, packet.getNbt(), blockState);\n }\n\n // If block entity is command block, OP permission level is appropriate, player is in creative mode and the NBT is not empty\n if (packet.getType() == UpdatedTileType.COMMAND_BLOCK && session.getOpPermissionLevel() >= 2 &&\n session.getGameMode() == GameMode.CREATIVE && packet.getNbt().size() > 5) {\n ContainerOpenPacket openPacket = new ContainerOpenPacket();\n openPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()));\n openPacket.setId((byte) 1);\n openPacket.setType(ContainerType.COMMAND_BLOCK);\n openPacket.setUniqueEntityId(-1);\n session.sendUpstreamPacket(openPacket);\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public void translate(ServerUpdateViewPositionPacket packet, GeyserSession session) {\n if (!session.isSpawned() && session.getLastChunkPosition() == null) {\n ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4));\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic PersistentTask createTask(String name, Serializable task) {\n\t\tPersistentTask ptask = new PersistentTask();\n\t\tDate currentDate = new Date();\n\t\tptask.setCreationDate(currentDate);\n\t\tptask.setLastModified(currentDate);\n\t\tptask.setName(name);\n\t\tptask.setStatus(TaskStatus.newTask);\n\t\tptask.setTask(xstream.toXML(task));\n\t\tdbInstance.getCurrentEntityManager().persist(ptask);\n\t\treturn ptask;\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "\tpublic PersistentTask updateTask(Task task, Serializable runnableTask, Identity modifier, Date scheduledDate) {\n\t\tPersistentTask ptask = dbInstance.getCurrentEntityManager()\n\t\t\t\t.find(PersistentTask.class, task.getKey(), LockModeType.PESSIMISTIC_WRITE);\n\t\tif(ptask != null) {\n\t\t\tptask.setLastModified(new Date());\n\t\t\tptask.setScheduledDate(scheduledDate);\n\t\t\tptask.setStatus(TaskStatus.newTask);\n\t\t\tptask.setStatusBeforeEditStr(null);\n\t\t\tptask.setTask(xstream.toXML(runnableTask));\n\n\t\t\tptask = dbInstance.getCurrentEntityManager().merge(ptask);\n\t\t\tif(modifier != null) {\n\t\t\t\t//add to the list of modifier\n\t\t\t\tPersistentTaskModifier mod = new PersistentTaskModifier();\n\t\t\t\tmod.setCreationDate(new Date());\n\t\t\t\tmod.setModifier(modifier);\n\t\t\t\tmod.setTask(ptask);\n\t\t\t\tdbInstance.getCurrentEntityManager().persist(mod);\n\t\t\t}\n\t\t\tdbInstance.commit();\n\t\t}\n\t\treturn ptask;\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "\tpublic static void writeObject(XStream xStream, OutputStream os, Object obj) {\n\t\ttry(OutputStreamWriter osw = new OutputStreamWriter(os, ENCODING)) {\n\t\t\tString data = xStream.toXML(obj);\n\t\t\tdata = \"\\n\"\n\t\t\t\t\t+ data; // give a decent header with the encoding used\n\t\t\tosw.write(data);\n\t\t\tosw.flush();\n\t\t} catch (Exception e) {\n\t\t\tthrow new OLATRuntimeException(XStreamHelper.class, \"Could not write object to stream.\", e);\n\t\t}\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "\tpublic static final void toStream(Binder binder, ZipOutputStream zout)\n\tthrows IOException {\n\t\ttry(OutputStream out=new ShieldOutputStream(zout)) {\n\t\t\tmyStream.toXML(binder, out);\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"Cannot export this map: \" + binder, e);\n\t\t}\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "\tpublic void testUpdateMapper_serializade() {\n\t\t//create a mapper\n\t\tString mapperId = UUID.randomUUID().toString();\n\t\tString sessionId = UUID.randomUUID().toString().substring(0, 32);\n\t\tPersistentMapper sMapper = new PersistentMapper(\"mapper-to-persist-bis\");\n\t\tPersistedMapper pMapper = mapperDao.persistMapper(sessionId, mapperId, sMapper, -1);\n\t\tAssert.assertNotNull(pMapper);\n\t\tdbInstance.commitAndCloseSession();\n\t\t\n\t\t//load the mapper\n\t\tPersistedMapper loadedMapper = mapperDao.loadByMapperId(mapperId);\n\t\tAssert.assertNotNull(loadedMapper);\n\t\tObject objReloaded = XStreamHelper.createXStreamInstance().fromXML(pMapper.getXmlConfiguration());\n\t\tAssert.assertTrue(objReloaded instanceof PersistentMapper);\n\t\tPersistentMapper sMapperReloaded = (PersistentMapper)objReloaded;\n\t\tAssert.assertEquals(\"mapper-to-persist-bis\", sMapperReloaded.getKey());\n\t\t\n\t\t//update\n\t\tPersistentMapper sMapper2 = new PersistentMapper(\"mapper-to-update\");\n\t\tboolean updated = mapperDao.updateConfiguration(mapperId, sMapper2, -1);\n\t\tAssert.assertTrue(updated);\n\t\tdbInstance.commitAndCloseSession();\n\t\t\n\t\t//load the updated mapper\n\t\tPersistedMapper loadedMapper2 = mapperDao.loadByMapperId(mapperId);\n\t\tAssert.assertNotNull(loadedMapper2);\n\t\tObject objReloaded2 = XStreamHelper.createXStreamInstance().fromXML(loadedMapper2.getXmlConfiguration());\n\t\tAssert.assertTrue(objReloaded2 instanceof PersistentMapper);\n\t\tPersistentMapper sMapperReloaded2 = (PersistentMapper)objReloaded2;\n\t\tAssert.assertEquals(\"mapper-to-update\", sMapperReloaded2.getKey());\n\t}", "label_name": "Base", "label": 1.0}
-{"code": "\tpublic Controller execute(FolderComponent fc, UserRequest ureq, WindowControl wContr, Translator trans) {\n\t\tthis.translator = trans;\n\t\tthis.folderComponent = fc;\n\t\tthis.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath());\n\n\t\tVFSContainer currentContainer = folderComponent.getCurrentContainer();\n\t\tList lockedFiles = hasLockedFiles(currentContainer, fileSelection);\n\t\tif (lockedFiles.isEmpty()) {\n\t\t\tString msg = trans.translate(\"del.confirm\") + \"\" + fileSelection.renderAsHtml() + \"
\";\t\t\n\t\t\t// create dialog controller\n\t\t\tdialogCtr = activateYesNoDialog(ureq, trans.translate(\"del.header\"), msg, dialogCtr);\n\t\t} else {\n\t\t\tString msg = FolderCommandHelper.renderLockedMessageAsHtml(trans, lockedFiles);\n\t\t\tList buttonLabels = Collections.singletonList(trans.translate(\"ok\"));\n\t\t\tlockedFiledCtr = activateGenericDialog(ureq, trans.translate(\"lock.title\"), msg, buttonLabels, lockedFiledCtr);\n\t\t}\n\t\treturn this;\n\t}", "label_name": "Base", "label": 1.0}
-{"code": " public function deleteCommentAction(CustomerComment $comment)\n {\n $customerId = $comment->getCustomer()->getId();\n\n try {\n $this->repository->deleteComment($comment);\n } catch (\\Exception $ex) {\n $this->flashDeleteException($ex);\n }\n\n return $this->redirectToRoute('customer_details', ['id' => $customerId]);\n }", "label_name": "Compound", "label": 4.0}
-{"code": " public function duplicateAction(Project $project, Request $request, ProjectDuplicationService $projectDuplicationService)\n {\n $newProject = $projectDuplicationService->duplicate($project, $project->getName() . ' [COPY]');\n\n return $this->redirectToRoute('project_details', ['id' => $newProject->getId()]);\n }", "label_name": "Compound", "label": 4.0}
-{"code": " this.changeUserSettingsIndifferent = function(attr,value){\n \t$.get(this.wwwDir+ 'user/setsettingajax/'+attr+'/'+encodeURIComponent(value)+'/(indifferent)/true');\n };", "label_name": "Compound", "label": 4.0}
-{"code": " $cfgSite->setSetting( 'db', $key, $value);\n }\n $cfgSite->setSetting( 'site', 'secrethash', substr(md5(time() . \":\" . mt_rand()),0,10));\n return true;\n } else {\n return $Errors;\n }\n }", "label_name": "Base", "label": 1.0}
-{"code": " public static function getHost() {\n\n if (isset($_SERVER['HTTP_HOST'])) {\n $site_address = (erLhcoreClassSystem::$httpsMode == true ? 'https:' : 'http:') . '//' . $_SERVER['HTTP_HOST'] ;\n } else if (class_exists('erLhcoreClassInstance')) {\n $site_address = 'https://' . erLhcoreClassInstance::$instanceChat->address . '.' . erConfigClassLhConfig::getInstance()->getSetting( 'site', 'seller_domain');\n } else if (class_exists('erLhcoreClassExtensionLhcphpresque')) {\n $site_address = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionLhcphpresque')->settings['site_address'];\n } else {\n $site_address = '';\n }\n\n return $site_address;\n }", "label_name": "Class", "label": 2.0}
-{"code": " public function __get($var) {\n\n switch ($var) {\n case 'configuration_array':\n $this->configuration_array = array();\n if ($this->configuration != ''){\n $jsonData = json_decode($this->configuration,true);\n if ($jsonData !== null) {\n $this->configuration_array = $jsonData;\n } else {\n $this->configuration_array = array();\n }\n }\n return $this->configuration_array;\n break;\n\n case 'name_support':\n return $this->name_support = $this->nick;\n break;\n\n case 'has_photo':\n return $this->filename != '';\n break;\n\n case 'photo_path':\n $this->photo_path = ($this->filepath != '' ? '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir() ) .'/'. $this->filepath . $this->filename;\n return $this->photo_path;\n break;\n\n case 'file_path_server':\n return $this->filepath . $this->filename;\n break;\n\n default:\n break;\n }\n }", "label_name": "Class", "label": 2.0}
-{"code": " public function rules()\n {\n return [\n 'upload_receipt' => [\n 'nullable',\n new Base64Mime(['gif', 'jpg', 'png'])\n ]\n ];\n }", "label_name": "Base", "label": 1.0}
-{"code": "\trequestForm: function (url, params = {}) {\n\t\tapp.openUrlMethodPost(url, params);\n\t}", "label_name": "Compound", "label": 4.0}
-{"code": "\t\t$.each(postData, (index, value) => {\n\t\t\tlet input = $(document.createElement('input'));\n\t\t\tinput.attr('type', 'hidden');\n\t\t\tinput.attr('name', index);\n\t\t\tinput.val(value);\n\t\t\tform.append(input);\n\t\t});", "label_name": "Compound", "label": 4.0}
-{"code": "\tpublic function validate($value, $isUserFormat = false)\n\t{\n\t\tif (empty($value)) {\n\t\t\treturn;\n\t\t}\n\t\tif (\\is_string($value)) {\n\t\t\t$value = \\App\\Json::decode($value);\n\t\t}\n\t\tif (!\\is_array($value)) {\n\t\t\tthrow new \\App\\Exceptions\\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getFieldName() . '||' . $this->getFieldModel()->getModuleName() . '||' . $value, 406);\n\t\t}\n\t\t$currencies = \\App\\Fields\\Currency::getAll(true);\n\t\tforeach ($value['currencies'] ?? [] as $id => $currency) {\n\t\t\tif (!isset($currencies[$id])) {\n\t\t\t\tthrow new \\App\\Exceptions\\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getFieldName() . '||' . $this->getFieldModel()->getModuleName() . '||' . $id, 406);\n\t\t\t}\n\t\t\t$price = $currency['price'];\n\t\t\tif ($isUserFormat) {\n\t\t\t\t$price = App\\Fields\\Double::formatToDb($price);\n\t\t\t}\n\t\t\tif (!is_numeric($price)) {\n\t\t\t\tthrow new \\App\\Exceptions\\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getFieldName() . '||' . $this->getFieldModel()->getModuleName() . '||' . $price, 406);\n\t\t\t}\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic function __construct()\n\t{\n\t\t$this->headers = \\App\\Controller\\Headers::getInstance();\n\t\tif (!self::$activatedLocale && \\App\\Config::performance('CHANGE_LOCALE')) {\n\t\t\t\\App\\Language::initLocale();\n\t\t\tself::$activatedLocale = true;\n\t\t}\n\t\tif (!self::$activatedCsrf) {\n\t\t\tif ($this->csrfActive && \\App\\Config::security('csrfActive')) {\n\t\t\t\trequire_once 'config/csrf_config.php';\n\t\t\t\t\\CsrfMagic\\Csrf::init();\n\t\t\t\t$this->csrfActive = true;\n\t\t\t} else {\n\t\t\t\t$this->csrfActive = false;\n\t\t\t}\n\t\t\tself::$activatedCsrf = true;\n\t\t}\n\t}", "label_name": "Compound", "label": 4.0}
-{"code": "\t\ti.onload = function () {\n\t\t\t/* Remove preview */\n\t\t\timgPreview.getElement().setHtml('');\n\n\t\t\t/* Set attributes */\n\t\t\tif (orgWidth == null || orgHeight == null) {\n\t\t\t\tt.setValueOf('tab-properties', 'width', this.width);\n\t\t\t\tt.setValueOf('tab-properties', 'height', this.height);\n\t\t\t\timgScal = 1;\n\t\t\t\tif (this.height > 0 && this.width > 0) imgScal = this.width / this.height;\n\t\t\t\tif (imgScal <= 0) imgScal = 1;\n\t\t\t} else {\n\t\t\t\torgWidth = null;\n\t\t\t\torgHeight = null;\n\t\t\t}\n\t\t\tthis.id = editor.id + 'previewimage';\n\t\t\tthis.setAttribute('style', 'max-width:400px;max-height:100px;');\n\t\t\tthis.setAttribute('alt', '');\n\n\t\t\t/* Insert preview image */\n\t\t\ttry {\n\t\t\t\tvar p = imgPreview.getElement().$;\n\t\t\t\tif (p) p.appendChild(this);\n\t\t\t} catch (e) {}\n\t\t};", "label_name": "Base", "label": 1.0}
-{"code": " it 'doesnt do anything' do\n pp = \"class { 'apache': default_confd_files => false }\"\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should output status via passenger-memory-stats' do\n shell(\"sudo /usr/sbin/passenger-memory-stats\") do |r|\n expect(r.stdout).to match(/Apache processes/)\n expect(r.stdout).to match(/Nginx processes/)\n expect(r.stdout).to match(/Passenger processes/)\n\n # passenger-memory-stats output on Ubuntu 14.04 does not contain\n # these two lines\n unless fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04'\n expect(r.stdout).to match(/### Processes: [0-9]+/)\n expect(r.stdout).to match(/### Total private dirty RSS: [0-9\\.]+ MB/)\n end\n\n expect(r.exit_code).to eq(0)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to be_enabled }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to be_enabled }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should create no default vhosts' do\n pp = <<-EOS\n class { 'apache':\n default_vhost => false,\n default_ssl_vhost => false,\n service_ensure => stopped\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe file(\"#{$vhost_dir}/15-default.conf\") do\n it { is_expected.not_to be_file }\n end\n\n describe file(\"#{$vhost_dir}/15-default-ssl.conf\") do\n it { is_expected.not_to be_file }\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should create default vhost configs' do\n pp = <<-EOS\n file { '#{$run_dir}':\n ensure => 'directory',\n recurse => true,\n }\n\n class { 'apache':\n default_ssl_vhost => true,\n require => File['#{$run_dir}'],\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe file(\"#{$vhost_dir}/15-default.conf\") do\n it { is_expected.to contain '' }\n end\n\n describe file(\"#{$vhost_dir}/15-default-ssl.conf\") do\n it { is_expected.to contain '' }\n it { is_expected.to contain \"SSLEngine on\" }\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should configure an apache proxy vhost' do\n pp = <<-EOS\n class { 'apache': }\n apache::vhost { 'proxy.example.com':\n port => '80',\n docroot => '/var/www/proxy',\n proxy_pass => [\n { 'path' => '/foo', 'url' => 'http://backend-foo/'},\n ],\n proxy_preserve_host => true,\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe file(\"#{$vhost_dir}/25-proxy.example.com.conf\") do\n it { is_expected.to contain '' }\n it { is_expected.to contain \"ServerName proxy.example.com\" }\n it { is_expected.to contain \"ProxyPass\" }\n it { is_expected.to contain \"ProxyPreserveHost On\" }\n it { is_expected.not_to contain \"\" }\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should answer to first.example.com' do\n shell(\"/usr/bin/curl first.example.com:80\", {:acceptable_exit_codes => 0}) do |r|\n expect(r.stdout).to eq(\"Hello from first\\n\")\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_class(\"apache::params\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_class(\"apache::params\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_apache__mod(\"deflate\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_class(\"apache::params\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_class(\"apache::params\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_class(\"apache::params\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_apache__mod('speling') }", "label_name": "Base", "label": 1.0}
-{"code": "def status_conf_spec(allow_from, extended_status)\n it do\n is_expected.to contain_file(\"status.conf\").with_content(\n \"\\n\"\\\n \" SetHandler server-status\\n\"\\\n \" Order deny,allow\\n\"\\\n \" Deny from all\\n\"\\\n \" Allow from #{Array(allow_from).join(' ')}\\n\"\\\n \"\\n\"\\\n \"ExtendedStatus #{extended_status}\\n\"\\\n \"\\n\"\\\n \"\\n\"\\\n \" # Show Proxy LoadBalancer status in mod_status\\n\"\\\n \" ProxyStatus On\\n\"\\\n \"\\n\"\n )\n end\nend", "label_name": "Base", "label": 1.0}
-{"code": " it { is_expected.to contain_service(\"httpd\").with(\n 'name' => 'apache2',\n 'ensure' => 'running',\n 'enable' => 'true'\n )\n }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should specify a NameVirtualHost' do\n is_expected.to contain_apache__listen(params[:port])\n is_expected.to contain_apache__namevirtualhost(\"*:#{params[:port]}\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should set wsgi_daemon_process_options' do\n is_expected.to contain_file(\"25-#{title}.conf\").with_content(\n /^ WSGIDaemonProcess example.org processes=2 threads=15$/\n )\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should match providers to resources\" do\n provider = mock(\"ssl_provider\", :name => \"ssl\")\n resource = mock(\"ssl_resource\")\n resource.expects(:provider=).with(provider)\n\n provider_class.expects(:instances).returns([provider])\n provider_class.prefetch(\"ssl\" => resource)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'contains a kernel ppa source' do\n shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should be_file }", "label_name": "Base", "label": 1.0}
-{"code": " it 'deletes 99test' do\n shell ('rm -rf /etc/apt/apt.conf.d/99test')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should work with no errors' do\n pp = <<-EOS\n include apt\n apt::pin { 'vim-puppet': }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'applies the manifest twice with no stderr' do\n expect(apply_manifest(pp, :catch_failures => true).stderr).to eq(\"\")\n expect(apply_manifest(pp, :catch_changes => true).stderr).to eq(\"\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail' do\n expect { should }.to raise_error(Puppet::Error, /is not a string/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail' do\n expect { should }.to raise_error(Puppet::Error, /is not an absolute path/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it '/home/apenny/.puppet/var' do\n Puppet.stubs(:[]).with(:vardir).returns('/home/apenny/.puppet/var')\n Facter.fact(:concat_basedir).value.should == '/home/apenny/.puppet/var/concat'\n end", "label_name": "Base", "label": 1.0}
-{"code": " it '/var/lib/puppet' do\n Puppet.stubs(:[]).with(:vardir).returns('/var/lib/puppet')\n Facter.fact(:concat_basedir).value.should == '/var/lib/puppet/concat'\n end", "label_name": "Base", "label": 1.0}
-{"code": " def initialize(*args)\n if Facter.fact('ip6tables_version').value.match /1\\.3\\.\\d/\n raise ArgumentError, 'The ip6tables provider is not supported on version 1.3 of iptables'\n else\n super\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def self.iptables(*args)\n ip6tables(*args)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def insert\n debug 'Inserting rule %s' % resource[:name]\n iptables insert_args\n end", "label_name": "Base", "label": 1.0}
-{"code": " def policy=(value)\n return if value == :empty\n allvalidchains do |t, chain, table|\n p = ['-t',table,'-P',chain,value.to_s.upcase]\n debug \"[set policy] #{t} #{p}\"\n t.call p\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def should=(values)\n @should = super(values).sort_by {|sym| sym.to_s}\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'contains the changing new 8.0.0.4 rule' do\n shell('iptables-save') do |r|\n expect(r.stdout).to match(/-A INPUT -s 8\\.0\\.0\\.4(\\/32)? -p tcp -m multiport --ports 101 -m comment --comment \"101 test source changes\" -j ACCEPT/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": "def ip6tables_flush_all_tables\n ['filter'].each do |t|\n expect(shell(\"ip6tables -t #{t} -F\").stderr).to eq(\"\")\n end\nend", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_class('firewall::linux').with_ensure('running') }", "label_name": "Base", "label": 1.0}
-{"code": " it {\n allow(Facter::Util::Resolution).to receive(:exec).with('iptables --version').\n and_return('iptables v1.4.7')\n Facter.fact(:iptables_version).value.should == '1.4.7'\n }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should be able to get a list of existing rules' do\n # Pretend to return nil from iptables\n allow(provider).to receive(:execute).with(['/sbin/ip6tables-save']).and_return(\"\")\n allow(provider).to receive(:execute).with(['/sbin/ebtables-save']).and_return(\"\")\n allow(provider).to receive(:execute).with(['/sbin/iptables-save']).and_return(\"\")\n\n provider.instances.each do |chain|\n expect(chain).to be_instance_of(provider)\n expect(chain.properties[:provider].to_s).to eq(provider.name.to_s)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'understands offsets for adding rules before unnamed rules' do\n resource = Puppet::Type.type(:firewall).new({ :name => '001 test', })\n allow(resource.provider.class).to receive(:instances).and_return(providers)\n expect(resource.provider.insert_order).to eq(1)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'understands offsets for editing rules before unnamed rules' do\n resource = Puppet::Type.type(:firewall).new({ :name => '100 test', })\n allow(resource.provider.class).to receive(:instances).and_return(providers)\n expect(resource.provider.insert_order).to eq(1)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'understands offsets for adding rules to the end' do\n resource = Puppet::Type.type(:firewall).new({ :name => '301 test', })\n allow(resource.provider.class).to receive(:instances).and_return(providers)\n expect(resource.provider.insert_order).to eq(4)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'fails when modifying the chain' do\n expect { instance.chain = \"OUTPUT\" }.to raise_error(/is not supported/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail if mask is present' do\n lambda { @resource[:set_mark] = '0x3e8/0xffffffff'}.should raise_error(\n Puppet::Error, /iptables version #{iptables_version} does not support masks on MARK rules$/\n )\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should allow me to set gid as an array, and silently hide my error' do\n @resource[:gid] = ['root', 'bobby']\n @resource[:gid].should == 'root'\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"provider #{provider} should autorequire packages iptables and iptables-persistent\" do\n @resource[:provider] = provider\n @resource[:provider].should == provider\n packages = [\n Puppet::Type.type(:package).new(:name => 'iptables'),\n Puppet::Type.type(:package).new(:name => 'iptables-persistent')\n ]\n catalog = Puppet::Resource::Catalog.new\n catalog.add_resource @resource\n packages.each do |package|\n catalog.add_resource package\n end\n packages.zip(@resource.autorequire) do |package, rel|\n rel.source.ref.should == package.ref\n rel.target.ref.should == @resource.ref\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should accept values as integers' do\n @resource[:icmp] = 9\n @resource[:icmp].should == 9\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should convert a port name for #{port} to its number\" do\n @resource[port] = 'ssh'\n @resource[port].should == ['22']\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail if value is not numeric' do\n lambda { @resource[:burst] = 'foo' }.should raise_error(Puppet::Error)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should allow me to set set-mark without mask' do\n @resource[:set_mark] = '0x3e8'\n @resource[:set_mark].should == '0x3e8'\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should accept a #{port} as an array\" do\n @resource[port] = ['22','23']\n @resource[port].should == ['22','23']\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should have no default\" do\n res = @class.new(:name => \"000 test\")\n res.parameters[:action].should == nil\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail when value is not recognized' do\n expect { resource[:policy] = 'not valid' }.to raise_error(Puppet::Error)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should exec for systemd if running Fedora 15 or greater' do\n allow(Facter.fact(:osfamily)).to receive(:value).and_return('RedHat')\n allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Fedora')\n allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('15')\n\n expect(subject).to receive(:execute).with(%w{/usr/libexec/iptables/iptables.init save})\n subject.persist_iptables(proto)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should reject invalid proto #{proto}\" do\n expect { subject.icmp_name_to_number('echo-reply', proto) }.\n to raise_error(ArgumentError, \"unsupported protocol family '#{proto}'\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should install sun-jdk' do\n pp = <<-EOS\n class { 'java':\n distribution => 'sun-jdk',\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n apply_manifest(pp, :catch_changes => true)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def exists?\n block_until_mongodb(@resource[:tries])\n mongo(\"--quiet\", \"--eval\", 'db.getMongo().getDBNames()').split(\",\").include?(@resource[:name])\n end", "label_name": "Base", "label": 1.0}
-{"code": " def exists?\n @property_hash[:ensure] == :present\n end", "label_name": "Base", "label": 1.0}
-{"code": " def destroy\n @property_flush[:ensure] = :absent\n end", "label_name": "Base", "label": 1.0}
-{"code": " def self.prefetch(resources)\n instances.each do |prov|\n if resource = resources[prov.name]\n resource.provider = prov\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def insync?(is)\n is.sort == should.sort\n end", "label_name": "Base", "label": 1.0}
-{"code": " def should_to_s(value)\n value.inspect\n end", "label_name": "Base", "label": 1.0}
-{"code": " it {\n should contain_file('/etc/mongod.conf')\n }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should contain mongodb_user with mongodb_database requirement' do\n should contain_mongodb_user('testuser')\\\n .with_require('Mongodb_database[testdb]')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should convert password into a hash' do\n result = scope.function_mongodb_password(%w(user pass))\n result.should(eq('e0c4a7b97d4db31f5014e9694e567d6b'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'makes a database' do\n provider.expects(:mongo)\n provider.create\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'raises an error when at least one member is configured with another replicaset name' do\n provider.stubs(:rs_status).returns({ \"set\" => \"rs_another\" })\n provider.members=(valid_members)\n expect { provider.flush }.to raise_error(Puppet::Error, /is already part of another replicaset\\.$/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'changes a password_hash' do\n provider.expects(:mongo)\n provider.password_hash=(\"newpass\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should require a password_hash' do\n expect {\n Puppet::Type.type(:mongodb_user).new({:name => 'test', :database => 'testdb'})\n }.to raise_error(Puppet::Error, 'Property \\'password_hash\\' must be set. Use mongodb_password() for creating hash.')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should use default role' do\n @user[:roles].should == ['dbAdmin']\n end", "label_name": "Base", "label": 1.0}
-{"code": " def destroy\n mysqladmin([defaults_file, '-f', 'drop', @resource[:name]].compact)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def create\n mysql([defaults_file, '-NBe', \"create database `#{@resource[:name]}` character set #{resource[:charset]}\"].compact)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def validate_privs(set_privs, all_privs)\n all_privs = all_privs.collect { |p| p.downcase }\n set_privs = set_privs.collect { |p| p.downcase }\n invalid_privs = Array.new\n hints = Array.new\n # Test each of the user provided privs to see if they exist in all_privs\n set_privs.each do |priv|\n invalid_privs << priv unless all_privs.include?(priv)\n hints << \"#{priv}_priv\" if all_privs.include?(\"#{priv}_priv\")\n end\n unless invalid_privs.empty?\n # Print a decently helpful and gramatically correct error message\n hints = \"Did you mean '#{hints.join(',')}'?\" unless hints.empty?\n p = invalid_privs.size > 1 ? ['s', 'are not valid'] : ['', 'is not valid']\n detail = [\"The privilege#{p[0]} '#{invalid_privs.join(',')}' #{p[1]}.\"]\n fail [detail, hints].join(' ')\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def max_connections_per_hour=(int)\n merged_name = self.class.cmd_user(@resource[:name])\n mysql([defaults_file, '-e', \"GRANT USAGE ON *.* TO #{merged_name} WITH MAX_CONNECTIONS_PER_HOUR #{int}\"].compact).chomp\n\n max_connections_per_hour == int ? (return true) : (return false)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def should_to_s(newvalue = @should)\n if newvalue\n unless newvalue.is_a?(Array)\n newvalue = [ newvalue ]\n end\n newvalue.collect do |v| v.downcase end.sort.join ', '\n else\n nil\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'creates the file elsewhere' do\n pp = <<-EOS\n class { 'mysql::server':\n config_file => '/etc/testmy.cnf',\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe file('/etc/testmy.cnf') do\n it { should be_file }\n end\nend", "label_name": "Base", "label": 1.0}
-{"code": " it 'shuts down mysql' do\n pp = <<-EOS\n class { 'mysql::server': service_enabled => false }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end\n\n it 'deletes the /root/.my.cnf password' do\n shell('rm -rf /root/.my.cnf')\n end\n\n it 'deletes all databases' do\n case fact('osfamily')\n when 'RedHat', 'Suse'\n shell('grep -q datadir /etc/my.cnf && rm -rf `grep datadir /etc/my.cnf | cut -d\" \" -f 3`/*')\n when 'Debian'\n shell('rm -rf `grep datadir /etc/mysql/my.cnf | cut -d\" \" -f 3`/*')\n shell('mysql_install_db')\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'starts up mysql' do\n pp = <<-EOS\n class { 'mysql::server': service_enabled => true }\n EOS\n\n puppet_apply(pp, :catch_failures => true)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'has a user' do\n shell(\"mysql -NBe \\\"select '1' from mysql.user where CONCAT(user, '@', host) = 'zerg1@localhost'\\\"\") do |r|\n expect(r.stdout).to match(/^1$/)\n expect(r.stderr).to be_empty\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'finds ipv4' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'192.168.5.6'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'192.168.5.6'/)\n expect(r.stderr).to be_empty\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'finds ipv6' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'/)\n expect(r.stderr).to be_empty\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should remove Mysql_User[root@myhost.mydomain]' do\n should contain_mysql_user('root@myhost.mydomain').with_ensure('absent')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should convert password into a hash' do\n result = scope.function_mysql_password(%w(password))\n result.should(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should recognize when all privileges are not set' do\n provider_class.expects(:mysql).with([\"--defaults-extra-file=#{root_home}/.my.cnf\", 'mysql', '-Be', \"select * from mysql.user where user='user' and host='host'\"]).returns <<-EOT\nHost\tUser\tPassword\tSelect_priv\tInsert_priv\tUpdate_priv\nhost\tuser\t\tY\tN\tY\nEOT\n @provider.all_privs_set?.should == false\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'removes cached privileges' do\n subject.expects(:mysqladmin).with([defaults_file, 'flush-privileges'])\n @provider.flush\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'makes a database' do\n provider.expects(:mysql).with([defaults_file, '-NBe', \"create database if not exists `#{resource[:name]}` character set #{resource[:charset]} collate #{resource[:collate]}\"])\n provider.expects(:exists?).returns(true)\n provider.create.should be_true\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'returns a collate' do\n instance.collate.should == 'latin1_swedish_ci'\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'fails if file missing' do\n File.stubs(:file?).with('/root/.my.cnf').returns(false)\n provider.defaults_file.should be_nil\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should require a name' do\n expect {\n Puppet::Type.type(:mysql_grant).new({})\n }.to raise_error(Puppet::Error, 'Title or name must be provided')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_package('nginx') }", "label_name": "Base", "label": 1.0}
-{"code": " it param[:title] do\n verify_contents(subject, \"/etc/nginx/conf.d/#{title}-geo.conf\", Array(param[:match]))\n Array(param[:notmatch]).each do |item|\n should contain_file(\"/etc/nginx/conf.d/#{title}-geo.conf\").without_content(item)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_file(\"/etc/nginx/conf.d/#{title}-map.conf\").with(\n {\n 'owner' => 'root',\n 'group' => 'root',\n 'mode' => '0644',\n 'ensure' => 'file',\n 'content' => /map \\$uri \\$#{title}/,\n }\n )}", "label_name": "Base", "label": 1.0}
-{"code": " it param[:title] do\n lines = subject.resource('concat::fragment', \"#{title}_upstream_#{param[:fragment]}\").send(:parameters)[:content].split(\"\\n\")\n (lines & Array(param[:match])).should == Array(param[:match])\n Array(param[:notmatch]).each do |item|\n should contain_concat__fragment(\"#{title}_upstream_#{param[:fragment]}\").without_content(item)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should run successfully' do\n pp = \"class { 'nginx': }\"\n\n puppet_apply(pp) do |r|\n #r.stderr.should be_empty\n [0,2].should include r.exit_code\n r.refresh\n #r.stderr.should be_empty\n r.exit_code.should be_zero\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should answer to http://www.puppetlabs.com' do\n shell(\"/usr/bin/curl http://www.puppetlabs.com:80\") do |r|\n r.stdout.should == \"Hello from www\\n\"\n r.exit_code.should == 0\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'raises a deprecation warning' do\n pp = \"class { 'ntp': autoupdate => true }\"\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/autoupdate parameter has been deprecated and replaced with package_ensure/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'disables the tinker panic setting' do\n pp = <<-EOS\n class { 'ntp':\n panic => true,\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe file('/etc/ntp.conf') do\n it { should_not contain 'tinker panic 0' }\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should purge source dir if source_dir_purge is true' do\n content = catalogue.resource('file', 'php.dir').send(:parameters)[:purge]\n content.should == true\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should remove the package' do\n should contain_package('pear-Crypt-CHAP').with_ensure('absent')\n end", "label_name": "Base", "label": 1.0}
-{"code": " def command()\n if ((! resource[:unless]) or (resource[:unless].empty?))\n if (resource.refreshonly?)\n # So, if there's no 'unless', and we're in \"refreshonly\" mode,\n # we need to return the target command here. If we don't,\n # then Puppet will generate an event indicating that this\n # property has changed.\n return resource[:command]\n end\n\n # if we're not in refreshonly mode, then we return nil,\n # which will cause Puppet to sync this property. This\n # is what we want if there is no 'unless' value specified.\n return nil\n end\n\n if Puppet::PUPPETVERSION.to_f < 4\n output, status = run_unless_sql_command(resource[:unless])\n else\n output = run_unless_sql_command(resource[:unless])\n status = output.exitcode\n end\n\n if status != 0\n puts status\n self.fail(\"Error evaluating 'unless' clause: '#{output}'\")\n end\n result_count = output.strip.to_i\n if result_count > 0\n # If the 'unless' query returned rows, then we don't want to execute\n # the 'command'. Returning the target 'command' here will cause\n # Puppet to treat this property as already being 'insync?', so it\n # won't call the setter to run the 'command' later.\n return resource[:command]\n end\n\n # Returning 'nil' here will cause Puppet to see this property\n # as out-of-sync, so it will call the setter later.\n nil\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'test loading class with no parameters' do\n pending('libpostgresql-java-jdbc not available natively for Ubuntu 10.04 and Debian 6',\n :if => (fact('osfamily') == 'Debian' and ['6', '10'].include?(fact('lsbmajdistrelease'))))\n\n pp = <<-EOS.unindent\n class { 'postgresql::lib::java': }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n apply_manifest(pp, :catch_changes => true)\n end\nend", "label_name": "Base", "label": 1.0}
-{"code": " it { should be_listening }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should keep retrying if database is down' do\n # So first we shut the db down, then background a startup routine with a\n # sleep 10 in front of it. That way the tests should continue while\n # the pause and db startup happens in the background.\n shell(\"/etc/init.d/postgresql* stop\")\n shell('nohup bash -c \"sleep 10; /etc/init.d/postgresql* start\" > /dev/null 2>&1 &')\n\n pp = <<-EOS.unindent\n postgresql::validate_db_connection { 'foo':\n database_name => 'foo',\n tries => 30,\n sleep => 1,\n run_as => 'postgres',\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_class(\"postgresql::lib::devel\") }", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_package('postgresql-jdbc').with(\n :name => 'libpostgresql-jdbc-java',\n :ensure => 'present'\n )}", "label_name": "Base", "label": 1.0}
-{"code": " it 'should remove datadir' do\n should contain_file('/my/path').with({\n :ensure => 'absent',\n })\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_postgresql__validate_db_connection('test') }", "label_name": "Base", "label": 1.0}
-{"code": " it \"should set simple configuration with period in name\" do\n provider.to_line({:name => \"auto_explain.log_min_duration\", :value => '100ms', :comment => nil, :record_type => :parsed }).should ==\n \"auto_explain.log_min_duration = 100ms\"\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should quote includes' do\n provider.to_line( {:name=>\"include\", :value=>\"puppetextra\", :comment=>nil, :record_type=>:parsed }).should ==\n \"include 'puppetextra'\"\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"executes with the given psql_path on the given DB\" do\n expect(provider).to receive(:run_command).with(['psql', '-d',\n attributes[:db], '-t', '-c', 'SELECT something'], 'postgres',\n 'postgres')\n\n provider.run_sql_command(\"SELECT something\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"will not enforce command on sync because refresh() will be called\" do\n expect(subject.provider).to_not receive(:command=)\n subject.property(:command).sync\n end", "label_name": "Base", "label": 1.0}
-{"code": " def query\n list = npmlist\n\n if list.has_key?(resource[:name]) and list[resource[:name]].has_key?('version')\n version = list[resource[:name]]['version']\n { :ensure => version, :name => resource[:name] }\n else\n { :ensure => :absent, :name => resource[:name] }\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def npmlist\n self.class.npmlist\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should populate correctly the puppi::info step file' do\n should contain_file('/etc/puppi/info/sample').with_content(/myownscript/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should return correct host' do\n should run.with_params('https://my_user:my_pass@www.example.com:8080/path/to/file.php?id=1&ret=0','host').and_return('www.example.com') \n end", "label_name": "Base", "label": 1.0}
-{"code": " def create\n command = ['install']\n # Yes Symbols instead of Booleans because we get Symbols from Puppet when\n # we use the force or resource parameters. This is madness!\n if resource[:keep] == :true\n command.push('--keep')\n end\n if resource[:name].split('-').last == 'debug'\n command.push('--debug')\n command.push(resource[:name].split('-')[0..-1])\n else\n command.push(resource[:name])\n end\n notice(\"Going to build #{resource[:name]}. This may take some time...\")\n pyenv(command)\n @property_hash[:ensure] = :present\n pyenv('rehash')\n end", "label_name": "Base", "label": 1.0}
-{"code": " def self.all_vhosts\n vhosts = []\n parse_command(rabbitmqctl('list_vhosts')).collect do |vhost|\n vhosts.push(vhost)\n end\n vhosts\n end", "label_name": "Base", "label": 1.0}
-{"code": " def self.parse_command(cmd_output)\n # first line is:\n # Listing exchanges/vhosts ...\n # while the last line is\n # ...done.\n #\n cmd_output.split(/\\n/)[1..-2]\n end", "label_name": "Base", "label": 1.0}
-{"code": " def tags\n get_user_tags.entries.sort\n end", "label_name": "Base", "label": 1.0}
-{"code": " def validate_permissions(value)\n begin\n Regexp.new(value)\n rescue RegexpError\n raise ArgumentError, \"Invalid regexp #{value}\"\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'fails' do\n expect{subject}.to raise_error(/^ERROR: The current erlang cookie is ORIGINAL/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should set ssl options to specified values' do\n contain_file('rabbitmq.config').with({\n 'content' => %r|ssl_listeners, \\[3141\\].*\n ssl_options, \\[{cacertfile,\"/path/to/cacert\".*\n certfile=\"/path/to/cert\".*\n keyfile,\"/path/to/key|,\n })\n end\n end\n\n describe 'ssl options with ssl_only' do\n let(:params) {\n { :ssl => true,\n :ssl_only => true,\n :ssl_management_port => 3141,\n :ssl_cacert => '/path/to/cacert',\n :ssl_cert => '/path/to/cert',\n :ssl_key => '/path/to/key'\n } }\n\n it 'should set ssl options to specified values' do\n contain_file('rabbitmq.config').with({\n 'content' => %r|tcp_listeners, \\[\\].*\n ssl_listeners, \\[3141\\].*\n ssl_options, \\[{cacertfile,\"/path/to/cacert\".*\n certfile=\"/path/to/cert\".*\n keyfile,\"/path/to/key|,\n })\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should set default_user and default_pass to specified values' do\n contain_file('rabbitmq.config').with({\n 'content' => /default_user, <<\"foo\">>.*default_pass, <<\"bar\">>/,\n })\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should not match an empty list' do\n @provider.class.expects(:rabbitmqctl).with('list_user_permissions', 'foo').returns <<-EOT\nListing users ...\n...done.\nEOT\n @provider.exists?.should == nil\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should fail when names dont have a @' do\n expect {\n @perms[:name] = 'bar'\n }.to raise_error(Puppet::Error, /Valid values match/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def aliascmd\n [command(:rvmcmd), \"alias\"]\n end", "label_name": "Base", "label": 1.0}
-{"code": " def self.gemsplit(desc)\n case desc\n when /^\\*\\*\\*/, /^\\s*$/, /^\\s+/; return nil\n when /gem: not found/; return nil\n # when /^(\\S+)\\s+\\((((((\\d+[.]?))+)(,\\s)*)+)\\)/\n when /^(\\S+)\\s+\\((\\d+.*)\\)/\n name = $1\n version = $2.split(/,\\s*/)\n return {\n :name => name,\n :ensure => version\n }\n else\n Puppet.warning \"Could not match #{desc}\"\n nil\n end", "label_name": "Base", "label": 1.0}
-{"code": " def create\n command = gemsetcommand + ['create', gemset_name]\n execute(command)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"module behavior should be configured as expected\" do\n file(conf_file) do |f|\n f.should contain \"PassengerRoot \\\"#{passenger_root}\\\"\"\n f.should contain \"PassengerRuby \\\"#{passenger_ruby}\\\"\"\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should be running\" do\n service(service_name) do |s|\n s.should_not be_enabled\n s.should be_running\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"rvm should install and configure system user\" do\n # Run it twice and test for idempotency\n apply_manifest(manifest, :catch_failures => true)\n apply_manifest(manifest, :catch_changes => true)\n shell(\"/usr/local/rvm/bin/rvm list\") do |r|\n r.stdout.should =~ Regexp.new(Regexp.escape(\"# No rvm rubies installed yet.\"))\n r.exit_code.should be_zero\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n lambda { scope.function_staging_parse([]) }.should( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " def create\n entries.each do |fact|\n type = fact_type(fact)\n parser = \"#{type}_parser\"\n\n if respond_to?(\"#{type}_parser\")\n Facter.debug(\"Parsing #{fact} using #{parser}\")\n\n send(parser, fact)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def json_parser(file)\n begin\n require 'json'\n rescue LoadError\n retry if require 'rubygems'\n raise\n end\n\n JSON.load(File.read(file)).each_pair do |f, v|\n Facter.add(f) do\n setcode { v }\n end\n end\n rescue Exception => e\n Facter.warn(\"Failed to handle #{file} as json facts: #{e.class}: #{e}\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " def script_parser(file)\n result = cache_lookup(file)\n ttl = cache_time(file)\n\n unless result\n result = Facter::Util::Resolution.exec(file)\n\n if ttl > 0\n Facter.debug(\"Updating cache for #{file}\")\n cache_store(file, result)\n cache_save!\n end\n else\n Facter.debug(\"Using cached data for #{file}\")\n end\n\n result.split(\"\\n\").each do |line|\n if line =~ /^(.+)=(.+)$/\n var = $1; val = $2\n\n Facter.add(var) do\n setcode { val }\n end\n end\n end\n rescue Exception => e\n Facter.warn(\"Failed to handle #{file} as script facts: #{e.class}: #{e}\")\n Facter.debug(e.backtrace.join(\"\\n\\t\"))\n end", "label_name": "Base", "label": 1.0}
-{"code": " def get_root_home\n root_ent = Facter::Util::Resolution.exec(\"getent passwd root\")\n # The home directory is the sixth element in the passwd entry\n # If the platform doesn't have getent, root_ent will be nil and we should\n # return it straight away.\n root_ent && root_ent.split(\":\")[5]\n end", "label_name": "Base", "label": 1.0}
-{"code": " def destroy\n local_lines = lines\n File.open(resource[:path],'w') do |fh|\n fh.write(local_lines.reject{|l| l.chomp == resource[:line] }.join(''))\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": "def count_tests_in(group)\n count_test_types_in('tests',group)\nend", "label_name": "Base", "label": 1.0}
-{"code": "def count_pending_tests_in(group)\n count_test_types_in('pending_tests',group)\nend", "label_name": "Base", "label": 1.0}
-{"code": " it 'should not fail on empty strings' do\n pp = <<-EOS\n $input = \"\"\n $output = chop($input)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should delete elements of the array' do\n pp = <<-EOS\n $output = delete(['a','b','c','b'], 'b')\n if $output == ['a','c'] {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should delete elements of the array' do\n pp = <<-EOS\n $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})\n if $output == { a => 'A', b => '', d => false } {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should delete elements of the hash' do\n pp = <<-EOS\n $a = { 'a' => 'A', 'b' => 'B', 'B' => 'C', 'd' => 'B' }\n $b = { 'a' => 'A', 'B' => 'C' }\n $o = delete_values($a, 'B')\n if $o == $b {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'fqdn_rotates floats' do\n shell(\"echo fqdn=fakehost.localdomain > '#{facts_d}/fqdn.txt'\")\n pp = <<-EOS\n $a = ['a','b','c','d']\n $o = fqdn_rotate($a)\n notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/fqdn_rotate is \\[\"c\", \"d\", \"a\", \"b\"\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'greps arrays' do\n pp = <<-EOS\n $a = ['aaabbb','bbbccc','dddeee']\n $b = 'bbb'\n $c = ['aaabbb','bbbccc']\n $o = grep($a,$b)\n if $o == $c {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'has_keys not in hashes' do\n pp = <<-EOS\n $a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' }\n $b = 'ccc'\n $c = false\n $o = has_key($a,$b)\n if $o == $c {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'is_function_availables true' do\n pp = <<-EOS\n $a = true\n $o = is_function_available($a)\n notice(inline_template('is_function_available is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/is_function_available is false/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'is_ip_addresss ipv4 out of range' do\n pp = <<-EOS\n $a = '1.2.3.400'\n $b = false\n $o = is_ip_address($a)\n if $o == $b {\n notify { 'output correct': }\n }\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/Notice: output correct/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'prefixes array of values' do\n pp = <<-EOS\n $o = prefix(['a','b','c'],'p')\n notice(inline_template('prefix is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/prefix is \\[\"pa\", \"pb\", \"pc\"\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'ranges letters' do\n pp = <<-EOS\n $o = range('a','d')\n notice(inline_template('range is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/range is \\[\"a\", \"b\", \"c\", \"d\"\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'suffixes array of values' do\n pp = <<-EOS\n $o = suffix(['a','b','c'],'p')\n notice(inline_template('suffix is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/suffix is \\[\"ap\", \"bp\", \"cp\"\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates an multiple arguments' do\n pp = <<-EOS\n $one = ['a', 'b']\n $two = [['c'], 'd']\n validate_array($one,$two)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates a single argument' do\n pp = <<-EOS\n $one = true\n validate_bool($one)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates a fail command with a custom error message' do\n pp = <<-EOS\n $one = 'foo'\n if $::osfamily == 'windows' {\n $two = 'C:/aoeu'\n } else {\n $two = '/bin/aoeu'\n }\n validate_cmd($one,$two,\"aoeu is dvorak\")\n EOS\n\n apply_manifest(pp, :expect_failures => true) do |output|\n expect(output.stderr).to match(/aoeu is dvorak/)\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates an multiple arguments' do\n pp = <<-EOS\n $one = { 'a' => 1 }\n $two = { 'b' => 2 }\n validate_hash($one,$two)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates an multiple arguments' do\n pp = <<-EOS\n $one = '3ffe:0505:0002::'\n $two = '3ffe:0505:0001::'\n validate_ipv6_address($one,$two)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'validates a string' do\n pp = <<-EOS\n $one = 'one'\n $two = '^one$'\n validate_re($one,$two)\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'handles improper number of arguments' do\n pp = <<-EOS\n $one = ['a','b','c','d','e']\n $output = values_at($one)\n notice(inline_template('<%= @output.inspect %>'))\n EOS\n\n expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/Wrong number of arguments/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'zips two arrays of numbers together and flattens them' do\n # XXX This only tests the argument `true`, even though the following are valid:\n # 1 t y true yes\n # 0 f n false no\n # undef undefined\n pp = <<-EOS\n $one = [1,2,3,4]\n $two = [5,6,7,8]\n $output = zip($one,$two,true)\n notice(inline_template('<%= @output.inspect %>'))\n EOS\n if is_future_parser_enabled?\n expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\\[1, 5, 2, 6, 3, 7, 4, 8\\]/)\n else\n expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\\[\"1\", \"5\", \"2\", \"6\", \"3\", \"7\", \"4\", \"8\"\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'zips two arrays of numbers together' do\n pp = <<-EOS\n $one = [1,2,3,4]\n $two = [5,6,7,8]\n $output = zip($one,$two)\n notice(inline_template('<%= @output.inspect %>'))\n EOS\n if is_future_parser_enabled?\n expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\\[\\[1, 5\\], \\[2, 6\\], \\[3, 7\\], \\[4, 8\\]\\]/)\n else\n expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/\\[\\[\"1\", \"5\"\\], \\[\"2\", \"6\"\\], \\[\"3\", \"7\"\\], \\[\"4\", \"8\"\\]\\]/)\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there are other than 2 arguments\" do\n expect { scope.function_base64([]) }.to(raise_error(Puppet::ParseError))\n expect { scope.function_base64([\"asdf\"]) }.to(raise_error(Puppet::ParseError))\n expect { scope.function_base64([\"asdf\",\"moo\",\"cow\"]) }.to(raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should encode a encoded string\" do\n result = scope.function_base64([\"encode\",'thestring'])\n expect(result).to match(/\\AdGhlc3RyaW5n\\n\\Z/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"bool2num\")).to eq(\"function_bool2num\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_capitalize([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should chop the end of a string\" do\n result = scope.function_chop([\"asdf\\n\"])\n expect(result).to(eq(\"asdf\"))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should leave the original array intact\" do\n array_original = ['1','2','3']\n result = scope.function_concat([array_original,['4','5','6']])\n array_original.should(eq(['1','2','3']))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should not change the original hashes 2' do\n hash1 = {'one' => { 'two' => [1,2] } }\n hash2 = { 'one' => { 'three' => 3 } }\n hash = scope.function_deep_merge([hash1, hash2])\n expect(hash1).to eq({'one' => { 'two' => [1,2] } })\n expect(hash2).to eq({ 'one' => { 'three' => 3 } })\n expect(hash['one']).to eq({ 'two' => [1,2], 'three' => 3 })\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should be able to deep_merge two hashes' do\n new_hash = scope.function_deep_merge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])\n expect(new_hash['one']).to eq('1')\n expect(new_hash['two']).to eq('2')\n expect(new_hash['three']).to eq('2')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"delete_undef_values\")).to eq(\"function_delete_undef_values\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should delete all undef items from Array and only these\" do\n result = scope.function_delete_undef_values([['a',:undef,'c','undef']])\n expect(result).to(eq(['a','c','undef']))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return the largest integer less than or equal to the input\" do\n result = scope.function_floor([3.8])\n expect(result).to(eq(3))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should should raise a ParseError if input isn't numeric (eg. Boolean)\" do\n expect { scope.function_floor([true]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should should raise a ParseError if input isn't numeric (eg. String)\" do\n expect { scope.function_floor([\"foo\"]) }.to( raise_error(Puppet::ParseError, /Wrong argument type/))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_fqdn_rotate([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should lookup variables in other namespaces\" do\n skip(\"Fails on 2.6.x, see bug #15912\") if Puppet.version =~ /^2\\.6\\./\n Puppet[:code] = <<-'ENDofPUPPETcode'\n class site::data { $foo = 'baz' }\n include site::data\n $foo = getvar(\"site::data::foo\")\n if $foo != 'baz' {\n fail('getvar did not return what we expect')\n }\n ENDofPUPPETcode\n scope.compiler.compile\n end\n end\nend", "label_name": "Base", "label": 1.0}
-{"code": " it 'should not have \"mspiggy\" on an interface' do\n expect(subject.call(['mspiggy'])).to be_falsey\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should require the first value to be a Hash\" do\n skip(\"Fails on 2.6.x, see bug #15912\") if Puppet.version =~ /^2\\.6\\./\n Puppet[:code] = \"$x = has_key('foo', 'bar')\"\n expect {\n scope.compiler.compile\n }.to raise_error(Puppet::ParseError, /expects the first argument to be a hash/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if passed a hash\" do\n result = scope.function_is_array([{'a'=>1}])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return true if passed an array\" do\n result = scope.function_is_array([[1,2,3]])\n expect(result).to(eq(true))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return true if the domain is .\" do\n result = scope.function_is_domain_name([\".\"])\n expect(result).to(be_truthy)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return true if the domain is x.com.\" do\n result = scope.function_is_domain_name([\"x.com.\"])\n expect(result).to(be_truthy)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if a string\" do\n result = scope.function_is_float([\"asdf\"])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"is_float\")).to eq(\"function_is_float\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"is_function_available\")).to eq(\"function_is_function_available\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if it is wrapped inside an array\" do\n result = scope.function_is_numeric([[1234]])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if a boolean\" do\n result = scope.function_is_numeric([true])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"is_mac_address\")).to eq(\"function_is_mac_address\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_is_mac_address([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if a hash\" do\n result = scope.function_is_numeric([{\"asdf\" => false}])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return true if a float is created from an arithmetical operation\" do\n result = scope.function_is_numeric([3.2*2])\n expect(result).to(eq(true))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return false if an array\" do\n result = scope.function_is_string([[\"a\",\"b\",\"c\"]])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return true if a string\" do\n result = scope.function_is_string([\"asdf\"])\n expect(result).to(eq(true))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a TypeError if the second argument is an array\" do\n expect { scope.function_join_keys_to_values([{}, [1,2]]) }.to raise_error TypeError\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"lstrip\")).to eq(\"function_lstrip\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should be able to compare numbers\" do\n expect(scope.function_max([6,8,4])).to(eq(8))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should be able to compare strings\" do\n expect(scope.function_max([\"albatross\",\"dog\",\"horse\"])).to(eq(\"horse\"))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should not compile when no arguments are passed\" do\n skip(\"Fails on 2.6.x, see bug #15912\") if Puppet.version =~ /^2\\.6\\./\n Puppet[:code] = '$x = merge()'\n expect {\n scope.compiler.compile\n }.to raise_error(Puppet::ParseError, /wrong number of arguments/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_parsejson([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should convert YAML to a data structure\" do\n yaml = <<-EOS\n- aaa\n- bbb\n- ccc\nEOS\n result = scope.function_parseyaml([yaml])\n expect(result).to(eq(['aaa','bbb','ccc']))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should return :undef if it is the last possibility' do\n expect(scope.function_pick_default(['', :undefined, :undef])).to eq(:undef)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should return :undefined if it is the only possibility' do\n expect(scope.function_pick_default([:undefined])).to eq(:undefined)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"returns a prefixed array\" do\n result = scope.function_prefix([['a','b','c'], 'p'])\n expect(result).to(eq(['pa','pb','pc']))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"raises a ParseError if there is less than 1 arguments\" do\n expect { scope.function_range([]) }.to raise_error Puppet::ParseError, /Wrong number of arguments.*0 for 1/\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"returns a number range given a step of 1\" do\n result = scope.function_range([\"1\",\"4\",\"1\"])\n expect(result).to eq [1,2,3,4]\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should reject contents from an array\" do\n result = scope.function_reject([[\"1111\", \"aaabbb\",\"bbbccc\",\"dddeee\"], \"bbb\"])\n expect(result).to(eq([\"1111\", \"dddeee\"]))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_reverse([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should reverse a string\" do\n result = scope.function_reverse([\"asdfghijkl\"])\n expect(result).to(eq('lkjihgfdsa'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_size([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return the boolean it was called with\" do\n result = scope.function_str2bool([true])\n expect(result).to(eq(true))\n result = scope.function_str2bool([false])\n expect(result).to(eq(false))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should swapcase a string\" do\n result = scope.function_swapcase([\"aaBBccDD\"])\n expect(result).to(eq('AAbbCCdd'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should should raise a ParseError if input isn't a number\" do\n expect { scope.function_to_bytes([\"foo\"]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there are fewer than 2 arguments\" do\n expect { scope.function_union([]) }.to( raise_error(Puppet::ParseError) )\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should remove duplicate elements in a string\" do\n result = scope.function_unique([\"aabbc\"])\n expect(result).to(eq('abc'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_upcase([]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should accept objects which extend String\" do\n class AlsoString < String\n end\n\n value = AlsoString.new('abc')\n result = scope.function_uriescape([value])\n result.should(eq('abc'))\n end", "label_name": "Base", "label": 1.0}
-{"code": " describe \"Nicer Error Messages\" do\n # The intent here is to make sure the function returns the 3rd argument\n # in the exception thrown\n inputs = [\n [ \"root:x:0:0:root\\n\", 'Passwd.lns', [], 'Failed to validate passwd content' ],\n [ \"127.0.1.1\\n\", 'Hosts.lns', [], 'Wrong hosts content' ],\n ]\n\n inputs.each do |input|\n it \"validate_augeas(#{input.inspect}) should fail\" do\n expect { subject.call input }.to raise_error /#{input[2]}/\n end\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should not compile when #{the_string} is a string\" do\n Puppet[:code] = \"validate_hash('#{the_string}')\"\n expect { scope.compiler.compile }.to raise_error(Puppet::ParseError, /is not a Hash/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"validate_re(#{input.inspect}) should not fail\" do\n expect { subject.call input }.not_to raise_error\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"raises an error if the third argument cannot be cast to an Integer\" do\n expect { scope.function_validate_slength(['input', 1, Object.new]) }.to raise_error Puppet::ParseError, /Expected third argument.*got .*Object/\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"raises an error if the second argument is smaller than the third argument\" do\n expect { scope.function_validate_slength(['input', 1, 2]) }.to raise_error Puppet::ParseError, /Expected second argument to be larger than third argument/\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should compile when an explicitly undef variable is passed (NOTE THIS MAY NOT BE DESIRABLE)\" do\n Puppet[:code] = <<-'ENDofPUPPETcode'\n $foo = undef\n validate_string($foo)\n ENDofPUPPETcode\n scope.compiler.compile\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"values_at\")).to eq(\"function_values_at\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return chosen values from an array when passed ranges and multiple indexes\" do\n result = scope.function_values_at([['a','b','c','d','e','f','g'],[\"0\",\"2\",\"4-5\"]])\n expect(result).to(eq(['a','c','e','f']))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return a multiset\" do\n result = scope.function_values([{'a'=>'1','b'=>'3','c'=>'3'}])\n expect(result).to match_array(%w{ 1 3 3 })\n expect(result).not_to match_array(%w{ 1 3 })\n end", "label_name": "Base", "label": 1.0}
-{"code": " def apply_compiled_manifest(manifest)\n transaction = Puppet::Transaction.new(compile_to_ral(manifest), Puppet::Transaction::Report.new(\"apply\"))\n transaction.evaluate\n transaction.report.finalize_report\n\n transaction\n end", "label_name": "Base", "label": 1.0}
-{"code": " def matches?(block)\n begin\n $stderr = $stdout = StringIO.new\n $stdout.set_encoding('UTF-8') if $stdout.respond_to?(:set_encoding)\n block.call\n $stdout.rewind\n @actual = $stdout.read\n ensure\n $stdout = STDOUT\n $stderr = STDERR\n end\n\n if @actual then\n case @expected\n when String\n @actual.include? @expected\n when Regexp\n @expected.match @actual\n end\n else\n false\n end", "label_name": "Base", "label": 1.0}
-{"code": " def with_verbose_disabled\n verbose, $VERBOSE = $VERBOSE, nil\n result = yield\n $VERBOSE = verbose\n return result\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should yield to the block' do\n subject.with_puppet { Puppet[:vardir] }\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should not accept an undef\" do\n expect { scope.function_bool2str([:undef]) }.to( raise_error(Puppet::ParseError))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"bool2str\")).to eq(\"function_bool2str\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should capitalize the beginning of a normal string\" do\n result = scope.function_camelcase([\"abc\"])\n expect(result).to(eq(\"Abc\"))\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should remove the line without touching the last new line' do\n File.open(@tmpfile, 'w') do |fh|\n fh.write(\"foo1\\nfoo\\nfoo2\\n\")\n end\n @provider.destroy\n expect(File.read(@tmpfile)).to eql(\"foo1\\nfoo2\\n\")\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should accept a match regex that does match the specified line' do\n expect {\n Puppet::Type.type(:file_line).new(\n :name => 'foo',\n :path => '/my/path',\n :line => 'foo=bar',\n :match => '^\\s*foo=.*$'\n )}.not_to raise_error\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should require that a file is specified' do\n expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should accept posix filenames' do\n file_line[:path] = '/tmp/path'\n expect(file_line[:path]).to eq('/tmp/path')\n end", "label_name": "Base", "label": 1.0}
-{"code": " it { should be_enabled }", "label_name": "Base", "label": 1.0}
-{"code": " it { should contain_class('supervisord') }", "label_name": "Base", "label": 1.0}
-{"code": " it 'should work with no errors' do\n pp = <<-EOS\n class { 'swap_file': }\n EOS\n\n # Run it twice and test for idempotency\n expect(apply_manifest(pp).exit_code).to_not eq(1)\n expect(apply_manifest(pp).exit_code).to eq(0)\n end\n it 'should contain the default swapfile' do\n shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0])\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " it 'should contain the default swapfile' do\n shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0])\n end", "label_name": "Base", "label": 1.0}
-{"code": " def path_empty?\n # Path is empty if the only entries are '.' and '..'\n d = Dir.new(@resource.value(:path))\n d.read # should return '.'\n d.read # should return '..'\n d.read.nil?\n end", "label_name": "Base", "label": 1.0}
-{"code": " def create_repository(path)\n bzr('init', path)\n end", "label_name": "Base", "label": 1.0}
-{"code": " def revision\n update_references\n current = at_path { git_with_identity('rev-parse', 'HEAD').chomp }\n return current unless @resource.value(:revision)\n\n if tag_revision?(@resource.value(:revision))\n canonical = at_path { git_with_identity('show', @resource.value(:revision)).scan(/^commit (.*)/).to_s }\n else\n # if it's not a tag, look for it as a local ref\n canonical = at_path { git_with_identity('rev-parse', '--revs-only', @resource.value(:revision)).chomp }\n if canonical.empty?\n # git rev-parse executed properly but didn't find the ref;\n # look for it in the remote\n remote_ref = at_path { git_with_identity('ls-remote', '--heads', '--tags', @resource.value(:remote), @resource.value(:revision)).chomp }\n if remote_ref.empty?\n fail(\"#{@resource.value(:revision)} is not a local or remote ref\")\n end\n\n # $ git ls-remote --heads --tags origin feature/cvs\n # 7d4244b35e72904e30130cad6d2258f901c16f1a\trefs/heads/feature/cvs\n canonical = remote_ref.split.first\n end\n end\n\n if current == canonical\n @resource.value(:revision)\n else\n current\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def remote_branch_revision?(revision = @resource.value(:revision))\n # git < 1.6 returns '#{@resource.value(:remote)}/#{revision}'\n # git 1.6+ returns 'remotes/#{@resource.value(:remote)}/#{revision}'\n branch = at_path { branches.grep /(remotes\\/)?#{@resource.value(:remote)}\\/#{revision}/ }\n branch unless branch.empty?\n end", "label_name": "Base", "label": 1.0}
-{"code": " def update_submodules\n at_path do\n git_with_identity('submodule', 'update', '--init', '--recursive')\n end\n end", "label_name": "Base", "label": 1.0}
-{"code": " def destroy\n FileUtils.rm_rf(@resource.value(:path))\n end", "label_name": "Base", "label": 1.0}
-{"code": " def create_repository(path)\n hg_wrapper('init', path)\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should read CVS/Tag\" do\n File.expects(:read).with(@tag_file).returns(\"T#{@tag}\")\n provider.revision.should == @tag\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should convert it to a bare repository\" do\n resource[:ensure] = :bare\n resource.delete(:source)\n provider.expects(:working_copy_exists?).returns(true)\n provider.expects(:convert_working_copy_to_bare)\n provider.create\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should return the revision\" do\n provider.expects(:git).with('config', 'remote.origin.url').returns('')\n provider.expects(:git).with('fetch', 'origin') # FIXME\n provider.expects(:git).with('fetch', '--tags', 'origin')\n provider.expects(:git).with('tag', '-l').returns(\"Hello\")\n provider.expects(:git).with('rev-parse', '--revs-only', resource.value(:revision)).returns('')\n provider.expects(:git).with('ls-remote', '--heads', '--tags', 'origin', resource.value(:revision)).returns(\"newsha refs/heads/#{resource.value(:revision)}\")\n provider.revision.should == 'currentsha'\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should just execute 'hg clone' without a revision\" do\n resource[:source] = 'something'\n provider.expects(:hg).with('clone', resource.value(:source), resource.value(:path))\n provider.create\n end", "label_name": "Base", "label": 1.0}
-{"code": " it \"should execute 'svnadmin create' with an '--fs-type' option\" do\n resource[:fstype] = 'ext4'\n provider.expects(:svnadmin).with('create', '--fs-type',\n resource.value(:fstype),\n resource.value(:path))\n provider.create\n end", "label_name": "Base", "label": 1.0}
-{"code": " var parse = function(element) {\r\n // Remove attributes\r\n if (element.attributes && element.attributes.length) {\r\n var image = null;\r\n var style = null;\r\n // Process style attribute\r\n var elementStyle = element.getAttribute('style');\r\n if (elementStyle) {\r\n style = [];\r\n var t = elementStyle.split(';');\r\n for (var j = 0; j < t.length; j++) {\r\n var v = t[j].trim().split(':');\r\n if (validStyle.indexOf(v[0].trim()) >= 0) {\r\n var k = v.shift();\r\n var v = v.join(':');\r\n style.push(k + ':' + v);\r\n }\r\n }\r\n }\r\n // Process image\r\n if (element.tagName == 'IMG') {\r\n if (! obj.options.acceptImages) {\r\n element.remove();\r\n } else {\r\n // Check if is data\r\n element.setAttribute('tabindex', '900');\r\n // Check attributes for persistance\r\n obj.addImage(element.src);\r\n }\r\n } else {\r\n // Remove attributes\r\n var numAttributes = element.attributes.length - 1;\r\n for (var i = numAttributes; i >= 0 ; i--) {\r\n element.removeAttribute(element.attributes[i].name);\r\n }\r\n }\r\n element.style = '';\r\n // Add valid style\r\n if (style && style.length) {\r\n element.setAttribute('style', style.join(';'));\r\n }\r\n }\r\n // Parse children\r\n if (element.children.length) {\r\n for (var i = 0; i < element.children.length; i++) {\r\n parse(element.children[i]);\r\n }\r\n }\r\n\r\n if (remove.indexOf(element.constructor) >= 0) {\r\n element.remove();\r\n }\r\n }\r", "label_name": "Base", "label": 1.0}
-{"code": " var filter = function(data) {\r\n if (data) {\r\n data = data.replace(new RegExp('', 'gsi'), '');\r\n }\r\n var span = document.createElement('span');\r\n span.innerHTML = data;\r\n parse(span);\r\n return span;\r\n } \r", "label_name": "Base", "label": 1.0}
-{"code": "func main() {\n\tos.Exit(prog.Run(\n\t\t[3]*os.File{os.Stdin, os.Stdout, os.Stderr}, os.Args,\n\t\tprog.Composite(\n\t\t\tbuildinfo.Program, daemon.Program, web.Program,\n\t\t\tshell.Program{ActivateDaemon: client.Activate})))\n}", "label_name": "Class", "label": 2.0}
-{"code": "func makeBytesWriterAndCollect() (*os.File, <-chan []byte) {\n\tr, w, err := os.Pipe()\n\t// os.Pipe returns error only on resource exhaustion.\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tchanCollected := make(chan []byte)\n\n\tgo func() {\n\t\tvar (\n\t\t\tcollected []byte\n\t\t\tbuf [outFileBufferSize]byte\n\t\t)\n\t\tfor {\n\t\t\tn, err := r.Read(buf[:])\n\t\t\tcollected = append(collected, buf[:n]...)\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tlog.Println(\"error when reading output pipe:\", err)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tr.Close()\n\t\tchanCollected <- collected\n\t}()\n\n\treturn w, chanCollected\n}", "label_name": "Class", "label": 2.0}
-{"code": "func (h httpHandler) handleExecute(w http.ResponseWriter, r *http.Request) {\n\tbytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Println(\"cannot read request body:\", err)\n\t\treturn\n\t}\n\tcode := string(bytes)\n\n\toutBytes, outValues, errBytes, err := evalAndCollect(h.ev, code)\n\terrText := \"\"\n\tif err != nil {\n\t\terrText = err.Error()\n\t}\n\tresponseBody, err := json.Marshal(\n\t\t&ExecuteResponse{string(outBytes), outValues, string(errBytes), errText})\n\tif err != nil {\n\t\tlog.Println(\"cannot marshal response body:\", err)\n\t}\n\n\t_, err = w.Write(responseBody)\n\tif err != nil {\n\t\tlog.Println(\"cannot write response:\", err)\n\t}\n}", "label_name": "Class", "label": 2.0}
-{"code": " public function countFilesInFolder(Folder $folder, $useFilters = true, $recursive = false)\n {\n $this->assureFolderReadPermission($folder);\n $filters = $useFilters ? $this->fileAndFolderNameFilters : [];\n return $this->driver->countFilesInFolder($folder->getIdentifier(), $recursive, $filters);\n }", "label_name": "Base", "label": 1.0}
-{"code": " public function countFoldersInFolder(Folder $folder, $useFilters = true, $recursive = false)\n {\n $this->assureFolderReadPermission($folder);\n $filters = $useFilters ? $this->fileAndFolderNameFilters : [];\n return $this->driver->countFoldersInFolder($folder->getIdentifier(), $recursive, $filters);\n }", "label_name": "Base", "label": 1.0}
-{"code": " public function isAuthorizedBackendUserSession()\n {\n if (!$this->hasSessionCookie()) {\n return false;\n }\n $this->initializeSession();\n if (empty($_SESSION['authorized']) || empty($_SESSION['isBackendSession'])) {\n return false;\n }\n return !$this->isExpired();\n }", "label_name": "Base", "label": 1.0}
-{"code": " public function getBranches()\n {\n if (null === $this->branches) {\n $branches = array();\n $bookmarks = array();\n\n $this->process->execute('hg branches', $output, $this->repoDir);\n foreach ($this->process->splitLines($output) as $branch) {\n if ($branch && Preg::isMatch('(^([^\\s]+)\\s+\\d+:([a-f0-9]+))', $branch, $match)) {\n $branches[$match[1]] = $match[2];\n }\n }\n\n $this->process->execute('hg bookmarks', $output, $this->repoDir);\n foreach ($this->process->splitLines($output) as $branch) {\n if ($branch && Preg::isMatch('(^(?:[\\s*]*)([^\\s]+)\\s+\\d+:(.*)$)', $branch, $match)) {\n $bookmarks[$match[1]] = $match[2];\n }\n }\n\n // Branches will have preference over bookmarks\n $this->branches = array_merge($bookmarks, $branches);\n }\n\n return $this->branches;\n }", "label_name": "Class", "label": 2.0}
+{"code": " public function saveNewUpload(UploadedFile $uploadedFile, $page_id)\n {\n $attachmentName = $uploadedFile->getClientOriginalName();\n $attachmentPath = $this->putFileInStorage($uploadedFile);\n $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');\n\n $attachment = Attachment::forceCreate([\n 'name' => $attachmentName,\n 'path' => $attachmentPath,\n 'extension' => $uploadedFile->getClientOriginalExtension(),\n 'uploaded_to' => $page_id,\n 'created_by' => user()->id,\n 'updated_by' => user()->id,\n 'order' => $largestExistingOrder + 1,\n ]);\n\n return $attachment;\n }", "label_name": "Base", "label": 1.0}
+{"code": "function adodb_addslashes($s)\n{\n\t$len = strlen($s);\n\tif ($len == 0) return \"''\";\n\tif (strncmp($s,\"'\",1) === 0 && substr($s,$len-1) == \"'\") return $s; // already quoted\n\n\treturn \"'\".addslashes($s).\"'\";\n}", "label_name": "Class", "label": 2.0}
+{"code": " public function testDuplicateAction()\n {\n $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);\n /** @var EntityManager $em */\n $em = $this->getEntityManager();\n $project = $em->find(Project::class, 1);\n $project->setMetaField((new ProjectMeta())->setName('foo')->setValue('bar'));\n $project->setEnd(new \\DateTime());\n $em->persist($project);\n $team = new Team();\n $team->addTeamlead($this->getUserByRole(User::ROLE_ADMIN));\n $team->addProject($project);\n $team->setName('project 1');\n $em->persist($team);\n $rate = new ProjectRate();\n $rate->setProject($project);\n $rate->setRate(123.45);\n $em->persist($rate);\n $activity = new Activity();\n $activity->setName('blub');\n $activity->setProject($project);\n $activity->setMetaField((new ActivityMeta())->setName('blub')->setValue('blab'));\n $em->persist($activity);\n $rate = new ActivityRate();\n $rate->setActivity($activity);\n $rate->setRate(123.45);\n $em->persist($rate);\n $em->flush();\n\n $this->request($client, '/admin/project/1/duplicate');\n $this->assertIsRedirect($client, '/details');\n $client->followRedirect();\n $node = $client->getCrawler()->filter('div.box#project_rates_box');\n self::assertEquals(1, $node->count());\n $node = $client->getCrawler()->filter('div.box#project_rates_box table.dataTable tbody tr:not(.summary)');\n self::assertEquals(1, $node->count());\n self::assertStringContainsString('123.45', $node->text(null, true));\n }", "label_name": "Compound", "label": 4.0}
+{"code": " public function testDuplicateAction()\n {\n $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);\n $this->request($client, '/admin/teams/1/duplicate');\n $this->assertIsRedirect($client, '/edit');\n $client->followRedirect();\n $node = $client->getCrawler()->filter('#team_edit_form_name');\n self::assertEquals(1, $node->count());\n self::assertEquals('Test team [COPY]', $node->attr('value'));\n }", "label_name": "Compound", "label": 4.0}
+{"code": " public function buildView(FormView $view, FormInterface $form, array $options)\n {\n if (!isset($options['api_data'])) {\n return;\n }\n\n $apiData = $options['api_data'];\n\n if (!\\is_array($apiData)) {\n throw new \\InvalidArgumentException('Option \"api_data\" must be an array for form \"' . $form->getName() . '\"');\n }\n\n if (!isset($apiData['select'])) {\n return;\n }\n\n if (!isset($apiData['route'])) {\n throw new \\InvalidArgumentException('Missing \"route\" option for \"api_data\" option for form \"' . $form->getName() . '\"');\n }\n\n if (!isset($apiData['route_params'])) {\n $apiData['route_params'] = [];\n }\n\n $formPrefixes = [];\n $parent = $form->getParent();\n do {\n $formPrefixes[] = $parent->getName();\n } while (($parent = $parent->getParent()) !== null);\n\n $formPrefix = implode('_', array_reverse($formPrefixes));\n\n $formField = $formPrefix . '_' . $apiData['select'];\n\n $view->vars['attr'] = array_merge($view->vars['attr'], [\n 'data-form-prefix' => $formPrefix,\n 'data-related-select' => $formField,\n 'data-api-url' => $this->router->generate($apiData['route'], $apiData['route_params']),\n ]);\n\n if (isset($apiData['empty_route_params'])) {\n $view->vars['attr'] = array_merge($view->vars['attr'], [\n 'data-empty-url' => $this->router->generate($apiData['route'], $apiData['empty_route_params']),\n ]);\n }\n }", "label_name": "Compound", "label": 4.0}
+{"code": " public function uploadCompanyLogo(Request $request)\n {\n $company = Company::find($request->header('company'));\n\n $this->authorize('manage company', $company);\n\n $data = json_decode($request->company_logo);\n\n if ($data) {\n $company = Company::find($request->header('company'));\n\n if ($company) {\n $company->clearMediaCollection('logo');\n\n $company->addMediaFromBase64($data->data)\n ->usingFileName($data->name)\n ->toMediaCollection('logo');\n }\n }\n\n return response()->json([\n 'success' => true,\n ]);\n }", "label_name": "Base", "label": 1.0}
+{"code": "\tprivate function validateCodeInjectionInMetadata()\n\t{\n\t\tif (\n\t\t\t\\function_exists('exif_read_data')\n\t\t\t&& \\in_array($this->getMimeType(), ['image/jpeg', 'image/tiff'])\n\t\t\t&& \\in_array(exif_imagetype($this->path), [IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM])\n\t\t) {\n\t\t\t$imageSize = getimagesize($this->path, $imageInfo);\n\t\t\tif (\n\t\t\t\t$imageSize\n\t\t\t\t&& (empty($imageInfo['APP1']) || 0 === strpos($imageInfo['APP1'], 'Exif'))\n\t\t\t\t&& ($exifdata = exif_read_data($this->path)) && !$this->validateImageMetadata($exifdata)\n\t\t\t) {\n\t\t\t\tthrow new \\App\\Exceptions\\DangerousFile('ERR_FILE_PHP_CODE_INJECTION');\n\t\t\t}\n\t\t}\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function validate($type = false)\n\t{\n\t\t$return = true;\n\t\ttry {\n\t\t\tif ($type && $this->getShortMimeType(0) !== $type) {\n\t\t\t\tthrow new \\App\\Exceptions\\DangerousFile('ERR_FILE_ILLEGAL_FORMAT');\n\t\t\t}\n\t\t\t$this->checkFile();\n\t\t\tif (!empty($this->validateAllowedFormat)) {\n\t\t\t\t$this->validateFormat();\n\t\t\t}\n\t\t\t$this->validateCodeInjection();\n\t\t\tif (($type && 'image' === $type) || 'image' === $this->getShortMimeType(0)) {\n\t\t\t\t$this->validateImage();\n\t\t\t}\n\t\t} catch (\\Exception $e) {\n\t\t\t$return = false;\n\t\t\t$message = $e->getMessage();\n\t\t\tif (false === strpos($message, '||')) {\n\t\t\t\t$message = \\App\\Language::translateSingleMod($message, 'Other.Exceptions');\n\t\t\t} else {\n\t\t\t\t$params = explode('||', $message);\n\t\t\t\t$message = \\call_user_func_array('vsprintf', [\\App\\Language::translateSingleMod(array_shift($params), 'Other.Exceptions'), $params]);\n\t\t\t}\n\t\t\t$this->validateError = $message;\n\t\t\tLog::error(\"Error: {$e->getMessage()} | {$this->getName()} | {$this->getSize()}\", __CLASS__);\n\t\t}\n\t\treturn $return;\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\t$contentType = str_replace('data:', '', $cur);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function findAddress(App\\Request $request)\n\t{\n\t\t$instance = \\App\\Map\\Address::getInstance($request->getByType('type'));\n\t\t$response = new Vtiger_Response();\n\t\tif ($instance) {\n\t\t\t$response->setResult($instance->find($request->getByType('value', 'Text')));\n\t\t}\n\t\t$response->emit();\n\t}", "label_name": "Base", "label": 1.0}
+{"code": " public function getFileIdentifiersInFolder($folderIdentifier, $useFilters = true, $recursive = false)\n {\n $filters = $useFilters == true ? $this->fileAndFolderNameFilters : [];\n return $this->driver->getFilesInFolder($folderIdentifier, 0, 0, $recursive, $filters);\n }", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic static function newFromRow( $row, Parameters $parameters, \\Title $title, $pageNamespace, $pageTitle ) {\n\t\tglobal $wgLang;\n\n\t\t$article = new Article( $title, $pageNamespace );\n\n\t\t$revActorName = null;\n\t\tif ( isset( $row['revactor_actor'] ) ) {\n\t\t\t$revActorName = User::newFromActorId( $row['revactor_actor'] )->getName();\n\t\t}\n\n\t\t$titleText = $title->getText();\n\t\tif ( $parameters->getParameter( 'shownamespace' ) === true ) {\n\t\t\t$titleText = $title->getPrefixedText();\n\t\t}\n\t\t$replaceInTitle = $parameters->getParameter( 'replaceintitle' );\n\t\tif ( is_array( $replaceInTitle ) && count( $replaceInTitle ) === 2 ) {\n\t\t\t$titleText = preg_replace( $replaceInTitle[0], $replaceInTitle[1], $titleText );\n\t\t}\n\n\t\t//Chop off title if longer than the 'titlemaxlen' parameter.\n\t\tif ( $parameters->getParameter( 'titlemaxlen' ) !== null && strlen( $titleText ) > $parameters->getParameter( 'titlemaxlen' ) ) {\n\t\t\t$titleText = substr( $titleText, 0, $parameters->getParameter( 'titlemaxlen' ) ) . '...';\n\t\t}\n\t\tif ( $parameters->getParameter( 'showcurid' ) === true && isset( $row['page_id'] ) ) {\n\t\t\t$articleLink = '[' . $title->getLinkURL( [ 'curid' => $row['page_id'] ] ) . ' ' . htmlspecialchars( $titleText ) . ']';\n\t\t} else {\n\t\t\t$articleLink = '[[' . ( $parameters->getParameter( 'escapelinks' ) && ( $pageNamespace == NS_CATEGORY || $pageNamespace == NS_FILE ) ? ':' : '' ) . $title->getFullText() . '|' . htmlspecialchars( $titleText ) . ']]';\n\t\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic static function init( $settings = false ) {\n\t\tif ( $settings === false ) {\n\t\t\tglobal $wgDplSettings;\n\n\t\t\t$settings = $wgDplSettings;\n\t\t}\n\n\t\tif ( !is_array( $settings ) ) {\n\t\t\tthrow new MWException( __METHOD__ . \": Invalid settings passed.\" );\n\t\t}\n\n\t\tself::$settings = array_merge( self::$settings, $settings );\n\t}", "label_name": "Class", "label": 2.0}
{"code": "\tpublic static function onRegistration() {\n\t\tif ( !defined( 'DPL_VERSION' ) ) {\n\t\t\tdefine( 'DPL_VERSION', '3.3.5' );\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate static function dumpParsedRefs( $parser, $label ) {\n\t\t// if (!preg_match(\"/Query Q/\",$parser->mTitle->getText())) return '';\n\t\techo 'parser mLinks: ';\n\t\tob_start();\n\t\tvar_dump( $parser->getOutput()->mLinks );\n\t\t$a = ob_get_contents();\n\t\tob_end_clean();\n\t\techo htmlspecialchars( $a, ENT_QUOTES );\n\t\techo '
';\n\t\techo 'parser mTemplates: ';\n\t\tob_start();\n\t\tvar_dump( $parser->getOutput()->mTemplates );\n\t\t$a = ob_get_contents();\n\t\tob_end_clean();\n\t\techo htmlspecialchars( $a, ENT_QUOTES );\n\t\techo '
';\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic static function dplParserFunction( &$parser ) {\n\t\tself::setLikeIntersection( false );\n\n\t\t$parser->addTrackingCategory( 'dpl-parserfunc-tracking-category' );\n\n\t\t// callback for the parser function {{#dpl:\t or {{DynamicPageList::\n\t\t$input = \"\";\n\n\t\t$numargs = func_num_args();\n\t\tif ( $numargs < 2 ) {\n\t\t\t$input = \"#dpl: no arguments specified\";\n\t\t\treturn str_replace( '\u00a7', '<', '\u00a7pre>\u00a7nowiki>' . $input . '\u00a7/nowiki>\u00a7/pre>' );\n\t\t}\n\n\t\t// fetch all user-provided arguments (skipping $parser)\n\t\t$arg_list = func_get_args();\n\t\tfor ( $i = 1; $i < $numargs; $i++ ) {\n\t\t\t$p1 = $arg_list[$i];\n\t\t\t$input .= str_replace( \"\\n\", \"\", $p1 ) . \"\\n\";\n\t\t}\n\n\t\t$parse = new \\DPL\\Parse();\n\t\t$dplresult = $parse->parse( $input, $parser, $reset, $eliminate, false );\n\t\treturn [ // parser needs to be coaxed to do further recursive processing\n\t\t\t$parser->getPreprocessor()->preprocessToObj( $dplresult, Parser::PTD_FOR_INCLUSION ),\n\t\t\t'isLocalObj' => true,\n\t\t\t'title' => $parser->getTitle()\n\t\t];\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic static function endReset( &$parser, $text ) {\n\t\tif ( !self::$createdLinks['resetdone'] ) {\n\t\t\tself::$createdLinks['resetdone'] = true;\n\t\t\tforeach ( $parser->getOutput()->mCategories as $key => $val ) {\n\t\t\t\tif ( array_key_exists( $key, self::$fixedCategories ) ) {\n\t\t\t\t\tself::$fixedCategories[$key] = $val;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs($parser,\"before final reset\");\n\t\t\tif ( self::$createdLinks['resetLinks'] ) {\n\t\t\t\t$parser->getOutput()->mLinks = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetCategories'] ) {\n\t\t\t\t$parser->getOutput()->mCategories = self::$fixedCategories;\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetTemplates'] ) {\n\t\t\t\t$parser->getOutput()->mTemplates = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetImages'] ) {\n\t\t\t\t$parser->getOutput()->mImages = [];\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs( $parser, 'after final reset' );\n\t\t\tself::$fixedCategories = [];\n\t\t}\n\t\treturn true;\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic static function dplReplaceParserFunction( &$parser, $text, $pat = '', $repl = '' ) {\n\t\t$parser->addTrackingCategory( 'dplreplace-parserfunc-tracking-category' );\n\t\tif ( $text == '' || $pat == '' ) {\n\t\t\treturn '';\n\t\t}\n\t\t# convert \\n to a real newline character\n\t\t$repl = str_replace( '\\n', \"\\n\", $repl );\n\n\t\t# replace\n\t\tif ( !self::isRegexp( $pat ) ) {\n\t\t\t$pat = '`' . str_replace( '`', '\\`', $pat ) . '`';\n\t\t}\n\n\t\treturn @preg_replace( $pat, $repl, $text );\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate function setDefaults() {\n\t\t$this->setParameter( 'defaulttemplatesuffix', '.default' );\n\n\t\t$parameters = $this->getParametersForRichness();\n\t\tforeach ( $parameters as $parameter ) {\n\t\t\tif ( $this->getData( $parameter )['default'] !== null && !( $this->getData( $parameter )['default'] === false && $this->getData( $parameter )['boolean'] === true ) ) {\n\t\t\t\tif ( $parameter == 'debug' ) {\n\t\t\t\t\t\\DynamicPageListHooks::setDebugLevel( $this->getData( $parameter )['default'] );\n\t\t\t\t}\n\t\t\t\t$this->setParameter( $parameter, $this->getData( $parameter )['default'] );\n\t\t\t}\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic static function setupMigration( Parser &$parser ) {\n\t\t$parser->setHook( 'Intersection', [ __CLASS__, 'intersectionTag' ] );\n\t\t$parser->addTrackingCategory( 'dpl-intersection-tracking-category' );\n\n\t\tself::init();\n\n\t\treturn true;\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic static function onParserFirstCallInit( Parser &$parser ) {\n\t\tself::init();\n\n\t\t//DPL offers the same functionality as Intersection. So we register the tag in case LabeledSection Extension is not installed so that the section markers are removed.\n\t\tif ( \\DPL\\Config::getSetting( 'handleSectionTag' ) ) {\n\t\t\t$parser->setHook( 'section', [ __CLASS__, 'dplTag' ] );\n\t\t}\n\n\t\t$parser->setHook( 'DPL', [ __CLASS__, 'dplTag' ] );\n\t\t$parser->setHook( 'DynamicPageList', [ __CLASS__, 'intersectionTag' ] );\n\n\t\t$parser->setFunctionHook( 'dpl', [ __CLASS__, 'dplParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplnum', [ __CLASS__, 'dplNumParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplvar', [ __CLASS__, 'dplVarParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplreplace', [ __CLASS__, 'dplReplaceParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplchapter', [ __CLASS__, 'dplChapterParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplmatrix', [ __CLASS__, 'dplMatrixParserFunction' ] );\n\n\t\treturn true;\n\t}", "label_name": "Class", "label": 2.0}
{"code": "\tpublic function __construct() {\n\t\t$this->setRichness( Config::getSetting( 'functionalRichness' ) );\n\n\t\tif ( \\DynamicPageListHooks::isLikeIntersection() ) {\n\t\t\t$this->data['ordermethod'] = [\n\t\t\t\t'default'\t=> 'categoryadd',\n\t\t\t\t'values'\t=> [\n\t\t\t\t\t'categoryadd',\n\t\t\t\t\t'lastedit',\n\t\t\t\t\t'none'\n\t\t\t\t]\n\t\t\t];\n\t\t\t$this->data['order'] = [\n\t\t\t\t'default'\t=> 'descending',\n\t\t\t\t'values'\t=> [\n\t\t\t\t\t'ascending',\n\t\t\t\t\t'descending'\n\t\t\t\t]\n\t\t\t];\n\t\t\t$this->data['mode'] = [\n\t\t\t\t'default'\t=> 'unordered',\n\t\t\t\t'values'\t=> [\n\t\t\t\t\t'none',\n\t\t\t\t\t'ordered',\n\t\t\t\t\t'unordered'\n\t\t\t\t]\n\t\t\t];\n\t\t\t$this->data['userdateformat'] = [\n\t\t\t\t'default' => 'Y-m-d: '\n\t\t\t];\n\t\t\t$this->data['allowcachedresults']['default'] = 'true';\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic function addOrderBy( $orderBy ) {\n\t\tif ( empty( $orderBy ) ) {\n\t\t\tthrow new \\MWException( __METHOD__ . ': An empty order by clause was passed.' );\n\t\t}\n\t\t$this->orderBy[] = $orderBy;\n\t\treturn true;\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\t\t\tVariables::setVar( [ '', '', $argName, $argValue ] );\n\t\t\tif ( defined( 'ExtVariables::VERSION' ) ) {\n\t\t\t\t\\ExtVariables::get( $this->parser )->setVarValue( $argName, $argValue );\n\t\t\t}\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tprivate function setHeader( $header ) {\n\t\tif ( \\DynamicPageListHooks::getDebugLevel() == 5 ) {\n\t\t\t$header = '' . $header;\n\t\t}\n\t\t$this->header = $this->replaceVariables( $header );\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\t\t\tVariables::setVar( [ '', '', $variable, $value ] );\n\t\t\tif ( defined( 'ExtVariables::VERSION' ) ) {\n\t\t\t\t\\ExtVariables::get( $this->parser )->setVarValue( $variable, $value );\n\t\t\t}\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
{"code": "\tprivate function _categoriesminmax( $option ) {\n\t\tif ( is_numeric( $option[0] ) ) {\n\t\t\t$this->addWhere( intval( $option[0] ) . ' <= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );\n\t\t}\n\t\tif ( is_numeric( $option[1] ) ) {\n\t\t\t$this->addWhere( intval( $option[1] ) . ' >= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprivate function _addfirstcategorydate( $option ) {\n\t\t//@TODO: This should be programmatically determining which categorylink table to use instead of assuming the first one.\n\t\t$this->addSelect(\n\t\t\t[\n\t\t\t\t'cl_timestamp'\t=> \"DATE_FORMAT(cl1.cl_timestamp, '%Y%m%d%H%i%s')\"\n\t\t\t]\n\t\t);\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic static function dumpArray( $arg ) {\n\t\t$numargs = count( $arg );\n\t\tif ( $numargs < 3 ) {\n\t\t\treturn '';\n\t\t}\n\t\t$var = trim( $arg[2] );\n\t\t$text = \" array {$var} = {\";\n\t\t$n = 0;\n\t\tif ( array_key_exists( $var, self::$memoryArray ) ) {\n\t\t\tforeach ( self::$memoryArray[$var] as $value ) {\n\t\t\t\tif ( $n++ > 0 ) {\n\t\t\t\t\t$text .= ', ';\n\t\t\t\t}\n\t\t\t\t$text .= \"{$value}\";\n\t\t\t}\n\t\t}\n\t\treturn $text . \"}\\n\";\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic static function newFromStyle( $style, \\DPL\\Parameters $parameters ) {\n\t\t$style = strtolower( $style );\n\t\tswitch ( $style ) {\n\t\t\tcase 'definition':\n\t\t\t\t$class = 'DefinitionHeading';\n\t\t\t\tbreak;\n\t\t\tcase 'h1':\n\t\t\tcase 'h2':\n\t\t\tcase 'h3':\n\t\t\tcase 'h4':\n\t\t\tcase 'h5':\n\t\t\tcase 'h6':\n\t\t\tcase 'header':\n\t\t\t\t$class = 'TieredHeading';\n\t\t\t\tbreak;\n\t\t\tcase 'ordered':\n\t\t\t\t$class = 'OrderedHeading';\n\t\t\t\tbreak;\n\t\t\tcase 'unordered':\n\t\t\t\t$class = 'UnorderedHeading';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t\t\tbreak;\n\t\t}\n\t\t$class = '\\DPL\\Heading\\\\' . $class;\n\n\t\treturn new $class( $parameters );\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tpublic function formatTemplateArg( $arg, $s, $argNr, $firstCall, $maxLength, Article $article ) {\n\t\t$tableFormat = $this->getParameters()->getParameter( 'tablerow' );\n\t\t// we could try to format fields differently within the first call of a template\n\t\t// currently we do not make such a difference\n\n\t\t// if the result starts with a '-' we add a leading space; thus we avoid a misinterpretation of |- as\n\t\t// a start of a new row (wiki table syntax)\n\t\tif ( array_key_exists( \"$s.$argNr\", $tableFormat ) ) {\n\t\t\t$n = -1;\n\t\t\tif ( $s >= 1 && $argNr == 0 && !$firstCall ) {\n\t\t\t\t$n = strpos( $tableFormat[\"$s.$argNr\"], '|' );\n\t\t\t\tif ( $n === false || !( strpos( substr( $tableFormat[\"$s.$argNr\"], 0, $n ), '{' ) === false ) || !( strpos( substr( $tableFormat[\"$s.$argNr\"], 0, $n ), '[' ) === false ) ) {\n\t\t\t\t\t$n = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$result = str_replace( '%%', $arg, substr( $tableFormat[\"$s.$argNr\"], $n + 1 ) );\n\t\t\t$result = str_replace( '%PAGE%', $article->mTitle->getPrefixedText(), $result );\n\t\t\t$result = str_replace( '%IMAGE%', $this->parseImageUrlWithPath( $arg ), $result ); //@TODO: This just blindly passes the argument through hoping it is an image. --Alexia\n\t\t\t$result = $this->cutAt( $maxLength, $result );\n\t\t\tif ( strlen( $result ) > 0 && $result[0] == '-' ) {\n\t\t\t\treturn ' ' . $result;\n\t\t\t} else {\n\t\t\t\treturn $result;\n\t\t\t}\n\t\t}\n\t\t$result = $this->cutAt( $maxLength, $arg );\n\t\tif ( strlen( $result ) > 0 && $result[0] == '-' ) {\n\t\t\treturn ' ' . $result;\n\t\t} else {\n\t\t\treturn $result;\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": "\tprotected function sort(&$rowsKey, $sortColumn) {\n\t\t$sortMethod = $this->getTableSortMethod();\n\t\n\t\tif ($sortColumn < 0) {\n\t\t\tswitch ($sortMethod) {\n\t\t\t\tcase 'natural':\n\t\t\t\t\t// Reverse natsort()\n uasort($rowsKey, function($first, $second) {\n \treturn strnatcmp($second, $first);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'standard':\n\t\t\t\tdefault:\n\t\t\t\t\tarsort($rowsKey);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tswitch ($sortMethod) {\n\t\t\t\tcase 'natural':\n\t\t\t\tnatsort($rowsKey);\n\t\t\t\tbreak;\n\t\t\tcase 'standard':\n\t\t\tdefault:\n\t\t\t\tasort($rowsKey);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "label_name": "Class", "label": 2.0}
-{"code": " def start_requests(self):\n yield SplashRequest(self.url)", "label_name": "Class", "label": 2.0}
-{"code": "void RequestContext::AddInstanceIdentityToken() {\n if (!method()) {\n return;\n }\n\n const auto &audience = method()->backend_jwt_audience();\n if (!audience.empty()) {\n auto &token = service_context()\n ->global_context()\n ->GetInstanceIdentityToken(audience)\n ->GetAuthToken();\n if (!token.empty()) {\n std::string origin_auth_header;\n if (request()->FindHeader(kAuthorizationHeader, &origin_auth_header)) {\n Status status = request()->AddHeaderToBackend(\n kXForwardedAuthorizationHeader, origin_auth_header);\n if (!status.ok()) {\n service_context()->env()->LogError(\n \"Failed to set X-Forwarded-Authorization header to backend.\");\n }\n }\n Status status = request()->AddHeaderToBackend(kAuthorizationHeader,\n kBearerPrefix + token);\n if (!status.ok()) {\n service_context()->env()->LogError(\n \"Failed to set authorization header to backend.\");\n }\n }\n }\n}", "label_name": "Base", "label": 1.0}
-{"code": "utils::Status NgxEspRequest::AddHeaderToBackend(const std::string &key,\n const std::string &value) {\n ngx_table_elt_t *h = nullptr;\n for (auto &h_in : r_->headers_in) {\n if (key.size() == h_in.key.len &&\n strncasecmp(key.c_str(), reinterpret_cast(h_in.key.data),\n h_in.key.len) == 0) {\n h = &h_in;\n break;\n }\n }\n if (h == nullptr) {\n h = reinterpret_cast(\n ngx_list_push(&r_->headers_in.headers));\n if (h == nullptr) {\n return utils::Status(Code::INTERNAL, \"Out of memory\");\n }\n\n h->lowcase_key =\n reinterpret_cast(ngx_pcalloc(r_->pool, key.size()));\n if (h->lowcase_key == nullptr) {\n return utils::Status(Code::INTERNAL, \"Out of memory\");\n }\n h->hash = ngx_hash_strlow(\n h->lowcase_key,\n reinterpret_cast(const_cast(key.c_str())),\n key.size());\n }\n\n if (ngx_str_copy_from_std(r_->pool, key, &h->key) != NGX_OK ||\n ngx_str_copy_from_std(r_->pool, value, &h->value) != NGX_OK) {\n return utils::Status(Code::INTERNAL, \"Out of memory\");\n }\n ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r_->connection->log, 0,\n \"updates header to backend: \\\"%V: %V\\\"\", &h->key, &h->value);\n return utils::Status::OK;\n}", "label_name": "Base", "label": 1.0}
-{"code": "func TestMsgGrantAuthorization(t *testing.T) {\n\ttests := []struct {\n\t\ttitle string\n\t\tgranter, grantee sdk.AccAddress\n\t\tauthorization authz.Authorization\n\t\texpiration time.Time\n\t\texpectErr bool\n\t\texpectPass bool\n\t}{\n\t\t{\"nil granter address\", nil, grantee, &banktypes.SendAuthorization{SpendLimit: coinsPos}, time.Now(), false, false},\n\t\t{\"nil grantee address\", granter, nil, &banktypes.SendAuthorization{SpendLimit: coinsPos}, time.Now(), false, false},\n\t\t{\"nil granter and grantee address\", nil, nil, &banktypes.SendAuthorization{SpendLimit: coinsPos}, time.Now(), false, false},\n\t\t{\"nil authorization\", granter, grantee, nil, time.Now(), true, false},\n\t\t{\"valid test case\", granter, grantee, &banktypes.SendAuthorization{SpendLimit: coinsPos}, time.Now().AddDate(0, 1, 0), false, true},\n\t\t{\"past time\", granter, grantee, &banktypes.SendAuthorization{SpendLimit: coinsPos}, time.Now().AddDate(0, 0, -1), false, false},\n\t}\n\tfor i, tc := range tests {\n\t\tmsg, err := authz.NewMsgGrant(\n\t\t\ttc.granter, tc.grantee, tc.authorization, tc.expiration,\n\t\t)\n\t\tif !tc.expectErr {\n\t\t\trequire.NoError(t, err)\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t\tif tc.expectPass {\n\t\t\trequire.NoError(t, msg.ValidateBasic(), \"test: %v\", i)\n\t\t} else {\n\t\t\trequire.Error(t, msg.ValidateBasic(), \"test: %v\", i)\n\t\t}\n\t}\n}", "label_name": "Class", "label": 2.0}
-{"code": "def camera_img_return_path(camera_unique_id, img_type, filename):\n \"\"\"Return an image from stills or time-lapses\"\"\"\n camera = Camera.query.filter(Camera.unique_id == camera_unique_id).first()\n camera_path = assure_path_exists(\n os.path.join(PATH_CAMERAS, '{uid}'.format(uid=camera.unique_id)))\n if img_type == 'still':\n if camera.path_still:\n path = camera.path_still\n else:\n path = os.path.join(camera_path, img_type)\n elif img_type == 'timelapse':\n if camera.path_timelapse:\n path = camera.path_timelapse\n else:\n path = os.path.join(camera_path, img_type)\n else:\n return \"Unknown Image Type\"\n\n if os.path.isdir(path):\n files = (files for files in os.listdir(path)\n if os.path.isfile(os.path.join(path, files)))\n else:\n files = []\n if filename in files:\n path_file = os.path.join(path, filename)\n return send_file(path_file, mimetype='image/jpeg')\n\n return \"Image not found\"", "label_name": "Base", "label": 1.0}
-{"code": "func (app *Configurable) Encrypt(parameters map[string]string) interfaces.AppFunction {\n\talgorithm, ok := parameters[Algorithm]\n\tif !ok {\n\t\tapp.lc.Errorf(\"Could not find '%s' parameter for Encrypt\", Algorithm)\n\t\treturn nil\n\t}\n\n\tsecretPath := parameters[SecretPath]\n\tsecretName := parameters[SecretName]\n\tencryptionKey := parameters[EncryptionKey]\n\n\t// SecretPath & SecretName are optional if EncryptionKey specified\n\t// EncryptionKey is optional if SecretPath & SecretName are specified\n\n\t// If EncryptionKey not specified, then SecretPath & SecretName must be specified\n\tif len(encryptionKey) == 0 && (len(secretPath) == 0 || len(secretName) == 0) {\n\t\tapp.lc.Errorf(\"Could not find '%s' or '%s' and '%s' in configuration\", EncryptionKey, SecretPath, SecretName)\n\t\treturn nil\n\t}\n\n\t// SecretPath & SecretName both must be specified it one of them is.\n\tif (len(secretPath) != 0 && len(secretName) == 0) || (len(secretPath) == 0 && len(secretName) != 0) {\n\t\tapp.lc.Errorf(\"'%s' and '%s' both must be set in configuration\", SecretPath, SecretName)\n\t\treturn nil\n\t}\n\n\tinitVector, ok := parameters[InitVector]\n\tif !ok {\n\t\tapp.lc.Error(\"Could not find \" + InitVector)\n\t\treturn nil\n\t}\n\n\ttransform := transforms.Encryption{\n\t\tEncryptionKey: encryptionKey,\n\t\tInitializationVector: initVector,\n\t\tSecretPath: secretPath,\n\t\tSecretName: secretName,\n\t}\n\n\tswitch strings.ToLower(algorithm) {\n\tcase EncryptAES:\n\t\treturn transform.EncryptWithAES\n\tdefault:\n\t\tapp.lc.Errorf(\n\t\t\t\"Invalid encryption algorithm '%s'. Must be '%s'\",\n\t\t\talgorithm,\n\t\t\tEncryptAES)\n\t\treturn nil\n\t}\n}", "label_name": "Class", "label": 2.0}
+{"code": "\tprivate function _allrevisionsbefore( $option ) {\n\t\t$this->addTable( 'revision_actor_temp', 'rev' );\n\t\t$this->addSelect(\n\t\t\t[\n\t\t\t\t'rev.revactor_rev',\n\t\t\t\t'rev.revactor_timestamp'\n\t\t\t]\n\t\t);\n\t\t$this->addOrderBy( 'rev.revactor_rev' );\n\t\t$this->setOrderDir( 'DESC' );\n\t\t$this->addWhere(\n\t\t\t[\n\t\t\t\t$this->tableNames['page'] . '.page_id = rev.revactor_page',\n\t\t\t\t'rev.revactor_timestamp < ' . $this->convertTimestamp( $option )\n\t\t\t]\n\t\t);\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tprivate function _adduser( $option, $tableAlias = '' ) {\n\t\t$tableAlias = ( !empty( $tableAlias ) ? $tableAlias . '.' : '' );\n\t\t$this->addSelect(\n\t\t\t[\n\t\t\t\t$tableAlias . 'revactor_actor',\n\t\t\t]\n\t\t);\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\t\t\t$this->where = array_merge( $this->where, $where );\n\t\t} else {\n\t\t\tthrow new \\MWException( __METHOD__ . ': An invalid where clause was passed.' );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tprivate function _notcreatedby( $option ) {\n\t\t$this->addTable( 'revision', 'no_creation_rev' );\n\t\t$this->addTable( 'revision_actor_temp', 'no_creation_rev_actor' );\n\t\t$user = new \\User;\n\n\t\t$this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' != no_creation_rev_actor.revactor_actor AND no_creation_rev_actor.revactor_page = page_id AND no_creation_rev.rev_parent_id = 0' );\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tprivate function _minrevisions( $option ) {\n\t\t$this->addWhere( \"((SELECT count(rev_aux2.revactor_page) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux2 WHERE rev_aux2.revactor_page = {$this->tableNames['page']}.page_id) >= {$option})\" );\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic function setListAttributes( $attributes ) {\n\t\t$this->listAttributes = \\Sanitizer::fixTagAttributes( $attributes, 'ul' );\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic static function newFromStyle( $style, \\DPL\\Parameters $parameters, \\Parser $parser ) {\n\t\t$style = strtolower( $style );\n\t\tswitch ( $style ) {\n\t\t\tcase 'category':\n\t\t\t\t$class = 'CategoryList';\n\t\t\t\tbreak;\n\t\t\tcase 'definition':\n\t\t\t\t$class = 'DefinitionList';\n\t\t\t\tbreak;\n\t\t\tcase 'gallery':\n\t\t\t\t$class = 'GalleryList';\n\t\t\t\tbreak;\n\t\t\tcase 'inline':\n\t\t\t\t$class = 'InlineList';\n\t\t\t\tbreak;\n\t\t\tcase 'ordered':\n\t\t\t\t$class = 'OrderedList';\n\t\t\t\tbreak;\n\t\t\tcase 'subpage':\n\t\t\t\t$class = 'SubPageList';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\tcase 'unordered':\n\t\t\t\t$class = 'UnorderedList';\n\t\t\t\tbreak;\n\t\t\tcase 'userformat':\n\t\t\t\t$class = 'UserFormatList';\n\t\t\t\tbreak;\n\t\t}\n\t\t$class = '\\DPL\\Lister\\\\' . $class;\n\n\t\treturn new $class( $parameters, $parser );\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic function __construct( \\DPL\\Parameters $parameters, \\Parser $parser ) {\n\t\t$this->setHeadListAttributes( $parameters->getParameter( 'hlistattr' ) );\n\t\t$this->setHeadItemAttributes( $parameters->getParameter( 'hitemattr' ) );\n\t\t$this->setListAttributes( $parameters->getParameter( 'listattr' ) );\n\t\t$this->setItemAttributes( $parameters->getParameter( 'itemattr' ) );\n\t\t$this->setDominantSectionCount( $parameters->getParameter( 'dominantsection' ) );\n\t\t$this->setTemplateSuffix( $parameters->getParameter( 'defaulttemplatesuffix' ) );\n\t\t$this->setTrimIncluded( $parameters->getParameter( 'includetrim' ) );\n\t\t$this->setTableSortColumn( $parameters->getParameter( 'tablesortcol' ) );\n\t\t$this->setTableSortMethod($parameters->getParameter('tablesortmethod'));\n\t\t$this->setTitleMaxLength( $parameters->getParameter( 'titlemaxlen' ) );\n\t\t$this->setEscapeLinks( $parameters->getParameter( 'escapelinks' ) );\n\t\t$this->setSectionSeparators( $parameters->getParameter( 'secseparators' ) );\n\t\t$this->setMultiSectionSeparators( $parameters->getParameter( 'multisecseparators' ) );\n\t\t$this->setIncludePageText( $parameters->getParameter( 'incpage' ) );\n\t\t$this->setIncludePageMaxLength( $parameters->getParameter( 'includemaxlen' ) );\n\t\t$this->setPageTextMatch( (array)$parameters->getParameter( 'seclabels' ) );\n\t\t$this->setPageTextMatchRegex( (array)$parameters->getParameter( 'seclabelsmatch' ) );\n\t\t$this->setPageTextMatchNotRegex( (array)$parameters->getParameter( 'seclabelsnotmatch' ) );\n\t\t$this->setIncludePageParsed( $parameters->getParameter( 'incparsed' ) );\n\t\t$this->parameters = $parameters;\n\t\t$this->parser = clone $parser;\n\t}", "label_name": "Class", "label": 2.0}
+{"code": "\tpublic function formatItem( Article $article, $pageText = null ) {\n\t\t$item = '';\n\n\t\tif ( $pageText !== null ) {\n\t\t\t//Include parsed/processed wiki markup content after each item before the closing tag.\n\t\t\t$item .= $pageText;\n\t\t}\n\n\t\t$item = $this->getItemStart() . $item . $this->getItemEnd();\n\n\t\t$item = $this->replaceTagParameters( $item, $article );\n\n\t\treturn $item;\n\t}", "label_name": "Class", "label": 2.0}
+{"code": " private static function retrieveClosurePattern($pure, $closureName)\n {\n $pattern = '/';\n if (!$pure) {\n $pattern .= preg_quote(self::$registeredDelimiters[0]) . \"\\s*\";\n }\n $pattern .= \"$closureName\\(([a-z0-9,\\.\\s]+)\\)\";\n if (!$pure) {\n $pattern .= \"\\s*\" . preg_quote(self::$registeredDelimiters[1]);\n }\n return $pattern . \"/i\";\n }", "label_name": "Class", "label": 2.0}
{"code": " public static function getUploadFileFromPost($siteID, $subDirectory, $id)\n {\n if (isset($_FILES[$id]))\n {\n if (!@file_exists($_FILES[$id]['tmp_name']))\n {\n // File was removed, accessed from another window, or no longer exists\n return false;\n }\n\n if (!eval(Hooks::get('FILE_UTILITY_SPACE_CHECK'))) return;\n\n $uploadPath = FileUtility::getUploadPath($siteID, $subDirectory);\n $newFileName = $_FILES[$id]['name'];\n\n // Could just while(file_exists) it, but I'm paranoid of infinate loops\n // Shouldn't have 1000 files of the same name anyway\n for ($i = 0; @file_exists($uploadPath . '/' . $newFileName) && $i < 1000; $i++)\n {\n $mp = explode('.', $newFileName);\n $fileNameBase = implode('.', array_slice($mp, 0, count($mp)-1));\n $fileNameExt = $mp[count($mp)-1];\n\n if (preg_match('/(.*)_Copy([0-9]{1,3})$/', $fileNameBase, $matches))\n {\n // Copy already appending, increase the #\n $fileNameBase = sprintf('%s_Copy%d', $matches[1], intval($matches[2]) + 1);\n }\n else\n {\n $fileNameBase .= '_Copy1';\n }\n\n $newFileName = $fileNameBase . '.' . $fileNameExt;\n }\n\n if (@move_uploaded_file($_FILES[$id]['tmp_name'], $uploadPath . '/' . $newFileName) &&\n @chmod($uploadPath . '/' . $newFileName, 0777))\n {\n return $newFileName;\n }\n }\n\n return false;\n }", "label_name": "Base", "label": 1.0}
-{"code": "DU_getStringDOElement(DcmItem *obj, DcmTagKey t, char *s, size_t bufsize)\n{\n DcmByteString *elem;\n DcmStack stack;\n OFCondition ec = EC_Normal;\n char* aString;\n\n ec = obj->search(t, stack);\n elem = (DcmByteString*) stack.top();\n if (ec == EC_Normal && elem != NULL) {\n if (elem->getLength() == 0) {\n s[0] = '\\0';\n } else {\n ec = elem->getString(aString);\n OFStandard::strlcpy(s, aString, bufsize);\n }\n }\n return (ec == EC_Normal);\n}", "label_name": "Base", "label": 1.0}
-{"code": "destroyUserInformationLists(DUL_USERINFO * userInfo)\n{\n PRV_SCUSCPROLE\n * role;\n\n role = (PRV_SCUSCPROLE*)LST_Dequeue(&userInfo->SCUSCPRoleList);\n while (role != NULL) {\n free(role);\n role = (PRV_SCUSCPROLE*)LST_Dequeue(&userInfo->SCUSCPRoleList);\n }\n LST_Destroy(&userInfo->SCUSCPRoleList);\n\n /* extended negotiation */\n delete userInfo->extNegList; userInfo->extNegList = NULL;\n\n /* user identity negotiation */\n delete userInfo->usrIdent; userInfo->usrIdent = NULL;\n}", "label_name": "Variant", "label": 0.0}
-{"code": "destroyPresentationContextList(LST_HEAD ** l)\n{\n PRV_PRESENTATIONCONTEXTITEM\n * prvCtx;\n DUL_SUBITEM\n * subItem;\n\n if (*l == NULL)\n return;\n\n prvCtx = (PRV_PRESENTATIONCONTEXTITEM*)LST_Dequeue(l);\n while (prvCtx != NULL) {\n subItem = (DUL_SUBITEM*)LST_Dequeue(&prvCtx->transferSyntaxList);\n while (subItem != NULL) {\n free(subItem);\n subItem = (DUL_SUBITEM*)LST_Dequeue(&prvCtx->transferSyntaxList);\n }\n LST_Destroy(&prvCtx->transferSyntaxList);\n free(prvCtx);\n prvCtx = (PRV_PRESENTATIONCONTEXTITEM*)LST_Dequeue(l);\n }\n LST_Destroy(l);\n}", "label_name": "Variant", "label": 0.0}
-{"code": "export function escapeCommentText(value: string): string {\n return value.replace(END_COMMENT, END_COMMENT_ESCAPED);\n}", "label_name": "Base", "label": 1.0}
-{"code": "static int on_header_value(\n multipart_parser *parser, const char *at, size_t length)\n{\n multipart_parser_data_t *data = NULL;\n\n ogs_assert(parser);\n data = multipart_parser_get_data(parser);\n ogs_assert(data);\n\n if (at && length) {\n SWITCH(data->header_field)\n CASE(OGS_SBI_CONTENT_TYPE)\n if (data->part[data->num_of_part].content_type)\n ogs_free(data->part[data->num_of_part].content_type);\n data->part[data->num_of_part].content_type =\n ogs_strndup(at, length);\n ogs_assert(data->part[data->num_of_part].content_type);\n break;\n CASE(OGS_SBI_CONTENT_ID)\n if (data->part[data->num_of_part].content_id)\n ogs_free(data->part[data->num_of_part].content_id);\n data->part[data->num_of_part].content_id =\n ogs_strndup(at, length);\n ogs_assert(data->part[data->num_of_part].content_id);\n break;\n\n DEFAULT\n ogs_error(\"Unknown header field [%s]\", data->header_field);\n END\n }\n\n return 0;\n}", "label_name": "Base", "label": 1.0}
-{"code": "RawTile KakaduImage::getRegion( int seq, int ang, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h )\n{\n // Scale up our output bit depth to the nearest factor of 8\n unsigned int obpc = bpc;\n if( bpc <= 16 && bpc > 8 ) obpc = 16;\n else if( bpc <= 8 ) obpc = 8;\n\n#ifdef DEBUG\n Timer timer;\n timer.start();\n#endif\n\n RawTile rawtile( 0, res, seq, ang, w, h, channels, obpc );\n\n if( obpc == 16 ) rawtile.data = new unsigned short[w*h*channels];\n else if( obpc == 8 ) rawtile.data = new unsigned char[w*h*channels];\n else throw file_error( \"Kakadu :: Unsupported number of bits\" );\n\n rawtile.dataLength = w*h*channels*(obpc/8);\n rawtile.filename = getImagePath();\n rawtile.timestamp = timestamp;\n\n process( res, layers, x, y, w, h, rawtile.data );\n\n#ifdef DEBUG\n logfile << \"Kakadu :: getRegion() :: \" << timer.getTime() << \" microseconds\" << endl;\n#endif\n\n return rawtile;\n\n}", "label_name": "Base", "label": 1.0}
-{"code": "njs_async_function_frame_invoke(njs_vm_t *vm, njs_value_t *retval)\n{\n njs_int_t ret;\n njs_value_t ctor;\n njs_native_frame_t *frame;\n njs_promise_capability_t *capability;\n\n frame = vm->top_frame;\n frame->retval = retval;\n\n njs_set_function(&ctor, &vm->constructors[NJS_OBJ_TYPE_PROMISE]);\n\n capability = njs_promise_new_capability(vm, &ctor);\n if (njs_slow_path(capability == NULL)) {\n return NJS_ERROR;\n }\n\n frame->function->context = capability;\n\n ret = njs_function_lambda_call(vm);\n\n if (ret == NJS_OK) {\n ret = njs_function_call(vm, njs_function(&capability->resolve),\n &njs_value_undefined, retval, 1, &vm->retval);\n\n } else if (ret == NJS_AGAIN) {\n ret = NJS_OK;\n\n } else if (ret == NJS_ERROR) {\n if (njs_is_memory_error(vm, &vm->retval)) {\n return NJS_ERROR;\n }\n\n ret = njs_function_call(vm, njs_function(&capability->reject),\n &njs_value_undefined, &vm->retval, 1,\n &vm->retval);\n }\n\n *retval = capability->promise;\n\n return ret;\n}", "label_name": "Variant", "label": 0.0}
+{"code": " public static function makeSafeFilename($filename)\n {\n /* Strip out *nix directories. */\n $filenameParts = explode('/', $filename);\n $filename = end($filenameParts);\n\n /* Strip out Windows directories. */\n $filenameParts = explode('\\\\', $filename);\n $filename = end($filenameParts);\n\n /* Strip out non-ASCII characters. */\n for ($i = 0; $i < strlen($filename); $i++)\n {\n if (ord($filename[$i]) >= 128 || ord($filename[$i]) < 32)\n {\n $filename[$i] = '_';\n }\n }\n\n /* Is the file extension safe? */\n $fileExtension = self::getFileExtension($filename);\n if (in_array($fileExtension, $GLOBALS['badFileExtensions']))\n {\n $filename .= '.txt';\n }\n\n return $filename;\n }", "label_name": "Base", "label": 1.0}
+{"code": " public function create($data)\n {\n if ($this->securityController->isWikiHibernated()) {\n throw new \\Exception(_t('WIKI_IN_HIBERNATION'));\n }\n // If ID is not set or if it is already used, find a new ID\n if (!$data['bn_id_nature'] || $this->getOne($data['bn_id_nature'])) {\n $data['bn_id_nature'] = $this->findNewId();\n }\n\n return $this->dbService->query('INSERT INTO ' . $this->dbService->prefixTable('nature')\n . '(`bn_id_nature` ,`bn_ce_i18n` ,`bn_label_nature` ,`bn_template` ,`bn_description` ,`bn_sem_context` ,`bn_sem_type` ,`bn_sem_use_template` ,`bn_condition`)'\n . ' VALUES (' . $data['bn_id_nature'] . ', \"fr-FR\", \"'\n . addslashes(_convert($data['bn_label_nature'], YW_CHARSET, true)) . '\",\"'\n . addslashes(_convert($data['bn_template'], YW_CHARSET, true)) . '\", \"'\n . addslashes(_convert($data['bn_description'], YW_CHARSET, true)) . '\", \"'\n . addslashes(_convert($data['bn_sem_context'], YW_CHARSET, true)) . '\", \"'\n . addslashes(_convert($data['bn_sem_type'], YW_CHARSET, true)) . '\", '\n . (isset($data['bn_sem_use_template']) ? '1' : '0') . ', \"'\n . addslashes(_convert($data['bn_condition'], YW_CHARSET, true)) . '\")');", "label_name": "Base", "label": 1.0}
+{"code": "\tfunction handleFormSubmission(&$request, &$output, &$session) {\n\t\tif ($request->getText('action')) {\n\t\t\thandleRequestActionSubmission('admin', $this, $session);\n\t\t} else if ($request->getText('blockSubmit')) {\n\t\t\t$this->handleBlockFormSubmission($request, $output, $session);\n\t\t} else if ($request->getText('unblockSubmit')) {\n\t\t\t$this->handleUnblockFormSubmission($request, $output, $session);\n\t\t} else if ($request->getText('bypassAddUsername') || $request->getText('bypassRemoveUsername')) { //TODO: refactor to move all the subpages into their own files\n\t\t\t$bypassPage = new RequirementsBypassPage($this);\n\t\t\t$bypassPage->handleFormSubmission();\n\t\t}\n\t}", "label_name": "Compound", "label": 4.0}
+{"code": "function append_token_to_url()\n{\n\treturn '/&token_submit=' . $_SESSION['Token'];\n}", "label_name": "Compound", "label": 4.0}
+{"code": "\tpublic function getNbOfVisibleMenuEntries()\n\t{\n\t\t$nb = 0;\n\t\tforeach ($this->liste as $val) {\n\t\t\t//if (dol_eval($val['enabled'], 1)) $nb++;\n\t\t\tif (!empty($val['enabled'])) {\n\t\t\t\t$nb++; // $val['enabled'] is already evaluated to 0 or 1, no need for dol_eval()\n\t\t\t}\n\t\t}\n\t\treturn $nb;\n\t}", "label_name": "Base", "label": 1.0}
+{"code": " private function invertedSection($nodes, $id, $filters, $level)\n {\n $method = $this->getFindMethod($id);\n $id = var_export($id, true);\n $filters = $this->getFilters($filters, $level);\n\n return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level));\n }", "label_name": "Base", "label": 1.0}
+{"code": " $schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode);\n }\n\n return $this->schedulesCache = $schedules;\n }", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function addTab($array)\n\t{\n\t\tif (!$array) {\n\t\t\t$this->setAPIResponse('error', 'no data was sent', 422);\n\t\t\treturn null;\n\t\t}\n\t\t$array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array);\n\t\t$array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId();\n\t\t$array['category_id'] = ($array['category_id']) ?? $this->getDefaultCategoryId();\n\t\t$array['enabled'] = ($array['enabled']) ?? 0;\n\t\t$array['default'] = ($array['default']) ?? 0;\n\t\t$array['type'] = ($array['type']) ?? 1;\n\t\t$array['order'] = ($array['order']) ?? $this->getNextTabOrder() + 1;\n\t\tif (array_key_exists('name', $array)) {\n\t\t\t$array['name'] = htmlspecialchars($array['name']);\n\t\t\tif ($this->isTabNameTaken($array['name'])) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\t$this->setAPIResponse('error', 'Tab name was not supplied', 422);\n\t\t\treturn false;\n\t\t}\n\t\tif (!array_key_exists('url', $array) && !array_key_exists('url_local', $array)) {\n\t\t\t$this->setAPIResponse('error', 'Tab url or url_local was not supplied', 422);\n\t\t\treturn false;\n\t\t}\n\t\tif (!array_key_exists('image', $array)) {\n\t\t\t$this->setAPIResponse('error', 'Tab image was not supplied', 422);\n\t\t\treturn false;\n\t\t}\n\t\t$response = [\n\t\t\tarray(\n\t\t\t\t'function' => 'query',\n\t\t\t\t'query' => array(\n\t\t\t\t\t'INSERT INTO [tabs]',\n\t\t\t\t\t$array\n\t\t\t\t)\n\t\t\t),\n\t\t];\n\t\t$this->setAPIResponse(null, 'Tab added');\n\t\t$this->setLoggerChannel('Tab Management');\n\t\t$this->logger->debug('Added Tab for [' . $array['name'] . ']');\n\t\treturn $this->processQueries($response);\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function setLoggerChannel($channel = 'Organizr', $username = null)\n\t{\n\t\tif ($this->hasDB()) {\n\t\t\t$setLogger = false;\n\t\t\tif ($username) {\n\t\t\t\t$username = htmlspecialchars($username);\n\t\t\t}\n\t\t\tif ($this->logger) {\n\t\t\t\tif ($channel) {\n\t\t\t\t\tif (strtolower($this->logger->getChannel()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($username) {\n\t\t\t\t\tif (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$setLogger = true;\n\t\t\t}\n\t\t\tif ($setLogger) {\n\t\t\t\t$channel = $channel ?: 'Organizr';\n\t\t\t\treturn $this->setupLogger($channel, $username);\n\t\t\t} else {\n\t\t\t\treturn $this->logger;\n\t\t\t}\n\t\t}\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function approvedFileExtension($filename, $type = 'image')\n\t{\n\t\t$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));\n\t\tif ($type == 'image') {\n\t\t\tswitch ($ext) {\n\t\t\t\tcase 'gif':\n\t\t\t\tcase 'png':\n\t\t\t\tcase 'jpeg':\n\t\t\t\tcase 'jpg':\n\t\t\t\tcase 'svg':\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t} elseif ($type == 'cert') {\n\t\t\tswitch ($ext) {\n\t\t\t\tcase 'pem':\n\t\t\t\t\treturn true;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "function get_rsvpversion() {\n\treturn '9.2.5';\n}", "label_name": "Base", "label": 1.0}
+{"code": " private function userAuth()\n {\n $user = new User();\n $nick = $this->request->request->get('fsNick', '');\n if ($nick === '') {\n return $this->cookieAuth($user);\n }\n\n if ($user->loadFromCode($nick) && $user->enabled) {\n if ($user->verifyPassword($this->request->request->get('fsPassword'))) {\n // Execute actions from User model extensions\n $user->pipe('login');\n\n $this->updateCookies($user, true);\n ToolBox::ipFilter()->clear();\n ToolBox::i18nLog()->debug('login-ok', ['%nick%' => $user->nick]);\n ToolBox::log()::setContext('nick', $user->nick);\n return $user;\n }\n\n $this->ipWarning();\n ToolBox::i18nLog()->warning('login-password-fail');\n return false;\n }\n\n $this->ipWarning();\n ToolBox::i18nLog()->warning('login-user-not-found', ['%nick%' => $nick]);\n return false;\n }", "label_name": "Base", "label": 1.0}
+{"code": " public function store(CreateAppointmentCalendarRequest $request)\n {\n \n $client_id = null;\n $user = User::where('external_id', $request->user)->first();\n\n if ($request->client_external_id) {\n $client_id = Client::where('external_id', $request->client_external_id)->first()->id;\n if (!$client_id) {\n return response(__(\"Client not found\"), 422);\n }\n }\n\n $request_type = null;\n $request_id = null;\n if ($request->source_type && $request->source_external_id) {\n $request_type = $request->source_type;\n\n $entry = $request_type::whereExternalId($request->source_external_id);\n $request_id = $entry->id;\n }\n\n if (!$user) {\n return response(__(\"User not found\"), 422);\n }\n\n $startTime = str_replace([\"am\", \"pm\", ' '], \"\", $request->start_time) . ':00';\n $endTime = str_replace([\"am\", \"pm\", ' '], \"\", $request->end_time) . ':00';\n\n \n\n $appointment = Appointment::create([\n 'external_id' => Uuid::uuid4()->toString(),\n 'source_type' => $request_type,\n 'source_id' => $request_id,\n 'client_id' => $client_id,\n 'title' => $request->title,\n 'start_at' => Carbon::parse($request->start_date . \" \" . $startTime),\n 'end_at' => Carbon::parse($request->end_date . \" \" . $endTime),\n 'user_id' => $user->id,\n 'color' => $request->color\n ]);\n $appointment->user_external_id = $user->external_id;\n $appointment->start_at = $appointment->start_at;\n\n return response($appointment);\n }", "label_name": "Base", "label": 1.0}
+{"code": " public function rules()\n {\n return [\n 'name' => 'required',\n 'email' => 'required|email',\n 'address' => '',\n 'primary_number' => 'numeric',\n 'secondary_number' => 'numeric',\n 'password' => 'required|min:5|confirmed',\n 'password_confirmation' => 'required|min:5',\n 'image_path' => '',\n 'roles' => 'required',\n 'departments' => 'required'\n ];\n }", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function &storeicms_ipf_ObjectD() {\r\n\t\treturn $this->storeicms_ipf_Object(true);\r\n\t}\r", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function getEditLanguageLink($icmsObj, $onlyUrl=false, $withimage=true) {\r\n\t\t$ret = $this->handler->_moduleUrl . \"admin/\"\r\n\t\t\t. $this->handler->_page\r\n\t\t\t. \"?op=mod&\" . $this->handler->keyName . \"=\" . $icmsObj->getVar($this->handler->keyName)\r\n\t\t\t. \"&language=\" . $icmsObj->getVar('language');\r\n\t\tif ($onlyUrl) {\r\n\t\t\treturn $ret;\r\n\t\t} elseif ($withimage) {\r\n\t\t\treturn \"\r\n\t\t\t\t
\";\r\n\t\t}\r\n\r\n\t\treturn \"\" . $icmsObj->getVar($this->handler->identifierName) . \"\";\r\n\t}\r", "label_name": "Base", "label": 1.0}
+{"code": "\tpublic function __construct($handler) {\r\n\t\t$this->handler=$handler;\r\n\t}\r", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t$this->run('rm', $item, '-r');\n\t\t\t}\n\n\t\t\treturn $this;\n\t\t}", "label_name": "Class", "label": 2.0}
+{"code": "\t\t\t\t$this->run('mv', $from, $to);\n\t\t\t}\n\n\t\t\treturn $this;\n\t\t}", "label_name": "Class", "label": 2.0}
+{"code": " public function testNotRemoveAuthorizationHeaderOnRedirect()\n {\n $mock = new MockHandler([\n new Response(302, ['Location' => 'http://example.com/2']),\n static function (RequestInterface $request) {\n self::assertTrue($request->hasHeader('Authorization'));\n return new Response(200);\n }\n ]);\n $handler = HandlerStack::create($mock);\n $client = new Client(['handler' => $handler]);\n $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]);\n }", "label_name": "Class", "label": 2.0}
+{"code": "function update_config() {\n var conf_ignore = \"binlog_ignore_db=\";\n var conf_do = \"binlog_do_db=\";\n var database_list = $('#db_select option:selected:first').val();\n $('#db_select option:selected:not(:first)').each(function() {\n database_list += ',' + $(this).val();\n });\n\n if ($('#db_select option:selected').size() == 0) {\n $('#rep').html(conf_prefix);\n } else if ($('#db_type option:selected').val() == 'all') {\n $('#rep').html(conf_prefix + conf_ignore + database_list);\n } else {\n $('#rep').html(conf_prefix + conf_do + database_list);\n }\n}", "label_name": "Base", "label": 1.0}
+{"code": "function PMA_current_version()\n{\n var current = parseVersionString(pmaversion);\n var latest = parseVersionString(PMA_latest_version);\n var version_information_message = PMA_messages['strLatestAvailable'] + ' ' + PMA_latest_version;\n if (latest > current) {\n var message = $.sprintf(PMA_messages['strNewerVersion'], PMA_latest_version, PMA_latest_date);\n if (Math.floor(latest / 10000) == Math.floor(current / 10000)) {\n /* Security update */\n klass = 'error';\n } else {\n klass = 'notice';\n }\n $('#maincontainer').after('' + message + '
');\n }\n if (latest == current) {\n version_information_message = ' (' + PMA_messages['strUpToDate'] + ')';\n }\n $('#li_pma_version').append(version_information_message);\n}", "label_name": "Base", "label": 1.0}
+{"code": "function goToFinish1NF()\n{\n if (normalizeto !== '1nf') {\n goTo2NFStep1();\n return true;\n }\n $(\"#mainContent legend\").html(PMA_messages.strEndStep);\n $(\"#mainContent h4\").html(\n \"\" + PMA_sprintf(PMA_messages.strFinishMsg, PMA_commonParams.get('table')) + \"
\"\n );\n $(\"#mainContent p\").html('');\n $(\"#mainContent #extra\").html('');\n $(\"#mainContent #newCols\").html('');\n $('.tblFooters').html('');\n}", "label_name": "Base", "label": 1.0}
+{"code": "function suggestPassword(passwd_form)\n{\n // restrict the password to just letters and numbers to avoid problems:\n // \"editors and viewers regard the password as multiple words and\n // things like double click no longer work\"\n var pwchars = \"abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ\";\n var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)\n var passwd = passwd_form.generated_pw;\n passwd.value = '';\n\n for (var i = 0; i < passwordlength; i++) {\n passwd.value += pwchars.charAt(Math.floor(Math.random() * pwchars.length));\n }\n passwd_form.text_pma_pw.value = passwd.value;\n passwd_form.text_pma_pw2.value = passwd.value;\n return true;\n}", "label_name": NaN, "label": NaN}
+{"code": "function suggestPassword(passwd_form)\n{\n // restrict the password to just letters and numbers to avoid problems:\n // \"editors and viewers regard the password as multiple words and\n // things like double click no longer work\"\n var pwchars = \"abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ\";\n var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)\n var passwd = passwd_form.generated_pw;\n var randomWords = new Int32Array(passwordlength);\n\n passwd.value = '';\n\n // First we're going to try to use a built-in CSPRNG\n if (window.crypto && window.crypto.getRandomValues) {\n window.crypto.getRandomValues(randomWords);\n }\n // Because of course IE calls it msCrypto instead of being standard\n else if (window.msCrypto && window.msCrypto.getRandomValues) {\n window.msCrypto.getRandomValues(randomWords);\n } else {\n // Fallback to Math.random\n for (var i = 0; i < passwordlength; i++) {\n randomWords[i] = Math.floor(Math.random() * pwchars.length);\n }\n }\n\n for (var i = 0; i < passwordlength; i++) {\n passwd.value += pwchars.charAt(Math.abs(randomWords[i]) % pwchars.length);\n }\n\n passwd_form.text_pma_pw.value = passwd.value;\n passwd_form.text_pma_pw2.value = passwd.value;\n return true;\n}", "label_name": NaN, "label": NaN}
+{"code": " this.switch_task = function(task)\n {\n if (this.task === task && task != 'mail')\n return;\n\n var url = this.get_task_url(task);\n\n if (task == 'mail')\n url += '&_mbox=INBOX';\n else if (task == 'logout' && !this.env.server_error) {\n url += '&_token=' + this.env.request_token;\n this.clear_compose_data();\n }\n\n this.redirect(url);\n };", "label_name": "Compound", "label": 4.0}
+{"code": "if(jQuery)(function(jQuery){jQuery.extend(jQuery.fn,{uploadify:function(options){jQuery(this).each(function(){settings=jQuery.extend({id:jQuery(this).attr('id'),uploader:'uploadify.swf',script:'uploadify.php',expressInstall:null,folder:'',height:30,width:110,cancelImg:'cancel.png',wmode:'opaque',scriptAccess:'sameDomain',fileDataName:'Filedata',method:'POST',queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:'percentage',onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},options);var pagePath=location.pathname;pagePath=pagePath.split('/');pagePath.pop();pagePath=pagePath.join('/')+'/';var data={};data.uploadifyID=settings.id;data.pagepath=pagePath;if(settings.buttonImg)data.buttonImg=escape(settings.buttonImg);if(settings.buttonText)data.buttonText=escape(settings.buttonText);if(settings.rollover)data.rollover=true;data.script=settings.script;data.folder=escape(settings.folder);if(settings.scriptData){var scriptDataString='';for(var name in settings.scriptData){scriptDataString+='&'+name+'='+settings.scriptData[name];}", "label_name": "Class", "label": 2.0}
+{"code": "return returnValue;}},uploadifyUpload:function(ID){jQuery(this).each(function(){document.getElementById(jQuery(this).attr('id')+'Uploader').startFileUpload(ID,false);});},uploadifyCancel:function(ID){jQuery(this).each(function(){document.getElementById(jQuery(this).attr('id')+'Uploader').cancelFileUpload(ID,true,false);});},uploadifyClearQueue:function(){jQuery(this).each(function(){document.getElementById(jQuery(this).attr('id')+'Uploader').clearFileUploadQueue(false);});}})})(jQuery);", "label_name": "Class", "label": 2.0}
+{"code": "Installer.prototype.readGlobalPackageData = function (cb) {\n validate('F', arguments)\n log.silly('install', 'readGlobalPackageData')\n var self = this\n this.loadArgMetadata(iferr(cb, function () {\n correctMkdir(self.where, iferr(cb, function () {\n var pkgs = {}\n self.args.forEach(function (pkg) {\n pkgs[pkg.name] = true\n })\n readPackageTree(self.where, function (ctx, kid) { return ctx.parent || pkgs[kid] }, iferr(cb, function (currentTree) {\n self.currentTree = currentTree\n return cb()\n }))\n }))\n }))\n}", "label_name": "Class", "label": 2.0}
+{"code": " function restoreOldNodeModules () {\n if (!movedDestAway) return\n return readdir(path.join(delpath, 'node_modules')).catch(() => []).then((modules) => {\n if (!modules.length) return\n return correctMkdir(path.join(pkg.realpath, 'node_modules')).then(() => Bluebird.map(modules, (file) => {\n const from = path.join(delpath, 'node_modules', file)\n const to = path.join(pkg.realpath, 'node_modules', file)\n return move(from, to, moveOpts)\n }))\n })\n }", "label_name": "Class", "label": 2.0}
+{"code": "\t\tformat: function (element, content) {\n\t\t\tvar author = '',\n\t\t\t\t$elm = $(element),\n\t\t\t\t$cite = $elm.children('cite').first();\n\t\t\t$cite.html($cite.text());\n\n\t\t\tif ($cite.length === 1 || $elm.data('author')) {\n\t\t\t\tauthor = $cite.text() || $elm.data('author');\n\n\t\t\t\t$elm.data('author', author);\n\t\t\t\t$cite.remove();\n\n\t\t\t\tcontent = this.elementToBbcode(element);\n\t\t\t\tauthor = '=' + author.replace(/(^\\s+|\\s+$)/g, '');\n\n\t\t\t\t$elm.prepend($cite);\n\t\t\t}\n\n\t\t\tif ($elm.data('pid'))\n\t\t\t\tauthor += \" pid='\" + $elm.data('pid') + \"'\";\n\n\t\t\tif ($elm.data('dateline'))\n\t\t\t\tauthor += \" dateline='\" + $elm.data('dateline') + \"'\";\n\n\t\t\treturn '[quote' + author + ']' + content + '[/quote]';\n\t\t},", "label_name": "Base", "label": 1.0}
+{"code": " link: function(scope, element, attrs) {\n\n var width = 120;\n var height = 39;\n\n var div = $('A
').css({\n position: 'absolute',\n left: -1000,\n top: -1000,\n display: 'block',\n padding: 0,\n margin: 0,\n 'font-family': 'monospace'\n }).appendTo($('body'));\n\n var charWidth = div.width();\n var charHeight = div.height();\n\n div.remove();\n\n // compensate for internal horizontal padding\n var cssWidth = width * charWidth + 20;\n // Add an extra line for the status bar and divider\n var cssHeight = (height * charHeight) + charHeight + 2;\n\n log.debug(\"desired console size in characters, width: \", width, \" height: \", height);\n log.debug(\"console size in pixels, width: \", cssWidth, \" height: \", cssHeight);\n log.debug(\"character size in pixels, width: \", charWidth, \" height: \", charHeight);\n\n element.css({\n width: cssWidth,\n height: cssHeight,\n 'min-width': cssWidth,\n 'min-height': cssHeight\n });\n\n var authHeader = Core.getBasicAuthHeader(userDetails.username, userDetails.password);\n\n gogo.Terminal(element.get(0), width, height, authHeader);\n\n scope.$on(\"$destroy\", function(e) {\n document.onkeypress = null;\n document.onkeydown = null;\n });\n\n }", "label_name": "Compound", "label": 4.0}
+{"code": "module.exports = function (src, file) {\n if (typeof src !== 'string') src = String(src);\n \n try {\n Function(src);\n return;\n }\n catch (err) {\n if (err.constructor.name !== 'SyntaxError') throw err;\n return errorInfo(src, file);\n }\n};", "label_name": "Base", "label": 1.0}
+{"code": " resolve: function resolve(hostname) {\n var output,\n nodeBinary = process.execPath,\n scriptPath = path.join(__dirname, \"../scripts/dns-lookup-script\"),\n response,\n cmd = util.format('\"%s\" \"%s\" %s', nodeBinary, scriptPath, hostname);\n\n response = shell.exec(cmd, {silent: true});\n if (response && response.code === 0) {\n output = response.output;\n if (output && net.isIP(output)) {\n return output;\n }\n }\n debug('hostname', \"fail to resolve hostname \" + hostname);\n return null;\n }", "label_name": "Class", "label": 2.0}
+{"code": "\t_create: function() {\n\n\t\tif ( this.options.helper === \"original\" ) {\n\t\t\tthis._setPositionRelative();\n\t\t}\n\t\tif (this.options.addClasses){\n\t\t\tthis.element.addClass(\"ui-draggable\");\n\t\t}\n\t\tif (this.options.disabled){\n\t\t\tthis.element.addClass(\"ui-draggable-disabled\");\n\t\t}\n\t\tthis._setHandleClassName();\n\n\t\tthis._mouseInit();\n\t},", "label_name": "Base", "label": 1.0}
+{"code": "\t_getItemsAsjQuery: function(connected) {\n\n\t\tvar i, j, cur, inst,\n\t\t\titems = [],\n\t\t\tqueries = [],\n\t\t\tconnectWith = this._connectWith();\n\n\t\tif(connectWith && connected) {\n\t\t\tfor (i = connectWith.length - 1; i >= 0; i--){\n\t\t\t\tcur = $(connectWith[i], this.document[0]);\n\t\t\t\tfor ( j = cur.length - 1; j >= 0; j--){\n\t\t\t\t\tinst = $.data(cur[j], this.widgetFullName);\n\t\t\t\t\tif(inst && inst !== this && !inst.options.disabled) {\n\t\t\t\t\t\tqueries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(\".ui-sortable-helper\").not(\".ui-sortable-placeholder\"), inst]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tqueries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(\".ui-sortable-helper\").not(\".ui-sortable-placeholder\"), this]);\n\n\t\tfunction addItems() {\n\t\t\titems.push( this );\n\t\t}\n\t\tfor (i = queries.length - 1; i >= 0; i--){\n\t\t\tqueries[i][0].each( addItems );\n\t\t}\n\n\t\treturn $(items);\n\n\t},", "label_name": "Base", "label": 1.0}
+{"code": "function _c(a,b,c){var d={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return a+\" \"+cd(d[c],a)}function ad(a){switch(bd(a)){case 1:case 3:case 4:case 5:case 9:return a+\" bloaz\";default:return a+\" vloaz\"}}function bd(a){return a>9?bd(a%10):a}function cd(a,b){return 2===b?dd(a):a}function dd(a){var b={m:\"v\",b:\"v\",d:\"z\"};return void 0===b[a.charAt(0)]?a:b[a.charAt(0)]+a.substring(1)}", "label_name": "Base", "label": 1.0}
+{"code": "function Zc(a,b){var c=a.split(\"_\");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function $c(a,b,c){var d={mm:b?\"\u0445\u0432\u0456\u043b\u0456\u043d\u0430_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d\":\"\u0445\u0432\u0456\u043b\u0456\u043d\u0443_\u0445\u0432\u0456\u043b\u0456\u043d\u044b_\u0445\u0432\u0456\u043b\u0456\u043d\",hh:b?\"\u0433\u0430\u0434\u0437\u0456\u043d\u0430_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d\":\"\u0433\u0430\u0434\u0437\u0456\u043d\u0443_\u0433\u0430\u0434\u0437\u0456\u043d\u044b_\u0433\u0430\u0434\u0437\u0456\u043d\",dd:\"\u0434\u0437\u0435\u043d\u044c_\u0434\u043d\u0456_\u0434\u0437\u0451\u043d\",MM:\"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u044b_\u043c\u0435\u0441\u044f\u0446\u0430\u045e\",yy:\"\u0433\u043e\u0434_\u0433\u0430\u0434\u044b_\u0433\u0430\u0434\u043e\u045e\"};return\"m\"===c?b?\"\u0445\u0432\u0456\u043b\u0456\u043d\u0430\":\"\u0445\u0432\u0456\u043b\u0456\u043d\u0443\":\"h\"===c?b?\"\u0433\u0430\u0434\u0437\u0456\u043d\u0430\":\"\u0433\u0430\u0434\u0437\u0456\u043d\u0443\":a+\" \"+Zc(d[c],+a)}", "label_name": "Base", "label": 1.0}
+{"code": "function Md(a,b,c,d){var e=a+\" \";switch(c){case\"s\":return b||d?\"nekaj sekund\":\"nekaj sekundami\";case\"m\":return b?\"ena minuta\":\"eno minuto\";case\"mm\":return e+=1===a?b?\"minuta\":\"minuto\":2===a?b||d?\"minuti\":\"minutama\":5>a?b||d?\"minute\":\"minutami\":b||d?\"minut\":\"minutami\";case\"h\":return b?\"ena ura\":\"eno uro\";case\"hh\":return e+=1===a?b?\"ura\":\"uro\":2===a?b||d?\"uri\":\"urama\":5>a?b||d?\"ure\":\"urami\":b||d?\"ur\":\"urami\";case\"d\":return b||d?\"en dan\":\"enim dnem\";case\"dd\":return e+=1===a?b||d?\"dan\":\"dnem\":2===a?b||d?\"dni\":\"dnevoma\":b||d?\"dni\":\"dnevi\";case\"M\":return b||d?\"en mesec\":\"enim mesecem\";case\"MM\":return e+=1===a?b||d?\"mesec\":\"mesecem\":2===a?b||d?\"meseca\":\"mesecema\":5>a?b||d?\"mesece\":\"meseci\":b||d?\"mesecev\":\"meseci\";case\"y\":return b||d?\"eno leto\":\"enim letom\";case\"yy\":return e+=1===a?b||d?\"leto\":\"letom\":2===a?b||d?\"leti\":\"letoma\":5>a?b||d?\"leta\":\"leti\":b||d?\"let\":\"leti\"}}function Nd(a){var b=a;return b=-1!==a.indexOf(\"jaj\")?b.slice(0,-3)+\"leS\":-1!==a.indexOf(\"jar\")?b.slice(0,-3)+\"waQ\":-1!==a.indexOf(\"DIS\")?b.slice(0,-3)+\"nem\":b+\" pIq\"}function Od(a){var b=a;return b=-1!==a.indexOf(\"jaj\")?b.slice(0,-3)+\"Hu\u2019\":-1!==a.indexOf(\"jar\")?b.slice(0,-3)+\"wen\":-1!==a.indexOf(\"DIS\")?b.slice(0,-3)+\"ben\":b+\" ret\"}function Pd(a,b,c,d){var e=Qd(a);switch(c){case\"mm\":return e+\" tup\";case\"hh\":return e+\" rep\";case\"dd\":return e+\" jaj\";case\"MM\":return e+\" jar\";case\"yy\":return e+\" DIS\"}}function Qd(a){var b=Math.floor(a%1e3/100),c=Math.floor(a%100/10),d=a%10,e=\"\";return b>0&&(e+=Sg[b]+\"vatlh\"),c>0&&(e+=(\"\"!==e?\" \":\"\")+Sg[c]+\"maH\"),d>0&&(e+=(\"\"!==e?\" \":\"\")+Sg[d]),\"\"===e?\"pagh\":e}function Rd(a,b,c,d){var e={s:[\"viensas secunds\",\"'iensas secunds\"],m:[\"'n m\u00edut\",\"'iens m\u00edut\"],mm:[a+\" m\u00eduts\",\"\"+a+\" m\u00eduts\"],h:[\"'n \u00feora\",\"'iensa \u00feora\"],hh:[a+\" \u00feoras\",\"\"+a+\" \u00feoras\"],d:[\"'n ziua\",\"'iensa ziua\"],dd:[a+\" ziuas\",\"\"+a+\" ziuas\"],M:[\"'n mes\",\"'iens mes\"],MM:[a+\" mesen\",\"\"+a+\" mesen\"],y:[\"'n ar\",\"'iens ar\"],yy:[a+\" ars\",\"\"+a+\" ars\"]};return d?e[c][0]:b?e[c][0]:e[c][1]}", "label_name": "Base", "label": 1.0}
+{"code": "function md(a,b,c){var d=a+\" \";switch(c){case\"m\":return b?\"jedna minuta\":\"jedne minute\";case\"mm\":return d+=1===a?\"minuta\":2===a||3===a||4===a?\"minute\":\"minuta\";case\"h\":return b?\"jedan sat\":\"jednog sata\";case\"hh\":return d+=1===a?\"sat\":2===a||3===a||4===a?\"sata\":\"sati\";case\"dd\":return d+=1===a?\"dan\":\"dana\";case\"MM\":return d+=1===a?\"mjesec\":2===a||3===a||4===a?\"mjeseca\":\"mjeseci\";case\"yy\":return d+=1===a?\"godina\":2===a||3===a||4===a?\"godine\":\"godina\"}}function nd(a,b,c,d){var e=a;switch(c){case\"s\":return d||b?\"n\u00e9h\u00e1ny m\u00e1sodperc\":\"n\u00e9h\u00e1ny m\u00e1sodperce\";case\"m\":return\"egy\"+(d||b?\" perc\":\" perce\");case\"mm\":return e+(d||b?\" perc\":\" perce\");case\"h\":return\"egy\"+(d||b?\" \u00f3ra\":\" \u00f3r\u00e1ja\");case\"hh\":return e+(d||b?\" \u00f3ra\":\" \u00f3r\u00e1ja\");case\"d\":return\"egy\"+(d||b?\" nap\":\" napja\");case\"dd\":return e+(d||b?\" nap\":\" napja\");case\"M\":return\"egy\"+(d||b?\" h\u00f3nap\":\" h\u00f3napja\");case\"MM\":return e+(d||b?\" h\u00f3nap\":\" h\u00f3napja\");case\"y\":return\"egy\"+(d||b?\" \u00e9v\":\" \u00e9ve\");case\"yy\":return e+(d||b?\" \u00e9v\":\" \u00e9ve\")}return\"\"}function od(a){return(a?\"\":\"[m\u00falt] \")+\"[\"+ug[this.day()]+\"] LT[-kor]\"}", "label_name": "Base", "label": 1.0}
+{"code": "\tfunction _fnBindAction( n, oData, fn )\r\n\t{\r\n\t\t$(n)\r\n\t\t\t.bind( 'click.DT', oData, function (e) {\r\n\t\t\t\t\tn.blur(); // Remove focus outline for mouse users\r\n\t\t\t\t\tfn(e);\r\n\t\t\t\t} )\r\n\t\t\t.bind( 'keypress.DT', oData, function (e){\r\n\t\t\t\tif ( e.which === 13 ) {\r\n\t\t\t\t\tfn(e);\r\n\t\t\t\t} } )\r\n\t\t\t.bind( 'selectstart.DT', function () {\r\n\t\t\t\t/* Take the brutal approach to cancelling text selection */\r\n\t\t\t\treturn false;\r\n\t\t\t\t} );\r\n\t}\r", "label_name": "Base", "label": 1.0}
+{"code": "\"row\")}function Na(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(\" \"),b.__rowc=b.__rowc?pa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(\" \")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===h(\"th, td\",g).length,o=a.oClasses,l=a.aoColumns;i&&(e=h(\"
\").appendTo(g));b=0;for(c=l.length;b\").css({position:\"fixed\",top:0,left:0,height:1,width:1,overflow:\"hidden\"}).append(h(\"\").css({position:\"absolute\",top:1,left:1,", "label_name": "Base", "label": 1.0}
+{"code": "if(i===k)return a.iDrawError!=e&&null===j&&(K(a,0,\"Requested unknown parameter \"+(\"function\"==typeof f.mData?\"{function}\":\"'\"+f.mData+\"'\")+\" for row \"+b+\", column \"+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j)i=j;else if(\"function\"===typeof i)return i.call(g);return null===i&&\"display\"==d?\"\":i}function jb(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}function La(a){return h.map(a.match(/(\\\\.|[^\\.])+/g)||[\"\"],function(a){return a.replace(/\\\\./g,\".\")})}function Q(a){if(h.isPlainObject(a)){var b=", "label_name": "Base", "label": 1.0}
+{"code": "!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h(\"\").insertBefore(c),d=a.oFeatures,e=h(\"\",{id:a.sTableId+\"_wrapper\",\"class\":b.sWrapper+(a.nTFoot?\"\":\" \"+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(\"\"),g,j,i,o,l,q,u=0;u\")[0];o=f[u+1];if(\"'\"==o||'\"'==o){l=\"\";for(q=2;f[u+q]!=o;)l+=f[u+q],q++;\"H\"==l?l=b.sJUIHeader:\"F\"==l&&(l=b.sJUIFooter);-1!=l.indexOf(\".\")?(o=l.split(\".\"),\ni.id=o[0].substr(1,o[0].length-1),i.className=o[1]):\"#\"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;u+=q}e.append(i);e=h(i)}else if(\">\"==j)e=e.parent();else if(\"l\"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if(\"f\"==j&&d.bFilter)g=pb(a);else if(\"r\"==j&&d.bProcessing)g=qb(a);else if(\"t\"==j)g=rb(a);else if(\"i\"==j&&d.bInfo)g=sb(a);else if(\"p\"==j&&d.bPaginate)g=tb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(o=i.length;q0&&h.which!=l.which||a(h.target).is(l.not))return;switch(h.type){case\"mousedown\":return a.extend(l,a(j).offset(),{elem:j,target:h.target,pageX:h.pageX,pageY:h.pageY}),b.add(document,\"mousemove mouseup\",e,l),i(j,!1),d.dragging=null,!1;case!d.dragging&&\"mousemove\":if(g(h.pageX-l.pageX)+g(h.pageY-l.pageY)=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(\":visible\")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);", "label_name": "Base", "label": 1.0}
+{"code": "Mocha.prototype.grep = function(re){\n this.options.grep = 'string' == typeof re\n ? new RegExp(utils.escapeRegexp(re))\n : re;\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "exports.parseQuery = function(qs){\n return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){\n var i = pair.indexOf('=')\n , key = pair.slice(0, i)\n , val = pair.slice(++i);\n\n obj[key] = decodeURIComponent(val);\n return obj;\n }, {});\n};", "label_name": "Base", "label": 1.0}
+{"code": "Hook.prototype.error = function(err){\n if (0 == arguments.length) {\n var err = this._error;\n this._error = null;\n return err;\n }\n\n this._error = err;\n};", "label_name": "Base", "label": 1.0}
+{"code": "function Base(runner) {\n var self = this\n , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }\n , failures = this.failures = [];\n\n if (!runner) return;\n this.runner = runner;\n\n runner.stats = stats;\n\n runner.on('start', function(){\n stats.start = new Date;\n });\n\n runner.on('suite', function(suite){\n stats.suites = stats.suites || 0;\n suite.root || stats.suites++;\n });\n\n runner.on('test end', function(test){\n stats.tests = stats.tests || 0;\n stats.tests++;\n });\n\n runner.on('pass', function(test){\n stats.passes = stats.passes || 0;\n\n var medium = test.slow() / 2;\n test.speed = test.duration > test.slow()\n ? 'slow'\n : test.duration > medium\n ? 'medium'\n : 'fast';\n\n stats.passes++;\n });\n\n runner.on('fail', function(test, err){\n stats.failures = stats.failures || 0;\n stats.failures++;\n test.err = err;\n failures.push(test);\n });\n\n runner.on('end', function(){\n stats.end = new Date;\n stats.duration = new Date - stats.start;\n });\n\n runner.on('pending', function(){\n stats.pending++;\n });\n}", "label_name": "Base", "label": 1.0}
+{"code": "function NyanCat(runner) {\n Base.call(this, runner);\n var self = this\n , stats = this.stats\n , width = Base.window.width * .75 | 0\n , rainbowColors = this.rainbowColors = self.generateColors()\n , colorIndex = this.colorIndex = 0\n , numerOfLines = this.numberOfLines = 4\n , trajectories = this.trajectories = [[], [], [], []]\n , nyanCatWidth = this.nyanCatWidth = 11\n , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)\n , scoreboardWidth = this.scoreboardWidth = 5\n , tick = this.tick = 0\n , n = 0;\n\n runner.on('start', function(){\n Base.cursor.hide();\n self.draw();\n });\n\n runner.on('pending', function(test){\n self.draw();\n });\n\n runner.on('pass', function(test){\n self.draw();\n });\n\n runner.on('fail', function(test, err){\n self.draw();\n });\n\n runner.on('end', function(){\n Base.cursor.show();\n for (var i = 0; i < self.numberOfLines; i++) write('\\n');\n self.epilogue();\n });\n}", "label_name": "Base", "label": 1.0}
+{"code": "Mocha.prototype.reporter = function(reporter){\n if ('function' == typeof reporter) {\n this._reporter = reporter;\n } else {\n reporter = reporter || 'dot';\n var _reporter;\n try { _reporter = require('./reporters/' + reporter); } catch (err) {};\n if (!_reporter) try { _reporter = require(reporter); } catch (err) {};\n if (!_reporter && reporter === 'teamcity')\n console.warn('The Teamcity reporter was moved to a package named ' +\n 'mocha-teamcity-reporter ' +\n '(https://npmjs.org/package/mocha-teamcity-reporter).');\n if (!_reporter) throw new Error('invalid reporter \"' + reporter + '\"');\n this._reporter = _reporter;\n }\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "function Context(){}", "label_name": "Base", "label": 1.0}
+{"code": " context.describe.skip = function(title, fn){\n var suite = Suite.create(suites[0], title);\n suite.pending = true;\n suites.unshift(suite);\n fn.call(suite);\n suites.shift();\n };", "label_name": "Base", "label": 1.0}
+{"code": "Mocha.prototype.run = function(fn){\n if (this.files.length) this.loadFiles();\n var suite = this.suite;\n var options = this.options;\n var runner = new exports.Runner(suite);\n var reporter = new this._reporter(runner);\n runner.ignoreLeaks = false !== options.ignoreLeaks;\n runner.asyncOnly = options.asyncOnly;\n if (options.grep) runner.grep(options.grep, options.invert);\n if (options.globals) runner.globals(options.globals);\n if (options.growl) this._growl(runner, reporter);\n exports.reporters.Base.useColors = options.useColors;\n exports.reporters.Base.inlineDiffs = options.useInlineDiffs;\n return runner.run(fn);\n};", "label_name": "Base", "label": 1.0}
+{"code": " function next(err, errSuite) {\n // if we bail after first err\n if (self.failures && suite._bail) return fn();\n\n if (self._abort) return fn();\n\n if (err) return hookErr(err, errSuite, true);\n\n // next test\n test = tests.shift();\n\n // all done\n if (!test) return fn();\n\n // grep\n var match = self._grep.test(test.fullTitle());\n if (self._invert) match = !match;\n if (!match) return next();\n\n // pending\n if (test.pending) {\n self.emit('pending', test);\n self.emit('test end', test);\n return next();\n }\n\n // execute test and hook(s)\n self.emit('test', self.test = test);\n self.hookDown('beforeEach', function(err, errSuite){\n\n if (err) return hookErr(err, errSuite, false);\n\n self.currentRunnable = self.test;\n self.runTest(function(err){\n test = self.test;\n\n if (err) {\n self.fail(test, err);\n self.emit('test end', test);\n return self.hookUp('afterEach', next);\n }\n\n test.state = 'passed';\n self.emit('pass', test);\n self.emit('test end', test);\n self.hookUp('afterEach', next);\n });\n });\n }", "label_name": "Base", "label": 1.0}
+{"code": "Runnable.prototype.globals = function(arr){\n var self = this;\n this._allowedGlobals = arr;\n};", "label_name": "Base", "label": 1.0}
+{"code": "Suite.prototype.timeout = function(ms){\n if (0 == arguments.length) return this._timeout;\n if ('string' == typeof ms) ms = milliseconds(ms);\n debug('timeout %d', ms);\n this._timeout = parseInt(ms, 10);\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "Suite.prototype.bail = function(bail){\n if (0 == arguments.length) return this._bail;\n debug('bail %s', bail);\n this._bail = bail;\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "exports.files = function(dir, ret){\n ret = ret || [];\n\n fs.readdirSync(dir)\n .filter(ignored)\n .forEach(function(path){\n path = join(dir, path);\n if (fs.statSync(path).isDirectory()) {\n exports.files(path, ret);\n } else if (path.match(/\\.(js|coffee|litcoffee|coffee.md)$/)) {\n ret.push(path);\n }\n });\n\n return ret;\n};", "label_name": "Base", "label": 1.0}
+{"code": "function fragment(html) {\n var args = arguments\n , div = document.createElement('div')\n , i = 1;\n\n div.innerHTML = html.replace(/%([se])/g, function(_, type){\n switch (type) {\n case 's': return String(args[i++]);\n case 'e': return escape(args[i++]);\n }\n });\n\n return div.firstChild;\n}", "label_name": "Base", "label": 1.0}
+{"code": " show: function(){\n isatty && process.stdout.write('\\u001b[?25h');\n },", "label_name": "Base", "label": 1.0}
+{"code": "Mocha.prototype.slow = function(slow){\n this.suite.slow(slow);\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "require.register = function (path, fn){\n require.modules[path] = fn;\n };", "label_name": "Base", "label": 1.0}
+{"code": "Mocha.prototype.addFile = function(file){\n this.files.push(file);\n return this;\n};", "label_name": "Base", "label": 1.0}
+{"code": "\t\thelp = function() {\n\t\t\t// help tab\n\t\t\thtml.push('');\n\t\t\t// end help\n\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\tthis.hideinfo = function() {\n\t\tthis.info.stop(true).hide();\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\titem = function(label, icon, callback) {\n\t\t\t\treturn $(tpl.replace('{icon}', icon ? 'elfinder-button-icon-'+icon : '').replace('{label}', label))\n\t\t\t\t\t.click(function(e) {\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t})\n\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\tunselectAll = function() {\n\t\t\t\tif (selectedFiles.length) {\n\t\t\t\t\tselectLock = false;\n\t\t\t\t\tselectedFiles = [];\n\t\t\t\t\tcwd.find('[id].'+clSelected).trigger(evtUnselect); \n\t\t\t\t\ttrigger();\n\t\t\t\t}\n\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\tisPerm = function(perm){\n\t\treturn (!isNaN(parseInt(perm, 8) && parseInt(perm, 8) <= 511) || perm.match(/^([r-][w-][x-]){3}$/i));\n\t};", "label_name": "Base", "label": 1.0}
+{"code": "elFinder.prototype.commands.copy = function() {\n\t\n\tthis.shortcuts = [{\n\t\tpattern : 'ctrl+c ctrl+insert'\n\t}];\n\t\n\tthis.getstate = function(sel) {\n\t\tvar sel = this.files(sel),\n\t\t\tcnt = sel.length;\n\n\t\treturn !this._disabled && cnt && $.map(sel, function(f) { return f.phash && f.read ? f : null }).length == cnt ? 0 : -1;\n\t}\n\t\n\tthis.exec = function(hashes) {\n\t\tvar fm = this.fm,\n\t\t\tdfrd = $.Deferred()\n\t\t\t\t.fail(function(error) {\n\t\t\t\t\tfm.error(error);\n\t\t\t\t});\n\n\t\t$.each(this.files(hashes), function(i, file) {\n\t\t\tif (!(file.read && file.phash)) {\n\t\t\t\treturn !dfrd.reject(['errCopy', file.name, 'errPerm']);\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes)));\n\t}\n\n}", "label_name": "Base", "label": 1.0}
+{"code": "\tthis.autoSync = function(stop) {\n\t\tvar sync;\n\t\tif (self.options.sync >= 1000) {\n\t\t\tif (syncInterval) {\n\t\t\t\tclearTimeout(syncInterval);\n\t\t\t\tsyncInterval = null;\n\t\t\t\tself.trigger('autosync', {action : 'stop'});\n\t\t\t}\n\t\t\tif (stop || !self.options.syncStart) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// run interval sync\n\t\t\tsync = function(start){\n\t\t\t\tvar timeout;\n\t\t\t\tif (cwdOptions.syncMinMs && (start || syncInterval)) {\n\t\t\t\t\tstart && self.trigger('autosync', {action : 'start'});\n\t\t\t\t\ttimeout = Math.max(self.options.sync, cwdOptions.syncMinMs);\n\t\t\t\t\tsyncInterval && clearTimeout(syncInterval);\n\t\t\t\t\tsyncInterval = setTimeout(function() {\n\t\t\t\t\t\tvar dosync = true, hash = cwd, cts;\n\t\t\t\t\t\tif (cwdOptions.syncChkAsTs && (cts = files[hash].ts)) {\n\t\t\t\t\t\t\tself.request({\n\t\t\t\t\t\t\t\tdata : {cmd : 'info', targets : [hash], compare : cts, reload : 1},\n\t\t\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.done(function(data){\n\t\t\t\t\t\t\t\tvar ts;\n\t\t\t\t\t\t\t\tdosync = true;\n\t\t\t\t\t\t\t\tif (data.compare) {\n\t\t\t\t\t\t\t\t\tts = data.compare;\n\t\t\t\t\t\t\t\t\tif (ts == cts) {\n\t\t\t\t\t\t\t\t\t\tdosync = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (dosync) {\n\t\t\t\t\t\t\t\t\tself.sync(hash).always(function(){\n\t\t\t\t\t\t\t\t\t\tif (ts) {\n\t\t\t\t\t\t\t\t\t\t\t// update ts for cache clear etc.\n\t\t\t\t\t\t\t\t\t\t\tfiles[hash].ts = ts;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsync();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsync();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.fail(function(error){\n\t\t\t\t\t\t\t\tif (error && error != 'errConnect') {\n\t\t\t\t\t\t\t\t\tself.error(error);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsyncInterval = setTimeout(function() {\n\t\t\t\t\t\t\t\t\t\tsync();\n\t\t\t\t\t\t\t\t\t}, timeout);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself.sync(cwd, true).always(function(){\n\t\t\t\t\t\t\t\tsync();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}, timeout);\n\t\t\t\t}\n\t\t\t};\n\t\t\tsync(true);\n\t\t}\n\t};", "label_name": "Base", "label": 1.0}
+{"code": "\tcookie : function(name, value) {\n\t\tvar d, o, c, i;\n\n\t\tname = 'elfinder-'+name+this.id;\n\n\t\tif (value === void(0)) {\n\t\t\tif (document.cookie && document.cookie != '') {\n\t\t\t\tc = document.cookie.split(';');\n\t\t\t\tname += '=';\n\t\t\t\tfor (i=0; i wtop + wheight) {\n\t\t\t\t\twrapper.scrollTop(parseInt(ftop + fheight - wheight));\n\t\t\t\t} else if (ftop < wtop) {\n\t\t\t\t\twrapper.scrollTop(ftop);\n\t\t\t\t}\n\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\tthis.isCommandEnabled = function(name, dstHash) {\n\t\tvar disabled;\n\t\tif (dstHash && self.root(dstHash) !== cwd) {\n\t\t\tdisabled = [];\n\t\t\t$.each(self.disabledCmds, function(i, v){\n\t\t\t\tif (dstHash.indexOf(i, 0) == 0) {\n\t\t\t\t\tdisabled = v;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tdisabled = cwdOptions.disabled;\n\t\t}\n\t\treturn this._commands[name] ? $.inArray(name, disabled) === -1 : false;\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\tthis.restoreSize = function() {\n\t\tthis.resize(width, height);\n\t}", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\t\t\tleft : parseInt($(window).scrollLeft())+'px',\n\t\t\t\t\t\t\ttop : parseInt($(window).scrollTop()) +'px'\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\t.bind(self.resize, function(e) {\n\t\t\t\t\t\tself.preview.trigger('changesize');\n\t\t\t\t\t})\n\t\t\t\t\t.trigger(scroll)\n\t\t\t\t\t.trigger(self.resize);\n\t\t\t\t\t\n\t\t\t\t\twin.bind('mousemove', function(e) {\n\t\t\t\t\t\tnavbar.stop(true, true).show().delay(3000).fadeOut('slow');\n\t\t\t\t\t})\n\t\t\t\t\t.mousemove();\n\t\t\t\t\t\n\t\t\t\t\tnavbar.mouseenter(function() {\n\t\t\t\t\t\tnavbar.stop(true, true).show();\n\t\t\t\t\t})\n\t\t\t\t\t.mousemove(function(e) {\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t});\n\t\t\t\t}", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\trotateable = function(destroy) {\n\t\t\t\t\t\tif ($.fn.draggable && $.fn.resizable) {\n\t\t\t\t\t\t\tif (destroy) {\n\t\t\t\t\t\t\t\timgr.hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\timgr.show()\n\t\t\t\t\t\t\t\t\t.width(rwidth)\n\t\t\t\t\t\t\t\t\t.height(rheight)\n\t\t\t\t\t\t\t\t\t.css('margin-top', (pheight-rheight)/2 + 'px')\n\t\t\t\t\t\t\t\t\t.css('margin-left', (pwidth-rwidth)/2 + 'px');\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\tgeturl = function(hash){\n\t\t\t\tvar turl = '';\n\t\t\t\t$.each(self.tmbUrls, function(i, u){\n\t\t\t\t\tif (hash.indexOf(i) === 0) {\n\t\t\t\t\t\tturl = self.tmbUrls[i];\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn turl;\n\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\t\tvar IETransform = function(element,transform){\n\n\t\t\tvar r;\n\t\t\tvar m11 = 1;\n\t\t\tvar m12 = 1;\n\t\t\tvar m21 = 1;\n\t\t\tvar m22 = 1;\n\n\t\t\tif (typeof element.style['msTransform'] != 'undefined'){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tStaticToAbsolute(element);\n\n\t\t\tr = transform.match(/rotate\\((.*?)\\)/);\n\t\t\tvar rotate = ( r && r[1])\t?\tparseInt(r[1])\t:\t0;\n\n\t\t\trotate = rotate % 360;\n\t\t\tif (rotate < 0) rotate = 360 + rotate;\n\n\t\t\tvar radian= rotate * Math.PI / 180;\n\t\t\tvar cosX =Math.cos(radian);\n\t\t\tvar sinY =Math.sin(radian);\n\n\t\t\tm11 *= cosX;\n\t\t\tm12 *= -sinY;\n\t\t\tm21 *= sinY;\n\t\t\tm22 *= cosX;\n\n\t\t\telement.style.filter = (element.style.filter || '').replace(/progid:DXImageTransform\\.Microsoft\\.Matrix\\([^)]*\\)/, \"\" ) +\n\t\t\t\t(\"progid:DXImageTransform.Microsoft.Matrix(\" + \n\t\t\t\t\t \"M11=\" + m11 + \n\t\t\t\t\t\",M12=\" + m12 + \n\t\t\t\t\t\",M21=\" + m21 + \n\t\t\t\t\t\",M22=\" + m22 + \n\t\t\t\t\t\",FilterType='bilinear',sizingMethod='auto expand')\") \n\t\t\t\t;\n\n\t \t\tvar ow = parseInt(element.style.width || element.width || 0 );\n\t \t\tvar oh = parseInt(element.style.height || element.height || 0 );\n\n\t\t\tvar radian = rotate * Math.PI / 180;\n\t\t\tvar absCosX =Math.abs(Math.cos(radian));\n\t\t\tvar absSinY =Math.abs(Math.sin(radian));\n\n\t\t\tvar dx = (ow - (ow * absCosX + oh * absSinY)) / 2;\n\t\t\tvar dy = (oh - (ow * absSinY + oh * absCosX)) / 2;\n\n\t\t\telement.style.marginLeft = Math.floor(dx) + \"px\";\n\t\t\telement.style.marginTop = Math.floor(dy) + \"px\";\n\n\t\t\treturn(true);\n\t\t};", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\tmulti = function(files, num){\n\t\t\t\t\tvar sfiles = [], cid;\n\t\t\t\t\tif (!abort) {\n\t\t\t\t\t\twhile(files.length && sfiles.length < num) {\n\t\t\t\t\t\t\tsfiles.push(files.shift());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (sfiles.length) {\n\t\t\t\t\t\t\tfor (var i=0; i < sfiles.length; i++) {\n\t\t\t\t\t\t\t\tif (abort) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcid = isDataType? (sfiles[i][0][0]._cid || null) : (sfiles[i][0]._cid || null);\n\t\t\t\t\t\t\t\tif (!!failChunk[cid]) {\n\t\t\t\t\t\t\t\t\tlast--;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfm.exec('upload', {\n\t\t\t\t\t\t\t\t\ttype: data.type,\n\t\t\t\t\t\t\t\t\tisDataType: isDataType,\n\t\t\t\t\t\t\t\t\tfiles: sfiles[i],\n\t\t\t\t\t\t\t\t\tchecked: true,\n\t\t\t\t\t\t\t\t\ttarget: target,\n\t\t\t\t\t\t\t\t\trenames: renames,\n\t\t\t\t\t\t\t\t\thashes: hashes,\n\t\t\t\t\t\t\t\t\tmultiupload: true})\n\t\t\t\t\t\t\t\t.fail(function(error) {\n\t\t\t\t\t\t\t\t\tif (cid) {\t\n\t\t\t\t\t\t\t\t\t\tfailChunk[cid] = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.always(function(e) {\n\t\t\t\t\t\t\t\t\tif (e && e.added) added = $.merge(added, e.added);\n\t\t\t\t\t\t\t\t\tif (last <= ++done) {\n\t\t\t\t\t\t\t\t\t\tfm.trigger('multiupload', {added: added});\n\t\t\t\t\t\t\t\t\t\tnotifyto && clearTimeout(notifyto);\n\t\t\t\t\t\t\t\t\t\tif (checkNotify()) {\n\t\t\t\t\t\t\t\t\t\t\tself.notify({type : 'upload', cnt : -cnt, progress : 0, size : 0});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmulti(files, 1); // Next one\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (sfiles.length < 1 || abort) {\n\t\t\t\t\t\tif (abort) {\n\t\t\t\t\t\t\tnotifyto && clearTimeout(notifyto);\n\t\t\t\t\t\t\tif (cid) {\n\t\t\t\t\t\t\t\tfailChunk[cid] = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdfrd.reject();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdfrd.resolve();\n\t\t\t\t\t\t\tself.uploads.xhrUploading = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\t\t\t.attr({title: fm.i18n('autoSync')})\n\t\t\t\t\t.on('click', function(e){\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tnode.parent()\n\t\t\t\t\t\t\t.toggleClass('ui-state-disabled', fm.options.syncStart)\n\t\t\t\t\t\t\t.parent().removeClass('ui-state-hover');\n\t\t\t\t\t\tfm.options.syncStart = !fm.options.syncStart;\n\t\t\t\t\t\tfm.autoSync(fm.options.syncStart? null : 'stop');\n\t\t\t\t\t})\n\t\t\t};", "label_name": "Base", "label": 1.0}
+{"code": "\t\t\tcreateFromRaw = function(raw) {\n\t\t\t\t$.each(raw, function(i, data) {\n\t\t\t\t\tvar node;\n\t\t\t\t\t\n\t\t\t\t\tif (data === '|') {\n\t\t\t\t\t\tmenu.append('');null==m&&(m=function(){var N=null;try{N=JSON.parse(localStorage.getItem(\"mxODPickerRecentList\"))}catch(Q){}return N});null==n&&(n=function(N){if(null!=N){var Q=m()||{};delete N[\"@microsoft.graph.downloadUrl\"];", "label_name": "Base", "label": 1.0}
+{"code": "action:\"size_\"+file.size})}catch(p){}};EditorUi.prototype.isResampleImageSize=function(d,g){g=null!=g?g:this.resampleThreshold;return d>g};EditorUi.prototype.resizeImage=function(d,g,k,l,p,q,x){p=null!=p?p:this.maxImageSize;var y=Math.max(1,d.width),A=Math.max(1,d.height);if(l&&this.isResampleImageSize(null!=x?x:g.length,q))try{var B=Math.max(y/p,A/p);if(1=Z.scrollHeight&&", "label_name": "Class", "label": 2.0}
{"code": "this.resolvedFontCss&&this.addFontCss(za,this.resolvedFontCss),Ga.src=Editor.createSvgDataUri(mxUtils.getXml(za))}catch(Fa){null!=N&&N(Fa)}});this.embedExtFonts(mxUtils.bind(this,function(Fa){try{null!=Fa&&this.addFontCss(za,Fa),this.loadFonts(Na)}catch(Ea){null!=N&&N(Ea)}}))}catch(Fa){null!=N&&N(Fa)}}),J,Z)}catch(za){null!=N&&N(za)}};Editor.crcTable=[];for(var m=0;256>m;m++)for(var n=m,v=0;8>v;v++)n=1==(n&1)?3988292384^n>>>1:n>>>1,Editor.crcTable[m]=n;Editor.updateCRC=function(u,E,J,T){for(var N=\n0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label_name": "Class", "label": 2.0}
+{"code": "this.resolvedFontCss&&this.addFontCss(za,this.resolvedFontCss),Ga.src=Editor.createSvgDataUri(mxUtils.getXml(za))}catch(Fa){null!=N&&N(Fa)}});this.embedExtFonts(mxUtils.bind(this,function(Fa){try{null!=Fa&&this.addFontCss(za,Fa),this.loadFonts(Na)}catch(Ea){null!=N&&N(Ea)}}))}catch(Fa){null!=N&&N(Fa)}}),J,Z)}catch(za){null!=N&&N(za)}};Editor.crcTable=[];for(var m=0;256>m;m++)for(var n=m,v=0;8>v;v++)n=1==(n&1)?3988292384^n>>>1:n>>>1,Editor.crcTable[m]=n;Editor.updateCRC=function(u,E,J,T){for(var N=\n0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label_name": "Base", "label": 1.0}
{"code": "this.editorUi.editor.graph,X=U.getSelectionCell();P.call(this,M,X,null,W);this.addMenuItems(M,[\"editTooltip\"],W);U.model.isVertex(X)&&this.addMenuItems(M,[\"editGeometry\"],W);this.addMenuItems(M,[\"-\",\"edit\"],W)})));this.addPopupMenuCellEditItems=function(M,W,U,X){M.addSeparator();this.addSubmenu(\"editCell\",M,X,mxResources.get(\"edit\"))};this.put(\"file\",new Menu(mxUtils.bind(this,function(M,W){var U=C.getCurrentFile();C.menus.addMenuItems(M,[\"new\"],W);C.menus.addSubmenu(\"openFrom\",M,W);isLocalStorage&&", "label_name": "Class", "label": 2.0}
+{"code": "this.editorUi.getCurrentFile();if(mxClient.IS_SVG&&this.isShadowOptionVisible()){var E=this.editorUi,J=E.editor.graph,T=this.createOption(mxResources.get(\"shadow\"),function(){return J.shadowVisible},function(N){var Q=new ChangePageSetup(E);Q.ignoreColor=!0;Q.ignoreImage=!0;Q.shadowVisible=N;J.model.execute(Q)},{install:function(N){this.listener=function(){N(J.shadowVisible)};E.addListener(\"shadowVisibleChanged\",this.listener)},destroy:function(){E.removeListener(this.listener)}});Editor.enableShadowOption||", "label_name": "Class", "label": 2.0}
{"code": "this.editorUi.getCurrentFile();if(mxClient.IS_SVG&&this.isShadowOptionVisible()){var E=this.editorUi,J=E.editor.graph,T=this.createOption(mxResources.get(\"shadow\"),function(){return J.shadowVisible},function(N){var Q=new ChangePageSetup(E);Q.ignoreColor=!0;Q.ignoreImage=!0;Q.shadowVisible=N;J.model.execute(Q)},{install:function(N){this.listener=function(){N(J.shadowVisible)};E.addListener(\"shadowVisibleChanged\",this.listener)},destroy:function(){E.removeListener(this.listener)}});Editor.enableShadowOption||", "label_name": "Base", "label": 1.0}
-{"code": "var O=mxText.prototype.redraw;mxText.prototype.redraw=function(){O.apply(this,arguments);null!=this.node&&\"DIV\"==this.node.nodeName&&Graph.processFontAttributes(this.node)};Graph.prototype.createTagsDialog=function(u,E,J){function T(){for(var ja=R.getSelectionCells(),Ba=[],Ha=0;Ha';L.setAttribute(\"title\",mxResources.get(\"showResolved\"));", "label_name": "Base", "label": 1.0}
-{"code": "Na+=\"@import url(\"+La+\");\\n\":Fa+='@font-face {\\nfont-family: \"'+Da+'\";\\nsrc: url(\"'+La+'\");\\n}\\n'}Ga.appendChild(za.createTextNode(Na+Fa));ra.getElementsByTagName(\"defs\")[0].appendChild(Ga)}null!=ja&&(this.shapeBackgroundColor=Ha,this.shapeForegroundColor=Ba,this.stylesheet=ja,this.refresh());return ra};var C=Graph.prototype.createSvgImageExport;Graph.prototype.createSvgImageExport=function(){var u=C.apply(this,arguments);if(this.mathEnabled){var E=u.drawText;u.drawText=function(J,T){if(null!=J.text&&\nnull!=J.text.value&&J.text.checkBounds()&&(mxUtils.isNode(J.text.value)||J.text.dialect==mxConstants.DIALECT_STRICTHTML)){var N=J.text.getContentNode();if(null!=N){N=N.cloneNode(!0);if(N.getElementsByTagNameNS)for(var Q=N.getElementsByTagNameNS(\"http://www.w3.org/1998/Math/MathML\",\"math\");0\")}var B=this.editor.graph.getGraphBounds(),I=this.getSelectedPageIndex();if(this.isExportToCanvas())this.editor.exportToCanvas(mxUtils.bind(this,function(z){var L=l?this.getFileData(!0):null;z=", "label_name": "Base", "label": 1.0}
+{"code": "for(la=ma=0;la