text:
<?php
namespace Df\Framework\Plugin\App;
use Magento\Framework\App\ResourceConnection as Sb;
# 2020-11-22
final class ResourceConnection {
	/**
	 * 2020-11-22
	 * @see \Magento\Framework\App\ResourceConnection::getConnection()
	 * @return string[]
	 */
	function beforeGetConnection(Sb $sb, string $n = Sb::DEFAULT_CONNECTION):array {return [
		Sb::DEFAULT_CONNECTION !== $n || !self::$CUSTOM ? $n : self::$CUSTOM
	];}

	/**
	 * 2020-11-22
	 * @used-by df_with_conn()
	 * @used-by self::beforeGetConnection()
	 * @var string|null
	 */
	static $CUSTOM;
}


text:
'use strict';

app.config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when('/namespace', {
        templateUrl: getPath('js/partials/namespace.html'),
        controller: 'namespaceCtrl'
    });
}]).controller('namespaceCtrl', [
    '$scope',
    '$http',
    '$httpParamSerializer',
    '$location',
    'namespace',
    '$mdDialog',
    '$mdToast',
    function ($scope, $http, $httpParamSerializer, $location, namespace, $mdDialog, $mdToast) {
        var updateList = function () {
            $http.get('/ws/namespaces/list')
                 .then(function (response) {
                    $scope.list = response.data;
                 });
        };

        $scope.choose = function (target) {
            namespace.set(target);
            $location.path('workflows');
        };

        $scope.add = function (ev) {
            var confirm = $mdDialog.prompt()
                                   .title('Nom du namespace')
                                   .textContent('Choisissez un nom pour votre nouveau namespace')
                                   .placeholder('Nom')
                                   .ariaLabel('Nom')
                                   .targetEvent(ev)
                                   .ok('Créer')
                                   .cancel('Annuler');
            $mdDialog.show(confirm).then(function (result) {
                $http({
                    method: 'POST',
                    url: '/ws/namespaces/create',
                    data: $httpParamSerializer({name: result}),
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
                    }
                }).then(function () {
                    $mdToast.show(
                        $mdToast.simple()
                                .textContent('Namespace créé')
                                .position('bottom right')
                                .hideDelay(3000)
                    );
                    updateList();
                });
            });
        };

        updateList();
    }
]);

redpajama_set_name: RedPajamaGithub


text:
class CreateZones < ActiveRecord::Migration[5.0]
  def change
    create_table :zones do |t|
      t.string :name
      t.integer :zone_number
      t.string :latitude
      t.string :longitude
      t.references :taluk, foreign_key: true
      t.references :district, foreign_key: true

      t.timestamps
    end
    add_index :zones, :name
    add_index :zones, :zone_number
  end
end


text:
<#/api/instances/Protectio
nDomain::{id}/action/qu
eryDevicesTestResults#>
function Get-SIODevicesTestResults
{
    [CmdletBinding(SupportsShouldProcess)]
    Param
    (
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName='1')]
        [Alias("ID")]
        [ValidatePattern("[0-9A-F]{16}")]$ProtectionDomainID
        #[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName='0')]

    )
    begin {
}

    process {
    switch ($PsCmdlet.ParameterSetName)
        {
        "0"
            {
            $uri = "$SIObaseurl/api/instances/System/action/setSdsPerformanceParameters"
            }
        "1"
            {
            $uri = "$SIObaseurl/api/instances/ProtectionDomain::$ProtectionDomainID/action/queryDevicesTestResults"
            }
       }
    try
        {
        Invoke-RestMethod -Uri $uri -Headers $ScaleIOAuthHeaders -Method Post -Body $JSonBody #| Select-Object  *| Select-Object deviceId, deviceTestResults #-ExpandProperty  deviceTestResults
        }
    catch
        {
        Get-SIOWebException -ExceptionMessage $_.Exception.Message
        break
        }

    }
    end {}
}

<#
/api/instances
/System/actio
n/resetDevice
OscillatingCou
nter
#>

function Reset-SIODeviceOscillatingCounter
{
    [CmdletBinding(SupportsShouldProcess)]
    Param
    (
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName='1')]
        [ValidateSet("DevLongSuccessfulIos")]$failureCounter,
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName='2')]
        [switch]$AllCounters
        #[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName='0')]
        #DevLongSuccessfulI
    )
    begin {
}

    process {
    $Uri = "$SIObaseurl/api/instances/System/action/resetDeviceOscillatingCounter"
    switch ($PsCmdlet.ParameterSetName)
        {
        "2"
            {
            $JSonBody = @{ allCounters = "TRUE" } | ConvertTo-Json
            }
        "1"
            {
            $JSonBody = @{ failureCounter = $failureCounter } | ConvertTo-Json
            }
       }
    try
        {
        Invoke-RestMethod -Uri $uri -Headers $ScaleIOAuthHeaders -Method Post -Body $JSonBody #| Select-Object  *| Select-Object deviceId, deviceTestResults #-ExpandProperty  deviceTestResults
        }
    catch
        {
        Get-SIOWebException -ExceptionMessage $_.Exception.Message
        break
        }

    }
    end {}
}


text:
/* ===========================================================================
 * aenig4, Enigma M4 cipher machine emulator.
 *
 * Handling of command line options, similar to getopt.
 * ===========================================================================
 */

#ifndef NGETOPT_H
#define NGETOPT_H

/*
 * Changelog:
 *
 * - Jul 21 2018: long options without short option character recognized.
 *
 */

struct ngetopt_opt {
	const char *name;
	int has_arg;
	int val;
};

struct ngetopt {
	char *optstr;
	char *optarg;
	/* private */
	int optind;
	int argc;
	char *const *argv;
	struct ngetopt_opt *ops;
	int subind;
	char str[3];
};

void ngetopt_init(struct ngetopt *p, int argc, char *const *argv,
	struct ngetopt_opt *ops);
int ngetopt_next(struct ngetopt *p);

#endif


text:
class Repositext
  class Validation
    class Validator
      # Validates that there is a subtitle_mark at the beginning of every paragraph
      # after the second record_id. We assume that every document has at least
      # two record_ids. This is a fair assumption since this validation is only
      # run on the primary repository.
      class SubtitleMarkAtBeginningOfEveryParagraph < Validator

        class NoSubtitleMarkAtBeginningOfParagraphError < StandardError; end

        # Runs all validations for self
        def run
          content_at_file = @file_to_validate
          outcome = subtitle_mark_at_beginning_of_every_paragraph?(
            content_at_file
          )
          log_and_report_validation_step(outcome.errors, outcome.warnings)
        end

      private

        # Checks that every paragraph in content begins with a subtitle_mark
        # @param content_at_file [RFile::ContentAt]
        # @return [Outcome]
        def subtitle_mark_at_beginning_of_every_paragraph?(content_at_file)
          content = content_at_file.contents
          # Early return if content doesn't contain any subtitle_marks
          return Outcome.new(true, nil)  if !content.index('@')
          case @options[:content_type]
          when :import
            # In this mode we raise an exception if we find any paragraphs
            content_without_headers = empty_header_lines(content)
            paragraphs_without_subtitle_mark = check_import_file(content_without_headers)
            if paragraphs_without_subtitle_mark.empty?
              Outcome.new(true, nil)
            else
              # We want to terminate an import if there isn't a subtitle_mark
              # at the beginning of every paragraph.
              # Normally we'd return a negative outcome (see :content), but in this
              # case we raise an exception.
              raise NoSubtitleMarkAtBeginningOfParagraphError.new(
                [
                  "The following paragraphs don't start with a subtitle_mark:",
                  paragraphs_without_subtitle_mark.map { |e| e.inspect }.join("\n")
                ].join("\n")
              )
            end
          when :content
            # In this mode we only report errors if we find any paragraphs
            # We only look at text after the second record_id. Replace all lines
            # before the second record_id with empty lines (to keep line location
            # in error reports accurate)
            content_from_second_record_id = remove_all_text_content_before_second_record_id(content)
            paragraphs_without_subtitle_mark = check_content_file(content_from_second_record_id)
            if paragraphs_without_subtitle_mark.empty?
              Outcome.new(true, nil)
            else
              Outcome.new(
                false, nil, [],
                paragraphs_without_subtitle_mark.map { |(line, para)|
                  Reportable.error(
                    {
                      filename: content_at_file.filename,
                      line: line,
                      context: para.inspect,
                    },
                    ["Paragraph doesn't start with a subtitle_mark"]
                  )
                }
              )
            end
          else
            raise ArgumentError.new("Invalid @options[:content_type]: #{ @options[:content_type].inspect }")
          end
        end

        # @param content [String]
        # @return (see #get_paragraphs_that_dont_start_with_subtitle_mark)
        def check_import_file(content)
          # No need to strip other tokens since the subtitle import files have them stripped already
          get_paragraphs_that_dont_start_with_subtitle_mark(content)
        end

        # @param [String] content
        # @return (see #get_paragraphs_that_dont_start_with_subtitle_mark)
        def check_content_file(content)
          content_with_subtitle_marks_only = Repositext::Utils::SubtitleMarkTools.extract_body_text_with_subtitle_marks_only(content)
          get_paragraphs_that_dont_start_with_subtitle_mark(content_with_subtitle_marks_only)
        end

        # @return [Array<Array<String>>] an array of arrays with line numbers and paras that don't start with @
        def get_paragraphs_that_dont_start_with_subtitle_mark(content)
          # split on para boundaries and find those that don't start with subtitle_mark
          content.split(/\n/).each_with_index.inject([]) { |m, (para, line_idx)|
            if '' != para && '@' != para.strip[0]
              m << ["line #{ line_idx + 1}", para]
            end
            m
          }
        end

        # Empties all header lines on an import file ("[|# Header text|]")
        # @param txt [String]
        def empty_header_lines(txt)
          txt.gsub(/^\[\|[^\]\n]+\](?=\n)/, '')
        end

        # Empties all lines up to the second record_id
        # @param txt [String]
        # @return [String]
        def remove_all_text_content_before_second_record_id(txt)
          # split text into lines
          lines = txt.split("\n")
          # empty all lines up to second record_id
          record_id_counter = 0
          lines.each_with_index do |line, idx|
            record_id_counter += 1  if /\A\^\^\^/ =~ line
            lines[idx] = ''
            break  if record_id_counter >= 2
          end
          if record_id_counter < 2
            # No second record_id found, return original text
            puts 'Warning: Could not find second record_id'
            txt
          else
            # return modified text
            lines.join("\n")
          end
        end

      end
    end
  end
end


text:
using tcp = boost::asio::ip::tcp;               // from <boost/asio/ip/tcp.hpp>
namespace websocket = boost::beast::websocket;  // from <boost/beast/websocket.hpp>

//------------------------------------------------------------------------------

// Report a failure
void
fail(boost::system::error_code ec, char const* what)
{
    std::cerr << what << ": " << ec.message() << "\n";
}

// Sends a WebSocket message and prints the response
class session : public std::enable_shared_from_this<session>
{
    tcp::resolver resolver_;
    websocket::stream<tcp::socket> ws_;
    boost::beast::multi_buffer buffer_;
    std::string host_;
    std::string text_;

public:
    // Resolver and socket require an io_context
    explicit
    session(boost::asio::io_context& ioc)
        : resolver_(ioc)
        , ws_(ioc)
    {
    }

    // Start the asynchronous operation
    void
    run(
        char const* host,
        char const* port,
        char const* text)
    {
        // Save these for later
        host_ = host;
        text_ = text;

        // Look up the domain name
        resolver_.async_resolve(
            host,
            port,
            std::bind(
                &session::on_resolve,
                shared_from_this(),
                std::placeholders::_1,
                std::placeholders::_2));
    }

    void
    on_resolve(
        boost::system::error_code ec,
        tcp::resolver::results_type results)
    {
        if(ec)
            return fail(ec, "resolve");

        // Make the connection on the IP address we get from a lookup
        boost::asio::async_connect(
            ws_.next_layer(),
            results.begin(),
            results.end(),
            std::bind(
                &session::on_connect,
                shared_from_this(),
                std::placeholders::_1));
    }

    void
    on_connect(boost::system::error_code ec)
    {
        if(ec)
            return fail(ec, "connect");

        // Perform the websocket handshake
        ws_.async_handshake(host_, "/",
            std::bind(
                &session::on_handshake,
                shared_from_this(),
                std::placeholders::_1));
    }

    void
    on_handshake(boost::system::error_code ec)
    {
        if(ec)
            return fail(ec, "handshake");

        // Send the message
        ws_.async_write(
            boost::asio::buffer(text_),
            std::bind(
                &session::on_write,
                shared_from_this(),
                std::placeholders::_1,
                std::placeholders::_2));
    }

    void
    on_write(
        boost::system::error_code ec,
        std::size_t bytes_transferred)
    {
        boost::ignore_unused(bytes_transferred);

        if(ec)
            return fail(ec, "write");

        // Read a message into our buffer
        ws_.async_read(
            buffer_,
            std::bind(
                &session::on_read,
                shared_from_this(),
                std::placeholders::_1,
                std::placeholders::_2));
    }

    void
    on_read(
        boost::system::error_code ec,
        std::size_t bytes_transferred)
    {
        boost::ignore_unused(bytes_transferred);

        if(ec)
            return fail(ec, "read");

        // Close the WebSocket connection
        ws_.async_close(websocket::close_code::normal,
            std::bind(
                &session::on_close,
                shared_from_this(),
                std::placeholders::_1));
    }

    void
    on_close(boost::system::error_code ec)
    {
        if(ec)
            return fail(ec, "close");

        // If we get here then the connection is closed gracefully

        // The buffers() function helps print a ConstBufferSequence
        std::cout << boost::beast::buffers(buffer_.data()) << std::endl;
    }
};

//------------------------------------------------------------------------------

int main(int argc, char** argv)
{
    // Check command line arguments.
    if(argc != 4)
    {
        std::cerr <<
            "Usage: websocket-client-async <host> <port> <text>\n" <<
            "Example:\n" <<
            "    websocket-client-async echo.websocket.org 80 \"Hello, world!\"\n";
        return EXIT_FAILURE;
    }
    auto const host = argv[1];
    auto const port = argv[2];
    auto const text = argv[3];

    // The io_context is required for all I/O
    boost::asio::io_context ioc;

    // Launch the asynchronous operation
    std::make_shared<session>(ioc)->run(host, port, text);

    // Run the I/O service. The call will return when
    // the socket is closed.
    ioc.run();

    return EXIT_SUCCESS;
}


text:
        GeoPanel

        Sair


text:
unset STREAMS_INSTALL
unset STREAMS_DOMAIN_ID
unset STREAMS_INSTANCE_ID

# Don't assume a service exists for testing.
if [ -z "${VCAP_SERVICES}" ] || [ -z "STREAMING_ANALYTICS_SERVICE_NAME" ]; then exit 0; fi

# Check the environment is correct
echo "${VCAP_SERVICES:?}" > /dev/null
echo "Service name: "  ${STREAMING_ANALYTICS_SERVICE_NAME:?}

set -x

cd $WORKSPACE/test/python
pyv=`$PYTHONHOME/bin/python -c 'import sys; print(str(sys.version_info.major)+str(sys.version_info.minor))'`
now=`date +%Y%m%d%H%M%S`
xuf="nose_runs/TEST-SERVICE-PY${pyv}_${now}.xml"
export PYTHONPATH=${PYTHONPATH}:${WORKSPACE}/test/python/topology:${WORKSPACE}/test/python/spl/tests:${WORKSPACE}/test/python/rest

wd="$WORKSPACE/test/python/nose_runs/service-py${pyv}"
mkdir -p ${wd}
# xunit not working with processes
# --xunit-file ${xuf} --xunit-testsuite-name="pysvc${pyv}"
nosetests --where=${wd} --config=nose.cfg --with-streamsx-skip-standalone ../../topology ../../spl/tests ../../rest
nrc=$?

# Ensure only test failures just cause an unstable build.
# Disabled for now since with multiple processes xunit does not
# collect results correctly
#if [ ${nrc} -eq 1 ] && [ -e  ${xuf} ]; then exit 0; else exit ${nrc}; fi
exit ${nrc}


text:
#include "HttpParserImpl.h"
#include "libkev/src/utils/kmtrace.h"
#include "libkev/src/utils/utils.h"
#include "Uri.h"

#include <algorithm>

using namespace kuma;

namespace {

#define CR  '\r'
#define LF  '\n'
#define MAX_HTTP_HEADER_SIZE	2*1024*1024 // 2 MB

}

//////////////////////////////////////////////////////////////////////////
// HttpParserImpl
HttpParser::Impl::Impl(const Impl& other)
: HttpHeader(false)
{
    *this = other;
}

HttpParser::Impl::Impl(Impl&& other)
: HttpHeader(false)
{
    *this = std::move(other);
}

HttpParser::Impl& HttpParser::Impl::operator=(const Impl& other)
{
    if(this != &other) {
        is_request_ = other.is_request_;
        str_buf_ = other.str_buf_;
        read_state_ = other.read_state_;
        header_complete_ = other.header_complete_;
        paused_ = other.paused_;
        has_content_length_ = other.has_content_length_;
        content_length_ = other.content_length_;
        has_body_ = other.has_body_;
        is_http2_ = other.is_http2_;
        is_outgoing_ = other.is_outgoing_;

        is_chunked_ = other.is_chunked_;
        chunk_state_ = other.chunk_state_;
        chunk_size_ = other.chunk_size_;
        chunk_bytes_read_ = other.chunk_bytes_read_;
        total_bytes_read_ = other.total_bytes_read_;

        method_ = other.method_;
        url_ = other.url_;
        url_path_ = other.url_path_;
        url_query_ = other.url_query_;
        param_map_ = other.param_map_;
        header_vec_ = other.header_vec_;
        status_code_ = other.status_code_;
    }
    return *this;
}

HttpParser::Impl& HttpParser::Impl::operator=(Impl&& other)
{
    if(this != &other) {
        is_request_ = other.is_request_;
        str_buf_.swap(other.str_buf_);
        read_state_ = other.read_state_;
        header_complete_ = other.header_complete_;
        paused_ = other.paused_;
        has_content_length_ = other.has_content_length_;
        content_length_ = other.content_length_;
        has_body_ = other.has_body_;
        is_http2_ = other.is_http2_;
        is_outgoing_ = other.is_outgoing_;

        is_chunked_ = other.is_chunked_;
        chunk_state_ = other.chunk_state_;
        chunk_size_ = other.chunk_size_;
        chunk_bytes_read_ = other.chunk_bytes_read_;
        total_bytes_read_ = other.total_bytes_read_;

        method_.swap(other.method_);
        url_.swap(other.url_);
        url_path_.swap(other.url_path_);
        url_query_.swap(other.url_query_);
        param_map_.swap(other.param_map_);
        header_vec_.swap(other.header_vec_);
        status_code_ = other.status_code_;
    }
    return *this;
}

HttpParser::Impl::~Impl()
{
    param_map_.clear();
    header_vec_.clear();
}

void HttpParser::Impl::reset()
{
    HttpHeader::reset();
    read_state_ = HTTP_READ_LINE;

    status_code_ = 0;
    header_complete_ = false;
    paused_ = false;

    chunk_state_ = CHUNK_READ_SIZE;
    chunk_size_ = 0;
    chunk_bytes_read_ = 0;

    total_bytes_read_ = 0;
    str_buf_.clear();

    method_ = "";
    url_ = "";
    version_ = "";
    url_path_ = "";

    param_map_.clear();
}

bool HttpParser::Impl::complete() const
{
    return HTTP_READ_DONE == read_state_;
}

bool HttpParser::Impl::error() const
{
    return HTTP_READ_ERROR == read_state_;
}

bool HttpParser::Impl::isUpgradeTo(const std::string& protocol) const
{
    if (!kev::is_equal(getHeaderValue("Upgrade"), protocol) ||
        !kev::contains_token(getHeaderValue("Connection"), "Upgrade", ',')) {
        return false;
    }
    if (!isRequest() && 101 != getStatusCode()) {
        return false;
    }
    if (isRequest() && kev::is_equal(protocol, "h2c") &&
        !kev::contains_token(getHeaderValue("Connection"), "HTTP2-Settings", ',')) {
        return false;
    }
    return true;
}

void HttpParser::Impl::pause() {
    paused_ = true;
}

void HttpParser::Impl::resume() {
    paused_ = false;
}

bool HttpParser::Impl::readEOF()
{
    return !is_request_ && !has_content_length_ && !is_chunked_ &&
           !((100 <= status_code_ && status_code_ <= 199) ||
             204 == status_code_ || 304 == status_code_);
}

bool HttpParser::Impl::hasBody()
{
    return HttpHeader::hasBody();
}

int HttpParser::Impl::parse(const char* data, size_t len)
{
    int bytes_parsed = 0;
    auto parse_state = parse(data, len, &bytes_parsed);
    if(PARSE_STATE_DESTROYED == parse_state) {
        return bytes_parsed;
    }
    if(PARSE_STATE_ERROR == parse_state && event_cb_) {
        event_cb_(HttpEvent::HTTP_ERROR);
    }
    return bytes_parsed;
}

int HttpParser::Impl::parse(const KMBuffer &buf)
{
    int total_parsed = 0;
    for (auto it = buf.begin(); it != buf.end(); ++it) {
        if (it->length() > 0) {
            int bytes_parsed = 0;
            auto parse_state = parse(static_cast<char*>(it->readPtr()), it->length(), &bytes_parsed);
            total_parsed += bytes_parsed;
            if(PARSE_STATE_CONTINUE != parse_state) {
                if(PARSE_STATE_ERROR == parse_state && event_cb_) {
                    event_cb_(HttpEvent::HTTP_ERROR);
                }
                return total_parsed;
            }
        }
    }
    return total_parsed;
}

bool HttpParser::Impl::setEOF()
{
    if(readEOF() && HTTP_READ_BODY == read_state_) {
        read_state_ = HTTP_READ_DONE;
        onComplete();
        return true;
    }
    return false;
}

KMError HttpParser::Impl::saveData(const char* cur_pos, const char* end)
{
    if(cur_pos == end) {
        return KMError::NOERR;
    }
    auto old_len = str_buf_.size();
    if((end - cur_pos) + old_len > MAX_HTTP_HEADER_SIZE) {
        return KMError::BUFFER_TOO_SMALL;
    }
    str_buf_.append(cur_pos, end);
    return KMError::NOERR;
}

HttpParser::Impl::ParseState HttpParser::Impl::parse(const char* data, size_t len, int *bytes_read)
{
    if(HTTP_READ_DONE == read_state_ || HTTP_READ_ERROR == read_state_) {
        KM_WARNTRACE("HttpParser::parse, invalid state="<<read_state_);
        *bytes_read = 0;
        return PARSE_STATE_DONE;
    }
    if(HTTP_READ_BODY == read_state_ && !is_chunked_ && !has_content_length_)
    {// return directly, read untill EOF
        total_bytes_read_ += len;
        *bytes_read = static_cast<int>(len);
        DESTROY_DETECTOR_SETUP();
        onBodyData(data, len);
        DESTROY_DETECTOR_CHECK(PARSE_STATE_DESTROYED);
        return PARSE_STATE_DONE;
    }
    const char* pos = data;
    const char* end = data + len;
    ParseState parse_state = parseHttp(pos, end);
    *bytes_read = static_cast<int>(pos - data);
    return parse_state;
}

HttpParser::Impl::ParseState HttpParser::Impl::parseHttp(const char*& cur_pos, const char* end)
{
    const char* line = nullptr;
    const char* line_end = nullptr;
    bool b_line = false;

    if(HTTP_READ_LINE == read_state_)
    {// try to get status line
        while ((b_line = getLine(cur_pos, end, line, line_end)) && line == line_end && str_buf_.empty())
            ;
        if(b_line && (line != line_end || !str_buf_.empty())) {
            if(!parseStartLine(line, line_end)) {
                read_state_ = HTTP_READ_ERROR;
                return PARSE_STATE_ERROR;
            }
            read_state_ = HTTP_READ_HEAD;
        } else {
            // need more data
            if(saveData(cur_pos, end) != KMError::NOERR) {
                return PARSE_STATE_ERROR;
            }
            cur_pos = end; // all data was consumed
            return PARSE_STATE_CONTINUE;
        }
    }
    if(HTTP_READ_HEAD == read_state_)
    {
        while ((b_line = getLine(cur_pos, end, line, line_end)))
        {
            if(line == line_end && bufferEmpty())
            {// blank line, header completed
                auto const &upgrade_to = HttpHeader::getHeader(strUpgrade);
                if(!upgrade_to.empty()) {
                    is_http2_ = kev::is_equal(upgrade_to, "h2c");
                    KM_INFOTRACE("HttpParser::onHeaderComplete, Upgrade="<<upgrade_to);
                }
                if (isRequest()) {
                    HttpHeader::processHeader();
                } else {
                    HttpHeader::processHeader(status_code_, method_);
                }
                header_complete_ = true;
                if(hasBody()) {
                    read_state_ = HTTP_READ_BODY;
                } else {
                    read_state_ = HTTP_READ_DONE;
                }
                DESTROY_DETECTOR_SETUP();
                onHeaderComplete();
                DESTROY_DETECTOR_CHECK(PARSE_STATE_DESTROYED);
                if(paused_) {
                    return PARSE_STATE_CONTINUE;
                }
                if(read_state_ == HTTP_READ_DONE) {
                    onComplete();
                    return PARSE_STATE_DONE;
                }
                break;
            }
            parseHeaderLine(line, line_end);
        }
        if(HTTP_READ_HEAD == read_state_)
        {// need more data
            if(saveData(cur_pos, end) != KMError::NOERR) {
                return PARSE_STATE_ERROR;
            }
            cur_pos = end; // all data was consumed
            return PARSE_STATE_CONTINUE;
        }
    }
    if(HTTP_READ_BODY == read_state_ && cur_pos < end)
    {// try to get body
        if(is_chunked_) {
            return parseChunk(cur_pos, end);
        } else {
            size_t cur_len = end - cur_pos;
            if(has_content_length_ && (content_length_ - total_bytes_read_) <= cur_len)
            {// data enough
                char* notify_data = const_cast<char*>(cur_pos);
                size_t notify_len = content_length_ - total_bytes_read_;
                cur_pos += notify_len;
                total_bytes_read_ = content_length_;
                read_state_ = HTTP_READ_DONE;
                DESTROY_DETECTOR_SETUP();
                onBodyData(notify_data, notify_len);
                DESTROY_DETECTOR_CHECK(PARSE_STATE_DESTROYED);
                onComplete();
                return PARSE_STATE_DONE;
            }
            else
            {// need more data, or read untill EOF
                char* notify_data = const_cast<char*>(cur_pos);
                total_bytes_read_ += cur_len;
                cur_pos = end;
                onBodyData(notify_data, cur_len);
                return PARSE_STATE_CONTINUE;
            }
        }
    }
    return HTTP_READ_DONE == read_state_?PARSE_STATE_DONE:PARSE_STATE_CONTINUE;
}

bool HttpParser::Impl::parseStartLine(const char* line, const char* line_end)
{
    const char* p_line = line;
    const char* p_end = line_end;
    if(!str_buf_.empty()) {
        str_buf_.append(line, line_end);
        p_line = str_buf_.c_str();
        p_end = p_line + str_buf_.length();
    }
    std::string str;
    const char* p = std::find(p_line, p_end, ' ');
    if(p != p_end) {
        str.assign(p_line, p);
        p_line = p + 1;
    } else {
        return false;
    }
    is_request_ = !kev::is_equal(str, "HTTP", 4);
    if(is_request_) {// request
        method_.swap(str);
        p = std::find(p_line, p_end, ' ');
        if(p != p_end) {
            url_.assign(p_line, p);
            p_line = p + 1;
        } else {
            return false;
        }
        version_.assign(p_line, p_end);
        decodeUrl();
        parseUrl();
    } else {// response
        version_.swap(str);
        p = std::find(p_line, p_end, ' ');
        str.assign(p_line, p);
        status_code_ = std::stoi(str);
    }
    clearBuffer();
    return true;
}

bool HttpParser::Impl::parseHeaderLine(const char* line, const char* line_end)
{
    const char* p_line = line;
    const char* p_end = line_end;
    if(!str_buf_.empty()) {
        str_buf_.append(line, line_end);
        p_line = str_buf_.c_str();
        p_end = p_line + str_buf_.length();
    }

    std::string str_name;
    std::string str_value;
    const char* p = std::find(p_line, p_end, ':');
    if(p == p_end) {
        clearBuffer();
        return false;
    }
    str_name.assign(p_line, p);
    p_line = p + 1;
    str_value.assign(p_line, p_end);
    clearBuffer();
    addHeaderValue(std::move(str_name), std::move(str_value));
    return true;
}

HttpParser::Impl::ParseState HttpParser::Impl::parseChunk(const char*& cur_pos, const char* end)
{
    const char* p_line = nullptr;
    const char* p_end = nullptr;
    bool b_line = false;
    while (cur_pos < end)
    {
        switch (chunk_state_)
        {
            case CHUNK_READ_SIZE:
            {
                b_line = getLine(cur_pos, end, p_line, p_end);
                if(!b_line)
                {// need more data, save remain data.
                    if(saveData(cur_pos, end) != KMError::NOERR) {
                        return PARSE_STATE_ERROR;
                    }
                    cur_pos = end;
                    return PARSE_STATE_CONTINUE;
                }
                std::string str;
                if(!str_buf_.empty()) {
                    str.swap(str_buf_);
                    clearBuffer();
                }
                str.append(p_line, p_end);
                // need not parse chunk extension
                chunk_size_ = strtol(str.c_str(), NULL, 16);
                //KM_INFOTRACE("HttpParser::parseChunk, chunk_size="<<chunk_size_);
                if(0 == chunk_size_)
                {// chunk completed
                    chunk_state_ = CHUNK_READ_TRAILER;
                } else {
                    chunk_bytes_read_ = 0;
                    chunk_state_ = CHUNK_READ_DATA;
                }
                break;
            }
            case CHUNK_READ_DATA:
            {
                size_t cur_len = end - cur_pos;
                if(chunk_size_ - chunk_bytes_read_ <= cur_len) {// data enough
                    char* notify_data = const_cast<char*>(cur_pos);
                    size_t notify_len = chunk_size_ - chunk_bytes_read_;
                    total_bytes_read_ += notify_len;
                    chunk_bytes_read_ = chunk_size_ = 0; // reset
                    chunk_state_ = CHUNK_READ_DATA_CR;
                    cur_pos += notify_len;
                    DESTROY_DETECTOR_SETUP();
                    onBodyData(notify_data, notify_len);
                    DESTROY_DETECTOR_CHECK(PARSE_STATE_DESTROYED);
                } else {// need more data
                    char* notify_data = const_cast<char*>(cur_pos);
                    total_bytes_read_ += cur_len;
                    chunk_bytes_read_ += cur_len;
                    cur_pos += cur_len;
                    onBodyData(notify_data, cur_len);
                    return PARSE_STATE_CONTINUE;
                }
                break;
            }
            case CHUNK_READ_DATA_CR:
            {
                if(*cur_pos != CR) {
                    KM_ERRTRACE("HttpParser::parseChunk, can not find data CR");
                    read_state_ = HTTP_READ_ERROR;
                    return PARSE_STATE_ERROR;
                }
                ++cur_pos;
                chunk_state_ = CHUNK_READ_DATA_LF;
                break;
            }
            case CHUNK_READ_DATA_LF:
            {
                if(*cur_pos != LF) {
                    KM_ERRTRACE("HttpParser::parseChunk, can not find data LF");
                    read_state_ = HTTP_READ_ERROR;
                    return PARSE_STATE_ERROR;
                }
                ++cur_pos;
                chunk_state_ = CHUNK_READ_SIZE;
                break;
            }
            case CHUNK_READ_TRAILER:
            {
                b_line = getLine(cur_pos, end, p_line, p_end);
                if(b_line) {
                    if(p_line == p_end && bufferEmpty()) {
                        // blank line, http completed
                        read_state_ = HTTP_READ_DONE;
                        onComplete();
                        return PARSE_STATE_DONE;
                    }
                    clearBuffer(); // discard trailer
                } else { // need more data
                    if(saveData(cur_pos, end) != KMError::NOERR) {
                        return PARSE_STATE_ERROR;
                    }
                    cur_pos = end; // all data was consumed
                    return PARSE_STATE_CONTINUE;
                }
                break;
            }
        }
    }
    return HTTP_READ_DONE == read_state_?PARSE_STATE_DONE:PARSE_STATE_CONTINUE;
}

void HttpParser::Impl::onHeaderComplete()
{
    if(has_content_length_) {
        KM_INFOTRACE("HttpParser::onHeaderComplete, Content-Length="<<content_length_);
    }
    if(is_chunked_) {
        KM_INFOTRACE("HttpParser::onHeaderComplete, Transfer-Encoding=" << getHeaderValue(strTransferEncoding));
    }
    auto const &contentEncoding = getHeaderValue(strContentEncoding);
    if (!contentEncoding.empty()) {
        KM_INFOTRACE("HttpParser::onHeaderComplete, Content-Encoding=" << contentEncoding);
    }

    if(event_cb_) event_cb_(HttpEvent::HEADER_COMPLETE);
}

void HttpParser::Impl::onBodyData(const char* data, size_t len)
{
    if (data_cb_) {
        KMBuffer buf(data, len, len);
        data_cb_(buf);
    }
}

void HttpParser::Impl::onBodyData(KMBuffer &buf)
{
    if (data_cb_) {
        data_cb_(buf);
    }
}

void HttpParser::Impl::onComplete()
{
    KM_INFOTRACE("HttpParser::onComplete");
    if(event_cb_) event_cb_(HttpEvent::COMPLETE);
}

bool HttpParser::Impl::decodeUrl()
{
    std::string new_url;
    size_t i = 0;
    auto len = url_.length();
    const char * p_str = url_.c_str();
    while (i < len)
    {
        switch (p_str[i])
        {
            case '+':
                new_url.append(1, ' ');
                i++;
                break;

            case '%':
                if (p_str[i + 1] == '%') {
                    new_url.append(1, '%');
                    i += 2;
                } else if(p_str[i + 1] == '\0') {
                    return false;
                } else {
                    char ch1 = p_str[i + 1];
                    char ch2 = p_str[i + 2];
                    ch1 = ch1 >= 'A' ? ((ch1 & 0xdf) - 'A' + 10) : ch1 - '0';
                    ch2 = ch2 >= 'A' ? ((ch2 & 0xdf) - 'A' + 10) : ch2 - '0';
                    new_url.append(1, (char)(ch1*16 + ch2));
                    i += 3;
                }
                break;

            default:
                new_url.append(1, p_str[i++]);
                break;
        }
    }

    std::swap(url_, new_url);
    return true;
}

bool HttpParser::Impl::parseUrl()
{
    Uri uri;
    if(!uri.parse(url_)) {
        return false;
    }
    url_path_ = uri.getPath();
    url_query_ = uri.getQuery();
    const std::string& query = uri.getQuery();
    std::string::size_type pos = 0;
    while (true) {
        auto pos1 = query.find('=', pos);
        if(pos1 == std::string::npos){
            break;
        }
        std::string name(query.begin()+pos, query.begin()+pos1);
        pos = pos1 + 1;
        pos1 = query.find('&', pos);
        if(pos1 == std::string::npos){
            std::string value(query.begin()+pos, query.end());
            addParamValue(std::move(name), std::move(value));
            break;
        }
        std::string value(query.begin()+pos, query.begin()+pos1);
        pos = pos1 + 1;
        addParamValue(std::move(name), std::move(value));
    }

    return true;
}

void HttpParser::Impl::addParamValue(std::string name, std::string value)
{
    if(!name.empty()) {
        param_map_[std::move(name)] = std::move(value);
    }
}

void HttpParser::Impl::addHeaderValue(std::string name, std::string value)
{
    kev::trim_left(name, ' ');
    kev::trim_right(name, ' ');
    kev::trim_left(value, ' ');
    kev::trim_right(value, ' ');
    if(!name.empty()) {
        HttpHeader::addHeader(std::move(name), std::move(value));
    }
}

const std::string& HttpParser::Impl::getParamValue(const std::string& name) const
{
    auto it = param_map_.find(name);
    if (it != param_map_.end()) {
        return (*it).second;
    }
    return EmptyString;
}

const std::string& HttpParser::Impl::getHeaderValue(const std::string& name) const
{
    return HttpHeader::getHeader(name);
}

void HttpParser::Impl::forEachParam(const EnumerateCallback &cb) const
{
    for (auto &kv : param_map_) {
        if (!cb(kv.first, kv.second)) {
            break;
        }
    }
}

void HttpParser::Impl::forEachHeader(const EnumerateCallback &cb) const
{
    for (auto &kv : header_vec_) {
        if (!cb(kv.first, kv.second)) {
            break;
        }
    }
}

void HttpParser::Impl::setMethod(std::string m)
{
    method_ = std::move(m);
}

void HttpParser::Impl::setUrl(std::string url)
{
    url_ = std::move(url);
}

void HttpParser::Impl::setUrlPath(std::string path)
{
    url_path_ = std::move(path);
}

void HttpParser::Impl::setVersion(std::string ver)
{
    version_ = std::move(ver);
}

void HttpParser::Impl::setStatusCode(int status_code)
{
    status_code_ = status_code;
}

bool HttpParser::Impl::getLine(const char*& cur_pos, const char* end, const char*& line, const char*& line_end)
{
    const char* lf = std::find(cur_pos, end, LF);
    if(lf == end) {
        return false;
    }
    line = cur_pos;
    line_end = lf;
    cur_pos = lf + 1;
    if(line != line_end && *(line_end - 1) == CR) {
        --line_end;
    }
    return true;
}


text:
.class public final Lcom/google/android/gms/games/Games$GamesOptions$Builder;
.super Ljava/lang/Object;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/google/android/gms/games/Games$GamesOptions;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "Builder"
.end annotation

# instance fields
.field ta:Z

.field tb:Z

.field tc:I

.field td:I

# direct methods
.method private constructor <init>()V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->ta:Z

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tb:Z

    const/16 v0, 0x11

    iput v0, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tc:I

    const/16 v0, 0x1110

    iput v0, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->td:I

    return-void
.end method

.method synthetic constructor <init>(Lcom/google/android/gms/games/Games$1;)V
    .locals 0

    invoke-direct {p0}, Lcom/google/android/gms/games/Games$GamesOptions$Builder;-><init>()V

    return-void
.end method

# virtual methods
.method public final build()Lcom/google/android/gms/games/Games$GamesOptions;
    .locals 2

    new-instance v0, Lcom/google/android/gms/games/Games$GamesOptions;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/google/android/gms/games/Games$GamesOptions;-><init>(Lcom/google/android/gms/games/Games$GamesOptions$Builder;Lcom/google/android/gms/games/Games$1;)V

    return-object v0
.end method

.method public final setSdkVariant(I)Lcom/google/android/gms/games/Games$GamesOptions$Builder;
    .locals 0

    iput p1, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->td:I

    return-object p0
.end method

.method public final setShowConnectingPopup(Z)Lcom/google/android/gms/games/Games$GamesOptions$Builder;
    .locals 1

    iput-boolean p1, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tb:Z

    const/16 v0, 0x11

    iput v0, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tc:I

    return-object p0
.end method

.method public final setShowConnectingPopup(ZI)Lcom/google/android/gms/games/Games$GamesOptions$Builder;
    .locals 0

    iput-boolean p1, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tb:Z

    iput p2, p0, Lcom/google/android/gms/games/Games$GamesOptions$Builder;->tc:I

    return-object p0
.end method


text:
/

#ifndef Point_H
#define Point_H

//***************************************************************************
//  Includes
//***************************************************************************

#include "IFXVector3.h"

namespace U3D_IDTF
{
	//***************************************************************************
	//  Defines
	//***************************************************************************

	//***************************************************************************
	//  Constants
	//***************************************************************************

	//***************************************************************************
	//  Enumerations
	//***************************************************************************

	//***************************************************************************
	//  Classes, structures and types
	//***************************************************************************

	/**
	This is the implementation of a class that is used to @todo: usage.

	It supports the following interfaces:  @todo: interfaces.
	*/
	class Point
	{
	public:
		Point() {};
		virtual ~Point() {};

		/**
		@todo:  INSERT CUSTOM METHOD PROTOTYPES AND DESCRIPTIONS.
		DOCUMENT THEM IN ONLY ONE SPOT.  IT'S BEST TO DO THIS IN THE
		INTERFACE HEADER HERE TO REDUCE DUPLICATION.

		@param  inputValue    An input value.
		@param  pOutputValue  A pointer to the output value that is
		initialize upon success.

		@return Upon success, IFX_OK is returned.  Otherwise, one of the
		following failures are returned:  @todo: return codes.
		*/
		void SetPoint( const IFXVector3& rPoint );
		const IFXVector3& GetPoint() const;

	protected:

	private:
		IFXVector3 m_point;
	};

	//***************************************************************************
	//  Inline functions
	//***************************************************************************

	IFXFORCEINLINE void Point::SetPoint( const IFXVector3& rPoint )
	{
		m_point = rPoint;
	}

	IFXFORCEINLINE const IFXVector3& Point::GetPoint() const
	{
		return m_point;
	}

	//***************************************************************************
	//  Global function prototypes
	//***************************************************************************

	//***************************************************************************
	//  Global data
	//***************************************************************************

	//***************************************************************************
	//  Failure return codes
	//***************************************************************************

	/**
	@todo:  Insert module/interface specific return code description.
	*/
	//#define IFX_E_????  MAKE_IFXRESULT_FAIL( IFXRESULT_COMPONENT_????, 0x0000 )

}

#endif


text:
describe('Weather API', function(){

});


text:
"""The motionEye integration."""
from __future__ import annotations

from types import MappingProxyType
from typing import Any

import aiohttp
from jinja2 import Template
from motioneye_client.client import MotionEyeClient, MotionEyeClientURLParseError
from motioneye_client.const import (
    DEFAULT_SURVEILLANCE_USERNAME,
    KEY_ACTION_SNAPSHOT,
    KEY_MOTION_DETECTION,
    KEY_NAME,
    KEY_STREAMING_AUTH_MODE,
    KEY_TEXT_OVERLAY_CAMERA_NAME,
    KEY_TEXT_OVERLAY_CUSTOM_TEXT,
    KEY_TEXT_OVERLAY_CUSTOM_TEXT_LEFT,
    KEY_TEXT_OVERLAY_CUSTOM_TEXT_RIGHT,
    KEY_TEXT_OVERLAY_DISABLED,
    KEY_TEXT_OVERLAY_LEFT,
    KEY_TEXT_OVERLAY_RIGHT,
    KEY_TEXT_OVERLAY_TIMESTAMP,
)
import voluptuous as vol

from homeassistant.components.mjpeg import (
    CONF_MJPEG_URL,
    CONF_STILL_IMAGE_URL,
    MjpegCamera,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
    CONF_AUTHENTICATION,
    CONF_NAME,
    CONF_PASSWORD,
    CONF_USERNAME,
    HTTP_BASIC_AUTHENTICATION,
    HTTP_DIGEST_AUTHENTICATION,
    Platform,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator

from . import (
    MotionEyeEntity,
    get_camera_from_cameras,
    is_acceptable_camera,
    listen_for_new_cameras,
)
from .const import (
    CONF_ACTION,
    CONF_CLIENT,
    CONF_COORDINATOR,
    CONF_STREAM_URL_TEMPLATE,
    CONF_SURVEILLANCE_PASSWORD,
    CONF_SURVEILLANCE_USERNAME,
    DOMAIN,
    MOTIONEYE_MANUFACTURER,
    SERVICE_ACTION,
    SERVICE_SET_TEXT_OVERLAY,
    SERVICE_SNAPSHOT,
    TYPE_MOTIONEYE_MJPEG_CAMERA,
)

PLATFORMS = [Platform.CAMERA]

SCHEMA_TEXT_OVERLAY = vol.In(
    [
        KEY_TEXT_OVERLAY_DISABLED,
        KEY_TEXT_OVERLAY_TIMESTAMP,
        KEY_TEXT_OVERLAY_CUSTOM_TEXT,
        KEY_TEXT_OVERLAY_CAMERA_NAME,
    ]
)
SCHEMA_SERVICE_SET_TEXT = vol.Schema(
    vol.All(
        cv.make_entity_service_schema(
            {
                vol.Optional(KEY_TEXT_OVERLAY_LEFT): SCHEMA_TEXT_OVERLAY,
                vol.Optional(KEY_TEXT_OVERLAY_CUSTOM_TEXT_LEFT): cv.string,
                vol.Optional(KEY_TEXT_OVERLAY_RIGHT): SCHEMA_TEXT_OVERLAY,
                vol.Optional(KEY_TEXT_OVERLAY_CUSTOM_TEXT_RIGHT): cv.string,
            },
        ),
        cv.has_at_least_one_key(
            KEY_TEXT_OVERLAY_LEFT,
            KEY_TEXT_OVERLAY_CUSTOM_TEXT_LEFT,
            KEY_TEXT_OVERLAY_RIGHT,
            KEY_TEXT_OVERLAY_CUSTOM_TEXT_RIGHT,
        ),
    ),
)

async def async_setup_entry(
    hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
    """Set up motionEye from a config entry."""
    entry_data = hass.data[DOMAIN][entry.entry_id]

    @callback
    def camera_add(camera: dict[str, Any]) -> None:
        """Add a new motionEye camera."""
        async_add_entities(
            [
                MotionEyeMjpegCamera(
                    entry.entry_id,
                    entry.data.get(
                        CONF_SURVEILLANCE_USERNAME, DEFAULT_SURVEILLANCE_USERNAME
                    ),
                    entry.data.get(CONF_SURVEILLANCE_PASSWORD, ""),
                    camera,
                    entry_data[CONF_CLIENT],
                    entry_data[CONF_COORDINATOR],
                    entry.options,
                )
            ]
        )

    listen_for_new_cameras(hass, entry, camera_add)

    platform = entity_platform.async_get_current_platform()
    platform.async_register_entity_service(
        SERVICE_SET_TEXT_OVERLAY,
        SCHEMA_SERVICE_SET_TEXT,
        "async_set_text_overlay",
    )
    platform.async_register_entity_service(
        SERVICE_ACTION,
        {vol.Required(CONF_ACTION): cv.string},
        "async_request_action",
    )
    platform.async_register_entity_service(
        SERVICE_SNAPSHOT,
        {},
        "async_request_snapshot",
    )

class MotionEyeMjpegCamera(MotionEyeEntity, MjpegCamera):
    """motionEye mjpeg camera."""

    _name: str

    def __init__(
        self,
        config_entry_id: str,
        username: str,
        password: str,
        camera: dict[str, Any],
        client: MotionEyeClient,
        coordinator: DataUpdateCoordinator,
        options: MappingProxyType[str, str],
    ) -> None:
        """Initialize a MJPEG camera."""
        self._surveillance_username = username
        self._surveillance_password = password
        self._motion_detection_enabled: bool = camera.get(KEY_MOTION_DETECTION, False)

        # motionEye cameras are always streaming or unavailable.
        self._attr_is_streaming = True

        MotionEyeEntity.__init__(
            self,
            config_entry_id,
            TYPE_MOTIONEYE_MJPEG_CAMERA,
            camera,
            client,
            coordinator,
            options,
        )
        MjpegCamera.__init__(
            self,
            verify_ssl=False,
            **self._get_mjpeg_camera_properties_for_camera(camera),
        )

    @callback
    def _get_mjpeg_camera_properties_for_camera(
        self, camera: dict[str, Any]
    ) -> dict[str, Any]:
        """Convert a motionEye camera to MjpegCamera internal properties."""
        auth = None
        if camera.get(KEY_STREAMING_AUTH_MODE) in (
            HTTP_BASIC_AUTHENTICATION,
            HTTP_DIGEST_AUTHENTICATION,
        ):
            auth = camera[KEY_STREAMING_AUTH_MODE]

        streaming_template = self._options.get(CONF_STREAM_URL_TEMPLATE, "").strip()
        streaming_url = None

        if streaming_template:
            # Note: Can't use homeassistant.helpers.template as it requires hass
            # which is not available during entity construction.
            streaming_url = Template(streaming_template).render(**camera)
        else:
            try:
                streaming_url = self._client.get_camera_stream_url(camera)
            except MotionEyeClientURLParseError:
                pass

        return {
            CONF_NAME: camera[KEY_NAME],
            CONF_USERNAME: self._surveillance_username if auth is not None else None,
            CONF_PASSWORD: self._surveillance_password if auth is not None else "",
            CONF_MJPEG_URL: streaming_url or "",
            CONF_STILL_IMAGE_URL: self._client.get_camera_snapshot_url(camera),
            CONF_AUTHENTICATION: auth,
        }

    @callback
    def _set_mjpeg_camera_state_for_camera(self, camera: dict[str, Any]) -> None:
        """Set the internal state to match the given camera."""

        # Sets the state of the underlying (inherited) MjpegCamera based on the updated
        # MotionEye camera dictionary.
        properties = self._get_mjpeg_camera_properties_for_camera(camera)
        self._name = properties[CONF_NAME]
        self._username = properties[CONF_USERNAME]
        self._password = properties[CONF_PASSWORD]
        self._mjpeg_url = properties[CONF_MJPEG_URL]
        self._still_image_url = properties[CONF_STILL_IMAGE_URL]
        self._authentication = properties[CONF_AUTHENTICATION]

        if (
            self._authentication == HTTP_BASIC_AUTHENTICATION
            and self._username is not None
        ):
            self._auth = aiohttp.BasicAuth(self._username, password=self._password)

    def _is_acceptable_streaming_camera(self) -> bool:
        """Determine if a camera is streaming/usable."""
        return is_acceptable_camera(
            self._camera
        ) and MotionEyeClient.is_camera_streaming(self._camera)

    @property
    def available(self) -> bool:
        """Return if entity is available."""
        return super().available and self._is_acceptable_streaming_camera()

    @callback
    def _handle_coordinator_update(self) -> None:
        """Handle updated data from the coordinator."""
        self._camera = get_camera_from_cameras(self._camera_id, self.coordinator.data)
        if self._camera and self._is_acceptable_streaming_camera():
            self._set_mjpeg_camera_state_for_camera(self._camera)
            self._motion_detection_enabled = self._camera.get(
                KEY_MOTION_DETECTION, False
            )
        super()._handle_coordinator_update()

    @property
    def brand(self) -> str:
        """Return the camera brand."""
        return MOTIONEYE_MANUFACTURER

    @property
    def motion_detection_enabled(self) -> bool:
        """Return the camera motion detection status."""
        return self._motion_detection_enabled

    async def async_set_text_overlay(
        self,
        left_text: str | None = None,
        right_text: str | None = None,
        custom_left_text: str | None = None,
        custom_right_text: str | None = None,
    ) -> None:
        """Set text overlay for a camera."""
        # Fetch the very latest camera config to reduce the risk of updating with a
        # stale configuration.
        camera = await self._client.async_get_camera(self._camera_id)
        if not camera:
            return
        if left_text is not None:
            camera[KEY_TEXT_OVERLAY_LEFT] = left_text
        if right_text is not None:
            camera[KEY_TEXT_OVERLAY_RIGHT] = right_text
        if custom_left_text is not None:
            camera[KEY_TEXT_OVERLAY_CUSTOM_TEXT_LEFT] = custom_left_text.encode(
                "unicode_escape"
            ).decode("UTF-8")
        if custom_right_text is not None:
            camera[KEY_TEXT_OVERLAY_CUSTOM_TEXT_RIGHT] = custom_right_text.encode(
                "unicode_escape"
            ).decode("UTF-8")
        await self._client.async_set_camera(self._camera_id, camera)

    async def async_request_action(self, action: str) -> None:
        """Call a motionEye action on a camera."""
        await self._client.async_action(self._camera_id, action)

    async def async_request_snapshot(self) -> None:
        """Request a motionEye snapshot be saved."""
        await self.async_request_action(KEY_ACTION_SNAPSHOT)


text:
package cz.metacentrum.perun.core.impl.modules;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import cz.metacentrum.perun.core.api.exceptions.rt.ModulePropertyNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static cz.metacentrum.perun.core.impl.Utils.notNull;

/**
 * @author Vojtech Sassmann <vojtech.sassmann@gmail.com>
 */

public class ModulesYamlConfigLoader implements ModulesConfigLoader {

	private final static Logger log = LoggerFactory.getLogger(ModulesYamlConfigLoader.class);

	private String modulesDirPath = "/etc/perun/modules/";

	public ModulesYamlConfigLoader() { }

	public ModulesYamlConfigLoader(String modulesDirPath) {
		this.modulesDirPath = modulesDirPath;
	}

	@Override
	public String loadString(String moduleName, String property) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			throw new ModulePropertyNotFoundException(moduleName, property);
		}
		return propertyNode.asText();
	}

	@Override
	public String loadStringOrDefault(String moduleName, String property, String defaultValue) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			return defaultValue;
		}
		return propertyNode.asText();
	}

	@Override
	public Integer loadInteger(String moduleName, String property) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			throw new ModulePropertyNotFoundException(moduleName, property);
		}
		return propertyNode.asInt();
	}

	@Override
	public Integer loadIntegerOrDefault(String moduleName, String property, Integer defaultValue) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			return defaultValue;
		}
		return propertyNode.asInt();
	}

	@Override
	public List<String> loadStringList(String moduleName, String property) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			throw new ModulePropertyNotFoundException(moduleName, property);
		}
		List<String> values = new ArrayList<>();
		propertyNode.iterator().forEachRemaining(node -> values.add(node.asText()));
		return values;
	}

	@Override
	public List<String> loadStringListOrDefault(String moduleName, String property, List<String> defaultValue) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			return defaultValue;
		}
		List<String> values = new ArrayList<>();
		propertyNode.iterator().forEachRemaining(node -> values.add(node.asText()));
		return values;
	}

	@Override
	public List<Integer> loadIntegerList(String moduleName, String property) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			throw new ModulePropertyNotFoundException(moduleName, property);
		}
		List<Integer> values = new ArrayList<>();
		propertyNode.iterator().forEachRemaining(node -> values.add(node.isNull() ? null : node.asInt()));
		return values;
	}

	@Override
	public List<Integer> loadIntegerListOrDefault(String moduleName, String property, List<Integer> defaultValue) {
		JsonNode propertyNode = loadPropertyNode(moduleName, property);
		if (propertyNode == null || propertyNode.isNull()) {
			return defaultValue;
		}
		List<Integer> values = new ArrayList<>();
		propertyNode.iterator().forEachRemaining(node -> values.add(node.isNull() ? null : node.asInt()));
		return values;
	}

	/**
	 * Loads a JsonNode corresponding to the given module and property name.
	 * This method expects a {moduleName}.yaml file at the modulesDirPath.
	 *
	 * @param moduleName name of the module
	 * @param propertyName property name
	 * @return JsonNode corresponding to the desired property.
	 */
	private JsonNode loadPropertyNode(String moduleName, String propertyName) {
		notNull(moduleName, "configFile");
		notNull(propertyName, "propertyName");

		String path = modulesDirPath + moduleName + ".yaml";

		JsonNode root = loadModulesYamlFile(path);

		return parsePropertyNode(root, propertyName);
	}

	/**
	 * Parse a corresponding JsonNode from the given root node, with the specified property name.
	 * The syntax supports a dot notation to identify children nodes. Eg: oidc.client.id.
	 *
	 * @param root root node
	 * @param propertyName name of the desired property
	 * @return JsonNode corresponding to the specified property name
	 */
	private static JsonNode parsePropertyNode(JsonNode root, String propertyName) {
		JsonNode currentNode = root;
		while (propertyName.contains(".")) {
			String[] split = propertyName.split("\\.", 2);
			currentNode = currentNode.get(split[0]);
			propertyName = split[1];
		}
		return currentNode.get(propertyName);
	}

	/**
	 * Loads a root JsonNode from the given path.
	 *
	 * @param path path
	 * @return loaded root JsonNode
	 */
	private static JsonNode loadModulesYamlFile(String path) {
		try {
			YAMLMapper mapper = new YAMLMapper();
			return mapper.readTree(new File(path));
		} catch (IOException e) {
			log.error("Failed to load a module's yaml property file at: {}", path);
			throw new ModulePropertyNotFoundException("Failed to load a module's yaml property file.", e);
		}
	}
}


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.IO;
using NUnit.Framework;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Tests.Resources;
using System.Linq;
using osu.Game.Audio;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Timing;
using osu.Game.Skinning;

namespace osu.Game.Tests.Beatmaps.Formats
{
    [TestFixture]
    public class LegacyBeatmapDecoderTest
    {
        [Test]
        public void TestDecodeBeatmapGeneral()
        {
            var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var beatmap = decoder.Decode(stream);
                var beatmapInfo = beatmap.BeatmapInfo;
                var metadata = beatmap.Metadata;

                Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", metadata.AudioFile);
                Assert.AreEqual(0, beatmapInfo.AudioLeadIn);
                Assert.AreEqual(164471, metadata.PreviewTime);
                Assert.IsFalse(beatmapInfo.Countdown);
                Assert.AreEqual(0.7f, beatmapInfo.StackLeniency);
                Assert.IsTrue(beatmapInfo.RulesetID == 0);
                Assert.IsFalse(beatmapInfo.LetterboxInBreaks);
                Assert.IsFalse(beatmapInfo.SpecialStyle);
                Assert.IsFalse(beatmapInfo.WidescreenStoryboard);
            }
        }

        [Test]
        public void TestDecodeBeatmapEditor()
        {
            var decoder = new LegacyBeatmapDecoder();
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var beatmapInfo = decoder.Decode(stream).BeatmapInfo;

                int[] expectedBookmarks =
                {
                    11505, 22054, 32604, 43153, 53703, 64252, 74802, 85351,
                    95901, 106450, 116999, 119637, 130186, 140735, 151285,
                    161834, 164471, 175020, 185570, 196119, 206669, 209306
                };
                Assert.AreEqual(expectedBookmarks.Length, beatmapInfo.Bookmarks.Length);
                for (int i = 0; i < expectedBookmarks.Length; i++)
                    Assert.AreEqual(expectedBookmarks[i], beatmapInfo.Bookmarks[i]);
                Assert.AreEqual(1.8, beatmapInfo.DistanceSpacing);
                Assert.AreEqual(4, beatmapInfo.BeatDivisor);
                Assert.AreEqual(4, beatmapInfo.GridSize);
                Assert.AreEqual(2, beatmapInfo.TimelineZoom);
            }
        }

        [Test]
        public void TestDecodeBeatmapMetadata()
        {
            var decoder = new LegacyBeatmapDecoder();
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var beatmap = decoder.Decode(stream);
                var beatmapInfo = beatmap.BeatmapInfo;
                var metadata = beatmap.Metadata;

                Assert.AreEqual("Renatus", metadata.Title);
                Assert.AreEqual("Renatus", metadata.TitleUnicode);
                Assert.AreEqual("Soleily", metadata.Artist);
                Assert.AreEqual("Soleily", metadata.ArtistUnicode);
                Assert.AreEqual("Gamu", metadata.AuthorString);
                Assert.AreEqual("Insane", beatmapInfo.Version);
                Assert.AreEqual(string.Empty, metadata.Source);
                Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags);
                Assert.AreEqual(557821, beatmapInfo.OnlineBeatmapID);
                Assert.AreEqual(241526, metadata.OnlineBeatmapSetID);
            }
        }

        [Test]
        public void TestDecodeBeatmapDifficulty()
        {
            var decoder = new LegacyBeatmapDecoder();
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var difficulty = decoder.Decode(stream).BeatmapInfo.BaseDifficulty;

                Assert.AreEqual(6.5f, difficulty.DrainRate);
                Assert.AreEqual(4, difficulty.CircleSize);
                Assert.AreEqual(8, difficulty.OverallDifficulty);
                Assert.AreEqual(9, difficulty.ApproachRate);
                Assert.AreEqual(1.8, difficulty.SliderMultiplier);
                Assert.AreEqual(2, difficulty.SliderTickRate);
            }
        }

        [Test]
        public void TestDecodeBeatmapEvents()
        {
            var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var beatmap = decoder.Decode(stream);
                var metadata = beatmap.Metadata;
                var breakPoint = beatmap.Breaks[0];

                Assert.AreEqual("machinetop_background.jpg", metadata.BackgroundFile);
                Assert.AreEqual(122474, breakPoint.StartTime);
                Assert.AreEqual(140135, breakPoint.EndTime);
                Assert.IsTrue(breakPoint.HasEffect);
            }
        }

        [Test]
        public void TestDecodeBeatmapTimingPoints()
        {
            var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var beatmap = decoder.Decode(stream);
                var controlPoints = beatmap.ControlPointInfo;

                Assert.AreEqual(4, controlPoints.TimingPoints.Count);
                var timingPoint = controlPoints.TimingPoints[0];
                Assert.AreEqual(956, timingPoint.Time);
                Assert.AreEqual(329.67032967033d, timingPoint.BeatLength);
                Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                Assert.AreEqual(5, controlPoints.DifficultyPoints.Count);
                var difficultyPoint = controlPoints.DifficultyPoints[0];
                Assert.AreEqual(116999, difficultyPoint.Time);
                Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier);

                Assert.AreEqual(34, controlPoints.SamplePoints.Count);
                var soundPoint = controlPoints.SamplePoints[0];
                Assert.AreEqual(956, soundPoint.Time);
                Assert.AreEqual("soft", soundPoint.SampleBank);
                Assert.AreEqual(60, soundPoint.SampleVolume);

                Assert.AreEqual(8, controlPoints.EffectPoints.Count);
                var effectPoint = controlPoints.EffectPoints[0];
                Assert.AreEqual(53703, effectPoint.Time);
                Assert.IsTrue(effectPoint.KiaiMode);
                Assert.IsFalse(effectPoint.OmitFirstBarLine);
            }
        }

        [Test]
        public void TestDecodeBeatmapColors()
        {
            var decoder = new LegacySkinDecoder();
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var comboColors = decoder.Decode(stream).ComboColours;

                Color4[] expectedColors =
                {
                    new Color4(142, 199, 255, 255),
                    new Color4(255, 128, 128, 255),
                    new Color4(128, 255, 255, 255),
                    new Color4(128, 255, 128, 255),
                    new Color4(255, 187, 255, 255),
                    new Color4(255, 177, 140, 255),
                };
                Assert.AreEqual(expectedColors.Length, comboColors.Count);
                for (int i = 0; i < expectedColors.Length; i++)
                    Assert.AreEqual(expectedColors[i], comboColors[i]);
            }
        }

        [Test]
        public void TestDecodeBeatmapHitObjects()
        {
            var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
            using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
            using (var stream = new StreamReader(resStream))
            {
                var hitObjects = decoder.Decode(stream).HitObjects;

                var curveData = hitObjects[0] as IHasCurve;
                var positionData = hitObjects[0] as IHasPosition;

                Assert.IsNotNull(positionData);
                Assert.IsNotNull(curveData);
                Assert.AreEqual(new Vector2(192, 168), positionData.Position);
                Assert.AreEqual(956, hitObjects[0].StartTime);
                Assert.IsTrue(hitObjects[0].Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL));

                positionData = hitObjects[1] as IHasPosition;

                Assert.IsNotNull(positionData);
                Assert.AreEqual(new Vector2(304, 56), positionData.Position);
                Assert.AreEqual(1285, hitObjects[1].StartTime);
                Assert.IsTrue(hitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP));
            }
        }
    }
}


text:
package com.timelesssoftware.popularmovies.Utils.Pallete;

import android.content.Context;
import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.v7.graphics.Palette;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;

/**
 * Created by Luka on 5. 10. 2017.
 */

class PaletteBitmapTranscoder implements ResourceTranscoder<Bitmap,  PaletteBitmap> {
    private final BitmapPool bitmapPool;

    public PaletteBitmapTranscoder(@NonNull Context context) {
        this.bitmapPool = Glide.get(context).getBitmapPool();
    }

    @Override public Resource<PaletteBitmap> transcode(Resource<Bitmap> toTranscode) {
        Bitmap bitmap = toTranscode.get();
        Palette palette = new Palette.Builder(bitmap).generate();
        PaletteBitmap result = new PaletteBitmap(bitmap, palette);
        return new PaletteBitmapResource(result, bitmapPool);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Arebis.Globalization
{
    /// <summary>
    /// Withing a CultureScope, CurrentCulture and CurrentUICulture can be overriden. When disposing
    /// the scope, the original cultures are restored.
    /// </summary>
    public class CultureScope : IDisposable
    {
        private CultureInfo originalCulture;
        private CultureInfo originalUICulture;

        /// <summary>
        /// Creates as CultureScope with invariant culture.
        /// </summary>
        public static CultureScope Invariant
        {
            get
            {
                return new CultureScope(CultureInfo.InvariantCulture);
            }
        }

        /// <summary>
        /// Overrides only the CurrentCulture within this scope.
        /// </summary>
        /// <param name="cultureId">LCID of a CultureInfo or a Windows-only culture identifier to set as CurrentCulture.</param>
        public CultureScope(int cultureId)
            : this(new CultureInfo(cultureId))
        { }

        /// <summary>
        /// Overrides the CurrentCulture and/or CurrentUICulture within this scope.
        /// </summary>
        /// <param name="cultureId">LCID of a CultureInfo or a Windows-only culture identifier, or null to leave the CurrentCulture untouched.</param>
        /// <param name="uiCultureId">LCID of a CultureInfo or a Windows-only culture identifier, or null to leave the CurrentUICulture untouched.</param>
        public CultureScope(int? cultureId, int? uiCultureId)
            : this((cultureId.HasValue) ? new CultureInfo(cultureId.Value) : null, (uiCultureId.HasValue) ? new CultureInfo(uiCultureId.Value) : null)
        { }

        /// <summary>
        /// Overrides only the CurrentCulture within this scope.
        /// </summary>
        /// <param name="cultureName">CultureInfo name to set as CurrentCulture.</param>
        public CultureScope(string cultureName)
            : this((cultureName != null) ? new CultureInfo(cultureName) : null)
        { }

        /// <summary>
        /// Overrides the CurrentCulture and/or CurrentUICulture within this scope.
        /// </summary>
        /// <param name="cultureName">CultureInfo name to set as CurrentCulture, or null to leave the CurrentCulture untouched.</param>
        /// <param name="uiCultureName">CultureInfo name to set as CurrentUICulture, or null to leave the CurrentUICulture untouched.</param>
        public CultureScope(string cultureName, string uiCultureName)
            : this((cultureName != null) ? new CultureInfo(cultureName) : null, (uiCultureName != null) ? new CultureInfo(uiCultureName) : null)
        { }

        /// <summary>
        /// Overrides only the CurrentCulture within this scope.
        /// </summary>
        /// <param name="culture">CultureInfo to set as CurrentCulture.</param>
        public CultureScope(CultureInfo culture)
            : this(culture, null)
        { }

        /// <summary>
        /// Overrides the CurrentCulture and/or CurrentUICulture within this scope.
        /// </summary>
        /// <param name="culture">CultureInfo to set as CurrentCulture, or null to leave the CurrentCulture untouched.</param>
        /// <param name="uiCulture">CultureInfo to set as CurrentUICulture, or null to leave the CurrentUICulture untouched.</param>
        public CultureScope(CultureInfo culture, CultureInfo uiCulture)
        {
            // Store original values:
            this.originalCulture = CultureInfo.CurrentCulture;
            this.originalUICulture = CultureInfo.CurrentUICulture;

            // Set scope values:
            System.Threading.Thread.CurrentThread.CurrentCulture = culture ?? System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = uiCulture ?? System.Threading.Thread.CurrentThread.CurrentUICulture;
        }

        /// <summary>
        /// Disposes the CultureScope, restoring the original CurrentCulture and CurrentUICulture.
        /// </summary>
        public void Dispose()
        {
            // Restore original values:
            System.Threading.Thread.CurrentThread.CurrentCulture = this.originalCulture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = this.originalUICulture;
        }
    }
}


text:
'use strict';

import nls = require('vs/nls');

import { Registry } from 'vs/platform/platform';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';

import './actions/expandAbbreviation';
import './actions/balance';
import './actions/matchingPair';
import './actions/wrapWithAbbreviation';
import './actions/editPoints';
import './actions/selectItem';
import './actions/toggleComment';
import './actions/splitJoinTag';
import './actions/removeTag';
import './actions/mergeLines';
import './actions/updateImageSize';
import './actions/evaluateMath';
import './actions/incrementDecrement';
import './actions/reflectCssValue';
// import './actions/base64'; // disabled - we will revisit the implementation
import './actions/updateTag';

// Configuration: emmet
const configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigurationExtensions.Configuration);
configurationRegistry.registerConfiguration({
	'id': 'emmet',
	'order': 6,
	'title': nls.localize('emmetConfigurationTitle', "Emmet"),
	'type': 'object',
	'properties': {
		'emmet.triggerExpansionOnTab': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('triggerExpansionOnTab', "When enabled, emmet abbreviations are expanded when pressing TAB.")
		},
		'emmet.preferences': {
			'type': 'object',
			'default': {},
			'description': nls.localize('emmetPreferences', "Preferences used to modify behavior of some actions and resolvers of Emmet.")
		},
		'emmet.syntaxProfiles': {
			'type': 'object',
			'default': {},
			'description': nls.localize('emmetSyntaxProfiles', "Define profile for specified syntax or use your own profile with specific rules.")
		},
		'emmet.excludeLanguages': {
			'type': 'array',
			'default': ['markdown'],
			'description': nls.localize('emmetExclude', "An array of languages where emmet abbreviations should not be expanded.")
		},
	}
});


text:
// $Id: KmaService.java 545 2008-06-13 11:13:05Z sven $

package com.nortal.jroad.client.kmais;

import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.BlacklistVastus;

import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.IdIsikukoodNimiFrag;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.IllegaalVastus;

import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.IsikutToendavatePvaVastus;

import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.AlalineElamislubaKleebisPvaVastus;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.DokNumberSala;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.EestiKodanikuPassPvaVastus;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.IdPvaVastus;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.IsikukoodNimiFragSala;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.ToolubaPvaVastus;
import com.nortal.jroad.client.kmais.types.ee.riik.xtee.kmais.producers.producer.kmais.ValismaalasePassPvaVastus;

/**
 * X-Tee KMA (KMAIS) päringud.
 */
public interface KmaisXTeeService {

	/**
	 * Eesti kodaniku passiandmete päring isikukoodi ja nime fragmendi järgi PVA-le salastatusega
	 */
	EestiKodanikuPassPvaVastus eestiKodaniku19V1(IsikukoodNimiFragSalaCallback callback)
    	throws XRoadServiceConsumptionException;

	/**
	 * Välismaalase passiandmete päring isikukoodi ja nime fragmendi järgi PVA-le salastatusega
	 */
	ValismaalasePassPvaVastus valismaalasePassiandmete12V1(IsikukoodNimiFragSalaCallback callback)
		throws XRoadServiceConsumptionException;

	interface IsikukoodNimiFragSalaCallback {
		void populate(IsikukoodNimiFragSala infs);
	}

	/**
	 * Isikut tõendavate dokumentide andmete päring isikukoodi ja nime fragmendi järgi PVA-le salastatusega
	 */
	IsikutToendavatePvaVastus isikutToendavate6V1(String isikukood, String eesnimi, String perenimi, String synniaeg, Integer salastusPaevi) throws XRoadServiceConsumptionException;

	/**
	 * Eestis ebaseaduslikult viibivate isikute andmete päring isikukoodi ja nime fragmendi järgi
	 */
	IllegaalVastus ebaseaduslikult2(IdIsikukoodNimiFrag request) throws XRoadServiceConsumptionException;

	/**
	 * Sissesõidukeeldu omavate isikute päring isikukoodi ja nime fragmendi järgi
	 */
	BlacklistVastus sissesoiduKeelduOmavate2(IdIsikukoodNimiFrag request) throws XRoadServiceConsumptionException;

	/**
	 * Eesti kodaniku passiandmete päring dokumendi numbri järgi PVA-le salastatusega
	 */
	EestiKodanikuPassPvaVastus eestiKodaniku17(DokNumberSala request) throws XRoadServiceConsumptionException;

	/**
	 * Isikutunnistuse andmete päring dokumendi numbri järgi PVA-le salastatusega
	 */
	IdPvaVastus isikutunnistuseAndmete10(DokNumberSala request) throws XRoadServiceConsumptionException;

	/**
	 * Välismaalase passiandmete päring dokumendi numbri järgi PVA-le salastatusega
	 */
	ValismaalasePassPvaVastus valismaalasePassiandmete10(DokNumberSala request) throws XRoadServiceConsumptionException;

	/**
	 * Elamisloa ja kleebise päring isikukoodi ja nime fragmendi järgi PVA-le salastatusega
	 */
	AlalineElamislubaKleebisPvaVastus alaliseElamisloa6(IsikukoodNimiFragSala request) throws XRoadServiceConsumptionException;

	/**
	 * Tööloa andmete päring isikukoodi ja nime järgi PVA-le
	 */
	ToolubaPvaVastus tooloaAndmete10(IsikukoodNimiFragSala request) throws XRoadServiceConsumptionException;
}


text:
@(title: String, html: String, js: String)

<!DOCTYPE html>

    <title>@title</title>
    <link rel="stylesheet" href='@controllers.qunit.routes.WebJarAssets.at(WebJarAssets.locate("qunit.css"))'>

QUnit

test markup, will be hidden

    @Html(html)


text:
* Be explicit about which ApplicationController we're using (Sextant)

## 0.2.2
* Fix JS, explicitly set layout

## 0.2.1
* Render without layout

## 0.2.0
* Render routes as HTML
* JS now uses asset pipeline

## 0.1.3

* Helper for mounting sextant in cases of catch all routes (via @menkel)

## 0.1.2

* Remove dependency on ApplicationController existance

## 0.0.1

* First Release


text:
const confirm = (obj)=>{
    return ((msg,callback)=>{
        message.send("confirm",{
            type: 'question',
            message : msg
        },function (event,arg) {
            if(callback != undefined) callback(arg);
        });
    }).bind(obj)
};
const alert = (obj)=>{
    return ((msg,callback)=>{
        message.send("alert",{
            type: 'info',
            message : msg
        },function (event,arg) {
            if(callback != undefined) callback(arg);
        });
    }).bind(obj)
};
const db = (obj)=>{
    return ((method,arg,callback)=>{
        message.send("db",{
            method,
            arg
        },function (event,arg) {
            if(callback != undefined) callback(arg);
        });
    }).bind(obj)
};

const config = (obj)=>{
    return ((method,arg,callback)=>{
        message.send('config',{
            method,
            arg
        },function (event,arg) {
            if(callback != undefined) callback(arg);
        });
    }).bind(obj);
}
var install = (Vue)=> {
    if (install.installed) return
    install.installed = true;

    Object.defineProperties(Vue.prototype, {
        $confirm: {
            get() {
                return confirm(this);
            }
        },
        $alert:{
            get() {
                return alert(this);
            }
        },
        $db:{
            get(){
                return db(this);
            }
        },
        $config:{
            get(){
                return config(this);
            }
        }
    });
};

let Message = {install};

export default Message;


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace XamlBrewer.Uwp.SplitViewSample.Views
{
    public sealed partial class SecondPage : Page
    {
        public SecondPage()
        {
            this.InitializeComponent();
        }
    }
}


text:
describe('Platforms', function() {
  require('./platforms/core-scriptjob')
})