If there are times 2010, 2011, and regions AUS, MEX, then the table has rows in this order: date, region, ... 2010, AUS 2010, MEX 2011, AUS ... etc.
426281
function buildRegionAndTimeColumns(item, dimensions) {
  var regionDimension = getDimensionById(dimensions, item.regionDimensionId);
  var timePeriodDimension = getDimensionById(
    dimensions,
    item.timePeriodDimensionId
  );
  if (!defined(regionDimension) && !defined(timePeriodDimension)) {
    // No region dimension (with the actual region values in it) AND no time dimension - we're done.
    return [];
  }
  var regionValues = [];
  var timePeriodValues = [];
  var regionCount = defined(regionDimension)
    ? regionDimension.values.length
    : 1;
  var timePeriodCount = defined(timePeriodDimension)
    ? timePeriodDimension.values.length
    : 1;
  for (
    var timePeriodIndex = 0;
    timePeriodIndex < timePeriodCount;
    timePeriodIndex++
  ) {
    for (var regionIndex = 0; regionIndex < regionCount; regionIndex++) {
      if (defined(regionDimension)) {
        regionValues.push(regionDimension.values[regionIndex].id);
      }
      if (defined(timePeriodDimension)) {
        timePeriodValues.push(timePeriodDimension.values[timePeriodIndex].id);
      }
    }
  }
  var timePeriodColumn;
  if (defined(timePeriodDimension)) {
    var thisColumnOptions = clone(item._columnOptions);
    if (timePeriodCount === 1) {
      thisColumnOptions.type = VarType.ENUM; // Don't trigger timeline off a single-valued time dimension.
    }
    timePeriodColumn = new TableColumn(
      "date",
      timePeriodValues,
      thisColumnOptions
    );
  }
  if (!defined(regionDimension)) {
    return [timePeriodColumn];
  }
  // If there are multiple region types in the data, only use the first region type.
  var regionColumnName = getRegionColumnName(item, dimensions, 0);
  var regionColumn = new TableColumn(
    regionColumnName,
    regionValues,
    item._columnOptions
  );
  if (defined(timePeriodDimension) && defined(regionDimension)) {
    return [timePeriodColumn, regionColumn];
  } else {
    return [regionColumn];
  }
}
859845
def group_order(tlist):
    """"""
    tidx, token = tlist.token_next_by(t=T.Keyword.Order)
    while token:
        pidx, prev_ = tlist.token_prev(tidx)
        if imt(prev_, i=sql.Identifier, t=T.Number):
            tlist.group_tokens(sql.Identifier, pidx, tidx)
            tidx = pidx
        tidx, token = tlist.token_next_by(t=T.Keyword.Order, idx=tidx)
882201
public function allCensusDates(): array
    {
        return [
            new CensusOfFrance1831(),
            new CensusOfFrance1836(),
            new CensusOfFrance1841(),
            new CensusOfFrance1846(),
            new CensusOfFrance1851(),
            new CensusOfFrance1856(),
            new CensusOfFrance1861(),
            new CensusOfFrance1866(),
            new CensusOfFrance1872(),
            new CensusOfFrance1876(),
            new CensusOfFrance1881(),
            new CensusOfFrance1886(),
            new CensusOfFrance1891(),
            new CensusOfFrance1896(),
            new CensusOfFrance1901(),
            new CensusOfFrance1906(),
            new CensusOfFrance1911(),
            new CensusOfFrance1921(),
            new CensusOfFrance1926(),
            new CensusOfFrance1931(),
            new CensusOfFrance1936(),
            new CensusOfFrance1946(),
        ];
    }
17602
private void processCalendars()
   {
      List<Row> rows = getRows("calendar", null, null);
      m_reader.processCalendars(rows);
   }
377555
private void readCalendars()
   {
      Table cal = m_tables.get("CAL");
      for (MapRow row : cal)
      {
         ProjectCalendar calendar = m_projectFile.addCalendar();
         m_calendarMap.put(row.getInteger("CALENDAR_ID"), calendar);
         Integer[] days =
         {
            row.getInteger("SUNDAY_HOURS"),
            row.getInteger("MONDAY_HOURS"),
            row.getInteger("TUESDAY_HOURS"),
            row.getInteger("WEDNESDAY_HOURS"),
            row.getInteger("THURSDAY_HOURS"),
            row.getInteger("FRIDAY_HOURS"),
            row.getInteger("SATURDAY_HOURS")
         };

         calendar.setName(row.getString("NAME"));
         readHours(calendar, Day.SUNDAY, days[0]);
         readHours(calendar, Day.MONDAY, days[1]);
         readHours(calendar, Day.TUESDAY, days[2]);
         readHours(calendar, Day.WEDNESDAY, days[3]);
         readHours(calendar, Day.THURSDAY, days[4]);
         readHours(calendar, Day.FRIDAY, days[5]);
         readHours(calendar, Day.SATURDAY, days[6]);

         int workingDaysPerWeek = 0;
         for (Day day : Day.values())
         {
            if (calendar.isWorkingDay(day))
            {
               ++workingDaysPerWeek;
            }
         }

         Integer workingHours = null;
         for (int index = 0; index < 7; index++)
         {
            if (days[index].intValue() != 0)
            {
               workingHours = days[index];
               break;
            }
         }

         if (workingHours != null)
         {
            int workingHoursPerDay = countHours(workingHours);
            int minutesPerDay = workingHoursPerDay * 60;
            int minutesPerWeek = minutesPerDay * workingDaysPerWeek;
            int minutesPerMonth = 4 * minutesPerWeek;
            int minutesPerYear = 52 * minutesPerWeek;

            calendar.setMinutesPerDay(Integer.valueOf(minutesPerDay));
            calendar.setMinutesPerWeek(Integer.valueOf(minutesPerWeek));
            calendar.setMinutesPerMonth(Integer.valueOf(minutesPerMonth));
            calendar.setMinutesPerYear(Integer.valueOf(minutesPerYear));
         }
      }
   }
244302
def previous_row(self):
        """"""
        row = self.currentIndex().row()
        rows = self.source_model.rowCount()
        if row == 0:
            row = rows
        self.selectRow(row - 1)
200166
function finishFromIndex(timeColumn, index) {
  if (!defined(timeColumn.displayDuration)) {
    return timeColumn.finishJulianDates[index];
  } else {
    return JulianDate.addMinutes(
      timeColumn.julianDates[index],
      timeColumn.displayDuration,
      endScratch
    );
  }
}
285781
protected function periodsSync()
    {
        foreach ($this->periods as $period) {
            $periodKey = $this->keys->period($period);

            if ($this->noExpiration($periodKey)) {
                $expireInSeconds = $this->newExpiration($period);
                $this->redis->incrby($periodKey . '_total', 0);
                $this->redis->zincrby($periodKey, 0, 0);
                $this->redis->expire($periodKey, $expireInSeconds);
                $this->redis->expire($periodKey . '_total', $expireInSeconds);
            }
        }
    }
398681
function (axis, row) {
                    var returnField = [];
                    if (axis !== null) {
                        if (axis._hasTimeField()) {
                            returnField.push(axis._parseDate(row[axis.timeField]));
                        } else if (axis._hasCategories()) {
                            axis.categoryFields.forEach(function (cat) {
                                returnField.push(row[cat]);
                            }, this);
                        }
                    }
                    return returnField;
                }
1012501
public function isRowsToRepeatAtTopSet()
    {
        if (is_array($this->rowsToRepeatAtTop)) {
            if ($this->rowsToRepeatAtTop[0] != 0 && $this->rowsToRepeatAtTop[1] != 0) {
                return true;
            }
        }

        return false;
    }
561341
protected function getTimestampedTraitHooks(): array
	{
		return
		[
			'beforeInsert' =>
			[
				function(array $values, $query): array
				{
					$dateTime = new DateTime;

					$createdAtColumn = $this->getCreatedAtColumn();

					$updatedAtColumn = $this->getUpdatedAtColumn();

					$this->columns[$createdAtColumn] = $dateTime;

					$this->columns[$updatedAtColumn] = $dateTime;

					return [$createdAtColumn => $dateTime, $updatedAtColumn => $dateTime] + $values;
				},
			],
			'afterInsert' =>
			[
				function($inserted): void
				{
					if($this->shouldTouchOnInsert() && $inserted && $this->isPersisted)
					{
						$this->touchRelated();
					}
				},
			],
			'beforeUpdate' =>
			[
				function(array $values, $query): array
				{
					$dateTime = new DateTime;

					$updatedAtColumn = $this->getUpdatedAtColumn();

					$this->columns[$updatedAtColumn] = $dateTime;

					return [$updatedAtColumn => $dateTime] + $values;
				},
			],
			'afterUpdate' =>
			[
				function($updated): void
				{
					if($this->shouldTouchOnUpdate() && $updated > 0 && $this->isPersisted)
					{
						$this->touchRelated();
					}
				},
			],
			'afterDelete' =>
			[
				function($deleted): void
				{
					if($this->shouldTouchOnDelete() && $deleted > 0 && $this->isPersisted)
					{
						$this->touchRelated();
					}
				},
			],
		];
	}
1190921
private function order()
    {
        $result = [];

        $data = $this->request;

        if ($data['table1'] > $data['table2']) {
            $result['first'] = $data['table2'];
            $result['second'] = $data['table1'];
        } else {
            $result['first'] = $data['table1'];
            $result['second'] = $data['table2'];
        }

        return $result;
    }
371731
function( times ) {

		function compareTime( i, j ) {

			return times[ i ] - times[ j ];

		}

		var n = times.length;
		var result = new Array( n );
		for ( var i = 0; i !== n; ++ i ) result[ i ] = i;

		result.sort( compareTime );

		return result;

	}
807738
public function gr($table, $where = array(), $order = array(), $cols = array(), $groupby = array(), $having = array(), $offset = 0, $time = null) {
        if ($this->logqueries) $start = microtime(true);
        $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, true));
        if (!$ret) $ret = $this->f($this->g($table, $where, $offset, 1, $order, $cols, $groupby, $having, false, $time, false));
        if ($this->logqueries) $res = file_put_contents($this->logfile, "GR: " . (number_format(microtime(true) - $start, 4)) . "\n", FILE_APPEND);
        return $ret;
    }
88326
public void processCalendars(List<Row> rows)
   {
      for (Row row : rows)
      {
         processCalendar(row);
      }

      if (m_defaultCalendarID != null)
      {
         ProjectCalendar defaultCalendar = m_calMap.get(m_defaultCalendarID);
         // Primavera XER files can sometimes not contain a definition of the default
         // project calendar so only try to set if we find a definition.
         if (defaultCalendar != null)
         {
            m_project.setDefaultCalendar(defaultCalendar);
         }
      }
   }
714089
protected function getTimezoneRegions()
    {
        return [
            'UTC'        => DateTimeZone::UTC,
            'Africa'     => DateTimeZone::AFRICA,
            'America'    => DateTimeZone::AMERICA,
            'Antarctica' => DateTimeZone::ANTARCTICA,
            'Asia'       => DateTimeZone::ASIA,
            'Atlantic'   => DateTimeZone::ATLANTIC,
            'Australia'  => DateTimeZone::AUSTRALIA,
            'Europe'     => DateTimeZone::EUROPE,
            'Indian'     => DateTimeZone::INDIAN,
            'Pacific'    => DateTimeZone::PACIFIC,
        ];
    }
75691
def process_row(cls, data, column_map):
        """"""
        row = {}
        for key,value in data.iteritems():
            if not value:
                value = '-'                
            elif isinstance(value, list):
                value = value[1]
            elif isinstance(value, dict):
                if 'type_name' in value:
                    if 'UnixTimeStamp' in value['type_name']:
                        value = datetime.datetime.utcfromtimestamp(value['epoch'])
                        if value == datetime.datetime(1970, 1, 1, 0, 0):
                            value = '-'

            # Assume the value is somehow well formed when we get here
            row[column_map[key]] = value
        return row