code
stringlengths
31
2.05k
label_name
stringclasses
5 values
label
int64
0
4
def serve_local_file_unauthed(request: HttpRequest, token: str, filename: str) -> HttpResponseBase: path_id = get_local_file_path_id_from_token(token) if path_id is None: raise JsonableError(_("Invalid token")) if path_id.split("/")[-1] != filename: raise JsonableError(_("Invalid filename"))...
Class
2
def get_signed_upload_url(path: str) -> str: client = boto3.client( "s3", aws_access_key_id=settings.S3_KEY, aws_secret_access_key=settings.S3_SECRET_KEY, region_name=settings.S3_REGION, endpoint_url=settings.S3_ENDPOINT_URL, ) return client.generate_presigned_url( ...
Class
2
def serve_file_unauthed_from_token( request: HttpRequest, token: str, filename: str ) -> HttpResponseBase: path_id = get_file_path_id_from_token(token) if path_id is None: raise JsonableError(_("Invalid token")) if path_id.split("/")[-1] != filename: raise JsonableError(_("Invalid filena...
Class
2
def serve_local(request: HttpRequest, path_id: str, download: bool = False) -> HttpResponseBase: assert settings.LOCAL_FILES_DIR is not None local_path = os.path.join(settings.LOCAL_FILES_DIR, path_id) assert_is_local_storage_path("files", local_path) if not os.path.isfile(local_path): return Ht...
Class
2
def serve_file( request: HttpRequest, maybe_user_profile: Union[UserProfile, AnonymousUser], realm_id_str: str, filename: str, url_only: bool = False, download: bool = False, ) -> HttpResponseBase: path_id = f"{realm_id_str}/{filename}" realm = get_valid_realm_from_request(request) i...
Class
2
def serve_file_download_backend( request: HttpRequest, user_profile: UserProfile, realm_id_str: str, filename: str ) -> HttpResponseBase: return serve_file(request, user_profile, realm_id_str, filename, url_only=False, download=True)
Class
2
def serve_s3(request: HttpRequest, path_id: str, download: bool = False) -> HttpResponse: url = get_signed_upload_url(path_id) assert url.startswith("https://") if settings.DEVELOPMENT: # In development, we do not have the nginx server to offload # the response to; serve a redirect to the s...
Class
2
async def form(self) -> FormMultiDict: """Retrieve form data from the request. If the request is either a 'multipart/form-data' or an 'application/x-www-form- urlencoded', return a FormMultiDict instance populated with the values sent in the request, otherwise, an empty instance. Re...
Base
1
async def extract_multipart( connection: "Request[Any, Any]", ) -> Any: connection.scope["_form"] = form_values = ( # type: ignore[typeddict-item] connection.scope["_form"] # type: ignore[typeddict-item] if "_form" in connection.scope else parse_multipart_fo...
Base
1
def create_multipart_extractor( signature_field: "SignatureField", is_data_optional: bool ) -> Callable[["ASGIConnection[Any, Any, Any]"], Coroutine[Any, Any, Any]]: """Create a multipart form-data extractor. Args: signature_field: A SignatureField instance. is_data_optional: Boolean dictat...
Base
1
def nested_serializer_factory(relation_info, nested_depth): """ Return a NestedSerializer representation of a serializer field. This method should only be called in build_nested_field() in which relation_info and nested_depth are already given. """ nested_serializer_name = f"Nested{nested_depth}...
Base
1
def render(self, record, bound_column, value): # pylint: disable=arguments-differ if value: name = bound_column.name css_class = getattr(record, f"get_{name}_class")() label = getattr(record, f"get_{name}_display")() return mark_safe(f'<span class="label labe...
Base
1
def render(self, value): return mark_safe(f'<span class="label color-block" style="background-color: #{value}">&nbsp;</span>')
Base
1
def render(self, record, value): # pylint: disable=arguments-differ if value: url = reverse(self.viewname, kwargs=self.view_kwargs) if self.url_params: url += "?" + "&".join([f"{k}={getattr(record, v)}" for k, v in self.url_params.items()]) return mark_sa...
Base
1
def header(self): return mark_safe('<input type="checkbox" class="toggle" title="Toggle all" />')
Base
1
def add_html_id(element_str, id_str): """Add an HTML `id="..."` attribute to the given HTML element string. Args: element_str (str): String describing an HTML element. id_str (str): String to add as the `id` attribute of the element_str. Returns: (str): HTML string with added `id`....
Base
1
def render_boolean(value): """Render HTML from a computed boolean value. Args: value (any): Input value, can be any variable. A truthy value (for example non-empty string / True / non-zero number) is considered True. A falsey value other than None (for example "" or 0 or False) ...
Base
1
def render_markdown(value): """ Render text as Markdown Example: {{ text | render_markdown }} """ # Strip HTML tags value = strip_tags(value) # Sanitize Markdown links schemes = "|".join(settings.ALLOWED_URL_SCHEMES) pattern = rf"\[(.+)\]\((?!({schemes})).*:(.+)\)" valu...
Base
1
def placeholder(value): """Render a muted placeholder if value is falsey, else render the value. Args: value (any): Input value, can be any variable. Returns: (str): Placeholder in HTML, or the string representation of the value. Example: >>> placeholder("") '<span cla...
Base
1
def render_jinja2(template_code, context): """ Render a Jinja2 template with the provided context. Return the rendered content. """ rendering_engine = engines["jinja"] template = rendering_engine.from_string(template_code) return template.render(context=context)
Base
1
def successful_post(self, request, obj, created, logger): """Callback after the form is successfully saved but before redirecting the user.""" verb = "Created" if created else "Modified" msg = f"{verb} {self.queryset.model._meta.verbose_name}" logger.info(f"{msg} {obj} (PK: {obj.pk})...
Base
1
def filter_queryset(self, queryset): """ Filter a query with request querystrings. """ if self.filterset_class is not None: self.filter_params = self.get_filter_params(self.request) self.filterset = self.filterset_class(self.filter_params, queryset) ...
Base
1
def _process_create_or_update_form(self, form): """ Helper method to create or update an object after the form is validated successfully. """ request = self.request queryset = self.get_queryset() with transaction.atomic(): object_created = not form.instanc...
Base
1
def handle_protectederror(obj_list, request, e): """ Generate a user-friendly error message in response to a ProtectedError exception. """ protected_objects = list(e.protected_objects) protected_count = len(protected_objects) if len(protected_objects) <= 50 else "More than 50" err_message = ( ...
Base
1
def post(self, request, pk): virtual_chassis = get_object_or_404(self.queryset, pk=pk) member_select_form = forms.VCMemberSelectForm(request.POST) if member_select_form.is_valid(): device = member_select_form.cleaned_data["device"] device.virtual_chassis = virtual_c...
Base
1
def render_description(self, record): if record.description: return mark_safe(render_markdown(record.description)) return self.default
Base
1
def computed_fields(context, obj, advanced_ui=None): """ Render all applicable links for the given object. This can also check whether the advanced_ui attribute is True or False for UI display purposes. """ fields = obj.get_computed_fields(label_as_key=True, advanced_ui=advanced_ui) if not compu...
Base
1
def _get_registered_content(obj, method, template_context, return_html=True): """ Given an object and a TemplateExtension method name and the template context, return all the registered content for the object's model. """ context = { "object": obj, "request": template_context["reques...
Base
1
def test_custom_field_table_render(self): queryset = Location.objects.filter(name=self.location.name) location_table = LocationTable(queryset) custom_column_expected = { "text_field": "bar", "number_field": "456", "boolean_field": '<span class="text-succe...
Base
1
def post(self, request, pk): post_data = request.POST job_button = JobButton.objects.get(pk=pk) job_model = job_button.job result = JobResult.enqueue_job( job_model=job_model, user=request.user, object_pk=post_data["object_pk"], object_...
Base
1
def render_markdown(value): """ Render text as Markdown Example: {{ text | render_markdown }} """ # Strip HTML tags value = strip_tags(value) # Sanitize Markdown links schemes = "|".join(settings.ALLOWED_URL_SCHEMES) pattern = rf"\[(.+)\]\((?!({schemes})).*:(.+)\)" valu...
Base
1
def test_support_message(self): """Test the `support_message` tag with config and settings.""" with override_settings(): del settings.SUPPORT_MESSAGE with override_config(): self.assertHTMLEqual( helpers.support_message(), ...
Base
1
def test_render_markdown(self): self.assertTrue(callable(helpers.render_markdown)) # Test common markdown formatting. self.assertEqual(helpers.render_markdown("**bold**"), "<p><strong>bold</strong></p>") self.assertEqual(helpers.render_markdown("__bold__"), "<p><strong>bold</strong><...
Base
1
def test_500_custom_support_message(self, mock_get): """Nautobot's custom 500 page should be used and should include a default support message.""" url = reverse("home") with self.assertTemplateUsed("500.html"): self.client.raise_request_exception = False response = se...
Base
1
def test_404_default_support_message(self): """Nautobot's custom 404 page should be used and should include a default support message.""" with self.assertTemplateUsed("404.html"): response = self.client.get("/foo/bar") self.assertContains(response, "Network to Code", status_code=...
Base
1
def test_500_default_support_message(self, mock_get): """Nautobot's custom 500 page should be used and should include a default support message.""" url = reverse("home") with self.assertTemplateUsed("500.html"): self.client.raise_request_exception = False response = s...
Base
1
def testPoolingRatioValueOutOfRange(self): with self.cached_session() as _: # Whether turn on `TF2_BEHAVIOR` generates different error messages with self.assertRaisesRegex( (errors.InvalidArgumentError, ValueError), r"(pooling_ratio cannot be smaller than 1, got: .*)|(is negative)"...
Variant
0
def testPoolingRatioValueOutOfRange(self): with self.cached_session() as _: # Whether turn on `TF2_BEHAVIOR` generates different error messages with self.assertRaisesRegex( (errors.InvalidArgumentError, ValueError), r"(pooling_ratio cannot be smaller than 1, got: .*)|(is negative)"...
Variant
0
def testSnapshotRecoveryFailsWithBadSplitNames(self, bad_split_filename): cluster, _ = self.setup() write_file(os.path.join(self.source_dir(), bad_split_filename)) with self.assertRaisesRegex(ValueError, "can't parse"): cluster.restart_dispatcher()
Base
1
def testSnapshotRecoveryFailsWithOutOfOrderSplitName(self): cluster, _ = self.setup() write_file(os.path.join(self.source_dir(), "split_1_0")) with self.assertRaisesRegex(ValueError, "found conflict"): cluster.restart_dispatcher()
Base
1
def testParallelConcatShapeZero(self): if not tf2.enabled(): self.skipTest("only fails in TF2") @def_function.function def f(): y = gen_array_ops.parallel_concat(values=[["tf"]], shape=0) return y with self.assertRaisesRegex(errors.InvalidArgumentError, ...
Base
1
def create_ssh_cred() -> None: from jinja2 import Environment, FileSystemLoader user_group = roxywi_common.get_user_group() name = common.checkAjaxInput(form.getvalue('new_ssh')) name = f'{name}_{user_group}' enable = common.checkAjaxInput(form.getvalue('ssh_enable')) group = common.checkAjaxInput(form.getvalue(...
Class
2
def extract_ip_or_domain(url): ip_regex = re.compile("^(?:http://|https://)(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})") domain_regex = re.compile("^(?:http://|https://)([a-zA-Z0-9.-]+)") match = ip_regex.findall(url) if len(match): ip_address = match[0] try: ipaddress.ip_ad...
Base
1
def webhook(self, request: WSGIRequest, path: str, previous_value) -> HttpResponse: print(request.body) return HttpResponse("[accepted]")
Base
1
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) configuration = {item["name"]: item["value"] for item in self.configuration} self.config = GatewayConfig( gateway_name=GATEWAY_NAME, auto_capture=True, # FIXME check this supported_cur...
Base
1
def create_transaction( payment: Payment, kind: str, payment_information: PaymentData, action_required: bool = False, gateway_response: GatewayResponse = None, error_msg=None, ) -> Transaction: """Create a transaction based on transaction kind and gateway response.""" # Default values fo...
Base
1
def gateway_postprocess(transaction, payment): if not transaction.is_success: return if transaction.action_required: payment.to_confirm = True payment.save(update_fields=["to_confirm"]) return transaction_kind = transaction.kind # if transaction.action_required: # ...
Base
1
def test_account_reset_password_user_is_inactive( mocked_notify, user_api_client, customer_user, channel_USD ): user = customer_user user.is_active = False user.save() variables = { "email": customer_user.email, "redirectUrl": "https://www.example.com", "channel": channel_US...
Base
1
def mutate(cls, root, info: ResolveInfo, **data): disallow_replica_in_context(info.context) setup_context_user(info.context) if not cls.check_permissions(info.context, data=data): raise PermissionDenied(permissions=cls._meta.permissions) manager = get_plugin_manager_prom...
Base
1
def test_graphql_execution_exception(monkeypatch, api_client): def mocked_execute(*args, **kwargs): raise IOError("Spanish inquisition") monkeypatch.setattr("graphql.backend.core.execute_and_validate", mocked_execute) response = api_client.post_graphql("{ shop { name }}") assert response.status...
Base
1
async def test_secure_channel_key_expiration(srv_crypto_one_cert, mocker): timeout = 1 _, cert = srv_crypto_one_cert clt = Client(uri_crypto_cert) clt.secure_channel_timeout = timeout * 1000 user_cert = uacrypto.CertProperties(peer_creds['certificate'], "DER") user_key = uacrypto.CertProperties(...
Class
2
def data_received(self, data): self._buffer += data # try to parse the incoming data while self._buffer: try: buf = Buffer(self._buffer) try: header = header_from_binary(buf) except NotEnoughData: ...
Base
1
def get(self, path: str) -> None: parts = path.split("/") component_name = parts[0] component_root = self._registry.get_component_path(component_name) if component_root is None: self.write(f"{path} not found") self.set_status(404) return f...
Base
1
def validate_absolute_path(self, root, absolute_path): try: media_file_manager.get(absolute_path) except KeyError: LOGGER.error("MediaFileManager: Missing file %s" % absolute_path) raise tornado.web.HTTPError(404, "%s not found", absolute_path) return abs...
Base
1
def test_invalid_content_request(self): """Test request failure when invalid content (file) is provided.""" with mock.patch("streamlit.components.v1.components.os.path.isdir"): declare_component("test", path=PATH) with mock.patch("streamlit.components.v1.components.open") as m:...
Base
1
def test_invalid_component_request(self): """Test request failure when invalid component name is provided.""" response = self._request_component("invalid_component") self.assertEqual(404, response.code) self.assertEqual(b"invalid_component not found", response.body)
Base
1
def test_invalid_encoding_request(self): """Test request failure when invalid encoded file is provided.""" with mock.patch("streamlit.components.v1.components.os.path.isdir"): declare_component("test", path=PATH) with mock.patch("streamlit.components.v1.components.open") as m: ...
Base
1
def convert(cls, bytestring=None, *, file_obj=None, url=None, dpi=96, parent_width=None, parent_height=None, scale=1, unsafe=False, background_color=None, negate_colors=False, invert_images=False, write_to=None, output_width=None, output_height=None, *...
Base
1
def download_url(url, proxies=None): """ Downloads a given url in a temporary file. This function is not safe to use in multiple processes. Its only use is for deprecated behavior allowing to download config/models with a single url instead of using the Hub. Args: url (`str`): The url of the fi...
Class
2
def test_legacy_index_retriever_retrieve(self): n_docs = 1 retriever = self.get_dummy_legacy_index_retriever() hidden_states = np.array( [np.ones(self.retrieval_vector_size), -np.ones(self.retrieval_vector_size)], dtype=np.float32 ) retrieved_doc_embeds, doc_ids, ...
Base
1
def test_legacy_index_retriever_retrieve(self): n_docs = 1 retriever = self.get_dummy_legacy_index_retriever() hidden_states = np.array( [np.ones(self.retrieval_vector_size), -np.ones(self.retrieval_vector_size)], dtype=np.float32 ) retrieved_doc_embeds, doc_ids, ...
Base
1
def get_dummy_legacy_index_retriever(self): dataset = Dataset.from_dict( { "id": ["0", "1"], "text": ["foo", "bar"], "title": ["Foo", "Bar"], "embeddings": [np.ones(self.retrieval_vector_size + 1), 2 * np.ones(self.retrieval_vector_...
Base
1
def get_dummy_legacy_index_retriever(self): dataset = Dataset.from_dict( { "id": ["0", "1"], "text": ["foo", "bar"], "title": ["Foo", "Bar"], "embeddings": [np.ones(self.retrieval_vector_size + 1), 2 * np.ones(self.retrieval_vector_...
Base
1
def test_legacy_hf_index_retriever_save_and_from_pretrained(self): retriever = self.get_dummy_legacy_index_retriever() with tempfile.TemporaryDirectory() as tmp_dirname: retriever.save_pretrained(tmp_dirname) retriever = RagRetriever.from_pretrained(tmp_dirname) s...
Base
1
def test_legacy_hf_index_retriever_save_and_from_pretrained(self): retriever = self.get_dummy_legacy_index_retriever() with tempfile.TemporaryDirectory() as tmp_dirname: retriever.save_pretrained(tmp_dirname) retriever = RagRetriever.from_pretrained(tmp_dirname) s...
Base
1
def dump_content(destination, path, getter): logging.debug(path) content = getter(path) if path.endswith("/"): path = path + "index.html" path = Path(destination) / path.lstrip("/") path.parent.mkdir(parents=True, exist_ok=True) with open(path, "wb") as f: f.write(content) ...
Base
1
def dump_content(destination, path, getter): logging.debug(path) content = getter(path) if path.endswith("/"): path = path + "index.html" path = Path(destination) / path.lstrip("/") path.parent.mkdir(parents=True, exist_ok=True) with open(path, "wb") as f: f.write(content) ...
Base
1
def _find_working_git(self): test_cmd = 'version' if app.GIT_PATH: main_git = '"' + app.GIT_PATH + '"' else: main_git = 'git' log.debug(u'Checking if we can use git commands: {0} {1}', main_git, test_cmd) _, _, exit_status = self._run_git(main_git, t...
Base
1
def _set_document_file_metadata(self): self.file.open() # Set new document file size self.file_size = self.file.size # Set new document file hash self._set_file_hash(self.file.read()) self.file.seek(0)
Class
2
def _set_document_file_metadata(self): self.file.open() # Set new document file size self.file_size = self.file.size # Set new document file hash self._set_file_hash(self.file.read()) self.file.seek(0)
Base
1
def get_file_hash(self): if self.file_hash == "": with self.open_file() as f: self._set_file_hash(f.read()) self.save(update_fields=["file_hash"]) return self.file_hash
Class
2
def get_file_hash(self): if self.file_hash == "": with self.open_file() as f: self._set_file_hash(f.read()) self.save(update_fields=["file_hash"]) return self.file_hash
Base
1
def _set_file_hash(self, file_contents): self.file_hash = hashlib.sha1(file_contents).hexdigest()
Class
2
def _set_file_hash(self, file_contents): self.file_hash = hashlib.sha1(file_contents).hexdigest()
Base
1
def get_file_hash(self): if self.file_hash == "": with self.open_file() as f: self._set_file_hash(f.read()) self.save(update_fields=["file_hash"]) return self.file_hash
Class
2
def get_file_hash(self): if self.file_hash == "": with self.open_file() as f: self._set_file_hash(f.read()) self.save(update_fields=["file_hash"]) return self.file_hash
Base
1
def _set_file_hash(self, file_contents): self.file_hash = hashlib.sha1(file_contents).hexdigest()
Class
2
def _set_file_hash(self, file_contents): self.file_hash = hashlib.sha1(file_contents).hexdigest()
Base
1
def _set_image_file_metadata(self): self.file.open() # Set new image file size self.file_size = self.file.size # Set new image file hash self._set_file_hash(self.file.read()) self.file.seek(0)
Class
2
def _set_image_file_metadata(self): self.file.open() # Set new image file size self.file_size = self.file.size # Set new image file hash self._set_file_hash(self.file.read()) self.file.seek(0)
Base
1
def to_python(self, data): """ Check that the file-upload field data contains a valid image (GIF, JPG, PNG, etc. -- whatever Willow supports). Overridden from ImageField to use Willow instead of Pillow as the image library in order to enable SVG support. """ f = FileF...
Class
2
def to_python(self, data): """ Check that the file-upload field data contains a valid image (GIF, JPG, PNG, etc. -- whatever Willow supports). Overridden from ImageField to use Willow instead of Pillow as the image library in order to enable SVG support. """ f = FileF...
Base
1
def test_split_backslash(): stmts = sqlparse.parse(r"select '\\'; select '\''; select '\\\'';") assert len(stmts) == 3
Base
1
def connect(self) -> dict: """ Set up the connection required by the handler. Returns: HandlerStatusResponse """ headers = { 'Content-Type': 'application/json', } data = '{' + f'"userName": "{self.connection_data["username"]}","passwo...
Class
2
def on_file(file): nonlocal file_object data["file"] = file.file_name.decode() file_object = file.file_object
Base
1
def create(self, target: str, df: Optional[pd.DataFrame] = None, args: Optional[Dict] = None) -> None: if 'using' not in args: raise Exception("LlamaIndex engine requires a USING clause! Refer to its documentation for more details.") if 'index_class' not in args['using']: ar...
Base
1
def select(self, query: ast.Select) -> pd.DataFrame: conditions = extract_comparison_conditions(query.where) urls = [] for op, arg1, arg2 in conditions: if op == 'or': raise NotImplementedError(f'OR is not supported') if arg1 == 'url': ...
Base
1
def test_basic_init_function(get_contract): code = """ val: public(uint256) @external def __init__(a: uint256): self.val = a """ c = get_contract(code, *[123]) assert c.val() == 123 # Make sure the init code does not access calldata opcodes = vyper.compile_code(code, ["opcodes"])["opcode...
Class
2
def set_code_offsets(vyper_module: vy_ast.Module) -> Dict: ret = {} offset = 0 for node in vyper_module.get_children(vy_ast.VariableDecl, filters={"is_immutable": True}): varinfo = node.target._metadata["varinfo"] type_ = varinfo.typ varinfo.set_position(CodeOffset(offset)) ...
Variant
0
def set_code_offsets(vyper_module: vy_ast.Module) -> Dict: ret = {} offset = 0 for node in vyper_module.get_children(vy_ast.VariableDecl, filters={"is_immutable": True}): varinfo = node.target._metadata["varinfo"] type_ = varinfo.typ varinfo.set_position(CodeOffset(offset)) ...
Base
1
def set_code_offsets(vyper_module: vy_ast.Module) -> Dict: ret = {} offset = 0 for node in vyper_module.get_children(vy_ast.VariableDecl, filters={"is_immutable": True}): varinfo = node.target._metadata["varinfo"] type_ = varinfo.typ varinfo.set_position(CodeOffset(offset)) ...
Pillar
3
def append_dyn_array(darray_node, elem_node): assert isinstance(darray_node.typ, DArrayT) assert darray_node.typ.count > 0, "jerk boy u r out" ret = ["seq"] with darray_node.cache_when_complex("darray") as (b1, darray_node): len_ = get_dyn_array_count(darray_node) with len_.cache_when_...
Base
1
def make_byte_array_copier(dst, src): assert isinstance(src.typ, _BytestringT) assert isinstance(dst.typ, _BytestringT) _check_assign_bytes(dst, src) # TODO: remove this branch, copy_bytes and get_bytearray_length should handle if src.value == "~empty": # set length word to 0. retu...
Base
1
def build_IR(self, expr, args, kwargs, context): placeholder_node = IRnode.from_list( context.new_internal_variable(BytesT(128)), typ=BytesT(128), location=MEMORY ) return IRnode.from_list( [ "seq", ["mstore", placeholder_node, args[0]]...
Base
1
def __init__(self, message="Error Message not found.", *items): """ Exception initializer. Arguments --------- message : str Error message to display with the exception. *items : VyperNode | Tuple[str, VyperNode], optional Vyper ast node(s), o...
Class
2
def validate_identifier(attr): if not re.match("^[_a-zA-Z][a-zA-Z0-9_]*$", attr): raise StructureException(f"'{attr}' contains invalid character(s)") if attr.lower() in RESERVED_KEYWORDS: raise StructureException(f"'{attr}' is a reserved keyword")
Class
2
def on_part_end(self) -> None: message = (MultiPartMessage.PART_END, b"") self.messages.append(message)
Class
2
def on_part_begin(self) -> None: message = (MultiPartMessage.PART_BEGIN, b"") self.messages.append(message)
Class
2
def on_part_data(self, data: bytes, start: int, end: int) -> None: message = (MultiPartMessage.PART_DATA, data[start:end]) self.messages.append(message)
Class
2
def on_header_field(self, data: bytes, start: int, end: int) -> None: message = (MultiPartMessage.HEADER_FIELD, data[start:end]) self.messages.append(message)
Class
2