<commit_before><commit_msg>size.py example<commit_after>from imap_tools import MailBox

# get size of message and attachments
with MailBox('imap.my.ru').login('acc', 'pwd', 'INBOX') as mailbox:
    for msg in mailbox.fetch():
        print(msg.date_str, msg.subject)
        print('-- RFC822.SIZE message size', msg.size)
        print('-- bytes size', len(bytes(msg.obj)))
        print('-- str size', len(str(msg.obj)))
        for att in msg.attachments:
            print('---- ATT:', att.filename)
            print('---- bytes size', len(bytes(att.part)))
            print('---- str size', len(str(att.part)))

# NOTE:
# len(bytes(msg.obj)) method will returns headers size only when fetch headers_only=True
{'fraction_non_alphanumeric': 0.16526610644257703, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 2.9502762430939224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2527416', 'n_tokens_mistral': 223, 'n_tokens_neox': 218, 'n_words': 62}