code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
void AveragePool(const float* input_data, const Dims<4>& input_dims, int stride_width, int stride_height, int pad_width, int pad_height, int kwidth, int kheight, float* output_data, const Dims<4>& output_dims) { float output_activation_min, output_activation_max; G...
Base
1
def test_create_catalog(self): pardir = self.get_test_dir(erase=1) cat = catalog.get_catalog(pardir,'c') assert_(cat is not None) cat.close() self.remove_dir(pardir)
Class
2
def test_show_student_extensions(self): self.test_change_due_date() url = reverse('show_student_extensions', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, {'student': self.user1.username}) self.assertEqual(response....
Compound
4
def testDictionary(self): with ops.Graph().as_default() as G: with ops.device('/cpu:0'): x = array_ops.placeholder(dtypes.float32) pi = array_ops.placeholder(dtypes.int64) gi = array_ops.placeholder(dtypes.int64) v = 2. * (array_ops.zeros([128, 128]) + x) with ops.devic...
Base
1
def CreateAuthenticator(): """Create a packet autenticator. All RADIUS packets contain a sixteen byte authenticator which is used to authenticate replies from the RADIUS server and in the password hiding algorithm. This function returns a suitable random string that can be used as an...
Class
2
def post(self, request, *args, **kwargs): serializer = self.serializer_class(data=request.data, context={'request': request}) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] if user is None: return FormattedResponse(status=HTTP_401_UNAUT...
Class
2
def insensitive_contains(field: Term, value: str) -> Criterion: return Upper(field).like(Upper(f"%{value}%"))
Base
1
def test_property_from_data_array(self, mocker): name = mocker.MagicMock() required = mocker.MagicMock() data = oai.Schema(type="array", items={"type": "number", "default": "0.0"},) ListProperty = mocker.patch(f"{MODULE_NAME}.ListProperty") FloatProperty = mocker.patch(f"{MOD...
Base
1
def register(request, registration_form=RegistrationForm): if request.user.is_authenticated: return redirect(request.GET.get('next', reverse('spirit:user:update'))) form = registration_form(data=post_data(request)) if (is_post(request) and not request.is_limited() and form.i...
Base
1
def func_begin(self, name): ctype = get_c_type(name) self.emit("PyObject*", 0) self.emit("ast2obj_%s(void* _o)" % (name), 0) self.emit("{", 0) self.emit("%s o = (%s)_o;" % (ctype, ctype), 1) self.emit("PyObject *result = NULL, *value = NULL;", 1) self.emit('if...
Base
1
def test_broken_chunked_encoding(self): control_line = "20;\r\n" # 20 hex = 32 dec s = "This string has 32 characters.\r\n" to_send = "GET / HTTP/1.1\nTransfer-Encoding: chunked\n\n" to_send += control_line + s # garbage in input to_send += "GET / HTTP/1.1\nTransfer-...
Base
1
def test_notfilelike_iobase_http11(self): to_send = "GET /notfilelike_iobase HTTP/1.1\n\n" to_send = tobytes(to_send) self.connect() for t in range(0, 2): self.sock.send(to_send) fp = self.sock.makefile("rb", 0) line, headers, response_body = rea...
Base
1
def update_server_key(conf): """ Download the server's RSA key and store in the location specified in the configuration. :param conf: The consumer configuration object. :type conf: dict """ host = conf['server']['host'] location = conf['server']['rsa_pub'] url = 'https://%s/pulp/stat...
Base
1
def test_show_unit_extensions(self): self.test_change_due_date() url = reverse('show_unit_extensions', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, {'url': self.week1.location.to_deprecated_string()}) self.assertEq...
Compound
4
def get_share_link(recipe): url = recipe.storage.url + '/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=' + recipe.file_path # noqa: E501 headers = { "OCS-APIRequest": "true", "Content-Type": "application/json" } r = requests.get( ...
Base
1
def test_parse_header_gardenpath(self): data = b"""\ GET /foobar HTTP/8.4 foo: bar""" self.parser.parse_header(data) self.assertEqual(self.parser.first_line, b"GET /foobar HTTP/8.4") self.assertEqual(self.parser.headers["FOO"], "bar")
Base
1
async def on_exchange_third_party_invite_request( self, room_id: str, event_dict: JsonDict
Class
2
def lcase(s): try: return unidecode.unidecode(s.lower()) except Exception as ex: log = logger.create() log.error_or_exception(ex) return s.lower()
Base
1
def org_login(org_slug): session["org_slug"] = current_org.slug return redirect(url_for(".authorize", next=request.args.get("next", None)))
Base
1
def authenticate(self, request, username=None, code=None, **kwargs): if username is None: username = kwargs.get(get_user_model().USERNAME_FIELD) if not username or not code: return try: user = get_user_model()._default_manager.get_by_natural_key(username...
Base
1
def _register_function_args(context: Context, sig: FunctionSignature) -> List[IRnode]: ret = [] # the type of the calldata base_args_t = TupleType([arg.typ for arg in sig.base_args]) # tuple with the abi_encoded args if sig.is_init_func: base_args_ofst = IRnode(0, location=DATA, typ=base_a...
Class
2
def to_simple(self, data, options): """ For a piece of data, attempts to recognize it and provide a simplified form of something complex. This brings complex Python data structures down to native types of the serialization format(s). """ if isinstance...
Class
2
def stream_exists_backend(request, user_profile, stream_id, autosubscribe): # type: (HttpRequest, UserProfile, int, bool) -> HttpResponse try: stream = get_and_validate_stream_by_id(stream_id, user_profile.realm) except JsonableError: stream = None result = {"exists": bool(stream)} i...
Class
2
def do_download_file(book, book_format, client, data, headers): if config.config_use_google_drive: #startTime = time.time() df = gd.getFileFromEbooksFolder(book.path, data.name + "." + book_format) #log.debug('%s', time.time() - startTime) if df: return gd.do_gdrive_downl...
Base
1
def test_chunking_request_without_content(self): header = tobytes("GET / HTTP/1.1\n" "Transfer-Encoding: chunked\n\n") self.connect() self.sock.send(header) self.sock.send(b"0\r\n\r\n") fp = self.sock.makefile("rb", 0) line, headers, echo = self._read_echo(fp) ...
Base
1
def _parse_a_camel_date_time(data: Dict[str, Any]) -> Union[datetime, date]: a_camel_date_time: Union[datetime, date] try: a_camel_date_time = datetime.fromisoformat(d["aCamelDateTime"]) return a_camel_date_time except: pass ...
Base
1
def adv_search_shelf(q, include_shelf_inputs, exclude_shelf_inputs): q = q.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id)\ .filter(or_(ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(exclude_shelf_inputs))) if len(include_shelf_inputs) > 0: q = q.filter(ub.BookShelf.shelf.in_...
Base
1
def _expand(self, key_material): output = [b""] counter = 1 while (self._algorithm.digest_size // 8) * len(output) < self._length: h = hmac.HMAC(key_material, self._algorithm, backend=self._backend) h.update(output[-1]) h.update(self._info) h....
Class
2
def make_homeserver(self, reactor, clock): hs = self.setup_test_homeserver(http_client=None) self.handler = hs.get_federation_handler() self.store = hs.get_datastore() return hs
Base
1
def xsrf_token(self): """The XSRF-prevention token for the current user/session. To prevent cross-site request forgery, we set an '_xsrf' cookie and include the same '_xsrf' value as an argument with all POST requests. If the two do not match, we reject the form submission a...
Base
1
def test_list_instructor_tasks_problem(self, act): """ Test list task history for problem. """ act.return_value = self.tasks url = reverse('list_instructor_tasks', kwargs={'course_id': self.course.id.to_deprecated_string()}) mock_factory = MockCompletionInfo() with patch('ins...
Compound
4
def CreateID(self): """Create a packet ID. All RADIUS requests have a ID which is used to identify a request. This is used to detect retries and replay attacks. This function returns a suitable random number that can be used as ID. :return: ID number :rtype: integer ...
Class
2
def test_list_course_role_members_bad_rolename(self): """ Test with an invalid rolename parameter. """ url = reverse('list_course_role_members', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, { 'rolename': 'robot-not-a-rolename', ...
Compound
4
def test_nonexistent_catalog_is_none(self): pardir = self.get_test_dir(erase=1) cat = catalog.get_catalog(pardir,'r') self.remove_dir(pardir) assert_(cat is None)
Class
2
def _access_endpoint(self, endpoint, args, status_code, msg): """ Asserts that accessing the given `endpoint` gets a response of `status_code`. endpoint: string, endpoint for instructor dash API args: dict, kwargs for `reverse` call status_code: expected HTTP status code res...
Compound
4
def test_get_student_progress_url(self): """ Test that progress_url is in the successful response. """ url = reverse('get_student_progress_url', kwargs={'course_id': self.course.id.to_deprecated_string()}) url += "?unique_student_identifier={}".format( quote(self.students[0].emai...
Compound
4
def test_get_anon_ids(self): """ Test the CSV output for the anonymized user ids. """ url = reverse('get_anon_ids', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, {}) self.assertEqual(response['Content-Type'], 'text/csv') ...
Compound
4
def test_digest_object_auth_info(): credentials = ("joe", "password") host = None request_uri = "/digest/nextnonce/" headers = {} response = httplib2.Response({}) response["www-authenticate"] = ( 'Digest realm="myrealm", nonce="barney", ' 'algorithm=MD5, qop="auth", stale=true' ...
Class
2
def test_get_sale_records_features_csv(self): """ Test that the response from get_sale_records is in csv format. """ for i in range(2): course_registration_code = CourseRegistrationCode( code='sale_invoice{}'.format(i), course_id=self.cours...
Compound
4
def format_time(self, data): """ A hook to control how times are formatted. Can be overridden at the ``Serializer`` level (``datetime_formatting``) or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``). Default is ``iso-8601``, which looks like "03:02:...
Class
2
def decompile(self): self.writeln("** Decompiling APK...", clr.OKBLUE) with ZipFile(self.file) as zipped: try: dex = self.tempdir + "/" + self.apk.package + ".dex" with open(dex, "wb") as classes: classes.write(zipped.read("classes.dex")) except Exception as e: sys.exit(self.writeln(str(e), ...
Base
1
def replace(self, key, value): self.dict[_hkey(key)] = [value if isinstance(value, unicode) else str(value)]
Base
1
def load(self, stream): '''read vault steam and return python object''' return yaml.load(self.vault.decrypt(stream))
Base
1
def get(self, id, project=None): if not project: project = g.project return ( Person.query.filter(Person.id == id) .filter(Project.id == project.id) .one() )
Class
2
def read_requirements(name): project_root = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(project_root, name), 'rb') as f: # remove whitespace and comments g = (line.decode('utf-8').lstrip().split('#', 1)[0].rstrip() for line in f) return [l for l in g if l]
Class
2
def mark_all_as_read(request): (TopicNotification.objects .for_access(request.user) .filter(is_read=False) .update(is_read=True)) return redirect(request.POST.get( 'next', reverse('spirit:topic:notification:index')))
Base
1
async def ignore_global(self, ctx, command: str.lower): """ Globally ignore or unignore the specified action. The bot will no longer respond to these actions. """ try: await self.config.get_raw("custom", command) except KeyError: awai...
Base
1
def save(self): self['__meta__'] = { 'httpie': __version__ } if self.helpurl: self['__meta__']['help'] = self.helpurl if self.about: self['__meta__']['about'] = self.about self.ensure_directory() json_string = json.dumps( ...
Class
2
def test_list(self): self.user.session_set.create(session_key='ABC123', ip='127.0.0.1', expire_date=datetime.now() + timedelta(days=1), user_agent='Firefox') response = self.client.get(reverse('user_sessions:session_list')) ...
Class
2
def test_invalid_sum(self): pos = dict(lineno=2, col_offset=3) m = ast.Module([ast.Expr(ast.expr(**pos), **pos)]) with self.assertRaises(TypeError) as cm: compile(m, "<test>", "exec") self.assertIn("but got <_ast.expr", str(cm.exception))
Base
1
def _register_function_args(context: Context, sig: FunctionSignature) -> List[IRnode]: ret = [] # the type of the calldata base_args_t = TupleType([arg.typ for arg in sig.base_args]) # tuple with the abi_encoded args if sig.is_init_func: base_args_ofst = IRnode(0, location=DATA, typ=base_a...
Base
1
def test_send_empty_body(self): to_send = "GET / HTTP/1.0\n" "Content-Length: 0\n\n" to_send = tobytes(to_send) self.connect() self.sock.send(to_send) fp = self.sock.makefile("rb", 0) line, headers, echo = self._read_echo(fp) self.assertline(line, "200", "OK",...
Base
1
def test_received_preq_completed_connection_close(self): inst, sock, map = self._makeOneWithMap() inst.server = DummyServer() preq = DummyParser() inst.request = preq preq.completed = True preq.empty = True preq.connection_close = True inst.received(b"...
Base
1
def test_reset_entrance_exam_all_student_attempts(self, act): """ Test reset all student attempts for entrance exam. """ url = reverse('reset_student_attempts_for_entrance_exam', kwargs={'course_id': unicode(self.course.id)}) response = self.client.get(url, { ...
Compound
4
def test_confirmation_obj_not_exist_error(self) -> None: """Since the key is a param input by the user to the registration endpoint, if it inserts an invalid value, the confirmation object won't be found. This tests if, in that scenario, we handle the exception by redirecting the user to ...
Base
1
def test_open_with_filename(self): tmpname = mktemp('', 'mmap') fp = memmap(tmpname, dtype=self.dtype, mode='w+', shape=self.shape) fp[:] = self.data[:] del fp os.unlink(tmpname)
Base
1
def expr(self, node, msg=None, *, exc=ValueError): mod = ast.Module([ast.Expr(node)]) self.mod(mod, msg, exc=exc)
Base
1
def publish(self, id_, identity, uow=None): """Publish a draft. Idea: - Get the draft from the data layer (draft is not passed in) - Validate it more strictly than when it was originally saved (drafts can be incomplete but only complete drafts can be turned ...
Class
2
def verify_cert_against_ca(self, filename, entry): """ check that a certificate validates against the ca cert, and that it has not expired. """ chaincert = self.CAs[self.cert_specs[entry.get('name')]['ca']].get('chaincert') cert = self.data + filename cmd = "o...
Class
2
def class_instances_from_soap_enveloped_saml_thingies(text, modules): """Parses a SOAP enveloped header and body SAML thing and returns the thing as a dictionary class instance. :param text: The SOAP object as XML :param modules: modules representing xsd schemas :return: The body and headers as cla...
Base
1
def generate_config_section(self, config_dir_path, server_name, **kwargs): return """\ ## Federation ## # Restrict federation to the following whitelist of domains. # N.B. we recommend also firewalling your federation listener to limit # inbound federation traffic as early a...
Base
1
def _get_object_element(dataset, seq_no, rel_path, download_link): """If rel_path and download_link are not None, we are called from scope. Otherwise we are called from ID and need to run SQL query to fetch these attrs.""" if rel_path is None: query = "SELECT rel_path, download_link FROM " + \ ...
Base
1
def save_cover(img, book_path): content_type = img.headers.get('content-type') if use_IM: if content_type not in ('image/jpeg', 'image/png', 'image/webp', 'image/bmp'): log.error("Only jpg/jpeg/png/webp/bmp files are supported as coverfile") return False, _("Only jpg/jpeg/png/we...
Base
1
def makeTrustRoot(self): # If this option is specified, use a specific root CA cert. This is useful for testing when it's not # practical to get the client cert signed by a real root CA but should never be used on a production server. caCertFilename = self.sydent.cfg.get('http', 'replication...
Base
1
def _rpsl_db_query_to_graphql_out(query: RPSLDatabaseQuery, info: GraphQLResolveInfo): """ Given an RPSL database query, execute it and clean up the output to be suitable to return to GraphQL. Main changes are: - Enum handling - Adding the asn and prefix fields if applicable - Ensuring the ...
Base
1
def test_modify_access_with_inactive_user(self): self.other_user.is_active = False self.other_user.save() # pylint: disable=no-member url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, { 'unique_stu...
Compound
4
def test_exchange_revoked_invite(self): user_id = self.register_user("kermit", "test") tok = self.login("kermit", "test") room_id = self.helper.create_room_as(room_creator=user_id, tok=tok) # Send a 3PID invite event with an empty body so it's considered as a revoked one. i...
Class
2
def table_xchange_author_title(): vals = request.get_json().get('xchange') if vals: for val in vals: modif_date = False book = calibre_db.get_book(val) authors = book.title book.authors = calibre_db.order_authors([book]) author_names = [] ...
Base
1
def test_security_check(self, password='password'): login_url = reverse('login') # Those URLs should not pass the security check for bad_url in ('http://example.com', 'https://example.com', 'ftp://exampel.com', '//examp...
Base
1
def test_send_event_single_sender(self): """Test that using a single federation sender worker correctly sends a new event. """ mock_client = Mock(spec=["put_json"]) mock_client.put_json.return_value = make_awaitable({}) self.make_worker_hs( "synapse.app.f...
Base
1
def test_credits_view_json(self): response = self.get_credits("json") self.assertEqual(response.status_code, 200) self.assertJSONEqual( response.content.decode(), [{"Czech": [["weblate@example.org", "Weblate Test", 1]]}], )
Base
1
def new_type_to_old_type(typ: new.BasePrimitive) -> old.NodeType: if isinstance(typ, new.BoolDefinition): return old.BaseType("bool") if isinstance(typ, new.AddressDefinition): return old.BaseType("address") if isinstance(typ, new.InterfaceDefinition): return old.InterfaceType(typ._i...
Base
1
def log_request(handler): """log a bit more information about each request than tornado's default - move static file get success to debug-level (reduces noise) - get proxied IP instead of proxy IP - log referer for redirect and failed requests - log user-agent for failed requests """ status...
Base
1
def test_modify_access_revoke(self): url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()}) response = self.client.get(url, { 'unique_student_identifier': self.other_staff.email, 'rolename': 'staff', 'action': 'revoke', ...
Compound
4
def test_logout_unknown_token(self): login_code = LoginCode.objects.create(user=self.user, code='foobar') self.client.login(username=self.user.username, code=login_code.code) response = self.client.post( '/accounts-rest/logout/', HTTP_AUTHORIZATION='Token unknown', ...
Base
1
def delete_scans(request): context = {} if request.method == "POST": list_of_scan_id = [] for key, value in request.POST.items(): if key != "scan_history_table_length" and key != "csrfmiddlewaretoken": ScanHistory.objects.filter(id=value).delete() messages.ad...
Class
2
def test_qute_settings_persistence(short_tmpdir, request, quteproc_new): """Make sure settings from qute://settings are persistent.""" args = _base_args(request.config) + ['--basedir', str(short_tmpdir)] quteproc_new.start(args) quteproc_new.open_path( 'qute://settings/set?option=search.ignore_c...
Compound
4
def mysql_insensitive_contains(field: Field, value: str) -> Criterion: return functions.Upper(functions.Cast(field, SqlTypes.CHAR)).like(functions.Upper(f"%{value}%"))
Base
1
def update(self, **kwargs): consumer_id = load_consumer_id(self.context) if not consumer_id: self.prompt.render_failure_message("This consumer is not registered to the Pulp server.") return delta = dict([(k, v) for k, v in kwargs.items() if v is not None]) if...
Base
1
def run(self, stat_name, criticity, commands, repeat, mustache_dict=None): """Run the commands (in background). - stats_name: plugin_name (+ header) - criticity: criticity of the trigger - commands: a list of command line with optional {{mustache}} - If True, then repeat the...
Base
1
def validate(self, data): user = providers.get_provider('login').login_user(**data, context=self.context) if user is not None: data['user'] = user return data
Class
2
def _decompress(compressed_path: Text, target_path: Text) -> None: with tarfile.open(compressed_path, "r:gz") as tar: tar.extractall(target_path) # target dir will be created if it not exists
Base
1
def del_project(request, client_id, project): if request.method == 'GET': client = Client.objects.get(id=client_id) try: scrapyd = get_scrapyd(client) result = scrapyd.delete_project(project=project) return JsonResponse(result) except ConnectionError: ...
Base
1
def test_tofile_sep(self): x = np.array([1.51, 2, 3.51, 4], dtype=float) f = open(self.filename, 'w') x.tofile(f, sep=',') f.close() f = open(self.filename, 'r') s = f.read() f.close() assert_equal(s, '1.51,2.0,3.51,4.0') os.unlink(self.filenam...
Class
2
def check_valid_db(cls, config_calibre_dir, app_db_path, config_calibre_uuid): if not config_calibre_dir: return False, False dbpath = os.path.join(config_calibre_dir, "metadata.db") if not os.path.exists(dbpath): return False, False try: check_eng...
Base
1
def update_dir_structure_gdrive(book_id, first_author, renamed_author): book = calibre_db.get_book(book_id) authordir = book.path.split('/')[0] titledir = book.path.split('/')[1] new_authordir = rename_all_authors(first_author, renamed_author, gdrive=True) new_titledir = get_valid_filename(book.tit...
Base
1
def test_received_preq_not_completed(self): inst, sock, map = self._makeOneWithMap() inst.server = DummyServer() preq = DummyParser() inst.request = preq preq.completed = False preq.empty = True inst.received(b"GET / HTTP/1.1\n\n") self.assertEqual(ins...
Base
1
def create(request, topic_id): topic = get_object_or_404( Topic.objects.for_access(request.user), pk=topic_id) form = NotificationCreationForm( user=request.user, topic=topic, data=request.POST) if form.is_valid(): form.save() else: messages.error...
Base
1
def test_digest_auth_stale(): # Test that we can handle a nonce becoming stale http = httplib2.Http() password = tests.gen_password() grenew_nonce = [None] requests = [] handler = tests.http_reflect_with_auth( allow_scheme="digest", allow_credentials=(("joe", password),), ...
Class
2
def move_files_on_change(calibre_path, new_authordir, new_titledir, localbook, db_filename, original_filepath, path): new_path = os.path.join(calibre_path, new_authordir, new_titledir) new_name = get_valid_filename(localbook.title, chars=96) + ' - ' + new_authordir try: if original_filepath: ...
Base
1
async def on_exchange_third_party_invite_request( self, room_id: str, event_dict: Dict
Class
2
def create(request, comment_id): comment = get_object_or_404(Comment, pk=comment_id) form = FlagForm( user=request.user, comment=comment, data=post_data(request)) if is_post(request) and form.is_valid(): form.save() return redirect(request.POST.get('next', comment.ge...
Base
1
def prepare_context(self, request, context, *args, **kwargs): """ Hook for adding additional data to the context dict """ pass
Class
2
def _not_here_yet(request, *args, **kwargs): return HttpResponse("Not here yet: %s (%r, %r)" % (request.path, args, kwargs), status=410)
Base
1
def prop_sentences_stats(self, type, vId = None): return { 'get_data' : "SELECT victims.*, geo.*, victims.ip AS ip_local, COUNT(clicks.id) FROM victims INNER JOIN geo ON victims.id = geo.id LEFT JOIN clicks ON clicks.id = victims.id GROUP BY victims.id ORDER BY victims.time DESC", 'a...
Base
1
def test_process_request(self, rf): uploaded_file = SimpleUploadedFile("uploaded_file.txt", b"uploaded") request = rf.post("/", data={"file": uploaded_file}) S3FileMiddleware(lambda x: None)(request) assert request.FILES.getlist("file") assert request.FILES.get("file").read()...
Base
1
def _auth_from_challenge(self, host, request_uri, headers, response, content): """A generator that creates Authorization objects that can be applied to requests. """ challenges = _parse_www_authenticate(response, "www-authenticate") for cred in self.credentials.iter(host):...
Class
2
def setUp(self): self.mock_federation_resource = MockHttpResource() self.mock_http_client = Mock(spec=[]) self.mock_http_client.put_json = DeferredMockCallable() hs = yield setup_test_homeserver( self.addCleanup, http_client=self.mock_http_client, keyring=Mock(), ...
Base
1
def config_basic(request): form = BasicConfigForm(data=post_data(request)) if is_post(request) and form.is_valid(): form.save() messages.info(request, _("Settings updated!")) return redirect(request.GET.get("next", request.get_full_path())) return render( request=request, ...
Base
1
def event_from_pdu_json(pdu_json, outlier=False): """Construct a FrozenEvent from an event json received over federation Args: pdu_json (object): pdu as received over federation outlier (bool): True to mark this event as an outlier Returns: FrozenEvent Raises: SynapseE...
Class
2