text:
<!DOCTYPE html>

        No.
        Item
        Old One
        New One
        Changed At
        Changed By

        ID
        Item
        Old One
        New One
        Changed At
        Changed By

        <form id="changeForm" method="POST" th:action="'/orders/' + ${order.id} + '/changes'"
              th:object="${change}">

            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Add Change

              Change Item
              <select th:field="*{item}" class="form-control input-sm">
                <option th:each="option : ${changeItemMap}"
                        th:value="${option.key}" th:text="#{${option.value}}">Change Item
                </option>
              </select>

              New Value
              <input type="text" class="form-control" th:field="*{newValue}" />

              <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">

              </button>
              <button type="submit" name="add" value="add" form="changeForm" class="btn btn-warning btn-sm">
                Add
              </button>

        </form>


text:
package vgrechka.phizdetsidea.phizdets.buildout.config;

import com.intellij.lang.ASTNode;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiParser;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;

/**
 * @author traff
 */
public class BuildoutCfgParser implements PsiParser, BuildoutCfgElementTypes, BuildoutCfgTokenTypes {
  @NotNull
  public ASTNode parse(IElementType root, PsiBuilder builder) {
    final PsiBuilder.Marker rootMarker = builder.mark();
    Parsing parsing = new Parsing(builder);
    while (!builder.eof()) {
      if (!parsing.parseSection()) {
        parsing.skipLine();
      }
    }
    rootMarker.done(root);
    return builder.getTreeBuilt();
  }

  private class Parsing {
    private final PsiBuilder myBuilder;

    public Parsing(PsiBuilder builder) {
      myBuilder = builder;
    }

    public boolean parseSection() {
      PsiBuilder.Marker section = mark();

      boolean res = true;

      PsiBuilder.Marker sectionHeader = mark();
      if (parseSectionHeader()) {
        sectionHeader.done(SECTION_HEADER);
      }
      else {
        error("Section name expected.");
        sectionHeader.drop();
        res = false;
      }

      while (is(KEY_CHARACTERS)) {
        res = true;
        parseOption();
      }
      section.done(SECTION);

      if (is(VALUE_CHARACTERS)) {
        advance();
        error("Key expected.");
      }
      while (is(VALUE_CHARACTERS)) {
        skipLine();
      }

      return res;
    }

    private void parseOption() {
      PsiBuilder.Marker option = myBuilder.mark();
      if (is(KEY_CHARACTERS)) {
        doneAdvance(mark(), KEY);
      }
      if (is(KEY_VALUE_SEPARATOR)) {
        advance();
      }
      else {
        error(": or = expected.");
      }

      PsiBuilder.Marker value = mark();
      while (is(VALUE_CHARACTERS)) {
        doneAdvance(mark(), VALUE_LINE);
      }
      value.done(VALUE);
      option.done(OPTION);
    }

    private boolean parseSectionHeader() {
      if (is(LBRACKET)) {

        advance();
        PsiBuilder.Marker sectionName = mark();
        boolean flag = false;
        while (is(SECTION_NAME)) {
          advance();
          flag = true;
        }

        if (flag) {
          sectionName.done(SECTION_NAME);
        }
        else {
          sectionName.drop();
          return false;
        }

        if (is(RBRACKET)) {
          advance();
        }
        else {
          error("] expected.");
          skipLine();
        }

        return true;
      }
      return false;
    }

    private boolean is(IElementType type) {
      return myBuilder.getTokenType() == type;
    }

    private void error(String message) {
      myBuilder.error(message);
    }

    private PsiBuilder.Marker mark() {
      return myBuilder.mark();
    }

    public void doneAdvance(PsiBuilder.Marker marker, IElementType element) {
      myBuilder.advanceLexer();
      marker.done(element);
    }

    public void advance() {
      myBuilder.advanceLexer();
    }

    private void skipLine() {
      while (!is(null) && !is(LBRACKET) && !is(KEY_CHARACTERS)) {
        myBuilder.advanceLexer();
      }
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
source setEnv.sh

# source in functions:
for file in ${functions}/*
do
        source ${file}
done

# failure tests
echoBlue "Running failure testing...\n"

# failure testing checkProgs
cmd="checkProgs zzZZ"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing check checkDir
cmd="checkDir zzZZ"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing getConfig.sh: no args
cmd="getConfig"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing check setConfig.sh: no args
cmd="gcloud/setConfig.sh"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing check setConfig.sh: project doesn't exist
cmd="gcloud/setConfig.sh -p zzZZZ -z us-east1-b"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing createK8sCluster.sh
cmd="gcloud/createK8sCluster.sh -p"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

cmd="gcloud/createK8sCluster.sh -x ${cluster}"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# failure testing create createSqlInstance.sh
cmd="gcloud/createSqlInstance.sh -x ${instance}"
echoYellow "Running failure test on: ${cmd}"
${cmd} 2>&1
failResults

# tests
echoBlue "Running standard tests...\n"

# test checkProgs
cmd="checkProgs ls"
echoCyan "Running test on: ${cmd}"
${cmd}
results

# test checkDir
cmd="checkDir yaml"
echoCyan "Running test on: ${cmd}"
${cmd}
results

# test colors
cmd="echoGreen"
echoCyan "Running test on: ${cmd}"
${cmd} "Green"
results
cmd="echoRed"
echoCyan "Running test on: ${cmd}"
${cmd} "Red"
results
cmd="echoYellow"
echoCyan "Running test on: ${cmd}"
${cmd} "Yellow"
results
cmd="echoBlue"
echoCyan "Running test on: ${cmd}"
${cmd} "Blue"
results
cmd="echoCyan"
echoCyan "Running test on: ${cmd}"
${cmd} "Cyan"
results

# test substitute
cmd="substitute deployment KIND Deployment NAME hello-web"
echoCyan "Running test on: ${cmd}"
${cmd}
results

# test setConfig.sh
cmd="gcloud/setConfig.sh -p ${project} -z ${zone} -r ${region}"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

cmd="getConfig project"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results
cmd="getConfig account"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results
cmd="getConfig zone"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results
cmd="getConfig region"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

# test createK8sCluster.sh
cmd="gcloud/createK8sCluster.sh -c ${cluster}"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

# test createK8sCluster.sh (Note this is testing for an already existing cluster)
cmd="gcloud/createK8sCluster.sh -c ${cluster}"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

# test start.sh
cmd="kubectl/start.sh -a hello-web"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

# test createSqlInstance.sh
cmd="gcloud/createSqlInstance.sh -i ${instance} -d ${dbName} -p ${password} -s ${serviceAccount}"
echoCyan "Running test on: ${cmd}"
${cmd} 2>&1
results

# cleanup
if [ "${cleanup}" = true ]; then
        cmd="${gcloud} container clusters delete ${cluster}"
        echoBlue "Running cleanup command: ${cmd}"
        ${cmd} 2>&1
        cmd="${gcloud} sql instances delete ${instance}"
        echoBlue "Running cleanup command: ${cmd}"
        ${cmd} 2>&1
        cmd="${gcloud} iam service-accounts delete ${serviceAccount}@${project}.iam.gserviceaccount.com"
        echoBlue "Running cleanup command: ${cmd}"
        ${cmd} 2>&1
        cmd="${gcloud} projects remove-iam-policy-binding  ${project} --member serviceAccount:${serviceAccount}@${project}.iam.gserviceaccount.com --role roles/cloudsql.client"
        echoBlue "Running cleanup command: ${cmd}"
        ${cmd} 2>&1
fi

# fail overall script if any of the individual results fail
if [ "${fail}" = true ]; then
        exit 1
fi


text:
"""Reads vehicle status from BMW connected drive portal."""
import logging

from bimmer_connected.state import ChargingState, LockState

from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_KILOMETERS

from . import DOMAIN as BMW_DOMAIN
from .const import ATTRIBUTION

_LOGGER = logging.getLogger(__name__)

SENSOR_TYPES = {
    "lids": ["Doors", "opening", "mdi:car-door-lock"],
    "windows": ["Windows", "opening", "mdi:car-door"],
    "door_lock_state": ["Door lock state", "lock", "mdi:car-key"],
    "lights_parking": ["Parking lights", "light", "mdi:car-parking-lights"],
    "condition_based_services": ["Condition based services", "problem", "mdi:wrench"],
    "check_control_messages": ["Control messages", "problem", "mdi:car-tire-alert"],
}

SENSOR_TYPES_ELEC = {
    "charging_status": ["Charging status", "power", "mdi:ev-station"],
    "connection_status": ["Connection status", "plug", "mdi:car-electric"],
}

SENSOR_TYPES_ELEC.update(SENSOR_TYPES)

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the BMW sensors."""
    accounts = hass.data[BMW_DOMAIN]
    _LOGGER.debug("Found BMW accounts: %s", ", ".join([a.name for a in accounts]))
    devices = []
    for account in accounts:
        for vehicle in account.account.vehicles:
            if vehicle.has_hv_battery:
                _LOGGER.debug("BMW with a high voltage battery")
                for key, value in sorted(SENSOR_TYPES_ELEC.items()):
                    if key in vehicle.available_attributes:
                        device = BMWConnectedDriveSensor(
                            account, vehicle, key, value[0], value[1], value[2]
                        )
                        devices.append(device)
            elif vehicle.has_internal_combustion_engine:
                _LOGGER.debug("BMW with an internal combustion engine")
                for key, value in sorted(SENSOR_TYPES.items()):
                    if key in vehicle.available_attributes:
                        device = BMWConnectedDriveSensor(
                            account, vehicle, key, value[0], value[1], value[2]
                        )
                        devices.append(device)
    add_entities(devices, True)

class BMWConnectedDriveSensor(BinarySensorEntity):
    """Representation of a BMW vehicle binary sensor."""

    def __init__(
        self, account, vehicle, attribute: str, sensor_name, device_class, icon
    ):
        """Initialize sensor."""
        self._account = account
        self._vehicle = vehicle
        self._attribute = attribute
        self._name = f"{self._vehicle.name} {self._attribute}"
        self._unique_id = f"{self._vehicle.vin}-{self._attribute}"
        self._sensor_name = sensor_name
        self._device_class = device_class
        self._icon = icon
        self._state = None

    @property
    def should_poll(self) -> bool:
        """Return False.

        Data update is triggered from BMWConnectedDriveEntity.
        """
        return False

    @property
    def unique_id(self):
        """Return the unique ID of the binary sensor."""
        return self._unique_id

    @property
    def name(self):
        """Return the name of the binary sensor."""
        return self._name

    @property
    def icon(self):
        """Icon to use in the frontend, if any."""
        return self._icon

    @property
    def device_class(self):
        """Return the class of the binary sensor."""
        return self._device_class

    @property
    def is_on(self):
        """Return the state of the binary sensor."""
        return self._state

    @property
    def device_state_attributes(self):
        """Return the state attributes of the binary sensor."""
        vehicle_state = self._vehicle.state
        result = {
            "car": self._vehicle.name,
            ATTR_ATTRIBUTION: ATTRIBUTION,
        }

        if self._attribute == "lids":
            for lid in vehicle_state.lids:
                result[lid.name] = lid.state.value
        elif self._attribute == "windows":
            for window in vehicle_state.windows:
                result[window.name] = window.state.value
        elif self._attribute == "door_lock_state":
            result["door_lock_state"] = vehicle_state.door_lock_state.value
            result["last_update_reason"] = vehicle_state.last_update_reason
        elif self._attribute == "lights_parking":
            result["lights_parking"] = vehicle_state.parking_lights.value
        elif self._attribute == "condition_based_services":
            for report in vehicle_state.condition_based_services:
                result.update(self._format_cbs_report(report))
        elif self._attribute == "check_control_messages":
            check_control_messages = vehicle_state.check_control_messages
            has_check_control_messages = vehicle_state.has_check_control_messages
            if has_check_control_messages:
                cbs_list = []
                for message in check_control_messages:
                    cbs_list.append(message["ccmDescriptionShort"])
                result["check_control_messages"] = cbs_list
            else:
                result["check_control_messages"] = "OK"
        elif self._attribute == "charging_status":
            result["charging_status"] = vehicle_state.charging_status.value
            result["last_charging_end_result"] = vehicle_state.last_charging_end_result
        elif self._attribute == "connection_status":
            result["connection_status"] = vehicle_state.connection_status

        return sorted(result.items())

    def update(self):
        """Read new state data from the library."""
        vehicle_state = self._vehicle.state

        # device class opening: On means open, Off means closed
        if self._attribute == "lids":
            _LOGGER.debug("Status of lid: %s", vehicle_state.all_lids_closed)
            self._state = not vehicle_state.all_lids_closed
        if self._attribute == "windows":
            self._state = not vehicle_state.all_windows_closed
        # device class lock: On means unlocked, Off means locked
        if self._attribute == "door_lock_state":
            # Possible values: LOCKED, SECURED, SELECTIVE_LOCKED, UNLOCKED
            self._state = vehicle_state.door_lock_state not in [
                LockState.LOCKED,
                LockState.SECURED,
            ]
        # device class light: On means light detected, Off means no light
        if self._attribute == "lights_parking":
            self._state = vehicle_state.are_parking_lights_on
        # device class problem: On means problem detected, Off means no problem
        if self._attribute == "condition_based_services":
            self._state = not vehicle_state.are_all_cbs_ok
        if self._attribute == "check_control_messages":
            self._state = vehicle_state.has_check_control_messages
        # device class power: On means power detected, Off means no power
        if self._attribute == "charging_status":
            self._state = vehicle_state.charging_status in [ChargingState.CHARGING]
        # device class plug: On means device is plugged in,
        #                    Off means device is unplugged
        if self._attribute == "connection_status":
            self._state = vehicle_state.connection_status == "CONNECTED"

    def _format_cbs_report(self, report):
        result = {}
        service_type = report.service_type.lower().replace("_", " ")
        result[f"{service_type} status"] = report.state.value
        if report.due_date is not None:
            result[f"{service_type} date"] = report.due_date.strftime("%Y-%m-%d")
        if report.due_distance is not None:
            distance = round(
                self.hass.config.units.length(report.due_distance, LENGTH_KILOMETERS)
            )
            result[
                f"{service_type} distance"
            ] = f"{distance} {self.hass.config.units.length_unit}"
        return result

    def update_callback(self):
        """Schedule a state update."""
        self.schedule_update_ha_state(True)

    async def async_added_to_hass(self):
        """Add callback after being added to hass.

        Show latest data after startup.
        """
        self._account.add_update_listener(self.update_callback)


text:
package core.model.misc

import java.util.{ List => JList }

import com.lvxingpai.model.marketplace.seller.Seller
import org.bson.types.ObjectId
import org.mongodb.morphia.annotations.{ Entity, Id }

import scala.beans.BeanProperty

/**
 * Created by pengyt on 2015/11/13.
 */
@Entity
class GeoCommodity {

  @Id
  var id: ObjectId = _

  /**
   * 城市或国家的ID
   */
  @BeanProperty
  var geoId: ObjectId = _

  /**
   * 商家列表
   *
   */
  var sellers: JList[Seller] = _
}


text:
<?php

namespace K20FastPass\Utilities;

use K20FastPass\Models\Attendee;

class AttendeeTransformer
{
    public static function transform(Attendee $attendee)
    {
        $output = [];
        $output = self::transformAttendee($output, $attendee);
        $output = self::transformSchool($output, $attendee);
        $output = self::transformDistrict($output, $attendee);
        $output = self::transformVendor($output, $attendee);
        $output = self::transformPhaseOne($output, $attendee);
        $output = self::transformSkie($output, $attendee);
        $output = self::transformClaim($output, $attendee);
        $output = self::transformGuestOf($output, $attendee);
        return $output;
    }

    private static function transformAttendee($output, $attendee)
    {
        return [
            'created' => $attendee->created_at->toDayDateTimeString(),
            'attendee_id' => $attendee->id,
            'full_name' => $attendee->name,
            'first_name' => $attendee->first_name,
            'last_name' => $attendee->last_name,
            'email' => $attendee->email,
            'organization' => $attendee->organization,
            'confirmation_code' => $attendee->confirmation_code,
            'attendee_type' => $attendee->type,
            'join_newsletter' => self::yesNo($attendee->newsletter),
            'luncheon_only' => self::yesNo($attendee->only_luncheon),
            'keynote_only' => self::yesNo($attendee->only_keynote),
            'attended' => self::yesNo($attendee->attended),
            'dietary_restrictions' => $attendee->dietary_restrictions,
            'professional_affiliation' => $attendee->professional_affiliation,
            'is_skie_awardee' => self::yesNo($attendee->is_skie_awardee),
            'is_phase_one_leader' => self::yesNo($attendee->is_phase_one_leader),
        ];
    }

    private static function transformSchool($output, $attendee)
    {
        if ($attendee->school) {
            $output = array_merge($output, [
                'school_name' => $attendee->school->name,
                'school_phone' => $attendee->school->phone,
                'is_last_year_oett' => self::yesNo($attendee->school->lastyear_oett),
                'is_current_year_oett' => self::yesNo($attendee->school->current_oett),
                'is_lastyear_okcgearup' => self::yesNo($attendee->school->lastyear_okcgearup),
                'is_current_okcgearup' => self::yesNo($attendee->school->current_okcgearup),
            ]);
        } else {
            $output = $output + [
                    'school_name' => '',
                    'school_phone' => '',
                    'is_last_year_oett' => self::yesNo(false),
                    'is_current_year_oett' => self::yesNo(false),
                    'is_lastyear_okcgearup' => self::yesNo(false),
                    'is_current_okcgearup' => self::yesNo(false),
                ];
        }
        return $output;
    }

    private static function transformDistrict($output, $attendee)
    {
        if ($attendee->school && $attendee->school->district) {
            $output = array_merge($output, [
                'district_name' => $attendee->school->district->name
            ]);
        } else {
            $output = $output + [
                    'district_name' => ''
                ];
        }
        return $output;
    }

    private static function transformVendor($output, $attendee)
    {
        if ($attendee->vendor) {
            $output = array_merge($output, [
                'is_vendor' => self::yesNo(true),
                'vendor_registration_type' => $attendee->vendor->type,
                'vendor_door_prizes' => $attendee->vendor->door_prizes,
                'vendor_num_additional_tables' => $attendee->vendor->num_additional_tables,
                'vendor_additional_door_prizes' => $attendee->vendor->additional_door_prizes,
                'vendor_num_box_lunches' => $attendee->vendor->num_box_lunches,
                'vendor_associates' => $attendee->vendor->associates,
                'vendor_need_electricity' => $attendee->vendor->need_electricity,
                'vendor_need_internet' => $attendee->vendor->need_internet,
                'vendor_logo' => $attendee->vendor->logo,
                'vendor_payment' => $attendee->vendor->payment,
            ]);
        } else {
            $output = $output + [
                    'is_vendor' => self::yesNo(false),
                    'vendor_registration_type' => '',
                    'vendor_door_prizes' => '',
                    'vendor_num_additional_tables' => '',
                    'vendor_additional_door_prizes' => '',
                    'vendor_num_box_lunches' => '',
                    'vendor_associates' => '',
                    'vendor_need_electricity' => '',
                    'vendor_need_internet' => '',
                    'vendor_logo' => '',
                    'vendor_payment' => '',
                ];
        }
        return $output;
    }

    private static function transformPhaseOne($output, $attendee)
    {
        if ($attendee->phaseOne) {
            $output = array_merge($output, [
                'is_phase_one_leader' => self::yesNo(true),
                'phase_one_seminar' => $attendee->phaseOne->seminar
            ]);
        } else {
            $output = $output + [
                    'is_phase_one_leader' => self::yesNo(false),
                    'phase_one_seminar' => ''
                ];
        }
        return $output;
    }

    private static function transformSkie($output, $attendee)
    {
        if ($attendee->skie) {
            $output = array_merge($output, [
                'is_skie_awardee' => self::yesNo(true)
            ]);
        } else {
            $output = $output + [
                    'is_skie_awardee' => self::yesNo(false)
                ];
        }
        return $output;
    }

    private static function transformClaim($output, $attendee)
    {
        if ($attendee->claim) {
            $output = array_merge($output, [
                'claims_to_be_skie_awardee' => self::yesNo($attendee->claim->is_skie),
                'claims_to_be_aret' => self::yesNo($attendee->claim->is_aret),
                'claims_to_be_corps' => self::yesNo($attendee->claim->is_corps),
                'claims_to_be_phase_one' => self::yesNo($attendee->claim->is_phase_one),
            ]);
        } else {
            $output = $output + [
                'claims_to_be_skie_awardee' => self::yesNo(false),
                'claims_to_be_aret' => self::yesNo(false),
                'claims_to_be_corps' => self::yesNo(false),
                'claims_to_be_phase_one' => self::yesNo(false),
            ];
        }
        return $output;
    }

    private static function transformGuestOf($output, $attendee)
    {
        if ($attendee->specialGuestOf) {
            $output = array_merge($output, [
                'special_guest_of' => $attendee->specialGuestOf->name
            ]);
        } else {
            $output = $output + [
                    'special_guest_of' => ''
                ];
        }
        return $output;
    }

    private static function yesNo($bool)
    {
        return ($bool) ? 'Yes' : 'No' ;
    }
}


text:
#ifndef ROSBAG_PLAYER_H
#define ROSBAG_PLAYER_H

#include <sys/stat.h>
#if !defined(_MSC_VER)
  #include <termios.h>
  #include <unistd.h>
#endif
#include <time.h>

#include <queue>
#include <string>

#include <ros/ros.h>
#include <ros/time.h>

#include "rosbag/bag.h"

#include "rosbag/time_translator.h"
#include "rosbag/macros.h"

namespace rosbag {

//! Helper function to create AdvertiseOptions from a MessageInstance
/*!
 *  param msg         The Message instance for which to generate adveritse options
 *  param queue_size  The size of the outgoing queue
 *  param prefix      An optional prefix for all output topics
 */
ros::AdvertiseOptions createAdvertiseOptions(MessageInstance const& msg, uint32_t queue_size, const std::string& prefix = "");

ROSBAG_DECL ros::AdvertiseOptions createAdvertiseOptions(const ConnectionInfo* c, uint32_t queue_size, const std::string& prefix = "");

struct ROSBAG_DECL PlayerOptions
{
    PlayerOptions();

    void check();

    std::string prefix;
    bool     quiet;
    bool     start_paused;
    bool     at_once;
    bool     bag_time;
    double   bag_time_frequency;
    double   time_scale;
    int      queue_size;
    ros::WallDuration advertise_sleep;
    bool     try_future;
    bool     has_time;
    bool     loop;
    float    time;
    bool     has_duration;
    float    duration;
    bool     keep_alive;
    ros::Duration skip_empty;

    std::vector<std::string> bags;
    std::vector<std::string> topics;
    std::vector<std::string> pause_topics;
};

//! PRIVATE. A helper class to track relevant state for publishing time
class ROSBAG_DECL TimePublisher {
public:
    /*! Create a time publisher
     *  A publish_frequency of < 0 indicates that time shouldn't actually be published
     */
    TimePublisher();

    void setPublishFrequency(double publish_frequency);

    void setTimeScale(double time_scale);

    /*! Set the horizon that the clock will run to */
    void setHorizon(const ros::Time& horizon);

    /*! Set the horizon that the clock will run to */
    void setWCHorizon(const ros::WallTime& horizon);

    /*! Set the current time */
    void setTime(const ros::Time& time);

    /*! Get the current time */
    ros::Time const& getTime() const;

    /*! Run the clock for AT MOST duration
     *
     * If horizon has been reached this function returns immediately
     */
    void runClock(const ros::WallDuration& duration);

    //! Sleep as necessary, but don't let the click run
    void runStalledClock(const ros::WallDuration& duration);

    //! Step the clock to the horizon
    void stepClock();

    bool horizonReached();

private:
    bool do_publish_;

    double publish_frequency_;
    double time_scale_;

    ros::NodeHandle node_handle_;
    ros::Publisher time_pub_;

    ros::WallDuration wall_step_;

    ros::WallTime next_pub_;

    ros::WallTime wc_horizon_;
    ros::Time horizon_;
    ros::Time current_;
};

//! PRIVATE.  Player class to abstract the interface to the player
/*!
 *  This API is currently considered private, but will be released in the
 * future after view.
 */
class ROSBAG_DECL Player
{
public:
    Player(PlayerOptions const& options);
    ~Player();

    void publish();

private:
    int readCharFromStdin();
    void setupTerminal();
    void restoreTerminal();

    void doPublish(rosbag::MessageInstance const& m);

    void doKeepAlive();

    void printTime();

private:

    PlayerOptions options_;

    ros::NodeHandle node_handle_;

    bool paused_;

    bool pause_for_topics_;

    ros::WallTime paused_time_;

    std::vector<boost::shared_ptr<Bag> >  bags_;
    std::map<std::string, ros::Publisher> publishers_;

    // Terminal
    bool    terminal_modified_;
#if defined(_MSC_VER)
    HANDLE input_handle;
    DWORD stdin_set;
#else
    termios orig_flags_;
    fd_set  stdin_fdset_;
#endif
    int     maxfd_;

    TimeTranslator time_translator_;
    TimePublisher time_publisher_;

    ros::Time start_time_;
    ros::Duration bag_length_;
};

} // namespace rosbag

#endif


text:
package com.spotify.heroic.aggregation.simple;

import com.spotify.heroic.aggregation.AbstractAnyBucket;
import com.spotify.heroic.metric.Metric;
import lombok.RequiredArgsConstructor;

import java.util.Map;
import java.util.concurrent.atomic.LongAdder;

/**
 * Bucket that counts the number of seen samples.
 * <p>
 * This bucket uses primitives based on striped atomic updates to reduce contention across CPUs.
 *
 * @author udoprog
 */
@RequiredArgsConstructor
public class StripedCountBucket extends AbstractAnyBucket {
    private final long timestamp;

    private final LongAdder count = new LongAdder();

    public long timestamp() {
        return timestamp;
    }

    @Override
    public void update(Map<String, String> tags, Metric d) {
        count.increment();
    }

    public long count() {
        return count.sum();
    }
}


text:
"""
Miscelaneous glue, mostly for interoperability between Python2 and Python3.
"""

import os
import os.path
import platform
import queue
import threading
import traceback

import SublimeHaskell.internals.logging as Logging

def decode_bytes(src):
    return src.decode('utf-8').replace('\r\n', '\n').replace('\r', '\n') if src else None

def encode_bytes(src):
    return src.replace('\r\n', os.linesep).replace('\n', os.linesep).encode('utf-8') if src else None

def head_of(lst):
    return lst[0] if lst else None

def tool_enabled(feature):
    """Generate the name of a feature to test whether it is enabled."""
    return 'enable_' + str(feature)

def normalize_path(dpath):
    return os.path.normcase(os.path.normpath(os.path.expandvars(os.path.expanduser(dpath))))

def is_windows():
    return platform.system() == 'Windows'

def is_macosx():
    return platform.system() == 'Darwin'

class Singleton(type):
    '''Singleton meta-class. This ensures that only one instance of an object is every alive at any given time during
    program execution. Principally used in backends and backend management, where only one NullHaskellBackend and
    one BackendManager class and instance ever need to be alive.
    '''
    _instances = {}
    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super().__call__(*args, **kwargs)
        return cls._instances[cls]

# Background worker
class Worker(object, metaclass=Singleton):
    def __init__(self):
        super().__init__()
        self.jobs = queue.Queue()
        self.inner_thread = threading.Thread(target=self.worker_run)
        self.inner_thread.start()

    def worker_run(self):
        while True:
            name, worker_fn, args, kwargs = self.jobs.get()
            try:
                Logging.log('worker: {0}'.format(name), Logging.LOG_DEBUG)
                worker_fn(*args, **kwargs)
            except Exception:
                Logging.log('worker: job {0} failed, see console window traceback'.format(name), Logging.LOG_ERROR)
                traceback.print_exc()
            finally:
                self.jobs.task_done()

    def async(self, name, worker_fn, *args, **kwargs):
        self.jobs.put((name, worker_fn, args, kwargs))

def run_async(name, worker_fn, *args, **kwargs):
    Worker().async(name, worker_fn, *args, **kwargs)


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://camel.apache.org/schema/cxf"

       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
   <import resource="classpath:META-INF/cxf/cxf.xml"/>
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

   <cxf:cxfEndpoint id="producerEndpoint" address="http://localhost:9001/SoapContext/SoapPort"
    		serviceClass="org.apache.hello_world_soap_http.Greeter"
    		endpointName="s:SoapPort"
    		serviceName="s:SOAPService"
    	xmlns:s="http://apache.org/hello_world_soap_http" >
    	<cxf:serviceFactory>
    	    <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
    			<property name="wrapped" value="true"/>
   			</bean>
    	</cxf:serviceFactory>
   </cxf:cxfEndpoint>

</beans>