<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import json
from datetime import datetime,timedelta
import imaplib


class MailChecker(object):
    """ 
    This class handles mailservers and outputs i3status compatible
    json data for the accumulated unread count. The mail server
    functionality is implemented in the subclass MailChecker.MailServer
    """
    
    settings =  {
        'color': '#ff0000',
        'servers': []
    }

    servers = []

    def __init__(self, settings = None):
        self.settings.update(settings)

        for server in settings['servers']:
            srv = MailChecker.MailServer(server)
            self.servers.append(srv)

    def output(self):
        unread = 0
        for srv in self.servers:
            unread += srv.get_unread_count()

        if not unread:
            return None

        return {'full_text' : '%d new emails' % unread, 
                'name' : 'newmail',
                'urgent' : 'true',
                'color' : self.settings['color']}

    class MailServer:<commit_msg>changed emails to email when only 1 unread<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import json
from datetime import datetime,timedelta
import imaplib


class MailChecker(object):
    """ 
    This class handles mailservers and outputs i3status compatible
    json data for the accumulated unread count. The mail server
    functionality is implemented in the subclass MailChecker.MailServer
    """
    
    settings =  {
        'color': '#ff0000',
        'servers': []
    }

    servers = []

    def __init__(self, settings = None):
        self.settings.update(settings)

        for server in settings['servers']:
            srv = MailChecker.MailServer(server)
            self.servers.append(srv)

    def output(self):
        unread = 0
        for srv in self.servers:
            unread += srv.get_unread_count()

        if not unread:
            return None

        return {'full_text' : '%d new email%s' % (unread, ('s' if unread > 1 else '')), 
                'name' : 'newmail',
                'urgent' : 'true',
                'color' : self.settings['color']}

    class MailServer:
{'fraction_non_alphanumeric': 0.10599909788001805, 'fraction_numerical': 0.007216959855660803, 'mean_word_length': 2.1371994342291374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2587756', 'n_tokens_mistral': 651, 'n_tokens_neox': 630, 'n_words': 185}