def test_chunker(self): """chunker()""" self.assertEqual(list(Utils.chunker(range(10), 3)), [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]) self.assertEqual(list(Utils.chunker(range(10), 4)), [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9]]) self.assertEqual(list(Utils.chunker(range(10), 4)), [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9]]) self.assertEqual(list(Utils.chunker(range(10), 10)), [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]) self.assertEqual(list(Utils.chunker(range(10), 20)), [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]])
parser.error("incorrect number of arguments") conffile = os.path.expanduser(os.path.expandvars(os.path.abspath(args[0]))) if not os.path.isfile(conffile): parser.error("could not read config file: {0}".format(conffile)) conf = readconfig(conffile) conf = _processSubs(conf) conf = _processDates(conf) print('Read and parsed config file: {0}'.format(conffile)) # figure out the dates we are going to use # make a range of dates dates = list(Utils.expandDates(conf['settings']['startdate'], conf['settings']['enddate'])) dates = [v.date() for v in dates] dates = list(Utils.chunker(dates, int(conf['panel']['daysperplot']))) # make the arrays that hold the files dbu = DButils.DButils(conf['settings']['mission'], echo=echo) # go through the panel and see how many plots there are nplots = _get_nplots(conf) ans = [] for pnum, ind_pnum in enumerate(range(nplots), 1): ans.append([]) n_prods = _get_nproducts(conf, pnum) prods = [] for ind_d, d in enumerate(dates): ans[ind_pnum].append([])