Skip to content

Update parser docstrings #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions rest_framework/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ class JSONParser(BaseParser):

def parse(self, stream, media_type=None, parser_context=None):
"""
Returns a 2-tuple of `(data, files)`.

`data` will be an object which is the parsed content of the response.
`files` will always be `None`.
Returns a dict of parsed items.
"""
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
Expand All @@ -74,10 +71,7 @@ class YAMLParser(BaseParser):

def parse(self, stream, media_type=None, parser_context=None):
"""
Returns a 2-tuple of `(data, files)`.

`data` will be an object which is the parsed content of the response.
`files` will always be `None`.
Returns a dict of parsed items.
"""
assert yaml, 'YAMLParser requires pyyaml to be installed'

Expand All @@ -100,10 +94,7 @@ class FormParser(BaseParser):

def parse(self, stream, media_type=None, parser_context=None):
"""
Returns a 2-tuple of `(data, files)`.

`data` will be a :class:`QueryDict` containing all the form parameters.
`files` will always be :const:`None`.
Returns a dict of parsed items.
"""
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
Expand Down Expand Up @@ -147,6 +138,9 @@ class XMLParser(BaseParser):
media_type = 'application/xml'

def parse(self, stream, media_type=None, parser_context=None):
"""
Returns a dict of parsed items.
"""
assert etree, 'XMLParser requires defusedxml to be installed'

parser_context = parser_context or {}
Expand Down