Return standardized pipeline objects to be used for comparing

    Remove year, month, and day components of the startDateTime so that data
    pipelines with the same time of day but different days are considered
    equal.
193951
def _cleaned(_pipeline_objects):
    
    pipeline_objects = copy.deepcopy(_pipeline_objects)
    for pipeline_object in pipeline_objects:
        if pipeline_object['id'] == 'DefaultSchedule':
            for field_object in pipeline_object['fields']:
                if field_object['key'] == 'startDateTime':
                    start_date_time_string = field_object['stringValue']
                    start_date_time = datetime.datetime.strptime(start_date_time_string,
                                                                 "%Y-%m-%dT%H:%M:%S")
                    field_object['stringValue'] = start_date_time.strftime("%H:%M:%S")
    return pipeline_objects
1017291
def get_start_and_end_time(self, ref=None):
        
        return (get_start_of_day(self.syear, int(self.smon), self.smday),
                get_end_of_day(self.eyear, int(self.emon), self.emday))
442471
def iso8601_date(d):
    
    if d == values.unset:
        return d
    elif isinstance(d, datetime.datetime):
        return str(d.date())
    elif isinstance(d, datetime.date):
        return str(d)
    elif isinstance(d, str):
        return d
281178
def component_on_date(self, date: datetime.date) -> Optional["Interval"]:
        
        return self.intersection(Interval.wholeday(date))
619222
def datetime(self, start: int = 2000, end: int = 2035,
                 timezone: Optional[str] = None) -> DateTime:
        
        datetime_obj = datetime.combine(
            date=self.date(start, end),
            time=self.time(),
        )
        if timezone:
            if not pytz:
                raise ImportError('Timezones are supported only with pytz')
            tz = pytz.timezone(timezone)
            datetime_obj = tz.localize(datetime_obj)

        return datetime_obj
940801
public static List<Long> createTimestampList(final long startUnixTimestamp,
                                                 final long endUnixTimestamp) {
        if (startUnixTimestamp > endUnixTimestamp) {
            return Collections.emptyList();
        }

        // normalize the start and end (next day's start)
        final long normStart = TimeModifier.START_OF_DAY.applyModifier(startUnixTimestamp);
        final long normEnd = TimeModifier.moveDays(endUnixTimestamp, true, 1);

        // determine which times we have to query for
        final List<Long> times = new ArrayList<>();
        for (long time = normStart; time < normEnd; time += 24 * 60 * 60) {
            times.add(time);
        }

        return times;
    }
156275
def pipeline(names, steps):
    """"""
    steps, times = zip(*map(_maybe_timed, steps))
    fit_time = sum(times)
    if any(s is FIT_FAILURE for s in steps):
        fit_est = FIT_FAILURE
    else:
        fit_est = Pipeline(list(zip(names, steps)))
    return fit_est, fit_time
612914
function isDayAfter(d1, d2) {
  var day1 = clone(d1).setHours(0, 0, 0, 0);
  var day2 = clone(d2).setHours(0, 0, 0, 0);
  return day1 > day2;
}
454662
def finite_datetimes(self, finite_start, finite_stop):
        
        start_date = self._align(finite_start)
        aligned_stop = self._align(finite_stop)
        dates = []
        for m in itertools.count():
            t = start_date + relativedelta(months=m)
            if t >= aligned_stop:
                return dates
            if t >= finite_start:
                dates.append(t)
150269
private boolean matchesDay(DateTime currentTime, TimeRestrictedAccess filter) {
        Integer dayStart = filter.getDayStart();
        Integer dayEnd = filter.getDayEnd();
        int dayNow = currentTime.getDayOfWeek();
        if (dayStart >= dayEnd) {
            return dayNow >= dayStart && dayNow <= dayEnd;
        } else {
            return dayNow <= dayEnd && dayNow >= dayStart;
        }
    }
907888
def query(self, start_date=None, end_date=None, ndays=None, metrics=[], dimensions=[], filters=None, segment=None, sort=[], start_index=1, max_results=10):
        
        if start_date:
            start_date = start_date
        elif getattr(self.args, 'start-date'):
            start_date = getattr(self.args, 'start-date')
        elif self.config.get('start-date', None):
            start_date = self.config['start-date']
        else:
            start_date = '2005-01-01'

        if end_date:
            end_date = end_date
        elif getattr(self.args, 'end-date'):
            end_date = getattr(self.args, 'end-date')
        elif self.config.get('end-date', None):
            end_date = self.config['end-date']
        elif ndays:
            end_date = self._ndays(start_date, ndays)
        elif self.args.ndays:
            end_date = self._ndays(start_date, self.args.ndays)
        elif self.config.get('ndays', None):
            end_date = self._ndays(start_date, self.config['ndays'])
        else:
            end_date = 'today' 

        if self.args.domain:
            domain = self.args.domain
        elif self.config.get('domain', None):
            domain = self.config['domain']
        else:
            domain = None

        if domain:
            domain_filter = 'ga:hostname==%s' % domain

            if filters:
                filters = '%s;%s' % (domain_filter, filters)
            else:
                filters = domain_filter

        if self.args.prefix:
            prefix = self.args.prefix
        elif self.config.get('prefix', None):
            prefix = self.config['prefix']
        else:
            prefix = None

        if prefix:
            prefix_filter = 'ga:pagePath=~^%s' % prefix 
                
            if filters:
                filters = '%s;%s' % (prefix_filter, filters)
            else:
                filters = prefix_filter

        return self.service.data().ga().get(
            ids='ga:' + self.config['property-id'],
            start_date=start_date,
            end_date=end_date,
            metrics=','.join(metrics) or None,
            dimensions=','.join(dimensions) or None,
            filters=filters,
            segment=segment,
            sort=','.join(sort) or None,
            start_index=str(start_index),
            max_results=str(max_results)
        ).execute()
606165
def finite_datetimes(self, finite_start, finite_stop):
        
        date_start = datetime(finite_start.year, finite_start.month, finite_start.day)
        dates = []
        for i in itertools.count():
            t = date_start + timedelta(days=i)
            if t >= finite_stop:
                return dates
            if t >= finite_start:
                dates.append(t)
1264144
private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types)
   {
      Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>();
      for (MapRow row : types)
      {
         List<DateRange> ranges = new ArrayList<DateRange>();
         for (MapRow range : row.getRows("TIME_RANGES"))
         {
            ranges.add(new DateRange(range.getDate("START"), range.getDate("END")));
         }
         map.put(row.getUUID("UUID"), ranges);
      }

      return map;
   }
861959
def dates_in_range(start_date, end_date):
    
    return [
        start_date + timedelta(n)
        for n in range(int((end_date - start_date).days))
    ]
1198978
def get_start_date_metadata(self):
        
        metadata = dict(self._start_date_metadata)
        metadata.update({'existing_date_time_values': self.my_osid_object_form._my_map['startDate']})
        return Metadata(**metadata)
443450
def floor(start, resolution):
    
    if resolution == STEP_10_SEC:
        return datetime(start.year, start.month, start.day, start.hour,
                        start.minute, start.second - (start.second % 10))
    elif resolution == STEP_1_MIN:
        return datetime(start.year, start.month, start.day, start.hour,
                        start.minute)
    elif resolution == STEP_5_MIN:
        return datetime(start.year, start.month, start.day, start.hour,
                        start.minute - (start.minute % 5))
    elif resolution == STEP_1_HOUR:
        return datetime(start.year, start.month, start.day, start.hour)
    elif resolution == STEP_1_DAY:
        return datetime(start.year, start.month, start.day)

    raise ValueError("{resolution} is not a valid resolution. Valid choices "
                     "are {choices}".format(resolution=resolution,
                                            choices=STEP_CHOICES))
102396
def get_dates_in_period(start=None, top=None, step=1, step_dict={}):
    """"""

    delta = relativedelta(**step_dict) if step_dict else timedelta(days=step)

    start = start or datetime.today()
    top = top or start + delta
    dates = []
    current = start
    while current <= top:
        dates.append(current)
        current += delta
    return dates