def test_create_svs_obj(): """ """ credentials = ge.get_credentials() service = ge.create_svs_obj(credentials) assert service
def main(cal_range): """ This function describes the top level interface of gcal_parse """ credentials = ge.get_credentials() service = ge.create_svs_obj(credentials) evStart_evEnd = ge.event_range(cal_range) evStartEvEnd_eventsDct = ge.get_events(service, evStart_evEnd, pvt.calendars) evStartEvEnd_calEvDfsDct = dfs.add_durations(evStartEvEnd_eventsDct) (evStart_evEnd, calEvDFsDct) = evStartEvEnd_calEvDfsDct print(evStart_evEnd) calPerTotHrsDct = dfs.get_cals_durs(calEvDFsDct) cumCalTotHrsLst = [] for key, value in calPerTotHrsDct.items(): cumCalTotHrsLst.append(value) # print(key, value) sumCumCalTotHrs = sum(cumCalTotHrsLst, timedelta()) allCalDurTotSec= sumCumCalTotHrs.total_seconds() # print(allCalDurTotSec) for key, value in calPerTotHrsDct.items(): thisCalDurTotSec = value.total_seconds() thisCalDurPerc = (thisCalDurTotSec / allCalDurTotSec) * 100 print(key, dfs.hrs_min_sec(value), ' Hrs, ', round(thisCalDurPerc, 1),'%') print("Total all Cals: ", dfs.hrs_min_sec(sumCumCalTotHrs))
def test_event_range(): """ """ credentials = ge.get_credentials() service = ge.create_svs_obj(credentials) begin = '2016-06-06T19:20:10' end = '2016-06-07T19:20:10' event_range = ge.event_range(begin, end) assert event_range