Skip to content

Commit 3b15e38

Browse files
authored
Convert sphinx tables to markdown tables on the docstrings (#109)
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
1 parent 7b31383 commit 3b15e38

File tree

1 file changed

+28
-106
lines changed

1 file changed

+28
-106
lines changed

multipart/multipart.py

+28-106
Original file line numberDiff line numberDiff line change
@@ -322,47 +322,13 @@ class File:
322322
There are some options that can be passed to the File to change behavior
323323
of the class. Valid options are as follows:
324324
325-
.. list-table::
326-
:widths: 15 5 5 30
327-
:header-rows: 1
328-
329-
* - Name
330-
- Type
331-
- Default
332-
- Description
333-
* - UPLOAD_DIR
334-
- `str`
335-
- None
336-
- The directory to store uploaded files in. If this is None, a
337-
temporary file will be created in the system's standard location.
338-
* - UPLOAD_DELETE_TMP
339-
- `bool`
340-
- True
341-
- Delete automatically created TMP file
342-
* - UPLOAD_KEEP_FILENAME
343-
- `bool`
344-
- False
345-
- Whether or not to keep the filename of the uploaded file. If True,
346-
then the filename will be converted to a safe representation (e.g.
347-
by removing any invalid path segments), and then saved with the
348-
same name). Otherwise, a temporary name will be used.
349-
* - UPLOAD_KEEP_EXTENSIONS
350-
- `bool`
351-
- False
352-
- Whether or not to keep the uploaded file's extension. If False, the
353-
file will be saved with the default temporary extension (usually
354-
".tmp"). Otherwise, the file's extension will be maintained. Note
355-
that this will properly combine with the UPLOAD_KEEP_FILENAME
356-
setting.
357-
* - MAX_MEMORY_FILE_SIZE
358-
- `int`
359-
- 1 MiB
360-
- The maximum number of bytes of a File to keep in memory. By
361-
default, the contents of a File are kept into memory until a certain
362-
limit is reached, after which the contents of the File are written
363-
to a temporary file. This behavior can be disabled by setting this
364-
value to an appropriately large value (or, for example, infinity,
365-
such as `float('inf')`.
325+
| Name | Type | Default | Description |
326+
|-----------------------|-------|---------|-------------|
327+
| UPLOAD_DIR | `str` | None | The directory to store uploaded files in. If this is None, a temporary file will be created in the system's standard location. |
328+
| UPLOAD_DELETE_TMP | `bool`| True | Delete automatically created TMP file |
329+
| UPLOAD_KEEP_FILENAME | `bool`| False | Whether or not to keep the filename of the uploaded file. If True, then the filename will be converted to a safe representation (e.g. by removing any invalid path segments), and then saved with the same name). Otherwise, a temporary name will be used. |
330+
| UPLOAD_KEEP_EXTENSIONS| `bool`| False | Whether or not to keep the uploaded file's extension. If False, the file will be saved with the default temporary extension (usually ".tmp"). Otherwise, the file's extension will be maintained. Note that this will properly combine with the UPLOAD_KEEP_FILENAME setting. |
331+
| MAX_MEMORY_FILE_SIZE | `int` | 1 MiB | The maximum number of bytes of a File to keep in memory. By default, the contents of a File are kept into memory until a certain limit is reached, after which the contents of the File are written to a temporary file. This behavior can be disabled by setting this value to an appropriately large value (or, for example, infinity, such as `float('inf')`. |
366332
367333
:param file_name: The name of the file that this :class:`File` represents
368334
@@ -372,7 +338,7 @@ class File:
372338
373339
:param config: The configuration for this File. See above for valid
374340
configuration keys and their corresponding values.
375-
"""
341+
""" # noqa: E501
376342

377343
def __init__(self, file_name: bytes | None, field_name: bytes | None = None, config: FileConfig = {}) -> None:
378344
# Save configuration, set other variables default.
@@ -748,28 +714,13 @@ class QuerystringParser(BaseParser):
748714
"""This is a streaming querystring parser. It will consume data, and call
749715
the callbacks given when it has data.
750716
751-
.. list-table::
752-
:widths: 15 10 30
753-
:header-rows: 1
754-
755-
* - Callback Name
756-
- Parameters
757-
- Description
758-
* - on_field_start
759-
- None
760-
- Called when a new field is encountered.
761-
* - on_field_name
762-
- data, start, end
763-
- Called when a portion of a field's name is encountered.
764-
* - on_field_data
765-
- data, start, end
766-
- Called when a portion of a field's data is encountered.
767-
* - on_field_end
768-
- None
769-
- Called when the end of a field is encountered.
770-
* - on_end
771-
- None
772-
- Called when the parser is finished parsing all data.
717+
| Callback Name | Parameters | Description |
718+
|----------------|-----------------|-----------------------------------------------------|
719+
| on_field_start | None | Called when a new field is encountered. |
720+
| on_field_name | data, start, end| Called when a portion of a field's name is encountered. |
721+
| on_field_data | data, start, end| Called when a portion of a field's data is encountered. |
722+
| on_field_end | None | Called when the end of a field is encountered. |
723+
| on_end | None | Called when the parser is finished parsing all data.|
773724
774725
:param callbacks: A dictionary of callbacks. See the documentation for
775726
:class:`BaseParser`.
@@ -788,7 +739,7 @@ class QuerystringParser(BaseParser):
788739
789740
:param max_size: The maximum size of body to parse. Defaults to infinity -
790741
i.e. unbounded.
791-
"""
742+
""" # noqa: E501
792743

793744
state: QuerystringState
794745

@@ -999,46 +950,17 @@ def __repr__(self) -> str:
999950
class MultipartParser(BaseParser):
1000951
"""This class is a streaming multipart/form-data parser.
1001952
1002-
.. list-table::
1003-
:widths: 15 10 30
1004-
:header-rows: 1
1005-
1006-
* - Callback Name
1007-
- Parameters
1008-
- Description
1009-
* - on_part_begin
1010-
- None
1011-
- Called when a new part of the multipart message is encountered.
1012-
* - on_part_data
1013-
- data, start, end
1014-
- Called when a portion of a part's data is encountered.
1015-
* - on_part_end
1016-
- None
1017-
- Called when the end of a part is reached.
1018-
* - on_header_begin
1019-
- None
1020-
- Called when we've found a new header in a part of a multipart
1021-
message
1022-
* - on_header_field
1023-
- data, start, end
1024-
- Called each time an additional portion of a header is read (i.e. the
1025-
part of the header that is before the colon; the "Foo" in
1026-
"Foo: Bar").
1027-
* - on_header_value
1028-
- data, start, end
1029-
- Called when we get data for a header.
1030-
* - on_header_end
1031-
- None
1032-
- Called when the current header is finished - i.e. we've reached the
1033-
newline at the end of the header.
1034-
* - on_headers_finished
1035-
- None
1036-
- Called when all headers are finished, and before the part data
1037-
starts.
1038-
* - on_end
1039-
- None
1040-
- Called when the parser is finished parsing all data.
1041-
953+
| Callback Name | Parameters | Description |
954+
|--------------------|-----------------|-------------|
955+
| on_part_begin | None | Called when a new part of the multipart message is encountered. |
956+
| on_part_data | data, start, end| Called when a portion of a part's data is encountered. |
957+
| on_part_end | None | Called when the end of a part is reached. |
958+
| on_header_begin | None | Called when we've found a new header in a part of a multipart message |
959+
| on_header_field | data, start, end| Called each time an additional portion of a header is read (i.e. the part of the header that is before the colon; the "Foo" in "Foo: Bar"). |
960+
| on_header_value | data, start, end| Called when we get data for a header. |
961+
| on_header_end | None | Called when the current header is finished - i.e. we've reached the newline at the end of the header. |
962+
| on_headers_finished| None | Called when all headers are finished, and before the part data starts. |
963+
| on_end | None | Called when the parser is finished parsing all data. |
1042964
1043965
:param boundary: The multipart boundary. This is required, and must match
1044966
what is given in the HTTP request - usually in the
@@ -1049,7 +971,7 @@ class MultipartParser(BaseParser):
1049971
1050972
:param max_size: The maximum size of body to parse. Defaults to infinity -
1051973
i.e. unbounded.
1052-
"""
974+
""" # noqa: E501
1053975

1054976
def __init__(
1055977
self, boundary: bytes | str, callbacks: MultipartCallbacks = {}, max_size: float = float("inf")

0 commit comments

Comments
 (0)