def mail_container(value):
    """
    Check that the value points to a valid mail container,
    in URI-style, e.g.: `mbox:///home/username/mail/mail.box`.
    `~`-expansion will work, e.g.: `mbox://~/mail/mail.box`.
    The value is cast to a :class:`mailbox.Mailbox` object.
    """
    if not re.match(r'.*://.*', value):
        raise VdtTypeError(value)
    mburl = urlparse(value)
    uri_scheme_to_mbclass = {
            'mbox': mailbox.mbox,
            'maildir': mailbox.Maildir,
            'mh': mailbox.MH,
            'babyl': mailbox.Babyl,
            'mmdf': mailbox.MMDF,
        }
    klass = uri_scheme_to_mbclass.get(mburl.scheme)
    if klass:
        return klass(mburl.netloc + mburl.path)
    raise VdtTypeError(value)
def mail_container ( value ) : if not re . match ( r'.*://.*' , value ) : raise VdtTypeError ( value ) mburl = urlparse ( value ) uri_scheme_to_mbclass = { 'mbox' : mailbox . mbox , 'maildir' : mailbox . Maildir , 'mh' : mailbox . MH , 'babyl' : mailbox . Babyl , 'mmdf' : mailbox . MMDF , } klass = uri_scheme_to_mbclass . get ( mburl . scheme ) if klass : return klass ( mburl . netloc + mburl . path ) raise VdtTypeError ( value )
Check that the value points to a valid mail container,
    in URI-style, e.g.: `mbox:///home/username/mail/mail.box`.
    `~`-expansion will work, e.g.: `mbox://~/mail/mail.box`.
    The value is cast to a :class:`mailbox.Mailbox` object.