<commit_before>from datetime import datetime

import constants
from .connectwise import Connectwise


class Member:
    def __init__(self, identifier, officeEmail, **kwargs):
        self.officeEmail = officeEmail
        self.identifier = identifier
        for kwarg in kwargs:
            setattr(self, kwarg, kwargs[kwarg])

    def __repr__(self):
        return "<Member {}>".format(self.identifier)

    @classmethod
    def fetch_member_by_office_email(cls, officeEmail):
        conditions = ['officeEmail="{}"'.format(officeEmail)]
        member = Connectwise.submit_request('system/members', conditions)[0]
        return cls(**member)

    @classmethod
    def fetch_member_by_identifier(cls, identifier):
        conditions = ['identifier="{}"'.format(identifier)]
        member = Connectwise.submit_request('system/members', conditions)[0]
        return cls(**member)

    @classmethod
    def fetch_all_members(cls):
        conditions = ['identifier!="APIMember"']
        filters = {'orderBy': 'lastName asc'}
        return [cls(**member) for member in Connectwise.submit_request('system/members', conditions, filters)]

    def hourly_cost(self, on_date='today'):
        if on_date.lower() == 'today' or on_date >= '2016-07-01':  # HARDCODED: NEEDS ADJUSTMENT
            return self.hourlyCost
        on_date = datetime.strptime(on_date, '%Y-%m-%d')
        if on_date.month >= 7:
            fy = '{}-{}'.format(on_date.year, on_date.year + 1)
        else:
            fy = '{}-{}'.format(on_date.year - 1, on_date.year)
        return constants.CONSULTANT_HOURLY_COSTS[self.identifier.lower()][fy]

    def daily_cost(self, on_date='today'):
        return round(self.hourly_cost(on_date) * 8, 2)
<commit_msg>officeEmail no longer required when first creating new Member object<commit_after>from datetime import datetime

import constants
from .connectwise import Connectwise


class Member:
    def __init__(self, identifier, **kwargs):
        self.officeEmail = None
        self.identifier = identifier
        for kwarg in kwargs:
            setattr(self, kwarg, kwargs[kwarg])

    def __repr__(self):
        return "<Member {}>".format(self.identifier)

    @classmethod
    def fetch_member_by_office_email(cls, officeEmail):
        conditions = ['officeEmail="{}"'.format(officeEmail)]
        member = Connectwise.submit_request('system/members', conditions)[0]
        return cls(**member)

    @classmethod
    def fetch_member_by_identifier(cls, identifier):
        conditions = ['identifier="{}"'.format(identifier)]
        member = Connectwise.submit_request('system/members', conditions)[0]
        return cls(**member)

    @classmethod
    def fetch_all_members(cls):
        conditions = ['identifier!="APIMember"']
        filters = {'orderBy': 'lastName asc'}
        return [cls(**member) for member in Connectwise.submit_request('system/members', conditions, filters)]

    def hourly_cost(self, on_date='today'):
        if on_date.lower() == 'today' or on_date >= '2016-07-01':  # HARDCODED: NEEDS ADJUSTMENT
            return self.hourlyCost
        on_date = datetime.strptime(on_date, '%Y-%m-%d')
        if on_date.month >= 7:
            fy = '{}-{}'.format(on_date.year, on_date.year + 1)
        else:
            fy = '{}-{}'.format(on_date.year - 1, on_date.year)
        return constants.CONSULTANT_HOURLY_COSTS[self.identifier.lower()][fy]

    def daily_cost(self, on_date='today'):
        return round(self.hourly_cost(on_date) * 8, 2)

{'fraction_non_alphanumeric': 0.13080649757765744, 'fraction_numerical': 0.008549444286121402, 'mean_word_length': 3.213685474189676, 'pattern_counts': {'":': 0, '<': 5, '<?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': '770998', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1028, 'n_words': 228}