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

Method __init__

Lib/mailbox.py:279–297  ·  view source on GitHub ↗

Initialize a Maildir instance.

(self, dirname, factory=None, create=True)

Source from the content-addressed store, hash-verified

277 colon = ':'
278
279 def __init__(self, dirname, factory=None, create=True):
280 """Initialize a Maildir instance."""
281 Mailbox.__init__(self, dirname, factory, create)
282 self._paths = {
283 'tmp': os.path.join(self._path, 'tmp'),
284 'new': os.path.join(self._path, 'new'),
285 'cur': os.path.join(self._path, 'cur'),
286 }
287 if not os.path.exists(self._path):
288 if create:
289 os.mkdir(self._path, 0o700)
290 for path in self._paths.values():
291 os.mkdir(path, 0o700)
292 else:
293 raise NoSuchMailboxError(self._path)
294 self._toc = {}
295 self._toc_mtimes = {'cur': 0, 'new': 0}
296 self._last_read = 0 # Records last time we read cur/new
297 self._skewfactor = 0.1 # Adjust if os/fs clocks are skewing
298
299 def add(self, message):
300 """Add message and return assigned key."""

Callers

nothing calls this directly

Calls 6

NoSuchMailboxErrorClass · 0.85
__init__Method · 0.45
joinMethod · 0.45
existsMethod · 0.45
mkdirMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected