
#!/usr/bin/python

import json
import sys
import datetime
import math
import getpass
import numpy as np
from dateutil.parser import parse


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result

    @staticmethod
    def getFirstEventDate(events, eventKey):
        for event in events:
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def getWeekNumber(date):
        return str(date.isocalendar()[0])+"-"+str(date.isocalendar()[1]).zfill(2)

    @staticmethod
    def getDayDate(date):
        return str(date.strftime("%Y-%m-%d"))

    @staticmethod
    def getDeltaWEExcluded(start, end):
        # don't count weekends
        deltadays = np.busday_count( GHUtils.getDayDate(start), GHUtils.getDayDate(end) )
        deltahours = end.hour - start.hour
        tfm = (deltadays * 24) + deltahours
        return tfm

    @staticmethod
    def isDateInRange(start, end, date):
        return date >= start and date < end

0777c622fb4490b157363479346a062f0970a0ef
<mask token>


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result
    <mask token>
    <mask token>

    @staticmethod
    def getDayDate(date):
        return str(date.strftime('%Y-%m-%d'))
    <mask token>
    <mask token>

<mask token>


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result
    <mask token>
    <mask token>

    @staticmethod
    def getDayDate(date):
        return str(date.strftime('%Y-%m-%d'))

    @staticmethod
    def getDeltaWEExcluded(start, end):
        deltadays = np.busday_count(GHUtils.getDayDate(start), GHUtils.
            getDayDate(end))
        deltahours = end.hour - start.hour
        tfm = deltadays * 24 + deltahours
        return tfm
    <mask token>

<mask token>


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result

    @staticmethod
    def getFirstEventDate(events, eventKey):
        for event in events:
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def getWeekNumber(date):
        return str(date.isocalendar()[0]) + '-' + str(date.isocalendar()[1]
            ).zfill(2)

    @staticmethod
    def getDayDate(date):
        return str(date.strftime('%Y-%m-%d'))

    @staticmethod
    def getDeltaWEExcluded(start, end):
        deltadays = np.busday_count(GHUtils.getDayDate(start), GHUtils.
            getDayDate(end))
        deltahours = end.hour - start.hour
        tfm = deltadays * 24 + deltahours
        return tfm
    <mask token>

import json
import sys
import datetime
import math
import getpass
import numpy as np
from dateutil.parser import parse


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result

    @staticmethod
    def getFirstEventDate(events, eventKey):
        for event in events:
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def getWeekNumber(date):
        return str(date.isocalendar()[0]) + '-' + str(date.isocalendar()[1]
            ).zfill(2)

    @staticmethod
    def getDayDate(date):
        return str(date.strftime('%Y-%m-%d'))

    @staticmethod
    def getDeltaWEExcluded(start, end):
        deltadays = np.busday_count(GHUtils.getDayDate(start), GHUtils.
            getDayDate(end))
        deltahours = end.hour - start.hour
        tfm = deltadays * 24 + deltahours
        return tfm

    @staticmethod
    def isDateInRange(start, end, date):
        return date >= start and date < end


#!/usr/bin/python

import json
import sys
import datetime
import math
import getpass
import numpy as np
from dateutil.parser import parse


class GHUtils:

    @staticmethod
    def getLastEventDate(events, eventKey):
        for event in reversed(events):
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def filterEventsByKey(events, eventKey):
        result = []
        for event in events:
            if event['event'] == eventKey:
                result.append(eventKey)
        return result

    @staticmethod
    def getFirstEventDate(events, eventKey):
        for event in events:
            if event['event'] == eventKey:
                return parse(event['created_at'])
        return None

    @staticmethod
    def getWeekNumber(date):
        return str(date.isocalendar()[0])+"-"+str(date.isocalendar()[1]).zfill(2)

    @staticmethod
    def getDayDate(date):
        return str(date.strftime("%Y-%m-%d"))

    @staticmethod
    def getDeltaWEExcluded(start, end):
        # don't count weekends
        deltadays = np.busday_count( GHUtils.getDayDate(start), GHUtils.getDayDate(end) )
        deltahours = end.hour - start.hour
        tfm = (deltadays * 24) + deltahours
        return tfm

    @staticmethod
    def isDateInRange(start, end, date):
        return date >= start and date < end
