mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Docstring consistency with the updated .tex files.
This commit is contained in:
parent
679113702c
commit
057b8428d0
1 changed files with 14 additions and 0 deletions
|
@ -49,6 +49,13 @@ class Parser:
|
||||||
self._strict = strict
|
self._strict = strict
|
||||||
|
|
||||||
def parse(self, fp, headersonly=False):
|
def parse(self, fp, headersonly=False):
|
||||||
|
"""Create a message structure from the data in a file.
|
||||||
|
|
||||||
|
Reads all the data from the file and returns the root of the message
|
||||||
|
structure. Optional headersonly is a flag specifying whether to stop
|
||||||
|
parsing after reading the headers or not. The default is False,
|
||||||
|
meaning it parses the entire contents of the file.
|
||||||
|
"""
|
||||||
root = self._class()
|
root = self._class()
|
||||||
self._parseheaders(root, fp)
|
self._parseheaders(root, fp)
|
||||||
if not headersonly:
|
if not headersonly:
|
||||||
|
@ -56,6 +63,13 @@ class Parser:
|
||||||
return root
|
return root
|
||||||
|
|
||||||
def parsestr(self, text, headersonly=False):
|
def parsestr(self, text, headersonly=False):
|
||||||
|
"""Create a message structure from a string.
|
||||||
|
|
||||||
|
Returns the root of the message structure. Optional headersonly is a
|
||||||
|
flag specifying whether to stop parsing after reading the headers or
|
||||||
|
not. The default is False, meaning it parses the entire contents of
|
||||||
|
the file.
|
||||||
|
"""
|
||||||
return self.parse(StringIO(text), headersonly=headersonly)
|
return self.parse(StringIO(text), headersonly=headersonly)
|
||||||
|
|
||||||
def _parseheaders(self, container, fp):
|
def _parseheaders(self, container, fp):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue