text
stringlengths
79
3.72M
<vulnerable_code> assert Variable.get("false", deserialize_json=True) is False assert Variable.get("null", deserialize_json=True) is None os.remove("variables_types.json") def test_variables_list(self):<commit_title>[PATCH] Use flag for variable import in cli and UI<commit_description><fixe...
<vulnerable_code> _check_last_log(session, dag_id=None, event="variables.varimport", execution_date=None) def test_import_variables_doesnt_override_existing_variables(session, admin_client, caplog): assert session.query(Variable).count() == 0 Variable.set("str_key", "str_value") content = '{"str_key": ...
<vulnerable_code> size_t len = STRLEN(cmd_start); // Special case: empty command uses "+": // "'<,'>mods" -> "mods'<,'>+ mch_memmove(orig_cmd, cmd_start, len); STRCPY(orig_cmd + len, "'<,'>+"); } else {<commit_title>[PATCH] patch 9.0.0025: accessing beyond allocated memory with the<commit_desc...
<vulnerable_code> static int included_patches[] = { /* Add new patch number below this line */ /**/ 24, /**/<commit_title>[PATCH] patch 9.0.0025: accessing beyond allocated memory with the<commit_description><fixed_code> static int included_patches[] = { /* Add new patch number below this line */ /**/ 25, ...
<vulnerable_code> case RSVP_OBJ_CLASSTYPE_OLD: /* fall through */ switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: ND_PRINT((ndo, "%s CT: %u", ident, EXTRACT_32BITS(obj_tptr) & 0x7));<commit_title>[PATCH] (for 4.9.3) CVE-2018-14465...
<vulnerable_code> @Controller @SuppressWarnings("WeakerAccess") @RequestMapping(value = "/add-on/business-continuity/api") public class PrimaryStatusProviderController { private GoFilesStatusProvider goFilesStatusProvider;<commit_title>[PATCH] #000 - Disable business-continuity<commit_description><fixed_code> @Co...
<vulnerable_code> this.dashboardJSON = this::showStatusJSON; } @RequestMapping(value = "/add-on/business-continuity/admin/dashboard", method = RequestMethod.GET) @ResponseBody public String dashboard(HttpServletRequest request, HttpServletResponse response) { return renderAfterAuthentica...
<vulnerable_code> if not allow_unsafe_protocols: Git.check_unsafe_protocols(str(url)) if not allow_unsafe_options and multi_options: Git.check_unsafe_options(options=multi_options, unsafe_options=cls.unsafe_git_clone_options) <commit_title>[PATCH] Block insecure non-multi options...
<vulnerable_code> rw_repo.clone(tmp_dir, multi_options=[unsafe_option]) assert not tmp_file.exists() @with_rw_repo("HEAD") def test_clone_unsafe_options_allowed(self, rw_repo): with tempfile.TemporaryDirectory() as tdir: Repo.clone_from(rw_repo.wor...
<vulnerable_code> e = jwe.JWE(algs=['A256KW']) e.deserialize(E_A5_ex, E_A4_ex['key2']) # RFC 7519 A1_header = {<commit_title>[PATCH] Add Timing tests for MMA<commit_description>This test is not very reliable and takes a long time so it is provided but diasabled by default. It is only useful to ...
<vulnerable_code> request_dict = parser.parse(query_string, normalized=True) run_id = request_dict.get("run_id") or request_dict.get("run_uuid") path = request_dict["path"] validate_path_is_safe(path) run = _get_tracking_store().get_run(run_id) if _is_servable_proxied_run_artifact_root(run.info....
<vulnerable_code> augmented_raise_for_status(resp) file_infos = [] for f in resp.json().get("files", []): validate_path_is_safe(f["path"]) file_info = FileInfo( posixpath.join(path, f["path"]) if path else f["path"], f["is_dir"], ...
<vulnerable_code> ): raise exc def validate_query_string(query): query = _decode(query)<commit_title>[PATCH] Use validated path after path validation (#10666)<commit_description>Signed-off-by: harupy <17039389+harupy@users.noreply.github.com><fixed_code> ): raise exc return path def...
<vulnerable_code> } filterTags(searchValue) { let filteredTags = _.filter(this.tags, (tag) => !_.includes(this.model, tag.Id)); if (!searchValue) { return filteredTags;<commit_title>[PATCH] don't load user html input<commit_description><fixed_code> } filterTags(searchValue) { if (this.tags) {...
<vulnerable_code>import toastr from 'toastr'; angular.module('portainer.app').factory('Notifications', [ var service = {}; service.success = function (title, text) { toastr.success($sanitize(text), $sanitize(title)); }; service.warning = function (title, text) { toastr.warning($sanitize(t...
<vulnerable_code> assignTeamLeaders(users, data.memberships); $scope.users = users; $scope.teams = _.orderBy(data.teams, 'Name', 'asc'); $scope.AuthenticationMethod = data.settings.AuthenticationMethod; }) .catch(function error(err) {<commit_title>[PATCH] don't loa...
<vulnerable_code> var num_filtered_clusters = 0; if (selectedState != "init") { var [filtered_centroids_keys, total_clusters] = filter_centroid_keys(); set_filtered_centroids_keys(filtered_centroids_keys) num_filtered_clusters = filtered_centroids_keys.length; if (get_cluster_typ...
<vulnerable_code><commit_title>[PATCH] XWIKI-20365: Improved ClassEditSheet escaping<commit_description><fixed_code> /* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms ...
<vulnerable_code> pkt->ref = NULL; pkt->type = GIT_PKT_NG; line += 3; /* skip "ng " */ if (!(ptr = strchr(line, ' '))) goto out_err; len = ptr - line; memcpy(pkt->ref, line, len); pkt->ref[len] = '\0'; line = ptr + 1; if (!(ptr = strchr(line, '\n'))) goto out_err; len = ptr - line; <commit_title>[PATCH]...
<vulnerable_code> new_acts_size = max(next_offset + req_size, ksize(*sfa) * 2); if (new_acts_size > MAX_ACTIONS_BUFSIZE) { if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) { OVS_NLERR(log, "Flow action size exceeds max %u", MAX_ACTIONS_BUFSIZE); return ERR_PTR(-EMSGSIZE);<commit_title>[PATCH] openvsw...
<vulnerable_code> ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,packet_size*image->colors,colormap); if (count != (ssize_t) (packet_size*image->colors)) ThrowReaderException(CorruptImageError, "InsufficientImage...
<vulnerable_code> static void validateExports(Module& module, ValidationInfo& info) { for (auto& curr : module.exports) { if (curr->kind == ExternalKind::Function) { if (info.validateWeb) { Function* f = module.getFunction(curr->value);<commit_title>[PATCH] Validate that export names are not empty<c...
<vulnerable_code> let formData = container.find('.js-modal-form').serializeFormData(); const listInstance = Vtiger_List_Js.getInstance(); $.extend(formData, listInstance.getSearchParams()); app.openUrlMethodPost('index.php', formData); Vtiger_Helper_Js.showMessage({ text: app.vtranslate('J...
<vulnerable_code> data: postData }; if (type === 'sendByForm') { app.openUrlMethodPost(massActionUrl, postData); progressIndicatorElement.progressIndicator({ mode: 'hide' }); } else { AppConnector.request(actionParams)<commit_title>[PATCH] Added minor improvements<commit_description><fixe...
<vulnerable_code> form.append($('<input>', { name: i, value: JSON.stringify(postData[i]) })); } $('body').append(form); form.submit(); } else { window.location.href = url; }<commit_title>[PATCH] Added minor improvements<commit_description><fixed_code> form.append($('<input>', { name: i, value: JS...
<vulnerable_code> } return aDeferred.promise(); }, requestForm: function (url, params = {}) { app.openUrlMethodPost(url, params); } };<commit_title>[PATCH] Added minor improvements<commit_description><fixed_code> } return aDeferred.promise(); }, /** * Send form data * @param {string} url * @param {...
<vulnerable_code> $(data).removeAttr('data-validation-engine'); }); form.addClass('not_validation'); form.submit(); }, /** * Register tab events $(data).removeAttr('data-validation-engine'); }); form.addClass('not_validation'); form.submit(); }, /** * Save quick crea...
<vulnerable_code><commit_title>[PATCH] Add regression test for #789<commit_description><fixed_code> import system_tests class SIGSEGV_in_PngImage_readMetadata( metaclass=system_tests.CaseMeta): url = "https://github.com/Exiv2/exiv2/issues/756" filename = system_tests.path( "$data_path/issue_...
<vulnerable_code>import static java.util.EnumSet.allOf; import static java.util.EnumSet.copyOf; import static java.util.EnumSet.noneOf; /** * The compliance mode for Cookie handling. { /** * Allow a comma as part of a cookie value */ COMMA_NOT_VALID_OCTET("https://tools.ietf.org/...
<vulnerable_code>import java.util.List; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.eclipse.jetty.http.CookieCompliance.Violation.COMMA_NOT_VALID_OCTET; import static org.eclipse.jetty.http.CookieCompliance.Violation.RESERVED_NAMES_NOT_DOLLAR_PREFIXED; /** * C...
<vulnerable_code> private HttpTokens.Token next(ByteBuffer buffer) { byte ch = buffer.get(); HttpTokens.Token t = HttpTokens.TOKENS[0xff & ch]; switch (t.getType()) {<commit_title>[PATCH] Initial work on reviewing CookieCutter.<commit_description>Signed-off-by: Simone Bordet <si...
<vulnerable_code> OTEXT // Obsolete text } public static class Token { private final Type _type; private final char _c; private final int _x; private Token(byte b, Type type) { _type = type; _c = (char)(0xff & b); char l...
<vulnerable_code>import java.util.List; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class CookieCutterTest { private Cookie[] parseCookieHeaders(CookieCompliance compliance, String... headers) { TestCutter cutt...
<vulnerable_code>import os from flask import has_request_context, request, session from flask_babel import Babel from flask_appbuilder.babels.views import LocaleView from flask_appbuilder.basemanager import BaseManager class BabelManager(BaseManager): appbuilder_parent_dir = os.path.join( os.pat...
<vulnerable_code>from flask_appbuilder import ModelView from flask_appbuilder.exceptions import PasswordComplexityValidationError from flask_appbuilder.models.sqla.filters import FilterEqual """ Test edit user with DB fail """ from unittest.mock import Mock, MagicMock client = s...
<vulnerable_code> && context_p->token.lit_location.type == LEXER_IDENT_LITERAL); #if ENABLED (JERRY_ES2015) if (context_p->next_scanner_info_p->source_p == context_p->source_p) { JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED); parser_raise_error (context_p...
<vulnerable_code>#endif /* ENABLED (JERRY_ES2015) */ scanner_push_literal_pool (context_p, scanner_context_p, status_flags); scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS; parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_STATEMENT);<commit_title>[PATCH] Fix parsig function statements...
<vulnerable_code> gql.Argument(name='SamlGroupName', type=gql.NonNullableType(gql.String)), gql.Argument(name='tags', type=gql.ArrayType(gql.String)), gql.Argument(name='devStrategy', type=gql.NonNullableType(gql.String)), gql.Argument(name='template', type=gql.String) ], ) <commit_ti...
<vulnerable_code>from ...context import Context from ....aws.handlers.service_handlers import Worker from ....aws.handlers.sts import SessionHelper from ....aws.handlers.codecommit import CodeCommit from ....db import permissions, models, exceptions from ....db.api import Pipeline, Environment, ResourcePolicy, Stack, K...
<vulnerable_code> stack.status = 'PENDING' session.commit() if stack.stack == 'cdkpipeline' or stack.stack == 'template': cdkpipeline = CDKPipelineStack(stack.targetUri) venv_name = cdkpipeline.venv_name if cdkpipeline.venv_name else None ...
<vulnerable_code> self.env, aws = CDKPipelineStack._set_env_vars(self.pipeline_environment) self.code_dir_path = os.path.dirname(os.path.abspath(__file__)) template = self.pipeline.template try: codecommit_client = aws.client('codecommit', region_name=self.pipeline_environme...
<vulnerable_code> region=environment.region, repo=slugify(data['label']), devStrategy=data['devStrategy'], template=data['template'] if data['devStrategy'] == 'template' else "", ) session.add(pipeline)<commit_title>[PATCH] Remove templates option in Pipel...
<vulnerable_code> len = XmlNameLength(enc, rawName); if (len != tag->rawNameLength || memcmp(tag->rawName, rawName, len) != 0) { *eventPP = rawName; return XML_ERROR_TAG_MISMATCH; }<commit_title>[PATCH] Fix memory leak.<commit_description>In the handling of XML_TOK...
<vulnerable_code><commit_title>[PATCH] implement CQL to OGC filter transforms<commit_description><fixed_code> # -*- coding: utf-8 -*- # ================================================================= # # Authors: Tom Kralidis <tomkralidis@gmail.com> # # Copyright (c) 2016 Tom Kralidis # # Permission is hereby granted...
<vulnerable_code>from six.moves.configparser import SafeConfigParser from pycsw.core.etree import etree from pycsw import oaipmh, opensearch, sru from pycsw.plugins.profiles import profile as pprofile import pycsw.plugins.outputschemas from pycsw.core import config, log, metadata, util % self.parent...
<vulnerable_code>from six import StringIO from six.moves.configparser import SafeConfigParser from pycsw.core.etree import etree from pycsw import oaipmh, opensearch, sru from pycsw.plugins.profiles import profile as pprofile import pycsw.plugins.outputschemas % self.parent.kvp['constraintlanguage']...
<vulnerable_code> return res; } obj = obj[key]; if (obj === undefined || obj === null) { break;<commit_title>[PATCH] fix: prevent changes in prototype chain<commit_description><fixed_code> return res; } if (Object.getOwnPropertyNames(obj).indexOf(key) == -1) { return undefin...
<vulnerable_code><commit_title>[PATCH] fix: prevent changes in prototype chain<commit_description><fixed_code> var test = require('tap').test; var undefsafe = require('../lib/undefsafe'); test('cannot modify prototype chain', function(t) { const pre = {}.__proto__.toString; var payload = '__proto__.toString'; un...
<vulnerable_code><commit_title>[PATCH] Add regression test for #511<commit_description><fixed_code> # -*- coding: utf-8 -*- import system_tests class ThrowsWhenIFDsAreMalformed(metaclass=system_tests.CaseMeta): url = "https://github.com/Exiv2/exiv2/issues/511" filename = system_tests.path("$data_path/pocIss...
<vulnerable_code> return (protocol.equals("http") || protocol.equals("https")) && !address.isAnyLocalAddress() && !address.isLoopbackAddress() && !host.endsWith(".internal") // Redundant && !host.endsWith(".local") // Redundant && !host.contains("localhost") // Redundant<commit_title>[P...
<vulnerable_code> mrb_bool failed = TRUE; mrb_get_args(mrb, "o", &orig); fptr_copy = (struct mrb_io *)DATA_PTR(copy); if (fptr_copy != NULL) { fptr_finalize(mrb, fptr_copy, FALSE); mrb_free(mrb, fptr_copy); } fptr_copy = (struct mrb_io *)mrb_io_alloc(mrb); fptr_orig = io_get_open_fptr(mrb, orig); ...
<vulnerable_code> var part var hasNextPart if (pointer[1] === 'constructor' && pointer[2] === 'prototype') return obj if (pointer[1] === '__proto__') return obj for (var p = 1, len = pointer.length; p < len;) { part = untilde(pointer[p++]) hasNextPart = len > p if (pointer[0] === '') return poin...
<vulnerable_code>jsonpointer.set({}, '/__proto__/boo', 'polluted') assert(!c.boo, 'should not boo') console.log('All tests pass.')<commit_title>[PATCH] fix-prototype-pollution<commit_description><fixed_code> jsonpointer.set({}, '/__proto__/boo', 'polluted') assert(!c.boo, 'should not boo') var d = {} jsonpointer.set(...
<vulnerable_code>class ClassroomPageAccessValidationHandlerTests(test_utils.GenericTestBase): def setUp(self) -> None: super(ClassroomPageAccessValidationHandlerTests, self).setUp() # type: ignore[no-untyped-call] self.signup( self.CURRICULUM_ADMIN_EMAIL, self.CURRICULUM_ADMIN_USERNAME)...
<vulnerable_code> """Common setUp() and tearDown() for Apache Beam job handler tests.""" def setUp(self) -> None: super(BeamHandlerTestBase, self).setUp() # type: ignore[no-untyped-call] self.signup( self.RELEASE_COORDINATOR_EMAIL, self.RELEASE_COORDINATOR_USERNAME) self.add_...
<vulnerable_code>from __future__ import absolute_import from __future__ import unicode_literals import datetime import itertools import json MYPY = False if MYPY: # pragma: no cover import contextlib # pylint: disable=unused-import from mypy_imports import auth_models auth_models, user_models = ( def __...
<vulnerable_code> """Tests for mailchimp services.""" def setUp(self) -> None: super(MailchimpServicesUnitTests, self).setUp() # type: ignore[no-untyped-call] self.user_email_1 = 'test1@example.com' self.user_email_2 = 'test2@example.com' self.user_email_3 = 'test3@example.com'<c...
<vulnerable_code> update_last_updated_time=update_last_updated_time) def put_multi(entities: List[TYPE_MODEL_SUBCLASS]) -> List[str]: """Stores a sequence of Model instances. Args: Returns: list(str). A list with the stored keys. """ return ndb.put_multi(entities) @transactio...
<vulnerable_code> dict. Dictionary of the data from AppFeedbackReportModel. """ user_data = {} report_models = cls.get_all().filter(cls.scrubbed_by == user_id).fetch() for report_model in report_models: submitted_on_msec = utils.get_time_in_millisecs( ...
<vulnerable_code> def setUp(self) -> None: """Set up models in datastore for use in testing.""" super(AppFeedbackReportModelTests, self).setUp() # type: ignore[no-untyped-call] self.feedback_report_model = ( app_feedback_report_models.AppFeedbackReportModel(<commit_title>[PATCH...
<vulnerable_code> def setUp(self) -> None: """Set up user models in datastore for use in testing.""" super(RoleQueryAuditModelUnitTests, self).setUp() # type: ignore[no-untyped-call] audit_models.RoleQueryAuditModel( id=self.ID, def setUp(self) -> None: """Set up us...
<vulnerable_code> def setUp(self) -> None: """Set up user models in storage for use in testing.""" super(UserAuthDetailsModelTests, self).setUp() # type: ignore[no-untyped-call] auth_models.UserAuthDetailsModel( id=self.USER_ID, def setUp(self) -> None: """Set up us...
<vulnerable_code> @classmethod def get_all( cls: Type[SELF_BASE_MODEL], include_deleted: bool = False ) -> 'datastore_services.Query[SELF_BASE_MODEL]': """Gets iterable of all entities of this class. Args: @classmethod def _fetch_page_sorted_by_last_updated( c...
<vulnerable_code> for entity in base_models.BaseModel.get_all(): entity.delete() super(BaseModelUnitTests, self).tearDown() # type: ignore[no-untyped-call] def test_get_deletion_policy(self) -> None: with self.assertRaisesRegexp( # type: ignore[no-untyped-call] model.del...
<vulnerable_code> .order(cls.next_scheduled_check_time) ) classifier_job_models = query.fetch( NEW_AND_PENDING_TRAINING_JOBS_FETCH_LIMIT, offset=offset) offset = offset + len(classifier_job_models) return classifier_job_models, offset <commit_title>[PATCH 2/9] Sto...
<vulnerable_code> USER_ID_6_NEW = 'id_6_new' def setUp(self) -> None: super(CollectionRightsModelUnitTest, self).setUp() # type: ignore[no-untyped-call] user_models.UserSettingsModel( id=self.USER_ID_1, email='some@email.com', USER_ID_COMMITTER = 'id_4' def setUp...
<vulnerable_code>from core.tests import test_utils import feconf MYPY = False if MYPY: # pragma: no cover from mypy_imports import base_models """Test the SentEmailModel class.""" def setUp(self) -> None: super(SentEmailModelUnitTests, self).setUp() # type: ignore[no-untyped-call] def moc...
<vulnerable_code> self.assertEqual( exp_models.ExplorationModel.get_exploration_count(), 1) saved_exploration = ( exp_models.ExplorationModel.get_all().fetch(limit=1)[0]) self.assertEqual(saved_exploration.title, 'A Title') self.assertEqual(saved_exploration.categ...
<vulnerable_code> """ user_data = {} feedback_models = ( cls.get_all().filter(cls.original_author_id == user_id).fetch()) for feedback_model in feedback_models: """ user_data = {} feedback_models = cls.get_all().filter(cls.author_id == user_id).fetch...
<vulnerable_code> def setUp(self) -> None: """Set up user models in datastore for use in testing.""" super(FeedbackThreadModelTest, self).setUp() # type: ignore[no-untyped-call] user_models.UserSettingsModel( id=self.NEW_USER_1_ID, MESSAGE_IDS_READ_IN_THREAD_C = [5, 6, 7, 8,...
<vulnerable_code> ).order(-cls.time_queued_msec).fetch(limit) @classmethod def get_unfinished_jobs( cls, job_type: str ) -> 'datastore_services.Query[JobModel]': """Gets jobs that are unfinished. Args:<commit_title>[PATCH 2/9] Stop printing backend test errors twice (#13...
<vulnerable_code> """Tests for Oppia job models with setUp.""" def setUp(self) -> None: super(JobModelSetUpJobsTest, self).setUp() # type: ignore[no-untyped-call] job_models.JobModel( id='MyJobId1', job_type='JobType1', status_code=job_models.STATUS_CODE_FAILED).put()<com...
<vulnerable_code> cls.incomplete_translation_language_codes == language_code ).order(cls.incomplete_translation_language_codes) results, cursor, _ = ( language_query.fetch_page(page_size, start_cursor=start_cursor)) # TODO(#13462): Refactor this so that we don't do the lo...
<vulnerable_code> """Test the ExplorationOpportunitySummaryModel class.""" def setUp(self) -> None: super(ExplorationOpportunitySummaryModelUnitTest, self).setUp() # type: ignore[no-untyped-call] opportunity_models.ExplorationOpportunitySummaryModel( id='opportunity_id1', """Tes...
<vulnerable_code> # https://github.com/oppia/oppia/pull/9061#issuecomment-629765809 # for more details. def get_offset( query: 'datastore_services.Query[QuestionSkillLinkModel]' ) -> int: """Helper function to get the offset.""" question_count = qu...
<vulnerable_code> sort = cls.skill_model_last_updated sort_query = cls.query().order(sort) query_models, next_cursor, _ = ( sort_query.fetch_page(page_size, start_cursor=cursor)) # TODO(#13462): Refactor this so that we don't do the lookup. # Do a forward lookup s...
<vulnerable_code>import python_utils import utils from typing import Any, Dict, List, Optional, Tuple, cast MYPY = False if MYPY: # pragma: no cover list(str). List of versions corresponding to annotation models with given exp_id. """ return [ annotations.version fo...
<vulnerable_code> suggestion_models: List[GeneralSuggestionModel] = [] offset, more = (0, True) while more: results = query.fetch(feconf.DEFAULT_QUERY_LIMIT, offset=offset) if len(results): offset = offset + len(results) suggestion_models.ex...
<vulnerable_code> mocked_datetime_utcnow = datetime.datetime(2020, 6, 15, 5) def setUp(self) -> None: super(SuggestionModelUnitTests, self).setUp() # type: ignore[no-untyped-call] suggestion_models.GeneralSuggestionModel.create( feconf.SUGGESTION_TYPE_EDIT_STATE_CONTENT, ...
<vulnerable_code> USER_ID_2 = 'user_id_2' def setUp(self) -> None: super(TopicRightsModelUnitTests, self).setUp() # type: ignore[no-untyped-call] topic_models.TopicRightsModel( id=self.TOPIC_4_ID, manager_ids=[self.USER_ID_2],<commit_title>[PATCH 2/9] Stop printing backen...
<vulnerable_code> start_cursor = datastore_services.make_cursor(urlsafe_cursor=cursor) created_on_query = cls.query().order(-cls.created_on) query_models, next_cursor, _ = ( created_on_query.fetch_page(page_size, start_cursor=start_cursor)) # TODO(#13462): Refactor this so th...
<vulnerable_code> GENERIC_DISPLAY_ALIAS = 'display_alias' def setUp(self) -> None: super(UserSettingsModelTest, self).setUp() # type: ignore[no-untyped-call] user_models.UserSettingsModel( id=self.USER_1_ID, email=self.USER_1_EMAIL, def setUp(self) -> None: "...
<vulnerable_code> SERVER_PORT = '8080' DEFAULT_VERSION_HOSTNAME = '%s:%s' % (HTTP_HOST, SERVER_PORT) def __init__(self, *args, **kwargs): super(AppEngineTestBase, self).__init__(*args, **kwargs) # Defined outside of setUp() because we access it from methods, but can # only install it...
<vulnerable_code> return ( self.pipeline | 'Get all non-deleted models' >> ( ndb_io.GetModels( # type: ignore[no-untyped-call] exp_models.ExpSummaryModel.get_all(include_deleted=False))) | 'Split models into batches' >> beam.transforms.util....
<vulnerable_code>import python_utils import apache_beam as beam from typing import Dict, List, Set, Tuple, Union # isort:skip MYPY = False if MYPY: JOB_CLASS = cron_jobs.IndexExplorationsInSearch def test_empty_storage(self) -> None: self.assert_job_output_is_empty() # type: ignore[no-untyped-call] ...
<vulnerable_code><commit_title>[PATCH 2/9] Stop printing backend test errors twice (#13886)<commit_description><fixed_code> # coding: utf-8 # # Copyright 2021 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with...
<vulnerable_code><commit_title>[PATCH 2/9] Stop printing backend test errors twice (#13886)<commit_description><fixed_code> # coding: utf-8 # # Copyright 2021 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with...
<vulnerable_code>import feconf import apache_beam as beam from apache_beam.io.gcp.datastore.v1new import datastoreio datastore_services = models.Registry.import_datastore_services() @beam.typehints.with_input_types(beam.pvalue.PBegin) @beam.typehints.with_output_types(datastore_services.Model) class GetModels(beam....
<vulnerable_code>from core.tests import test_utils from jobs import base_jobs from jobs import job_options import python_utils from apache_beam import runners from apache_beam.testing import test_pipeline from apache_beam.testing import util as beam_testing_util datastore_services = models.Registry.import_datastore_s...
<vulnerable_code>from apache_beam.io.gcp.datastore.v1new import types as beam_datastore_types from google.cloud.ndb import model as ndb_model from google.cloud.ndb import query as ndb_query MYPY = False if MYPY: # pragma: no cover from mypy_imports import datastore_services datastore_services = models.Registry.im...
<vulnerable_code> from apache_beam.io.gcp.datastore.v1new import types as beam_datastore_types (base_models,) = models.Registry.import_models([models.NAMES.base_model]) datastore_services = models.Registry.import_datastore_services() class CloneTests(test_utils.TestBase): def test_clone_model(self): mod...
<vulnerable_code>class RefreshStateOfBeamJobRunModelTests(test_utils.GenericTestBase): def setUp(self) -> None: super().setUp() # type: ignore[no-untyped-call] self.run_model = beam_job_services.create_beam_job_run_model( 'WorkingJob', dataflow_job_id='123') try: se...
<vulnerable_code># of every job. from jobs.batch_jobs import blog_validation_jobs # pylint: disable=unused-import # isort: skip from jobs.batch_jobs import cron_jobs # pylint: disable=unused-import # isort: skip from jobs.batch_jobs import validation_jobs # pylint: disable=unused-import # isort: s...
<vulnerable_code> 'jobs/job_options_test.py', 'jobs/job_test_utils.py', 'jobs/job_test_utils_test.py', 'jobs/job_utils.py', 'jobs/job_utils_test.py', 'jobs/registry.py', 'jobs/registry_test.py', 'jobs/transforms/validation/auth_validation.py', 'jobs/types/feedback_validation_errors.py...
<vulnerable_code> except Exception: task_execution_failed = True for task in tasks: if task.exception: concurrent_task_utils.log(task.exception.args[0]) python_utils.PRINT('') python_utils.PRINT('+------------------+') python_utils.PRINT('| SUMMARY OF...
<vulnerable_code> new_exp = self.save_new_default_exploration( new_exp_id, feconf.SYSTEM_COMMITTER_ID, title='New title') change_list = [exp_domain.ExplorationChange({ 'cmd': 'edit_state_property', 'state_name': new_exp.init_state_name, 'property_name': ex...
<vulnerable_code> }) return draft_change_list @classmethod def _convert_states_v47_dict_to_v48_dict(cls, draft_change_list): """Converts draft change list from state version 47 to 48. State<commit_title>[PATCH 2/9] Stop printing backend test errors twice (#13886)<commit_descripti...
<vulnerable_code> msg='Current schema version is %d but DraftUpgradeUtil.%s is ' 'unimplemented.' % (state_schema_version, conversion_fn_name)) def test_convert_states_v47_dict_to_v48_dict(self): draft_change_list_v47 = [ exp_domain.ExplorationChange({<commit_title>[PATCH...
<vulnerable_code> for state_dict in states_dict.values(): list_of_subtitled_unicode_content_ids = [] customisation_args = ( state_domain.InteractionInstance .convert_customization_args_dict_to_customization_args( state_dict['interaction...
<vulnerable_code>title: Title """) _LATEST_YAML_CONTENT = YAML_CONTENT_V53 def test_load_from_v46_with_item_selection_input_interaction(self): """Tests the migration of ItemSelectionInput rule inputs.""" objective: '' param_changes: [] param_specs: {} schema_version: 53 states: (untitled state): ...