Given the current setting in report_period_type, returns a list of options (suitable for select)
          as an array or pairs telling the valid periods to select.
        :return: An array of period options.
182123
def get_period_options(self):
        

        if self.report_period_type == 'ago':
            return PERIOD_AGO_LOOKUPS
        elif self.report_period_type == 'current':
            return PERIOD_CURRENT_LOOKUPS
        elif self.report_period_type == 'both':
            return PERIOD_AGO_LOOKUPS + PERIOD_CURRENT_LOOKUPS
        else:
            raise ValueError("Invalid report period type. Expected: 'ago', 'current', or 'both'")
1131495
def filter_by_analysis_period(self, analysis_period):
        
        _filtered_data = self.filter_by_months(analysis_period.months_int)
        _filtered_data.header._analysis_period = analysis_period
        return _filtered_data
462509
def get_options(self):
        
        return reduce(
            list.__add__,
            [list(option_list) for option_list in self.get_option_lists()],
            [])
1110708
function getChoices() {
    return {
      roleIdentifiers: () => {
        return plugin.loadRoles()
        .then(roles => {
          // Build the list of available roles for input verification and interactive selection
          return _.map(roles, role => {
            return {
              value: role.name,
              name: role.name + (role.description ? ' - ' + role.description : '')
            };
          });
        });
      }
    };
  }
709794
def _from_selection(self):
        
        # upsampling and PeriodIndex resampling do not work
        # with selection, this state used to catch and raise an error
        return (self.groupby is not None and
                (self.groupby.key is not None or
                 self.groupby.level is not None))
23114
public com.google.api.ads.admanager.axis.v201902.PeriodType getValuePeriodType() {
        return valuePeriodType;
    }
1161059
def filter_by_analysis_period(self, analysis_period):
        
        self._check_analysis_period(analysis_period)
        analysis_period = self._get_analysis_period_subset(analysis_period)

        if analysis_period.st_hour == 0 and analysis_period.end_hour == 23:
            # We can still return an Hourly Continuous Data Collection
            t_s = 60 / analysis_period.timestep
            st_ind = int((analysis_period.st_time.moy / t_s) -
                         (self.header.analysis_period.st_time.moy / t_s))
            end_ind = int((analysis_period.end_time.moy / t_s) -
                          (analysis_period.st_time.moy / t_s) + st_ind + 1)
            if end_ind > st_ind:
                _filt_values = self._values[st_ind:end_ind]
            else:
                _filt_values = self._values[st_ind:] + self._values[:end_ind]
            _filt_header = self.header.duplicate()
            _filt_header._analysis_period = analysis_period
            return HourlyContinuousCollection(_filt_header, _filt_values)
        else:
            # Filter using  HOYs and the result cannot be continuous
            _filtered_data = self.filter_by_moys(analysis_period.moys)
            _filtered_data.header._analysis_period = analysis_period
            return _filtered_data
431727
def report_view(self, request, key, period):
        

        if not self.has_change_permission(request, None):
            raise PermissionDenied

        reporters = self.get_reporters()
        try:
            reporter = reporters[key]
        except KeyError:
            return self.render_report_error(request, _('Report not found'), 404)

        allowed_periods = [k for (k, v) in self.get_period_options()]
        if period == 'A':
            period = ''

        if period and period not in allowed_periods:
            return self.render_report_error(request, _('Invalid report type'), 400)

        try:
            return reporter.process(request, self.get_period_queryset(request, period), period)
        except:
            logger.exception('Tracking Reports could not generate the report due to an internal error')
            return self.render_report_error(request, _('An unexpected error has occurred'), 500)
1208478
def get_period_strs(self, now=None):
        
        if now is None:
            now = self.dt.utcnow()

        year_str = "%04d" % now.year
        month_str = "%04d-%02d" % (now.year, now.month)
        day_str = "%04d-%02d-%02d" % (now.year, now.month, now.day)
        hour_str = "%04d-%02d-%02dT%02d" % (
            now.year, now.month, now.day, now.hour)

        # Note: The week number may be in the previous year during the last
        # days of the year.
        isocal = now.isocalendar()
        week_str = "%04d-W%02d" % (isocal[0], isocal[1])

        return {
            "year": year_str,
            "month": month_str,
            "day": day_str,
            "hour": hour_str,
            "week": week_str,
        }
715579
def period_break(dates, period):
    
    current = getattr(dates, period)
    previous = getattr(dates - 1 * dates.freq, period)
    return np.nonzero(current - previous)[0]
396010
def _report_options(p):
    
    _default_options(p, blacklist=['cache', 'log-group', 'quiet'])
    p.add_argument(
        '--days', type=float, default=1,
        help="Number of days of history to consider")
    p.add_argument(
        '--raw', type=argparse.FileType('wb'),
        help="Store raw json of collected records to given file path")
    p.add_argument(
        '--field', action='append', default=[], type=_key_val_pair,
        metavar='HEADER=FIELD',
        help='Repeatable. JMESPath of field to include in the output OR '
        'for a tag use prefix `tag:`. Special case fields `region` and'
        '`policy` are available')
    p.add_argument(
        '--no-default-fields', action="store_true",
        help='Exclude default fields for report.')
    p.add_argument(
        '--format', default='csv', choices=['csv', 'grid', 'simple', 'json'],
        help="Format to output data in (default: %(default)s). "
        "Options include simple, grid, csv, json")
1093157
def aroon_down(data, period):
    
    catch_errors.check_for_period_error(data, period)
    period = int(period)

    a_down = [((period -
            list(reversed(data[idx+1-period:idx+1])).index(np.min(data[idx+1-period:idx+1]))) /
            float(period)) * 100 for idx in range(period-1, len(data))]
    a_down = fill_for_noncomputable_vals(data, a_down)
    return a_down
170743
def get_options(self):
        
        query = 'SET'
        return dict(row[:2] for row in self.con.fetchall(query))
1157279
public static PeriodType days() {
        PeriodType type = cDays;
        if (type == null) {
            type = new PeriodType(
                "Days",
                new DurationFieldType[] { DurationFieldType.days() },
                new int[] { -1, -1, -1, 0, -1, -1, -1, -1, }
            );
            cDays = type;
        }
        return type;
    }
63731
protected final void setReportFormDateRangeAndInterval(final F report) {
        // Determine default interval based on the intervals available for this aggregation
        if (report.getInterval() == null) {
            report.setInterval(AggregationInterval.DAY);
            final Set<AggregationInterval> intervals = this.getIntervals();
            for (final AggregationInterval preferredInterval : PREFERRED_INTERVAL_ORDER) {
                if (intervals.contains(preferredInterval)) {
                    report.setInterval(preferredInterval);
                    break;
                }
            }
        }

        // Set the report end date as today
        final DateMidnight reportEnd;
        if (report.getEnd() == null) {
            reportEnd = new DateMidnight();
            report.setEnd(reportEnd);
        } else {
            reportEnd = report.getEnd();
        }

        // Determine the best start date based on the selected interval
        if (report.getStart() == null) {
            final DateMidnight start;
            switch (report.getInterval()) {
                case MINUTE:
                    {
                        start = reportEnd.minusDays(1);
                        break;
                    }
                case FIVE_MINUTE:
                    {
                        start = reportEnd.minusDays(2);
                        break;
                    }
                case HOUR:
                    {
                        start = reportEnd.minusWeeks(1);
                        break;
                    }
                case DAY:
                    {
                        start = reportEnd.minusMonths(1);
                        break;
                    }
                case WEEK:
                    {
                        start = reportEnd.minusMonths(3);
                        break;
                    }
                case MONTH:
                    {
                        start = reportEnd.minusYears(1);
                        break;
                    }
                case ACADEMIC_TERM:
                    {
                        start = reportEnd.minusYears(2);
                        break;
                    }
                case CALENDAR_QUARTER:
                    {
                        start = reportEnd.minusYears(2);
                        break;
                    }
                case YEAR:
                    {
                        start = reportEnd.minusYears(10);
                        break;
                    }
                default:
                    {
                        start = reportEnd.minusWeeks(1);
                    }
            }

            report.setStart(start);
        }
    }
843735
public static PeriodType months() {
        PeriodType type = cMonths;
        if (type == null) {
            type = new PeriodType(
                "Months",
                new DurationFieldType[] { DurationFieldType.months() },
                new int[] { -1, 0, -1, -1, -1, -1, -1, -1, }
            );
            cMonths = type;
        }
        return type;
    }
372293
def select_options(access = :deposit)
      @service.search_results(access).map do |admin_set|
        [admin_set.to_s, admin_set.id, data_attributes(admin_set)]
      end
    end