MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/email/feedparser.py:139–167  ·  view source on GitHub ↗

_factory is called with no arguments to create a new message obj The policy keyword specifies a policy object that controls a number of aspects of the parser's operation. The default policy maintains backward compatibility.

(self, _factory=None, *, policy=compat32)

Source from the content-addressed store, hash-verified

137 """A feed-style parser of email."""
138
139 def __init__(self, _factory=None, *, policy=compat32):
140 """_factory is called with no arguments to create a new message obj
141
142 The policy keyword specifies a policy object that controls a number of
143 aspects of the parser's operation. The default policy maintains
144 backward compatibility.
145
146 """
147 self.policy = policy
148 self._old_style_factory = False
149 if _factory is None:
150 if policy.message_factory is None:
151 from email.message import Message
152 self._factory = Message
153 else:
154 self._factory = policy.message_factory
155 else:
156 self._factory = _factory
157 try:
158 _factory(policy=self.policy)
159 except TypeError:
160 # Assume this is an old-style factory
161 self._old_style_factory = True
162 self._input = BufferedSubFile()
163 self._msgstack = []
164 self._parse = self._parsegen().__next__
165 self._cur = None
166 self._last = None
167 self._headersonly = False
168
169 # Non-public interface for supporting Parser's headersonly flag
170 def _set_headersonly(self):

Callers

nothing calls this directly

Calls 2

_parsegenMethod · 0.95
BufferedSubFileClass · 0.85

Tested by

no test coverage detected