text:
<?php

namespace ccxt\pro;

// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

use Exception; // a common import
use ccxt\AuthenticationError;
use ccxt\NotSupported;
use React\Async;

class cryptocom extends \ccxt\async\cryptocom {

    use ClientTrait;

    public function describe() {
        return $this->deep_extend(parent::describe(), array(
            'has' => array(
                'ws' => true,
                'watchBalance' => true,
                'watchTicker' => true,
                'watchTickers' => false, // for now
                'watchMyTrades' => true,
                'watchTrades' => true,
                'watchOrderBook' => true,
                'watchOrders' => true,
                'watchOHLCV' => true,
            ),
            'urls' => array(
                'api' => array(
                    'ws' => array(
                        'public' => 'wss://stream.crypto.com/v2/market',
                        'private' => 'wss://stream.crypto.com/v2/user',
                    ),
                ),
                'test' => array(
                    'public' => 'wss://uat-stream.3ona.co/v2/market',
                    'private' => 'wss://uat-stream.3ona.co/v2/user',
                ),
            ),
            'options' => array(
            ),
            'streaming' => array(
            ),
        ));
    }

    public function pong($client, $message) {
        return Async\async(function () use ($client, $message) {
            // {
            //     "id" => 1587523073344,
            //     "method" => "public/heartbeat",
            //     "code" => 0
            // }
            Async\await($client->send (array( 'id' => $this->safe_integer($message, 'id'), 'method' => 'public/respond-heartbeat' )));
        }) ();
    }

    public function watch_order_book($symbol, $limit = null, $params = array ()) {
        return Async\async(function () use ($symbol, $limit, $params) {
            /**
             * watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
             * @see https://exchange-docs.crypto.com/spot/index.html#book-instrument_name-depth
             * @param {string} $symbol unified $symbol of the $market to fetch the order book for
             * @param {int|null} $limit the maximum amount of order book entries to return
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {array} A dictionary of {@link https://docs.ccxt.com/en/latest/manual.html#order-book-structure order book structures} indexed by $market symbols
             */
            Async\await($this->load_markets());
            $market = $this->market($symbol);
            if (!$market['spot']) {
                throw new NotSupported($this->id . ' watchOrderBook() supports spot markets only');
            }
            $messageHash = 'book' . '.' . $market['id'];
            $orderbook = Async\await($this->watch_public($messageHash, $params));
            return $orderbook->limit ();
        }) ();
    }

    public function handle_order_book_snapshot($client, $message) {
        // full $snapshot
        //
        // {
        //     "instrument_name":"LTC_USDT",
        //     "subscription":"book.LTC_USDT.150",
        //     "channel":"book",
        //     "depth":150,
        //     "data" => [
        //          {
        //              'bids' => [
        //                  [122.21, 0.74041, 4]
        //              ],
        //              'asks' => [
        //                  [122.29, 0.00002, 1]
        //              ]
        //              't' => 1648123943803,
        //              's':754560122
        //          }
        //      ]
        // }
        //
        $messageHash = $this->safe_string($message, 'subscription');
        $marketId = $this->safe_string($message, 'instrument_name');
        $market = $this->safe_market($marketId);
        $symbol = $market['symbol'];
        $data = $this->safe_value($message, 'data');
        $data = $this->safe_value($data, 0);
        $timestamp = $this->safe_integer($data, 't');
        $snapshot = $this->parse_order_book($data, $symbol, $timestamp);
        $snapshot['nonce'] = $this->safe_integer($data, 's');
        $orderbook = $this->safe_value($this->orderbooks, $symbol);
        if ($orderbook === null) {
            $limit = $this->safe_integer($message, 'depth');
            $orderbook = $this->order_book(array(), $limit);
        }
        $orderbook->reset ($snapshot);
        $this->orderbooks[$symbol] = $orderbook;
        $client->resolve ($orderbook, $messageHash);
    }

    public function watch_trades($symbol, $since = null, $limit = null, $params = array ()) {
        return Async\async(function () use ($symbol, $since, $limit, $params) {
            /**
             * get the list of most recent $trades for a particular $symbol
             * @param {string} $symbol unified $symbol of the $market to fetch $trades for
             * @param {int|null} $since timestamp in ms of the earliest trade to fetch
             * @param {int|null} $limit the maximum amount of $trades to fetch
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {[array]} a list of ~@link https://docs.ccxt.com/en/latest/manual.html?#public-$trades trade structures~
             */
            Async\await($this->load_markets());
            $market = $this->market($symbol);
            $symbol = $market['symbol'];
            if (!$market['spot']) {
                throw new NotSupported($this->id . ' watchTrades() supports spot markets only');
            }
            $messageHash = 'trade' . '.' . $market['id'];
            $trades = Async\await($this->watch_public($messageHash, $params));
            if ($this->newUpdates) {
                $limit = $trades->getLimit ($symbol, $limit);
            }
            return $this->filter_by_since_limit($trades, $since, $limit, 'timestamp', true);
        }) ();
    }

    public function handle_trades($client, $message) {
        //
        // {
        //     code => 0,
        //     method => 'subscribe',
        //     result => {
        //       instrument_name => 'BTC_USDT',
        //       subscription => 'trade.BTC_USDT',
        //       $channel => 'trade',
        //       $data => array(
        //             {
        //                 "dataTime":1648122434405,
        //                 "d":"2358394540212355488",
        //                 "s":"SELL",
        //                 "p":42980.85,
        //                 "q":0.002325,
        //                 "t":1648122434404,
        //                 "i":"BTC_USDT"
        //              }
        //              (...)
        //       )
        // }
        //
        $channel = $this->safe_string($message, 'channel');
        $marketId = $this->safe_string($message, 'instrument_name');
        $symbolSpecificMessageHash = $this->safe_string($message, 'subscription');
        $market = $this->safe_market($marketId);
        $symbol = $market['symbol'];
        $stored = $this->safe_value($this->trades, $symbol);
        if ($stored === null) {
            $limit = $this->safe_integer($this->options, 'tradesLimit', 1000);
            $stored = new ArrayCache ($limit);
            $this->trades[$symbol] = $stored;
        }
        $data = $this->safe_value($message, 'data', array());
        $parsedTrades = $this->parse_trades($data, $market);
        for ($j = 0; $j < count($parsedTrades); $j++) {
            $stored->append ($parsedTrades[$j]);
        }
        $client->resolve ($stored, $symbolSpecificMessageHash);
        $client->resolve ($stored, $channel);
    }

    public function watch_my_trades($symbol = null, $since = null, $limit = null, $params = array ()) {
        return Async\async(function () use ($symbol, $since, $limit, $params) {
            /**
             * watches information on multiple $trades made by the user
             * @param {string} $symbol unified $market $symbol of the $market orders were made in
             * @param {int|null} $since the earliest time in ms to fetch orders for
             * @param {int|null} $limit the maximum number of  orde structures to retrieve
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {[array]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure
             */
            Async\await($this->load_markets());
            $market = null;
            if ($symbol !== null) {
                $market = $this->market($symbol);
                $symbol = $market['symbol'];
            }
            $defaultType = $this->safe_string($this->options, 'defaultType', 'spot');
            $messageHash = ($defaultType === 'margin') ? 'user.margin.trade' : 'user.trade';
            $messageHash = ($market !== null) ? ($messageHash . '.' . $market['id']) : $messageHash;
            $trades = Async\await($this->watch_private($messageHash, $params));
            if ($this->newUpdates) {
                $limit = $trades->getLimit ($symbol, $limit);
            }
            return $this->filter_by_symbol_since_limit($trades, $symbol, $since, $limit, true);
        }) ();
    }

    public function watch_ticker($symbol, $params = array ()) {
        return Async\async(function () use ($symbol, $params) {
            /**
             * watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific $market
             * @param {string} $symbol unified $symbol of the $market to fetch the ticker for
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {array} a {@link https://docs.ccxt.com/en/latest/manual.html#ticker-structure ticker structure}
             */
            Async\await($this->load_markets());
            $market = $this->market($symbol);
            if (!$market['spot']) {
                throw new NotSupported($this->id . ' watchTicker() supports spot markets only');
            }
            $messageHash = 'ticker' . '.' . $market['id'];
            return Async\await($this->watch_public($messageHash, $params));
        }) ();
    }

    public function handle_ticker($client, $message) {
        //
        // {
        //     "info":{
        //        "instrument_name":"BTC_USDT",
        //        "subscription":"ticker.BTC_USDT",
        //        "channel":"ticker",
        //        "data":array(
        //           {
        //              "i":"BTC_USDT",
        //              "b":43063.19,
        //              "k":43063.2,
        //              "a":43063.19,
        //              "t":1648121165658,
        //              "v":43573.912409,
        //              "h":43498.51,
        //              "l":41876.58,
        //              "c":1087.43
        //           }
        //        )
        //     }
        //  }
        //
        $messageHash = $this->safe_string($message, 'subscription');
        $marketId = $this->safe_string($message, 'instrument_name');
        $market = $this->safe_market($marketId);
        $data = $this->safe_value($message, 'data', array());
        for ($i = 0; $i < count($data); $i++) {
            $ticker = $data[$i];
            $parsed = $this->parse_ticker($ticker, $market);
            $symbol = $parsed['symbol'];
            $this->tickers[$symbol] = $parsed;
            $client->resolve ($parsed, $messageHash);
        }
    }

    public function watch_ohlcv($symbol, $timeframe = '1m', $since = null, $limit = null, $params = array ()) {
        return Async\async(function () use ($symbol, $timeframe, $since, $limit, $params) {
            /**
             * watches historical candlestick data containing the open, high, low, and close price, and the volume of a $market
             * @param {string} $symbol unified $symbol of the $market to fetch OHLCV data for
             * @param {string} $timeframe the length of time each candle represents
             * @param {int|null} $since timestamp in ms of the earliest candle to fetch
             * @param {int|null} $limit the maximum amount of candles to fetch
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
             */
            Async\await($this->load_markets());
            $market = $this->market($symbol);
            $symbol = $market['symbol'];
            if (!$market['spot']) {
                throw new NotSupported($this->id . ' watchOHLCV() supports spot markets only');
            }
            $interval = $this->timeframes[$timeframe];
            $messageHash = 'candlestick' . '.' . $interval . '.' . $market['id'];
            $ohlcv = Async\await($this->watch_public($messageHash, $params));
            if ($this->newUpdates) {
                $limit = $ohlcv->getLimit ($symbol, $limit);
            }
            return $this->filter_by_since_limit($ohlcv, $since, $limit, 0, true);
        }) ();
    }

    public function handle_ohlcv($client, $message) {
        //
        //  {
        //       instrument_name => 'BTC_USDT',
        //       subscription => 'candlestick.1m.BTC_USDT',
        //       channel => 'candlestick',
        //       depth => 300,
        //       $interval => '1m',
        //       $data => [ [Object] ]
        //   }
        //
        $messageHash = $this->safe_string($message, 'subscription');
        $marketId = $this->safe_string($message, 'instrument_name');
        $market = $this->safe_market($marketId);
        $symbol = $market['symbol'];
        $interval = $this->safe_string($message, 'interval');
        $timeframe = $this->find_timeframe($interval);
        $this->ohlcvs[$symbol] = $this->safe_value($this->ohlcvs, $symbol, array());
        $stored = $this->safe_value($this->ohlcvs[$symbol], $timeframe);
        if ($stored === null) {
            $limit = $this->safe_integer($this->options, 'OHLCVLimit', 1000);
            $stored = new ArrayCacheByTimestamp ($limit);
            $this->ohlcvs[$symbol][$timeframe] = $stored;
        }
        $data = $this->safe_value($message, 'data');
        for ($i = 0; $i < count($data); $i++) {
            $tick = $data[$i];
            $parsed = $this->parse_ohlcv($tick, $market);
            $stored->append ($parsed);
        }
        $client->resolve ($stored, $messageHash);
    }

    public function watch_orders($symbol = null, $since = null, $limit = null, $params = array ()) {
        return Async\async(function () use ($symbol, $since, $limit, $params) {
            /**
             * watches information on multiple $orders made by the user
             * @param {string|null} $symbol unified $market $symbol of the $market $orders were made in
             * @param {int|null} $since the earliest time in ms to fetch $orders for
             * @param {int|null} $limit the maximum number of  orde structures to retrieve
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {[array]} a list of {@link https://docs.ccxt.com/en/latest/manual.html#order-structure order structures}
             */
            Async\await($this->load_markets());
            $market = null;
            if ($symbol !== null) {
                $market = $this->market($symbol);
                $symbol = $market['symbol'];
            }
            $defaultType = $this->safe_string($this->options, 'defaultType', 'spot');
            $messageHash = ($defaultType === 'margin') ? 'user.margin.order' : 'user.order';
            $messageHash = ($market !== null) ? ($messageHash . '.' . $market['id']) : $messageHash;
            $orders = Async\await($this->watch_private($messageHash, $params));
            if ($this->newUpdates) {
                $limit = $orders->getLimit ($symbol, $limit);
            }
            return $this->filter_by_symbol_since_limit($orders, $symbol, $since, $limit, true);
        }) ();
    }

    public function handle_orders($client, $message, $subscription = null) {
        //
        // {
        //     "method" => "subscribe",
        //     "result" => {
        //       "instrument_name" => "ETH_CRO",
        //       "subscription" => "user.order.ETH_CRO",
        //       "channel" => "user.order",
        //       "data" => array(
        //         {
        //           "status" => "ACTIVE",
        //           "side" => "BUY",
        //           "price" => 1,
        //           "quantity" => 1,
        //           "order_id" => "366455245775097673",
        //           "client_oid" => "my_order_0002",
        //           "create_time" => 1588758017375,
        //           "update_time" => 1588758017411,
        //           "type" => "LIMIT",
        //           "instrument_name" => "ETH_CRO",
        //           "cumulative_quantity" => 0,
        //           "cumulative_value" => 0,
        //           "avg_price" => 0,
        //           "fee_currency" => "CRO",
        //           "time_in_force":"GOOD_TILL_CANCEL"
        //         }
        //       ),
        //       "channel" => "user.order.ETH_CRO"
        //     }
        //
        $channel = $this->safe_string($message, 'channel');
        $symbolSpecificMessageHash = $this->safe_string($message, 'subscription');
        $orders = $this->safe_value($message, 'data', array());
        $ordersLength = count($orders);
        if ($ordersLength > 0) {
            if ($this->orders === null) {
                $limit = $this->safe_integer($this->options, 'ordersLimit', 1000);
                $this->orders = new ArrayCacheBySymbolById ($limit);
            }
            $stored = $this->orders;
            $parsed = $this->parse_orders($orders);
            for ($i = 0; $i < count($parsed); $i++) {
                $stored->append ($parsed[$i]);
            }
            $client->resolve ($stored, $symbolSpecificMessageHash);
            // non-symbol specific
            $client->resolve ($stored, $channel);
        }
    }

    public function watch_balance($params = array ()) {
        return Async\async(function () use ($params) {
            /**
             * query for balance and get the amount of funds available for trading or funds locked in orders
             * @param {array} $params extra parameters specific to the cryptocom api endpoint
             * @return {array} a ~@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure balance structure~
             */
            $defaultType = $this->safe_string($this->options, 'defaultType', 'spot');
            $messageHash = ($defaultType === 'margin') ? 'user.margin.balance' : 'user.balance';
            return Async\await($this->watch_private($messageHash, $params));
        }) ();
    }

    public function handle_balance($client, $message) {
        //
        // {
        //     "method" => "subscribe",
        //     "result" => {
        //       "subscription" => "user.balance",
        //       "channel" => "user.balance",
        //       "data" => array(
        //         {
        //           "currency" => "CRO",
        //           "balance" => 99999999947.99626,
        //           "available" => 99999988201.50826,
        //           "order" => 11746.488,
        //           "stake" => 0
        //         }
        //       ),
        //       "channel" => "user.balance"
        //     }
        // }
        //
        $messageHash = $this->safe_string($message, 'subscription');
        $data = $this->safe_value($message, 'data');
        for ($i = 0; $i < count($data); $i++) {
            $balance = $data[$i];
            $currencyId = $this->safe_string($balance, 'currency');
            $code = $this->safe_currency_code($currencyId);
            $account = $this->account();
            $account['free'] = $this->safe_string($balance, 'available');
            $account['total'] = $this->safe_string($balance, 'balance');
            $this->balance[$code] = $account;
            $this->balance = $this->safe_balance($this->balance);
        }
        $client->resolve ($this->balance, $messageHash);
    }

    public function watch_public($messageHash, $params = array ()) {
        return Async\async(function () use ($messageHash, $params) {
            $url = $this->urls['api']['ws']['public'];
            $id = $this->nonce();
            $request = array(
                'method' => 'subscribe',
                'params' => array(
                    'channels' => array( $messageHash ),
                ),
                'nonce' => $id,
            );
            $message = array_merge($request, $params);
            return Async\await($this->watch($url, $messageHash, $message, $messageHash));
        }) ();
    }

    public function watch_private($messageHash, $params = array ()) {
        return Async\async(function () use ($messageHash, $params) {
            Async\await($this->authenticate());
            $url = $this->urls['api']['ws']['private'];
            $id = $this->nonce();
            $request = array(
                'method' => 'subscribe',
                'params' => array(
                    'channels' => array( $messageHash ),
                ),
                'nonce' => $id,
            );
            $message = array_merge($request, $params);
            return Async\await($this->watch($url, $messageHash, $message, $messageHash));
        }) ();
    }

    public function handle_error_message($client, $message) {
        // {
        //     id => 0,
        //     code => 10004,
        //     method => 'subscribe',
        //     $message => 'invalid channel array("channels":["trade.BTCUSD-PERP"])'
        // }
        $errorCode = $this->safe_integer($message, 'code');
        try {
            if ($errorCode !== null && $errorCode !== 0) {
                $feedback = $this->id . ' ' . $this->json($message);
                $this->throw_exactly_matched_exception($this->exceptions['exact'], $errorCode, $feedback);
                $messageString = $this->safe_value($message, 'message');
                if ($messageString !== null) {
                    $this->throw_broadly_matched_exception($this->exceptions['broad'], $messageString, $feedback);
                }
            }
        } catch (Exception $e) {
            if ($e instanceof AuthenticationError) {
                $client->reject ($e, 'authenticated');
                if (is_array($client->subscriptions) && array_key_exists('public/auth', $client->subscriptions)) {
                    unset($client->subscriptions['public/auth']);
                }
                return false;
            } else {
                $client->reject ($e);
            }
        }
        return $message;
    }

    public function handle_message($client, $message) {
        // ping
        // {
        //     "id" => 1587523073344,
        //     "method" => "public/heartbeat",
        //     "code" => 0
        // }
        // auth
        //  array( id => 1648132625434, $method => 'public/auth', code => 0 )
        // ohlcv
        // {
        //     code => 0,
        //     $method => 'subscribe',
        //     $result => {
        //       instrument_name => 'BTC_USDT',
        //       subscription => 'candlestick.1m.BTC_USDT',
        //       $channel => 'candlestick',
        //       depth => 300,
        //       interval => '1m',
        //       data => [ [Object] ]
        //     }
        //   }
        // ticker
        // {
        //     "info":{
        //        "instrument_name":"BTC_USDT",
        //        "subscription":"ticker.BTC_USDT",
        //        "channel":"ticker",
        //        "data":array( array( ) )
        //
        if (!$this->handle_error_message($client, $message)) {
            return;
        }
        $subject = $this->safe_string($message, 'method');
        if ($subject === 'public/heartbeat') {
            $this->handle_ping($client, $message);
            return;
        }
        if ($subject === 'public/auth') {
            $this->handle_authenticate($client, $message);
            return;
        }
        $methods = array(
            'candlestick' => array($this, 'handle_ohlcv'),
            'ticker' => array($this, 'handle_ticker'),
            'trade' => array($this, 'handle_trades'),
            'book' => array($this, 'handle_order_book_snapshot'),
            'user.order' => array($this, 'handle_orders'),
            'user.margin.order' => array($this, 'handle_orders'),
            'user.trade' => array($this, 'handle_trades'),
            'user.margin.trade' => array($this, 'handle_trades'),
            'user.balance' => array($this, 'handle_balance'),
            'user.margin.balance' => array($this, 'handle_balance'),
        );
        $result = $this->safe_value_2($message, 'result', 'info');
        $channel = $this->safe_string($result, 'channel');
        $method = $this->safe_value($methods, $channel);
        if ($method !== null) {
            $method($client, $result);
        }
    }

    public function authenticate($params = array ()) {
        return Async\async(function () use ($params) {
            $url = $this->urls['api']['ws']['private'];
            $this->check_required_credentials();
            $client = $this->client($url);
            $future = $client->future ('authenticated');
            $messageHash = 'public/auth';
            $authenticated = $this->safe_value($client->subscriptions, $messageHash);
            if ($authenticated === null) {
                $nonce = (string) $this->nonce();
                $auth = $messageHash . $nonce . $this->apiKey . $nonce;
                $signature = $this->hmac($this->encode($auth), $this->encode($this->secret), 'sha256');
                $request = array(
                    'id' => $nonce,
                    'nonce' => $nonce,
                    'method' => $messageHash,
                    'api_key' => $this->apiKey,
                    'sig' => $signature,
                );
                $this->spawn(array($this, 'watch'), $url, $messageHash, array_merge($request, $params), $messageHash);
            }
            return Async\await($future);
        }) ();
    }

    public function handle_ping($client, $message) {
        $this->spawn(array($this, 'pong'), $client, $message);
    }

    public function handle_authenticate($client, $message) {
        //
        //  array( id => 1648132625434, method => 'public/auth', code => 0 )
        //
        $future = $client->futures['authenticated'];
        $future->resolve (1);
        $client->resolve (1, 'public/auth');
        return $message;
    }
}


text:
(function(){

  function CircleChart(options){
    return {
      aspectRatio : 1,
      center      : true,
      init:function (canvas,data,util,emit){
        this.color = d3.scale.linear()
            .domain([-1, 3])
            .range(["hsl(152,80%,0%)", "hsl(228,30%,70%)"])
            .interpolate(d3.interpolateHcl);

        this.pack = d3.layout.pack()
            .padding(2)
            .size([canvas.width, canvas.height])
            .children(util.children)
            .value(function(d) {
                if (d.snapshots && d.snapshots.length>0){
                  return 10 + d.snapshots[d.snapshots.length-1].WMQIStatisticsAccounting.MessageFlow.TotalCPUTime;

                }else{
                  return 1;

                }
            });

        //TODO should this really be done in css or set by the containing app?
        canvas.svg.style("border-radius","50px");
        this.svg = canvas.svg.append("g")
                    .attr("id", "circle");
        this.focus = data;

      },
      draw: function (canvas,data,emit){
        var self=this;

        var nodes = this.pack.nodes(data),
                view;

        this.svg.selectAll("circle")
            .data(nodes)
            .enter().append("circle");

        this.svg.selectAll("circle")
            .attr("class", function(d) {
                return d.parent ? d.children ? "node" : "node node--leaf" : "node node--root";
            })
            .attr("id", function(d) {
                return d.id;
            })
            .attr("value", function(d) {
                return d.name
            })
            .attr("parent", function(d) {
                if (d.parent) return d.parent['id']
            })/*.
            .attr("r", function(d) {
              return d.r;
            });*/

            this.svg.selectAll("circle").style({
                "fill": function(d) {
                    if (d.type == 'messageflow') {
                        if (!d.isRunning)
                            return "#ffd6d6";
                        return 'white';
                    } else if (d.type == 'applicationflow') {
                        if (!d.isRunning)
                            return "#ff9307";
                        return 'yellow';
                    } else {
                        return self.color(d.depth);
                    }
                    //return ((d.type != 'messageflow') || (d.type != 'applicationflow')) ? color(d.depth) : 'white' : 'yellow';
                },
                "display": "inline-block"
            })
            .on("click", function(d) {
                // check the type of the clicked element and call the getResources() method inside the chart controller
                //TODO emit events from this widget and handle them in the containing app's controller
                if (d.type == "inode") {
                  emit("nodeSelected",{
                                    id:d.id,
                                    type:d.type,
                                    name:d.name});
                    chartCtrl.getResources(d.id, null, null, null, d.type, d.name);
                } else if (d.type == "iserver") {
                    chartCtrl.getResources(d.parent.id, d.name, null, null, d.type, d.name);
                } else if (d.type == "messageflow") {
                    chartCtrl.getResources(d.parent.parent.id, d.parent.name, null, d.name, d.type, d.name);
                } else  if (d.type == "application") {
                    chartCtrl.getResources(d.parent.parent.id, d.parent.name, d.name, null, d.type, d.name);
                } else if (d.type == "applicationflow") {
                    chartCtrl.getResources(d.parent.parent.parent.id, d.parent.parent.name, d.parent.name, d.name, d.type, d.name);
                }
                if (self.focus !== d) zoom(d), d3.event.stopPropagation();
            });

            var text = this.svg.selectAll("text")
                .data(nodes)
                .enter().append("text")
                .attr("class", "label")
                .style("fill-opacity", function(d) {
                    return d.parent === data ? 1 : 0;
                })
                .style("display", function(d) {
                    return d.parent === data ? null : "none";
                })
                //.style("display", function(d) { if (d.attr('class')) })
                .text(function(d) {
                    return d.name;
                });

            var node = this.svg.selectAll("circle,text");

            this.svg
                .style("background", self.color(-1))
                .on("click", function() {
                    zoom(data);
                });

            zoomTo([this.focus.x, this.focus.y, this.focus.r * 2 ]);

            function zoom(d) {
                var focus0 = this.focus;
                self.focus = d;

                var transition = d3.transition()
                    .duration(d3.event.altKey ? 7500 : 750)
                    .tween("zoom", function(d) {
                        var i = d3.interpolateZoom(view, [self.focus.x, self.focus.y, self.focus.r * 2]);
                        return function(t) {
                            zoomTo(i(t));
                        };
                    });

                transition.selectAll("text")
                    .filter(function(d) {
                        return d.parent === self.focus || this.style.display === "inline";
                    })
                    .style("fill-opacity", function(d) {
                        return d.parent === self.focus ? 1 : 0;
                    })
                    .each("start", function(d) {
                        if (d.parent === self.focus) this.style.display = "inline";
                    })
                    .each("end", function(d) {
                        if (d.parent !== self.focus) this.style.display = "none";
                    });
            }

            function zoomTo(v) {
                var k = canvas.width / v[2];
                view = v;
                node.attr("transform", function(d) {
                    return "translate(" + (d.x - v[0]) * k + "," + (d.y - v[1]) * k + ")";
                });
                node.attr("r", function(d) {
                    return d.r * k;
                });
                node.attr("z-index", "-1");
            }
      }
    }
  };
  var circleChartWidget = {
    widget     : CircleChart,//widget constructor
    descriptor : {
      id          : "iib-circle-chart",
      name        : "Heat map",
      description : "Integration bus, nodes, servers, applications etc laid out as a circle pack",
      preview     : "images/circlePack.png",
      attributes  : [ ]
    }
  };

  function iibCircleChartDirective($rootScope,d3Util,iibWidgetRegistry){
    return {
      restrict: 'A',
      scope:{
          "iibOnNodeClick":'&'
      },
      link: link
    };

    function link(scope,iElement,iAttrs){
      var widget=iibWidgetRegistry.createWidget("iib-circle-chart",scope);

      d3Util.renderWidget(widget,iElement);
    }
  }

  angular.module('iibWidgets')
  .config(function(iibWidgetRegistryProvider){
    iibWidgetRegistryProvider.register(circleChartWidget);

  })
  .directive('iibCircleChart', ['$rootScope', 'd3Util','iibWidgetRegistry',iibCircleChartDirective])
  ;
})();

redpajama_set_name: RedPajamaGithub


text:
#ifndef _cimple_util_crc_h
#define _cimple_util_crc_h

#include "linkage.h"

CIMPLEUTIL_LINKAGE
unsigned int crc_update(unsigned int crc, unsigned char *buf, int len);

CIMPLEUTIL_LINKAGE
unsigned int crc_compute(unsigned char *buf, int len);

#endif /* _cimple_util_crc_h */


text:
process.chdir(__dirname);

var fs = require('fs');
var execSync = require('child_process').execSync;
var spawnSync = require('child_process').spawnSync;
var os = require('os');
var path = require('path');

var helper = require('./helper');

var args = process.argv.slice(2);
var searchDirs = args[0].split(';');
var inputDirs = args[1].split(';');
var outputDir = args[2];
var csharpFile = args[3];

// Generate cpp & csharp files from .proto files
try {
    fs.statSync(outputDir);
}
catch (err) {
    fs.mkdirSync(outputDir);
}

var protoc = '';

if (os.platform() == 'win32') {
    protoc = path.resolve(String.raw`..\protoc\protoc`);
} else {
    protoc = 'protoc';
}

var subDirs = [];

for (var inputDir of inputDirs) {
    var dirs = helper.getAllDirsContainingExtension(inputDir, 'proto');

    for (var dir of dirs) {
        subDirs.push(path.resolve(dir, '*.proto'));
    }
}

var csharpDir = path.dirname(csharpFile);
try {
    fs.statSync(csharpDir);
}
catch (err) {
    fs.mkdirSync(csharpDir);
}

var protobin = path.resolve(outputDir, 'proto.protobin');

var protobinArgs = searchDirs.map(searchDir => { return '--proto_path=' + path.resolve(searchDir); }).concat([
    '--descriptor_set_out=' + protobin
]).concat(subDirs);

var protobinOutput = spawnSync(protoc, protobinArgs);
helper.printSpawnLog('Protobin', protobinOutput);

var csharpOutput = spawnSync(String.raw`..\protoc\ProtoGen`, [
    '-o:' + path.resolve(csharpFile),
    '-i:' + protobin
]);

helper.printSpawnLog('CSharp', csharpOutput);

fs.unlinkSync(protobin);

console.log('protobuf source build done');


text:
from .settings import SUPPORTED_LANGUAGES
from .itupass import app, get_db

__all__ = ['SUPPORTED_LANGUAGES', 'app', 'get_db']


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>NerdFonts Tests</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {{content-for 'head'}}
    {{content-for 'test-head'}}

    <link rel="stylesheet" href="assets/vendor.css">
    <link rel="stylesheet" href="assets/nerd-fonts.css">
    <link rel="stylesheet" href="assets/test-support.css">

    {{content-for 'head-footer'}}
    {{content-for 'test-head-footer'}}
  </head>
  <body>
    {{content-for 'body'}}
    {{content-for 'test-body'}}

    <script src="assets/vendor.js"></script>
    <script src="assets/test-support.js"></script>
    <script src="assets/nerd-fonts.js"></script>
    <script src="testem.js" integrity=""></script>
    <script src="assets/tests.js"></script>
    <script src="assets/test-loader.js"></script>

    {{content-for 'body-footer'}}
    {{content-for 'test-body-footer'}}
  </body>
</html>


text:
package com.alexrwegener.dagger2byexamples.api.auth;

import com.alexrwegener.dagger2byexamples.di.ApplicationScope;
import dagger.Module;
import dagger.Provides;
import retrofit.MockRestAdapter;
import retrofit.RestAdapter;
import retrofit.client.Client;
import retrofit.converter.Converter;
import timber.log.Timber;

@Module public final class AuthModule {

    @Provides @ApplicationScope AuthService provideAuthRestAdapter(Client client, Converter converter) {
        MockRestAdapter mockRestAdapter = MockRestAdapter.from(
                new RestAdapter.Builder().setClient(client).setConverter(converter).setLogLevel(RestAdapter.LogLevel.BASIC).setLog(new RestAdapter.Log() {
                    @Override public void log(String message) {
                        Timber.d(message);
                    }
                }).setEndpoint("https://alexrwegener.com/").build());
        mockRestAdapter.setDelay(100);
        return mockRestAdapter.create(AuthService.class, new MockAuthService());
    }
}


text:
class CreateEvents < ActiveRecord::Migration[5.0]
  def change
    create_table :events do |t|
      t.string :title
      t.string :description
      t.string :address
      t.string :lng
      t.string :lat
      t.integer :user_id

      t.timestamps
    end
  end
end


text:
using System.Data.Entity.ModelConfiguration;
using Nop.Core.Domain.Forums;

namespace Nop.Data.Mapping.Forums
{
    public partial class ForumSubscriptionMap : EntityTypeConfiguration<ForumSubscription>
    {
        public ForumSubscriptionMap()
        {
            this.ToTable("Forums_Subscription");
            this.HasKey(fs => fs.Id);

            this.HasRequired(fs => fs.Customer)
                .WithMany()
                .HasForeignKey(fs => fs.CustomerId)
                .WillCascadeOnDelete(false);
        }
    }
}


text:
import { Mongo } from 'meteor/mongo';

StudyImportStatus = new Mongo.Collection('studyImportStatus');

// Servers describe the DICOM servers configurations
Servers = new Mongo.Collection('servers');

// CurrentServer is a single document collection to describe which of the Servers is being used
CurrentServer = new Mongo.Collection('currentServer');


text:
layout: page
title: Contact
style: nohead
---

Contact

Have an issue, suggestion, comment, etc? Send it over!

    <form method="POST" action="http://formspree.io/nate@VaporShell.io">

                <input type="email" name="email" id="email" value="" placeholder="Email" />

                <input type="text" name="_subject" value="" placeholder="Subject" />

                <textarea name="message" id="message" placeholder="Message" rows="6"></textarea>

<input type="submit" value="Send Message" class="special" />

<input type="reset" value="Reset" />

                    <input type="hidden" name="_next" value="{{ "/formsent " | prepend: site.url }}" />

    </form>


text:
from beritest_tools import BaseBERITestCase
from nose.plugins.attrib import attr

#
# Test that csetlen raises a C2E exception if the tag bit is not set on
# the capability register.
#

class test_cp2_x_csetlen_tag(BaseBERITestCase):
    @attr('capabilities')
    def test_cp2_x_setlen_tag_1(self):
        '''Test csetlen did not set the length of an untagged capability'''
        self.assertRegisterEqual(self.MIPS.a0, 8,
            "csetlen set the length of a capability with tag bit unset")

    @attr('capabilities')
    def test_cp2_x_csetlen_tag_2(self):
        '''Test cincbase raised a C2E exception when capability tag was unset'''
        self.assertRegisterEqual(self.MIPS.a2, 1,
            "csetlen did not raise an exception when capability tag was unset")

    @attr('capabilities')
    def test_cp2_x_csetlen_tag_3(self):
        '''Test capability cause is set correctly when capability tag was unset'''
        self.assertRegisterEqual(self.MIPS.a3, 0x0201,
            "Capability cause was not set correcly when capability tag was unset")


text:
doomdots
========

My dotfiles


text:
//
//  BeanLocator.h
//  Bean OSX Library
//
//  Created by Raymond Kampmeier on 2/18/14.
//  Copyright (c) 2014 Punch Through Design. All rights reserved.
//

#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <CoreBluetooth/CoreBluetooth.h>
#else
#import <IOBluetooth/IOBluetooth.h>
#endif
#import "PTDBean.h"

/**
 *  The state of the BeanManager bluetooth connection
 */
typedef NS_ENUM(NSUInteger, BeanManagerState) {
    /**
     *  Initializing or an unknown error has occured
     */
    BeanManagerState_Unknown = 0,
    /**
     *  The bluetooth connection is resetting
     */
    BeanManagerState_Resetting,
    /**
     *  An unsupport request has been made
     */
    BeanManagerState_Unsupported,
    /**
     *  Unauthorized access has been attempted
     */
    BeanManagerState_Unauthorized,
    /**
     *  The BeanManager is off
     */
    BeanManagerState_PoweredOff,
    /**
     *  The BeanManager is on
     */
    BeanManagerState_PoweredOn,
};

/**
 *  Bean connection options
 */
extern NSString * const PTDBeanManagerConnectionOptionAutoReconnect;
extern NSString * const PTDBeanManagerConnectionOptionConfigSave;
extern NSString * const PTDBeanManagerConnectionOptionProfilesRequiredToConnect;

@protocol PTDBeanManagerDelegate;

/**
 Manages discovery and connection of Beans

     Example:

     //Put the following code in your class initialization
     {
        PTDBeanManager* beanManager;
        // create the Bean Manager and assign ourselves as the delegate
        beanManager = [[PTDBeanManager alloc] initWithDelegate:self];
     }

     // check to make sure we're on
     - (void)beanManagerDidUpdateState:(PTDBeanManager *)manager{
       if(beanManager.state == BeanManagerState_PoweredOn){
         // if we're on, scan for advertisting beans
         NSError* scanError;
         [beanManager startScanningForBeans_error:&scanError];
         if (scanError) {
            NSLog(@"%@", [scanError localizedDescription]);
         }
       }
       else if (beanManager.state == BeanManagerState_PoweredOff) {
         // do something else
       }
     }
     // bean discovered
     - (void)beanManager:(PTDBeanManager*)beanManager didDiscoverBean:(PTDBean*)bean error:(NSError*)error{
       if (error) {
         NSLog(@"%@", [error localizedDescription]);
         return;
       }
       NSError* connectError;
       [beanManager connectToBean:bean error:&connectError];
       if (connectError) {
         NSLog(@"%@", [connectError localizedDescription]);
       }
     }
     // bean connected
     - (void)beanManager:(PTDBeanManager*)beanManager didConnectToBean:(PTDBean*)bean error:(NSError*)error{
       if (error) {
         NSLog(@"%@", [error localizedDescription]);
         return;
       }
       // do stuff with your Bean
     }

 @see PTDBeanManagerDelegate
 */
@interface PTDBeanManager : NSObject

/// @name Monitoring Properties
/**
 *  The delegate object for the BeanManager. Assign your class as this delegate to receive delegate messages.
 @see PTDBeanManagerDelegate
 */
@property (nonatomic, weak) id<PTDBeanManagerDelegate> delegate;
/**
 The <BeanManagerState> state of the BeanManager. Tells you if the Bluetooth Adapter is of, off, unknown, etc.
 */
@property (nonatomic, assign, readonly) BeanManagerState state;

/// @name Initializing a Bean Manager
/**
 *  Initializes the BeanManager with a delegate that implements the PTDBeanManagerDelegate protocol.
 *
 *  @param delegate the <delegate> for this object
 *
 *  @return an instance of the BeanManager
 */
-(instancetype)initWithDelegate:(id<PTDBeanManagerDelegate>)delegate;

#if TARGET_OS_IPHONE
/**
 *  Initializes the BeanManager with a delegate that implements the PTDBeanManagerDelegate protocol with state restoration (iOS only).
 *
 *  @param delegate the <delegate> for this object
 *  @param stateRestorationIdentifier the CoreBluetooth state restoration identifier
 *
 *  @return an instance of the BeanManager
 */
- (instancetype)initWithDelegate:(id<PTDBeanManagerDelegate>)delegate stateRestorationIdentifier:(NSString *)stateRestorationIdentifier;
#endif

/// @name Scanning or Stopping Scans for Beans
/**
 *  Begins scanning for Beans
 *
 *  @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)startScanningForBeans_error:(NSError**)error;
/**
 *  Stops scanning for Beans
 *
 *  @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)stopScanningForBeans_error:(NSError**)error;

/// @name Establishing or Canceling Connections with Beans
/**
 *  Connects to a Bean
 *
 *  @param bean  The Bean to connect to
 *  @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)connectToBean:(PTDBean*)bean error:(NSError**)error;
/**
 *  Connects to Bean
 *
 * @param bean The Bean to connect to
 * @param options A dictionary of connection options
 * @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)connectToBean:(PTDBean*)bean withOptions:(NSDictionary*)options error:(NSError**)error;
/**
 *  Disconnects from a Bean. This will cancel any firmware update in progress.
 *
 *  @param bean  The Bean to disconnect from
 *  @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)disconnectBean:(PTDBean*)bean error:(NSError**)error;
/**
 * Disconnects all connected Beans
 *
 * @param error Nil if successful. See <BeanErrors> for error codes.
 */
-(void)disconnectFromAllBeans:(NSError**)error;
@end

/**
 Delegates of a <PTDBeanManager> object should implement this protocol. See [BeanXcodeWorkspace](http://www.punchthrough.com) for more examples.
 */
@protocol PTDBeanManagerDelegate <NSObject>
@optional
/**
 The BeanManager's <BeanManagerState> has been updated. This method will also be called when Bluetooth is enabled or disabled.

     Example:
     - (void)beanManagerDidUpdateState:(PTDBeanManager *)manager{
       // if manager is powered on, start scanning
       if(self.beanManager.state == BeanManagerState_PoweredOn){
         [self.beanManager startScanningForBeans_error:nil];
       }
       else if (self.beanManager.state == BeanManagerState_PoweredOff) {
         // do something else
       }
     }

 @param beanManager the BeanManager whose state was updated
 */
- (void)beanManagerDidUpdateState:(PTDBeanManager *)beanManager;

/**
 An advertising Bean was discovered.

    Example:
    // Manager letting us know a Bean was discovered
    - (void)beanManager:(PTDBeanManager*)beanManager didDiscoverBean:(PTDBean*)bean error:(NSError*)error{
        NSError* connectError;
        [self.beanManager connectToBean:bean error:&connectError];
        if (connectError) {
          NSLog(@"%@", [connectError localizedDescription]);
        }
    }

 @param beanManager The BeanManager scanning for advertising beans
 @param bean        The Bean that was discovered
 @param error       Not implemented yet
 */
- (void)beanManager:(PTDBeanManager*)beanManager didDiscoverBean:(PTDBean*)bean error:(NSError*)error;
/**
 *  A Bean was connected
 *
 *  @param beanManager The BeanManager that connected to an advertising beans
 *  @param bean        The Bean that was connected
 *  @param error       This error is passed through from [centralManager:didFailToConnectPeripheral:error:](https://developer.apple.com/library/mac/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/translated_content/CBCentralManagerDelegate.html#//apple_ref/occ/intfm/CBCentralManagerDelegate/centralManager:didDisconnectPeripheral:error:)
 */
- (void)beanManager:(PTDBeanManager*)beanManager didConnectBean:(PTDBean*)bean error:(NSError*)error;
/**
 *  A Bean was disconnected
 *
 *  @param beanManager The BeanManager that lost connection with the Bean
 *  @param bean        The Bean that was disconnect
 *  @param error       This error is passed through from [centralManager:didDisconnectPeripheral:error:](https://developer.apple.com/library/mac/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/translated_content/CBCentralManagerDelegate.html#//apple_ref/occ/intfm/CBCentralManagerDelegate/centralManager:didDisconnectPeripheral:error:)
 */
- (void)beanManager:(PTDBeanManager*)beanManager didDisconnectBean:(PTDBean*)bean error:(NSError*)error;

@end


text:
package hotbeans.support;

import hotbeans.HotBeanContext;

import java.beans.Introspector;

import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * HotBeanContext implementation that uses a Spring application context for definition of beans.
 *
 * @author Tobias Löfstrand
 */
public class SpringHotBeanContext extends ClassPathXmlApplicationContext implements HotBeanContext {

   private ClassLoader classLoader;

   private volatile boolean initialized = false;

   /**
    * Creates a new SpringHotBeanContext.
    */
   public SpringHotBeanContext(ClassLoader classLoader) throws BeansException {
      super(new String[] { "hotBeanContext.xml" }, false);
      this.classLoader = classLoader;
   }

   /**
    * Overriden to set the class loader on the XmlBeanDefinitionReader.
    */
   protected void initBeanDefinitionReader(final XmlBeanDefinitionReader beanDefinitionReader) {
      super.initBeanDefinitionReader(beanDefinitionReader);

      // Set the bean class loader of beanDefinitionReader to the classloader used by the module
      beanDefinitionReader.setBeanClassLoader(this.classLoader);
   }

   /**
    * Gets the classloader used by this SpringHotBeanContext.
    */
   public ClassLoader getClassLoader() {
      return this.classLoader;
   }

   /**
    * Sets the classloader used by this SpringHotBeanContext.
    */
   public void setClassLoader(ClassLoader classLoader) {
      this.classLoader = classLoader;
   }

   /**
    * Initializes this context.
    */
   public void init() throws Exception {
      if (!this.initialized) {
         this.initialized = true;
         super.refresh();
      }
   }

   /**
    * Destroys this context.
    */
   public void destroy() {
      if (this.initialized) {
         super.destroy();

         LogFactory.release(this.classLoader);

         Introspector.flushCaches();

         this.initialized = false;
      }

      this.classLoader = null;
   }

   /**
    * Checks if this context contains the bean with the specified name.
    *
    * @since 1.0.1 (20070302)
    */
   public boolean hasHotBean(final String beanName) {
      return super.containsBean(beanName);
   }

   /**
    * Gets the bean with the specified name.
    */
   public Object getHotBean(final String beanName) {
      return super.getBean(beanName);
   }

   /**
    * Gets the class name of the bean with the specified name from this context.
    *
    * @since 1.0.1 (20070212)
    */
   public String getHotBeanClassName(final String beanName) {
      return ((AbstractBeanDefinition) super.getBeanFactory().getBeanDefinition(beanName)).getBeanClassName();
   }

   /**
    * Gets the class of the bean with the specified name from this context.
    *
    * @since 1.0.1 (20070212)
    */
   public Class getHotBeanClass(final String beanName) {
      return super.getType(beanName);
   }
}


text:
#pragma once
#include <aws/eks/EKS_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/eks/model/AddonIssue.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace EKS
{
namespace Model
{

  /**
   *
The health of the add-on.

See Also:
   AWS API
   * Reference

   */
  class AWS_EKS_API AddonHealth
  {
  public:
    AddonHealth();
    AddonHealth(Aws::Utils::Json::JsonView jsonValue);
    AddonHealth& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
An object representing the health issues for an add-on.

     */
    inline const Aws::Vector<AddonIssue>& GetIssues() const{ return m_issues; }

    /**
     *
An object representing the health issues for an add-on.

     */
    inline bool IssuesHasBeenSet() const { return m_issuesHasBeenSet; }

    /**
     *
An object representing the health issues for an add-on.

     */
    inline void SetIssues(const Aws::Vector<AddonIssue>& value) { m_issuesHasBeenSet = true; m_issues = value; }

    /**
     *
An object representing the health issues for an add-on.

     */
    inline void SetIssues(Aws::Vector<AddonIssue>&& value) { m_issuesHasBeenSet = true; m_issues = std::move(value); }

    /**
     *
An object representing the health issues for an add-on.

     */
    inline AddonHealth& WithIssues(const Aws::Vector<AddonIssue>& value) { SetIssues(value); return *this;}

    /**
     *
An object representing the health issues for an add-on.

     */
    inline AddonHealth& WithIssues(Aws::Vector<AddonIssue>&& value) { SetIssues(std::move(value)); return *this;}

    /**
     *
An object representing the health issues for an add-on.

     */
    inline AddonHealth& AddIssues(const AddonIssue& value) { m_issuesHasBeenSet = true; m_issues.push_back(value); return *this; }

    /**
     *
An object representing the health issues for an add-on.

     */
    inline AddonHealth& AddIssues(AddonIssue&& value) { m_issuesHasBeenSet = true; m_issues.push_back(std::move(value)); return *this; }

  private:

    Aws::Vector<AddonIssue> m_issues;
    bool m_issuesHasBeenSet = false;
  };

} // namespace Model
} // namespace EKS
} // namespace Aws


text:
"""
Helper for testing.
"""

import sys
import warnings
import os.path
import re
import subprocess
import threading

import pytest
import _pytest

raises = pytest.raises
warns = pytest.warns
SkipTest = _pytest.runner.Skipped
skipif = pytest.mark.skipif
fixture = pytest.fixture
parametrize = pytest.mark.parametrize
timeout = pytest.mark.timeout
xfail = pytest.mark.xfail
param = pytest.param

def warnings_to_stdout():
    """ Redirect all warnings to stdout.
    """
    showwarning_orig = warnings.showwarning

    def showwarning(msg, cat, fname, lno, file=None, line=0):
        showwarning_orig(msg, cat, os.path.basename(fname), line, sys.stdout)

    warnings.showwarning = showwarning
    # warnings.simplefilter('always')

def check_subprocess_call(cmd, timeout=5, stdout_regex=None,
                          stderr_regex=None):
    """Runs a command in a subprocess with timeout in seconds.

    Also checks returncode is zero, stdout if stdout_regex is set, and
    stderr if stderr_regex is set.
    """
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)

    def kill_process():
        warnings.warn("Timeout running {}".format(cmd))
        proc.kill()

    timer = threading.Timer(timeout, kill_process)
    try:
        timer.start()
        stdout, stderr = proc.communicate()
        stdout, stderr = stdout.decode(), stderr.decode()
        if proc.returncode != 0:
            message = (
                'Non-zero return code: {}.\nStdout:\n{}\n'
                'Stderr:\n{}').format(
                    proc.returncode, stdout, stderr)
            raise ValueError(message)

        if (stdout_regex is not None and
                not re.search(stdout_regex, stdout)):
            raise ValueError(
                "Unexpected stdout: {!r} does not match:\n{!r}".format(
                    stdout_regex, stdout))
        if (stderr_regex is not None and
                not re.search(stderr_regex, stderr)):
            raise ValueError(
                "Unexpected stderr: {!r} does not match:\n{!r}".format(
                    stderr_regex, stderr))

    finally:
        timer.cancel()


text:
using System;
using System.IO;
using iTextSharp.text.pdf;

namespace PowerShell.PDF
{
    /// <summary>
    /// Parses a PDF file and extracts the text from it.
    ///
    /// original code and copyright by Zollor
    /// swiped from http://www.codeproject.com/KB/cs/PDFToText.aspx
    /// code is protected by the Code Project Open License 1.02 (http://www.codeproject.com/info/cpol10.aspx)
    ///
    /// maintainers:
    /// jdac jimchristopher@gmail.com http://www.beefycode.com
    ///
    /// changes:
    /// 07.08.2009 jdac ExtractText changed to accept Stream parameters instead of file names
    /// </summary>
    public class PDFParser
    {
        /// BT = Beginning of a text object operator
        /// ET = End of a text object operator
        /// Td move to the start of next line
        ///  5 Ts = superscript
        /// -5 Ts = subscript

        #region Fields

        #region _numberOfCharsToKeep
        /// <summary>
        /// The number of characters to keep, when extracting text.
        /// </summary>
        private static int _numberOfCharsToKeep = 15;
        #endregion

        #endregion

        #region ExtractText
        /// <summary>
        /// Extracts a text from a PDF file.
        /// </summary>
        /// <param name="inFileName">the full path to the pdf file.</param>
        /// <param name="outFileName">the output file name.</param>
        /// <returns>the extracted text</returns>
        public bool ExtractText( Stream input, Stream output )
        {
            StreamWriter outFile = null;
            try
            {
                // Create a reader for the given PDF file
                PdfReader reader = new PdfReader( input );
                //outFile = File.CreateText(outFileName);
                outFile = new StreamWriter( output, System.Text.Encoding.UTF8 );

                Console.Write( "Processing: " );

                int totalLen = 68;
                float charUnit = ( ( float )totalLen ) / ( float )reader.NumberOfPages;
                int totalWritten = 0;
                float curUnit = 0;

                for( int page = 1; page <= reader.NumberOfPages; page++ )
                {
                    outFile.Write( ExtractTextFromPDFBytes( reader.GetPageContent( page ) ) + " " );

                    // Write the progress.
                    if( charUnit >= 1.0f )
                    {
                        for( int i = 0; i < ( int )charUnit; i++ )
                        {
                            Console.Write( "#" );
                            totalWritten++;
                        }
                    }
                    else
                    {
                        curUnit += charUnit;
                        if( curUnit >= 1.0f )
                        {
                            for( int i = 0; i < ( int )curUnit; i++ )
                            {
                                Console.Write( "#" );
                                totalWritten++;
                            }
                            curUnit = 0;
                        }

                    }
                }

                if( totalWritten < totalLen )
                {
                    for( int i = 0; i < ( totalLen - totalWritten ); i++ )
                    {
                        Console.Write( "#" );
                    }
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
        #endregion

        #region ExtractTextFromPDFBytes
        /// <summary>
        /// This method processes an uncompressed Adobe (text) object
        /// and extracts text.
        /// </summary>
        /// <param name="input">uncompressed</param>
        /// <returns></returns>
        private string ExtractTextFromPDFBytes( byte[] input )
        {
            if( input == null || input.Length == 0 ) return "";

            try
            {
                string resultString = "";

                // Flag showing if we are we currently inside a text object
                bool inTextObject = false;

                // Flag showing if the next character is literal
                // e.g. '\\' to get a '\' character or '\(' to get '('
                bool nextLiteral = false;

                // () Bracket nesting level. Text appears inside ()
                int bracketDepth = 0;

                // Keep previous chars to get extract numbers etc.:
                char[] previousCharacters = new char[ _numberOfCharsToKeep ];
                for( int j = 0; j < _numberOfCharsToKeep; j++ ) previousCharacters[ j ] = ' ';

                for( int i = 0; i < input.Length; i++ )
                {
                    char c = ( char )input[ i ];

                    if( inTextObject )
                    {
                        // Position the text
                        if( bracketDepth == 0 )
                        {
                            if( CheckToken( new string[] { "TD", "Td" }, previousCharacters ) )
                            {
                                resultString += "\n\r";
                            }
                            else
                            {
                                if( CheckToken( new string[] { "'", "T*", "\"" }, previousCharacters ) )
                                {
                                    resultString += "\n";
                                }
                                else
                                {
                                    if( CheckToken( new string[] { "Tj" }, previousCharacters ) )
                                    {
                                        resultString += " ";
                                    }
                                }
                            }
                        }

                        // End of a text object, also go to a new line.
                        if( bracketDepth == 0 &&
                            CheckToken( new string[] { "ET" }, previousCharacters ) )
                        {

                            inTextObject = false;
                            resultString += " ";
                        }
                        else
                        {
                            // Start outputting text
                            if( ( c == '(' ) && ( bracketDepth == 0 ) && ( !nextLiteral ) )
                            {
                                bracketDepth = 1;
                            }
                            else
                            {
                                // Stop outputting text
                                if( ( c == ')' ) && ( bracketDepth == 1 ) && ( !nextLiteral ) )
                                {
                                    bracketDepth = 0;
                                }
                                else
                                {
                                    // Just a normal text character:
                                    if( bracketDepth == 1 )
                                    {
                                        // Only print out next character no matter what.
                                        // Do not interpret.
                                        if( c == '\\' && !nextLiteral )
                                        {
                                            nextLiteral = true;
                                        }
                                        else
                                        {
                                            if( ( ( c >= ' ' ) && ( c <= '~' ) ) ||
                                                ( ( c >= 128 ) && ( c < 255 ) ) )
                                            {
                                                resultString += c.ToString();
                                            }

                                            nextLiteral = false;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // Store the recent characters for
                    // when we have to go back for a checking
                    for( int j = 0; j < _numberOfCharsToKeep - 1; j++ )
                    {
                        previousCharacters[ j ] = previousCharacters[ j + 1 ];
                    }
                    previousCharacters[ _numberOfCharsToKeep - 1 ] = c;

                    // Start of a text object
                    if( !inTextObject && CheckToken( new string[] { "BT" }, previousCharacters ) )
                    {
                        inTextObject = true;
                    }
                }
                return resultString;
            }
            catch
            {
                return "";
            }
        }
        #endregion

        #region CheckToken
        /// <summary>
        /// Check if a certain 2 character token just came along (e.g. BT)
        /// </summary>
        /// <param name="search">the searched token</param>
        /// <param name="recent">the recent character array</param>
        /// <returns></returns>
        private bool CheckToken( string[] tokens, char[] recent )
        {
            foreach( string token in tokens )
            {
                if( ( recent[ _numberOfCharsToKeep - 3 ] == token[ 0 ] ) &&
                    ( recent[ _numberOfCharsToKeep - 2 ] == token[ 1 ] ) &&
                    ( ( recent[ _numberOfCharsToKeep - 1 ] == ' ' ) ||
                    ( recent[ _numberOfCharsToKeep - 1 ] == 0x0d ) ||
                    ( recent[ _numberOfCharsToKeep - 1 ] == 0x0a ) ) &&
                    ( ( recent[ _numberOfCharsToKeep - 4 ] == ' ' ) ||
                    ( recent[ _numberOfCharsToKeep - 4 ] == 0x0d ) ||
                    ( recent[ _numberOfCharsToKeep - 4 ] == 0x0a ) )
                    )
                {
                    return true;
                }
            }
            return false;
        }
        #endregion
    }
}


text:
package appstate // import "google.golang.org/api/appstate/v1"

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strconv"
	"strings"

	googleapi "google.golang.org/api/googleapi"
	gensupport "google.golang.org/api/internal/gensupport"
	option "google.golang.org/api/option"
	htransport "google.golang.org/api/transport/http"
)

// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled

const apiId = "appstate:v1"
const apiName = "appstate"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/appstate/v1/"

// OAuth2 scopes used by this API.
const (
	// View and manage your data for this application
	AppstateScope = "https://www.googleapis.com/auth/appstate"
)

// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
	scopesOption := option.WithScopes(
		"https://www.googleapis.com/auth/appstate",
	)
	// NOTE: prepend, so we don't override user-specified scopes.
	opts = append([]option.ClientOption{scopesOption}, opts...)
	client, endpoint, err := htransport.NewClient(ctx, opts...)
	if err != nil {
		return nil, err
	}
	s, err := New(client)
	if err != nil {
		return nil, err
	}
	if endpoint != "" {
		s.BasePath = endpoint
	}
	return s, nil
}

// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
	if client == nil {
		return nil, errors.New("client is nil")
	}
	s := &Service{client: client, BasePath: basePath}
	s.States = NewStatesService(s)
	return s, nil
}

type Service struct {
	client    *http.Client
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	States *StatesService
}

func (s *Service) userAgent() string {
	if s.UserAgent == "" {
		return googleapi.UserAgent
	}
	return googleapi.UserAgent + " " + s.UserAgent
}

func NewStatesService(s *Service) *StatesService {
	rs := &StatesService{s: s}
	return rs
}

type StatesService struct {
	s *Service
}

// GetResponse: This is a JSON template for an app state resource.
type GetResponse struct {
	// CurrentStateVersion: The current app state version.
	CurrentStateVersion string `json:"currentStateVersion,omitempty"`

	// Data: The requested data.
	Data string `json:"data,omitempty"`

	// Kind: Uniquely identifies the type of this resource. Value is always
	// the fixed string appstate#getResponse.
	Kind string `json:"kind,omitempty"`

	// StateKey: The key for the data.
	StateKey int64 `json:"stateKey,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "CurrentStateVersion")
	// to unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "CurrentStateVersion") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (s *GetResponse) MarshalJSON() ([]byte, error) {
	type NoMethod GetResponse
	raw := NoMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// ListResponse: This is a JSON template to convert a list-response for
// app state.
type ListResponse struct {
	// Items: The app state data.
	Items []*GetResponse `json:"items,omitempty"`

	// Kind: Uniquely identifies the type of this resource. Value is always
	// the fixed string appstate#listResponse.
	Kind string `json:"kind,omitempty"`

	// MaximumKeyCount: The maximum number of keys allowed for this user.
	MaximumKeyCount int64 `json:"maximumKeyCount,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Items") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Items") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *ListResponse) MarshalJSON() ([]byte, error) {
	type NoMethod ListResponse
	raw := NoMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// UpdateRequest: This is a JSON template for a requests which update
// app state
type UpdateRequest struct {
	// Data: The new app state data that your application is trying to
	// update with.
	Data string `json:"data,omitempty"`

	// Kind: Uniquely identifies the type of this resource. Value is always
	// the fixed string appstate#updateRequest.
	Kind string `json:"kind,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Data") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Data") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (s *UpdateRequest) MarshalJSON() ([]byte, error) {
	type NoMethod UpdateRequest
	raw := NoMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// WriteResult: This is a JSON template for an app state write result.
type WriteResult struct {
	// CurrentStateVersion: The version of the data for this key on the
	// server.
	CurrentStateVersion string `json:"currentStateVersion,omitempty"`

	// Kind: Uniquely identifies the type of this resource. Value is always
	// the fixed string appstate#writeResult.
	Kind string `json:"kind,omitempty"`

	// StateKey: The written key.
	StateKey int64 `json:"stateKey,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "CurrentStateVersion")
	// to unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "CurrentStateVersion") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (s *WriteResult) MarshalJSON() ([]byte, error) {
	type NoMethod WriteResult
	raw := NoMethod(*s)
	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}

// method id "appstate.states.clear":

type StatesClearCall struct {
	s          *Service
	stateKey   int64
	urlParams_ gensupport.URLParams
	ctx_       context.Context
	header_    http.Header
}

// Clear: Clears (sets to empty) the data for the passed key if and only
// if the passed version matches the currently stored version. This
// method results in a conflict error on version mismatch.
func (r *StatesService) Clear(stateKey int64) *StatesClearCall {
	c := &StatesClearCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.stateKey = stateKey
	return c
}

// CurrentDataVersion sets the optional parameter "currentDataVersion":
// The version of the data to be cleared. Version strings are returned
// by the server.
func (c *StatesClearCall) CurrentDataVersion(currentDataVersion string) *StatesClearCall {
	c.urlParams_.Set("currentDataVersion", currentDataVersion)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatesClearCall) Fields(s ...googleapi.Field) *StatesClearCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StatesClearCall) Context(ctx context.Context) *StatesClearCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatesClearCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *StatesClearCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}/clear")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("POST", urls, body)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"stateKey": strconv.FormatInt(c.stateKey, 10),
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "appstate.states.clear" call.
// Exactly one of *WriteResult or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *WriteResult.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *StatesClearCall) Do(opts ...googleapi.CallOption) (*WriteResult, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &WriteResult{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := gensupport.DecodeResponse(target, res); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Clears (sets to empty) the data for the passed key if and only if the passed version matches the currently stored version. This method results in a conflict error on version mismatch.",
	//   "httpMethod": "POST",
	//   "id": "appstate.states.clear",
	//   "parameterOrder": [
	//     "stateKey"
	//   ],
	//   "parameters": {
	//     "currentDataVersion": {
	//       "description": "The version of the data to be cleared. Version strings are returned by the server.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "stateKey": {
	//       "description": "The key for the data to be retrieved.",
	//       "format": "int32",
	//       "location": "path",
	//       "maximum": "3",
	//       "minimum": "0",
	//       "required": true,
	//       "type": "integer"
	//     }
	//   },
	//   "path": "states/{stateKey}/clear",
	//   "response": {
	//     "$ref": "WriteResult"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/appstate"
	//   ]
	// }

}

// method id "appstate.states.delete":

type StatesDeleteCall struct {
	s          *Service
	stateKey   int64
	urlParams_ gensupport.URLParams
	ctx_       context.Context
	header_    http.Header
}

// Delete: Deletes a key and the data associated with it. The key is
// removed and no longer counts against the key quota. Note that since
// this method is not safe in the face of concurrent modifications, it
// should only be used for development and testing purposes. Invoking
// this method in shipping code can result in data loss and data
// corruption.
func (r *StatesService) Delete(stateKey int64) *StatesDeleteCall {
	c := &StatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.stateKey = stateKey
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatesDeleteCall) Fields(s ...googleapi.Field) *StatesDeleteCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StatesDeleteCall) Context(ctx context.Context) *StatesDeleteCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatesDeleteCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *StatesDeleteCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("DELETE", urls, body)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"stateKey": strconv.FormatInt(c.stateKey, 10),
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "appstate.states.delete" call.
func (c *StatesDeleteCall) Do(opts ...googleapi.CallOption) error {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if err != nil {
		return err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return err
	}
	return nil
	// {
	//   "description": "Deletes a key and the data associated with it. The key is removed and no longer counts against the key quota. Note that since this method is not safe in the face of concurrent modifications, it should only be used for development and testing purposes. Invoking this method in shipping code can result in data loss and data corruption.",
	//   "httpMethod": "DELETE",
	//   "id": "appstate.states.delete",
	//   "parameterOrder": [
	//     "stateKey"
	//   ],
	//   "parameters": {
	//     "stateKey": {
	//       "description": "The key for the data to be retrieved.",
	//       "format": "int32",
	//       "location": "path",
	//       "maximum": "3",
	//       "minimum": "0",
	//       "required": true,
	//       "type": "integer"
	//     }
	//   },
	//   "path": "states/{stateKey}",
	//   "scopes": [
	//     "https://www.googleapis.com/auth/appstate"
	//   ]
	// }

}

// method id "appstate.states.get":

type StatesGetCall struct {
	s            *Service
	stateKey     int64
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// Get: Retrieves the data corresponding to the passed key. If the key
// does not exist on the server, an HTTP 404 will be returned.
func (r *StatesService) Get(stateKey int64) *StatesGetCall {
	c := &StatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.stateKey = stateKey
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatesGetCall) Fields(s ...googleapi.Field) *StatesGetCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *StatesGetCall) IfNoneMatch(entityTag string) *StatesGetCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StatesGetCall) Context(ctx context.Context) *StatesGetCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatesGetCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *StatesGetCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, body)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"stateKey": strconv.FormatInt(c.stateKey, 10),
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "appstate.states.get" call.
// Exactly one of *GetResponse or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *GetResponse.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *StatesGetCall) Do(opts ...googleapi.CallOption) (*GetResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &GetResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := gensupport.DecodeResponse(target, res); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Retrieves the data corresponding to the passed key. If the key does not exist on the server, an HTTP 404 will be returned.",
	//   "httpMethod": "GET",
	//   "id": "appstate.states.get",
	//   "parameterOrder": [
	//     "stateKey"
	//   ],
	//   "parameters": {
	//     "stateKey": {
	//       "description": "The key for the data to be retrieved.",
	//       "format": "int32",
	//       "location": "path",
	//       "maximum": "3",
	//       "minimum": "0",
	//       "required": true,
	//       "type": "integer"
	//     }
	//   },
	//   "path": "states/{stateKey}",
	//   "response": {
	//     "$ref": "GetResponse"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/appstate"
	//   ]
	// }

}

// method id "appstate.states.list":

type StatesListCall struct {
	s            *Service
	urlParams_   gensupport.URLParams
	ifNoneMatch_ string
	ctx_         context.Context
	header_      http.Header
}

// List: Lists all the states keys, and optionally the state data.
func (r *StatesService) List() *StatesListCall {
	c := &StatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}

// IncludeData sets the optional parameter "includeData": Whether to
// include the full data in addition to the version number
func (c *StatesListCall) IncludeData(includeData bool) *StatesListCall {
	c.urlParams_.Set("includeData", fmt.Sprint(includeData))
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatesListCall) Fields(s ...googleapi.Field) *StatesListCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *StatesListCall) IfNoneMatch(entityTag string) *StatesListCall {
	c.ifNoneMatch_ = entityTag
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StatesListCall) Context(ctx context.Context) *StatesListCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatesListCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *StatesListCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	if c.ifNoneMatch_ != "" {
		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
	}
	var body io.Reader = nil
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "states")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("GET", urls, body)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "appstate.states.list" call.
// Exactly one of *ListResponse or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *ListResponse.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *StatesListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &ListResponse{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := gensupport.DecodeResponse(target, res); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Lists all the states keys, and optionally the state data.",
	//   "httpMethod": "GET",
	//   "id": "appstate.states.list",
	//   "parameters": {
	//     "includeData": {
	//       "default": "false",
	//       "description": "Whether to include the full data in addition to the version number",
	//       "location": "query",
	//       "type": "boolean"
	//     }
	//   },
	//   "path": "states",
	//   "response": {
	//     "$ref": "ListResponse"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/appstate"
	//   ]
	// }

}

// method id "appstate.states.update":

type StatesUpdateCall struct {
	s             *Service
	stateKey      int64
	updaterequest *UpdateRequest
	urlParams_    gensupport.URLParams
	ctx_          context.Context
	header_       http.Header
}

// Update: Update the data associated with the input key if and only if
// the passed version matches the currently stored version. This method
// is safe in the face of concurrent writes. Maximum per-key size is
// 128KB.
func (r *StatesService) Update(stateKey int64, updaterequest *UpdateRequest) *StatesUpdateCall {
	c := &StatesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.stateKey = stateKey
	c.updaterequest = updaterequest
	return c
}

// CurrentStateVersion sets the optional parameter
// "currentStateVersion": The version of the app state your application
// is attempting to update. If this does not match the current version,
// this method will return a conflict error. If there is no data stored
// on the server for this key, the update will succeed irrespective of
// the value of this parameter.
func (c *StatesUpdateCall) CurrentStateVersion(currentStateVersion string) *StatesUpdateCall {
	c.urlParams_.Set("currentStateVersion", currentStateVersion)
	return c
}

// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatesUpdateCall) Fields(s ...googleapi.Field) *StatesUpdateCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c
}

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *StatesUpdateCall) Context(ctx context.Context) *StatesUpdateCall {
	c.ctx_ = ctx
	return c
}

// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatesUpdateCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}

func (c *StatesUpdateCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
	for k, v := range c.header_ {
		reqHeaders[k] = v
	}
	reqHeaders.Set("User-Agent", c.s.userAgent())
	var body io.Reader = nil
	body, err := googleapi.WithoutDataWrapper.JSONReader(c.updaterequest)
	if err != nil {
		return nil, err
	}
	reqHeaders.Set("Content-Type", "application/json")
	c.urlParams_.Set("alt", alt)
	c.urlParams_.Set("prettyPrint", "false")
	urls := googleapi.ResolveRelative(c.s.BasePath, "states/{stateKey}")
	urls += "?" + c.urlParams_.Encode()
	req, err := http.NewRequest("PUT", urls, body)
	if err != nil {
		return nil, err
	}
	req.Header = reqHeaders
	googleapi.Expand(req.URL, map[string]string{
		"stateKey": strconv.FormatInt(c.stateKey, 10),
	})
	return gensupport.SendRequest(c.ctx_, c.s.client, req)
}

// Do executes the "appstate.states.update" call.
// Exactly one of *WriteResult or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *WriteResult.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *StatesUpdateCall) Do(opts ...googleapi.CallOption) (*WriteResult, error) {
	gensupport.SetOptions(c.urlParams_, opts...)
	res, err := c.doRequest("json")
	if res != nil && res.StatusCode == http.StatusNotModified {
		if res.Body != nil {
			res.Body.Close()
		}
		return nil, &googleapi.Error{
			Code:   res.StatusCode,
			Header: res.Header,
		}
	}
	if err != nil {
		return nil, err
	}
	defer googleapi.CloseBody(res)
	if err := googleapi.CheckResponse(res); err != nil {
		return nil, err
	}
	ret := &WriteResult{
		ServerResponse: googleapi.ServerResponse{
			Header:         res.Header,
			HTTPStatusCode: res.StatusCode,
		},
	}
	target := &ret
	if err := gensupport.DecodeResponse(target, res); err != nil {
		return nil, err
	}
	return ret, nil
	// {
	//   "description": "Update the data associated with the input key if and only if the passed version matches the currently stored version. This method is safe in the face of concurrent writes. Maximum per-key size is 128KB.",
	//   "httpMethod": "PUT",
	//   "id": "appstate.states.update",
	//   "parameterOrder": [
	//     "stateKey"
	//   ],
	//   "parameters": {
	//     "currentStateVersion": {
	//       "description": "The version of the app state your application is attempting to update. If this does not match the current version, this method will return a conflict error. If there is no data stored on the server for this key, the update will succeed irrespective of the value of this parameter.",
	//       "location": "query",
	//       "type": "string"
	//     },
	//     "stateKey": {
	//       "description": "The key for the data to be retrieved.",
	//       "format": "int32",
	//       "location": "path",
	//       "maximum": "3",
	//       "minimum": "0",
	//       "required": true,
	//       "type": "integer"
	//     }
	//   },
	//   "path": "states/{stateKey}",
	//   "request": {
	//     "$ref": "UpdateRequest"
	//   },
	//   "response": {
	//     "$ref": "WriteResult"
	//   },
	//   "scopes": [
	//     "https://www.googleapis.com/auth/appstate"
	//   ]
	// }

}


text:
<?php

namespace Mizmoz\Container\Tests;

class ResolveLogger implements ResolveLoggerInterface
{
    public function __construct()
    {
        // so we can test resolving with constructor and no arguments
    }

    /**
     * @inheritdoc
     */
    public function log(string $message)
    {
        // write the log to something!
    }
}