<commit_before>#!/usr/bin/env python

import sys, os;  sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'server')))

import sessionmanager

import IPython

# You can also do this with
# $ python -m imapclient.interact -H <host> -u <user> ...
# but we want to use our sessionmanager and crispin so we're not.

c = sessionmanager.get_crispin_from_email(
                '<EMAIL>')

all_mail = c.all_mail_folder_name()
select_info = c.select_folder(all_mail)

server_uids = [unicode(s) for s in c.imap_server.search(['NOT DELETED'])]

banner = """
You can access the crispin instance with the 'c' variable.
AllMail message UIDs are in 'server_uids'.

IMAPClient docs are at:

    http://imapclient.readthedocs.org/en/latest/#imapclient-class-reference
"""

IPython.embed(banner1=banner)

# XXX Any cleanup?<commit_msg>crispinshell.py: Add refresh capability.<commit_after>#!/usr/bin/env python

import sys, os;  sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'server')))

import sessionmanager

import IPython

# You can also do this with
# $ python -m imapclient.interact -H <host> -u <user> ...
# but we want to use our sessionmanager and crispin so we're not.

c = None

def refresh_crispin():
    global c
    c = sessionmanager.get_crispin_from_email(
                    '<EMAIL>')

refresh_crispin()

all_mail = c.all_mail_folder_name()
select_info = c.select_folder(all_mail)

server_uids = [unicode(s) for s in c.imap_server.search(['NOT DELETED'])]

banner = """
You can access the crispin instance with the 'c' variable.
AllMail message UIDs are in 'server_uids'.
You can refresh the session with 'refresh_crispin()'.

IMAPClient docs are at:

    http://imapclient.readthedocs.org/en/latest/#imapclient-class-reference
"""

IPython.embed(banner1=banner)

# XXX Any cleanup?
{'fraction_non_alphanumeric': 0.1285097192224622, 'fraction_numerical': 0.0021598272138228943, 'mean_word_length': 4.1187845303867405, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1511707', 'n_tokens_mistral': 672, 'n_tokens_neox': 658, 'n_words': 172}