text:
'use strict';

var DELAY = 'DELAY';
var ERROR = 'ERROR';
var LONG_PRESS_DETECTED = 'LONG_PRESS_DETECTED';
var NOT_RESPONDER = 'NOT_RESPONDER';
var RESPONDER_ACTIVE_LONG_PRESS_START = 'RESPONDER_ACTIVE_LONG_PRESS_START';
var RESPONDER_ACTIVE_PRESS_START = 'RESPONDER_ACTIVE_PRESS_START';
var RESPONDER_INACTIVE_PRESS_START = 'RESPONDER_INACTIVE_PRESS_START';
var RESPONDER_GRANT = 'RESPONDER_GRANT';
var RESPONDER_RELEASE = 'RESPONDER_RELEASE';
var RESPONDER_TERMINATED = 'RESPONDER_TERMINATED';
var Transitions = Object.freeze({
  NOT_RESPONDER: {
    DELAY: ERROR,
    RESPONDER_GRANT: RESPONDER_INACTIVE_PRESS_START,
    RESPONDER_RELEASE: ERROR,
    RESPONDER_TERMINATED: ERROR,
    LONG_PRESS_DETECTED: ERROR
  },
  RESPONDER_INACTIVE_PRESS_START: {
    DELAY: RESPONDER_ACTIVE_PRESS_START,
    RESPONDER_GRANT: ERROR,
    RESPONDER_RELEASE: NOT_RESPONDER,
    RESPONDER_TERMINATED: NOT_RESPONDER,
    LONG_PRESS_DETECTED: ERROR
  },
  RESPONDER_ACTIVE_PRESS_START: {
    DELAY: ERROR,
    RESPONDER_GRANT: ERROR,
    RESPONDER_RELEASE: NOT_RESPONDER,
    RESPONDER_TERMINATED: NOT_RESPONDER,
    LONG_PRESS_DETECTED: RESPONDER_ACTIVE_LONG_PRESS_START
  },
  RESPONDER_ACTIVE_LONG_PRESS_START: {
    DELAY: ERROR,
    RESPONDER_GRANT: ERROR,
    RESPONDER_RELEASE: NOT_RESPONDER,
    RESPONDER_TERMINATED: NOT_RESPONDER,
    LONG_PRESS_DETECTED: RESPONDER_ACTIVE_LONG_PRESS_START
  },
  ERROR: {
    DELAY: NOT_RESPONDER,
    RESPONDER_GRANT: RESPONDER_INACTIVE_PRESS_START,
    RESPONDER_RELEASE: NOT_RESPONDER,
    RESPONDER_TERMINATED: NOT_RESPONDER,
    LONG_PRESS_DETECTED: NOT_RESPONDER
  }
});

var isActiveSignal = signal => signal === RESPONDER_ACTIVE_PRESS_START || signal === RESPONDER_ACTIVE_LONG_PRESS_START;

var isButtonRole = element => element.getAttribute('role') === 'button';

var isPressStartSignal = signal => signal === RESPONDER_INACTIVE_PRESS_START || signal === RESPONDER_ACTIVE_PRESS_START || signal === RESPONDER_ACTIVE_LONG_PRESS_START;

var isTerminalSignal = signal => signal === RESPONDER_TERMINATED || signal === RESPONDER_RELEASE;

var isValidKeyPress = event => {
  var key = event.key,
      target = event.target;
  var role = target.getAttribute('role');
  var isSpacebar = key === ' ' || key === 'Spacebar';
  return key === 'Enter' || isSpacebar && role === 'button';
};

var DEFAULT_LONG_PRESS_DELAY_MS = 450; // 500 - 50

var DEFAULT_PRESS_DELAY_MS = 50;
/**
 * =========================== PressResponder Tutorial ===========================
 *
 * The `PressResponder` class helps you create press interactions by analyzing the
 * geometry of elements and observing when another responder (e.g. ScrollView)
 * has stolen the touch lock. It offers hooks for your component to provide
 * interaction feedback to the user:
 *
 * - When a press has activated (e.g. highlight an element)
 * - When a press has deactivated (e.g. un-highlight an element)
 * - When a press sould trigger an action, meaning it activated and deactivated
 *   while within the geometry of the element without the lock being stolen.
 *
 * A high quality interaction isn't as simple as you might think. There should
 * be a slight delay before activation. Moving your finger beyond an element's
 * bounds should trigger deactivation, but moving the same finger back within an
 * element's bounds should trigger reactivation.
 *
 * In order to use `PressResponder`, do the following:
 *
 *     const pressResponder = new PressResponder(config);
 *
 * 2. Choose the rendered component who should collect the press events. On that
 *    element, spread `pressability.getEventHandlers()` into its props.
 *
 *    return (
 *      <View {...this.state.pressResponder.getEventHandlers()} />
 *    );
 *
 * 3. Reset `PressResponder` when your component unmounts.
 *
 *    componentWillUnmount() {
 *      this.state.pressResponder.reset();
 *    }
 *
 * ==================== Implementation Details ====================
 *
 * `PressResponder` only assumes that there exists a `HitRect` node. The `PressRect`
 * is an abstract box that is extended beyond the `HitRect`.
 *
 * # Geometry
 *
 *  ┌────────────────────────┐
 *  │  ┌──────────────────┐  │ - Presses start anywhere within `HitRect`.
 *  │  │  ┌────────────┐  │  │
 *  │  │  │ VisualRect │  │  │
 *  │  │  └────────────┘  │  │ - When pressed down for sufficient amount of time
 *  │  │    HitRect       │  │   before letting up, `VisualRect` activates.
 *  │  └──────────────────┘  │
 *  │       Out Region   o   │
 *  └────────────────────│───┘
 *                       └────── When the press is released outside the `HitRect`,
 *                               the responder is NOT eligible for a "press".
 *
 * # State Machine
 *
 * ┌───────────────┐ ◀──── RESPONDER_RELEASE
 * │ NOT_RESPONDER │
 * └───┬───────────┘ ◀──── RESPONDER_TERMINATED
 *     │
 *     │ RESPONDER_GRANT (HitRect)
 *     │
 *     ▼
 * ┌─────────────────────┐          ┌───────────────────┐              ┌───────────────────┐
 * │ RESPONDER_INACTIVE_ │  DELAY   │ RESPONDER_ACTIVE_ │  T + DELAY   │ RESPONDER_ACTIVE_ │
 * │ PRESS_START         ├────────▶ │ PRESS_START       ├────────────▶ │ LONG_PRESS_START  │
 * └─────────────────────┘          └───────────────────┘              └───────────────────┘
 *
 * T + DELAY => LONG_PRESS_DELAY + DELAY
 *
 * Not drawn are the side effects of each transition. The most important side
 * effect is the invocation of `onLongPress`. Only when the browser produces a
 * `click` event is `onPress` invoked.
 */

export default class PressResponder {
  constructor(config) {
    this._eventHandlers = null;
    this._isPointerTouch = false;
    this._longPressDelayTimeout = null;
    this._longPressDispatched = false;
    this._pressDelayTimeout = null;
    this._pressOutDelayTimeout = null;
    this._touchState = NOT_RESPONDER;
    this.configure(config);
  }

  configure(config) {
    this._config = config;
  }
  /**
   * Resets any pending timers. This should be called on unmount.
   */

  reset() {
    this._cancelLongPressDelayTimeout();

    this._cancelPressDelayTimeout();

    this._cancelPressOutDelayTimeout();
  }
  /**
   * Returns a set of props to spread into the interactive element.
   */

  getEventHandlers() {
    if (this._eventHandlers == null) {
      this._eventHandlers = this._createEventHandlers();
    }

    return this._eventHandlers;
  }

  _createEventHandlers() {
    var start = (event, shouldDelay) => {
      event.persist();

      this._cancelPressOutDelayTimeout();

      this._longPressDispatched = false;
      this._selectionTerminated = false;
      this._touchState = NOT_RESPONDER;
      this._isPointerTouch = event.nativeEvent.type === 'touchstart';

      this._receiveSignal(RESPONDER_GRANT, event);

      var delayPressStart = normalizeDelay(this._config.delayPressStart, 0, DEFAULT_PRESS_DELAY_MS);

      if (shouldDelay !== false && delayPressStart > 0) {
        this._pressDelayTimeout = setTimeout(() => {
          this._receiveSignal(DELAY, event);
        }, delayPressStart);
      } else {
        this._receiveSignal(DELAY, event);
      }

      var delayLongPress = normalizeDelay(this._config.delayLongPress, 10, DEFAULT_LONG_PRESS_DELAY_MS);
      this._longPressDelayTimeout = setTimeout(() => {
        this._handleLongPress(event);
      }, delayLongPress + delayPressStart);
    };

    var end = event => {
      this._receiveSignal(RESPONDER_RELEASE, event);
    };

    var keyupHandler = event => {
      var onPress = this._config.onPress;
      var target = event.target;

      if (this._touchState !== NOT_RESPONDER && isValidKeyPress(event)) {
        end(event);
        document.removeEventListener('keyup', keyupHandler);
        var role = target.getAttribute('role');
        var elementType = target.tagName.toLowerCase();
        var isNativeInteractiveElement = role === 'link' || elementType === 'a' || elementType === 'button' || elementType === 'input' || elementType === 'select' || elementType === 'textarea';

        if (onPress != null && !isNativeInteractiveElement) {
          onPress(event);
        }
      }
    };

    return {
      onStartShouldSetResponder: event => {
        var disabled = this._config.disabled;

        if (disabled && isButtonRole(event.currentTarget)) {
          event.stopPropagation();
        }

        if (disabled == null) {
          return true;
        }

        return !disabled;
      },
      onKeyDown: event => {
        var disabled = this._config.disabled;
        var key = event.key,
            target = event.target;

        if (!disabled && isValidKeyPress(event)) {
          if (this._touchState === NOT_RESPONDER) {
            start(event, false); // Listen to 'keyup' on document to account for situations where
            // focus is moved to another element during 'keydown'.

            document.addEventListener('keyup', keyupHandler);
          }

          var role = target.getAttribute('role');
          var isSpacebarKey = key === ' ' || key === 'Spacebar';

          var _isButtonRole = role === 'button' || role === 'menuitem';

          if (isSpacebarKey && _isButtonRole) {
            // Prevent spacebar scrolling the window
            event.preventDefault();
          }

          event.stopPropagation();
        }
      },
      onResponderGrant: event => start(event),
      onResponderMove: event => {
        if (this._config.onPressMove != null) {
          this._config.onPressMove(event);
        }

        var touch = getTouchFromResponderEvent(event);

        if (this._touchActivatePosition != null) {
          var deltaX = this._touchActivatePosition.pageX - touch.pageX;
          var deltaY = this._touchActivatePosition.pageY - touch.pageY;

          if (Math.hypot(deltaX, deltaY) > 10) {
            this._cancelLongPressDelayTimeout();
          }
        }
      },
      onResponderRelease: event => end(event),
      onResponderTerminate: event => {
        if (event.nativeEvent.type === 'selectionchange') {
          this._selectionTerminated = true;
        }

        this._receiveSignal(RESPONDER_TERMINATED, event);
      },
      onResponderTerminationRequest: event => {
        var _this$_config = this._config,
            cancelable = _this$_config.cancelable,
            disabled = _this$_config.disabled,
            onLongPress = _this$_config.onLongPress; // If `onLongPress` is provided, don't terminate on `contextmenu` as default
        // behavior will be prevented for non-mouse pointers.

        if (!disabled && onLongPress != null && this._isPointerTouch && event.nativeEvent.type === 'contextmenu') {
          return false;
        }

        if (cancelable == null) {
          return true;
        }

        return cancelable;
      },
      // NOTE: this diverges from react-native in 3 significant ways:
      // * The `onPress` callback is not connected to the responder system (the native
      //  `click` event must be used but is dispatched in many scenarios where no pointers
      //   are on the screen.) Therefore, it's possible for `onPress` to be called without
      //   `onPress{Start,End}` being called first.
      // * The `onPress` callback is only be called on the first ancestor of the native
      //   `click` target that is using the PressResponder.
      // * The event's `nativeEvent` is a `MouseEvent` not a `TouchEvent`.
      onClick: event => {
        var _this$_config2 = this._config,
            disabled = _this$_config2.disabled,
            onPress = _this$_config2.onPress;

        if (!disabled) {
          // If long press dispatched, cancel default click behavior.
          // If the responder terminated because text was selected during the gesture,
          // cancel the default click behavior.
          event.stopPropagation();

          if (this._longPressDispatched || this._selectionTerminated) {
            event.preventDefault();
          } else if (onPress != null && event.altKey === false) {
            onPress(event);
          }
        } else {
          if (isButtonRole(event.currentTarget)) {
            event.stopPropagation();
          }
        }
      },
      // If `onLongPress` is provided and a touch pointer is being used, prevent the
      // default context menu from opening.
      onContextMenu: event => {
        var _this$_config3 = this._config,
            disabled = _this$_config3.disabled,
            onLongPress = _this$_config3.onLongPress;

        if (!disabled) {
          if (onLongPress != null && this._isPointerTouch && !event.defaultPrevented) {
            event.preventDefault();
            event.stopPropagation();
          }
        } else {
          if (isButtonRole(event.currentTarget)) {
            event.stopPropagation();
          }
        }
      }
    };
  }
  /**
   * Receives a state machine signal, performs side effects of the transition
   * and stores the new state. Validates the transition as well.
   */

  _receiveSignal(signal, event) {
    var prevState = this._touchState;
    var nextState = null;

    if (Transitions[prevState] != null) {
      nextState = Transitions[prevState][signal];
    }

    if (this._touchState === NOT_RESPONDER && signal === RESPONDER_RELEASE) {
      return;
    }

    if (nextState == null || nextState === ERROR) {
      console.error("PressResponder: Invalid signal " + signal + " for state " + prevState + " on responder");
    } else if (prevState !== nextState) {
      this._performTransitionSideEffects(prevState, nextState, signal, event);

      this._touchState = nextState;
    }
  }
  /**
   * Performs a transition between touchable states and identify any activations
   * or deactivations (and callback invocations).
   */

  _performTransitionSideEffects(prevState, nextState, signal, event) {
    if (isTerminalSignal(signal)) {
      // Pressable suppression of contextmenu on windows.
      // On Windows, the contextmenu is displayed after pointerup.
      // https://github.com/necolas/react-native-web/issues/2296
      setTimeout(() => {
        this._isPointerTouch = false;
      }, 0);
      this._touchActivatePosition = null;

      this._cancelLongPressDelayTimeout();
    }

    if (isPressStartSignal(prevState) && signal === LONG_PRESS_DETECTED) {
      var onLongPress = this._config.onLongPress; // Long press is not supported for keyboards because 'click' can be dispatched
      // immediately (and multiple times) after 'keydown'.

      if (onLongPress != null && event.nativeEvent.key == null) {
        onLongPress(event);
        this._longPressDispatched = true;
      }
    }

    var isPrevActive = isActiveSignal(prevState);
    var isNextActive = isActiveSignal(nextState);

    if (!isPrevActive && isNextActive) {
      this._activate(event);
    } else if (isPrevActive && !isNextActive) {
      this._deactivate(event);
    }

    if (isPressStartSignal(prevState) && signal === RESPONDER_RELEASE) {
      var _this$_config4 = this._config,
          _onLongPress = _this$_config4.onLongPress,
          onPress = _this$_config4.onPress;

      if (onPress != null) {
        var isPressCanceledByLongPress = _onLongPress != null && prevState === RESPONDER_ACTIVE_LONG_PRESS_START;

        if (!isPressCanceledByLongPress) {
          // If we never activated (due to delays), activate and deactivate now.
          if (!isNextActive && !isPrevActive) {
            this._activate(event);

            this._deactivate(event);
          }
        }
      }
    }

    this._cancelPressDelayTimeout();
  }

  _activate(event) {
    var _this$_config5 = this._config,
        onPressChange = _this$_config5.onPressChange,
        onPressStart = _this$_config5.onPressStart;
    var touch = getTouchFromResponderEvent(event);
    this._touchActivatePosition = {
      pageX: touch.pageX,
      pageY: touch.pageY
    };

    if (onPressStart != null) {
      onPressStart(event);
    }

    if (onPressChange != null) {
      onPressChange(true);
    }
  }

  _deactivate(event) {
    var _this$_config6 = this._config,
        onPressChange = _this$_config6.onPressChange,
        onPressEnd = _this$_config6.onPressEnd;

    function end() {
      if (onPressEnd != null) {
        onPressEnd(event);
      }

      if (onPressChange != null) {
        onPressChange(false);
      }
    }

    var delayPressEnd = normalizeDelay(this._config.delayPressEnd);

    if (delayPressEnd > 0) {
      this._pressOutDelayTimeout = setTimeout(() => {
        end();
      }, delayPressEnd);
    } else {
      end();
    }
  }

  _handleLongPress(event) {
    if (this._touchState === RESPONDER_ACTIVE_PRESS_START || this._touchState === RESPONDER_ACTIVE_LONG_PRESS_START) {
      this._receiveSignal(LONG_PRESS_DETECTED, event);
    }
  }

  _cancelLongPressDelayTimeout() {
    if (this._longPressDelayTimeout != null) {
      clearTimeout(this._longPressDelayTimeout);
      this._longPressDelayTimeout = null;
    }
  }

  _cancelPressDelayTimeout() {
    if (this._pressDelayTimeout != null) {
      clearTimeout(this._pressDelayTimeout);
      this._pressDelayTimeout = null;
    }
  }

  _cancelPressOutDelayTimeout() {
    if (this._pressOutDelayTimeout != null) {
      clearTimeout(this._pressOutDelayTimeout);
      this._pressOutDelayTimeout = null;
    }
  }

}

function normalizeDelay(delay, min, fallback) {
  if (min === void 0) {
    min = 0;
  }

  if (fallback === void 0) {
    fallback = 0;
  }

  return Math.max(min, delay !== null && delay !== void 0 ? delay : fallback);
}

function getTouchFromResponderEvent(event) {
  var _event$nativeEvent = event.nativeEvent,
      changedTouches = _event$nativeEvent.changedTouches,
      touches = _event$nativeEvent.touches;

  if (touches != null && touches.length > 0) {
    return touches[0];
  }

  if (changedTouches != null && changedTouches.length > 0) {
    return changedTouches[0];
  }

  return event.nativeEvent;
}


text:
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/third_party/quiche/src/quic/core/tls_handshaker.h"

#include "third_party/boringssl/src/include/openssl/crypto.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
#include "net/third_party/quiche/src/quic/core/tls_client_handshaker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_str_cat.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"

namespace quic {

TlsHandshaker::TlsHandshaker(QuicCryptoStream* stream, QuicSession* session)
    : stream_(stream), handshaker_delegate_(session) {}

TlsHandshaker::~TlsHandshaker() {}

bool TlsHandshaker::ProcessInput(quiche::QuicheStringPiece input,
                                 EncryptionLevel level) {
  if (parser_error_ != QUIC_NO_ERROR) {
    return false;
  }
  // TODO(nharper): Call SSL_quic_read_level(ssl()) and check whether the
  // encryption level BoringSSL expects matches the encryption level that we
  // just received input at. If they mismatch, should ProcessInput return true
  // or false? If data is for a future encryption level, it should be queued for
  // later?
  if (SSL_provide_quic_data(ssl(), TlsConnection::BoringEncryptionLevel(level),
                            reinterpret_cast<const uint8_t*>(input.data()),
                            input.size()) != 1) {
    // SSL_provide_quic_data can fail for 3 reasons:
    // - API misuse (calling it before SSL_set_custom_quic_method, which we
    //   call in the TlsHandshaker c'tor)
    // - Memory exhaustion when appending data to its buffer
    // - Data provided at the wrong encryption level
    //
    // Of these, the only sensible error to handle is data provided at the wrong
    // encryption level.
    //
    // Note: the error provided below has a good-sounding enum value, although
    // it doesn't match the description as it's a QUIC Crypto specific error.
    parser_error_ = QUIC_INVALID_CRYPTO_MESSAGE_TYPE;
    parser_error_detail_ = "TLS stack failed to receive data";
    return false;
  }
  AdvanceHandshake();
  return true;
}

size_t TlsHandshaker::BufferSizeLimitForLevel(EncryptionLevel level) const {
  return SSL_quic_max_handshake_flight_len(
      ssl(), TlsConnection::BoringEncryptionLevel(level));
}

const EVP_MD* TlsHandshaker::Prf(const SSL_CIPHER* cipher) {
  return EVP_get_digestbynid(SSL_CIPHER_get_prf_nid(cipher));
}

void TlsHandshaker::SetWriteSecret(EncryptionLevel level,
                                   const SSL_CIPHER* cipher,
                                   const std::vector<uint8_t>& write_secret) {
  std::unique_ptr<QuicEncrypter> encrypter =
      QuicEncrypter::CreateFromCipherSuite(SSL_CIPHER_get_id(cipher));
  CryptoUtils::SetKeyAndIV(Prf(cipher), write_secret, encrypter.get());
  handshaker_delegate_->OnNewEncryptionKeyAvailable(level,
                                                    std::move(encrypter));
}

bool TlsHandshaker::SetReadSecret(EncryptionLevel level,
                                  const SSL_CIPHER* cipher,
                                  const std::vector<uint8_t>& read_secret) {
  std::unique_ptr<QuicDecrypter> decrypter =
      QuicDecrypter::CreateFromCipherSuite(SSL_CIPHER_get_id(cipher));
  CryptoUtils::SetKeyAndIV(Prf(cipher), read_secret, decrypter.get());
  return handshaker_delegate_->OnNewDecryptionKeyAvailable(
      level, std::move(decrypter),
      /*set_alternative_decrypter=*/false,
      /*latch_once_used=*/false);
}

void TlsHandshaker::WriteMessage(EncryptionLevel level,
                                 quiche::QuicheStringPiece data) {
  stream_->WriteCryptoData(level, data);
}

void TlsHandshaker::FlushFlight() {}

void TlsHandshaker::SendAlert(EncryptionLevel level, uint8_t desc) {
  // TODO(b/151676147): Alerts should be sent on the wire as a varint QUIC error
  // code computed to be 0x100 | desc (draft-ietf-quic-tls-27, section 4.9).
  // This puts it in the range reserved for CRYPTO_ERROR
  // (draft-ietf-quic-transport-27, section 20). However, according to
  // quic_error_codes.h, this QUIC implementation only sends 1-byte error codes
  // right now.
  std::string error_details = quiche::QuicheStrCat(
      "TLS handshake failure (", EncryptionLevelToString(level), ") ",
      static_cast<int>(desc), ": ", SSL_alert_desc_string_long(desc));
  QUIC_DLOG(ERROR) << error_details;
  CloseConnection(QUIC_HANDSHAKE_FAILED, error_details);
}

}  // namespace quic

redpajama_set_name: RedPajamaGithub


text:
var fs = require('fs');
var selectors;

function writeIconCSS() {
    fs.appendFile(DATA_DIR + 'custom.css', selectors);
}

exports.commands = {
    seticon: function (target, room, user) {
        if (!this.can('ban')) return this.errorReply("Access denied.");

        var args = target.split(',');
        if (args.length < 3) return this.parse('/help seticon');
        var username = toId(args.shift());
        var image = 'background: rgba(244, 244, 244, 0.8) url("' + args.shift().trim() + '") right no-repeat;';
        selectors = '\n\n' + '  #' + toId(args.shift()) + '-userlist-user-' + username;
        args.forEach(function (room) {
            selectors += ', #' + toId(room) + '-userlist-user-' + username;
        });
        selectors += ' { \n' + '    ' + image +  '\n  }';

        this.privateModCommand("(" + user.name + " le ha puesto un icono a: " + username + ")");
        writeIconCSS();
    },
    seticonhelp: ["/iconcss [username], [image], [room 1], [room 2], etc. - Sets an icon to a user in chosen rooms."]
};


text: Server for centralized log management in Openstack


text:
class WebpackCLITestPlugin {
  constructor(options, showAll = true, showHooks) {
    this.opts = options;
    this.showAll = showAll;
    this.showHooks = showHooks;
  }

  apply(compiler) {
    compiler.hooks.done.tap("webpack-cli Test Plugin", () => {
      if (this.showHooks) {
        const identifiers = this.showHooks.split(".");

        let shown = compiler;

        identifiers.forEach((identifier) => {
          shown = shown[identifier];
        });

        console.log(shown);
      }

      if (this.showAll) {
        console.log(compiler.options);
      }

      if (this.opts) {
        this.opts.map((e) => {
          const config = Object.getOwnPropertyDescriptor(compiler.options, e);

          console.log(config.value);
        });
      }
    });
  }
}

module.exports = WebpackCLITestPlugin;


text:
%{
  version: "1.0.2",
  title: "NimblePublisher",
  excerpt: """
  Η [NimblePublisher](https://github.com/dashbitco/nimble_publisher) είναι μια μινιμαλιστική μηχανή δημοσιεύσεων βασισμένη σε αρχεία με υποστήριξη για κώδικα Markdown και επισήμανση κώδικα.
  """
}
---

## Γιατί να χρησιμοποιήσουμε την NimblePublisher

Η NimblePublisher είναι μια απλή βιβλιοθήκη σχεδιασμένη για δημοσιεύσεις περιεχομένου επεξεργάζοντας τοπικά αρχεία που χρησιμοποιούν συντακτικό Markdown.
Μια τυπική περίπτωση θα ήταν η δημιουργία ενός blog.

Αυτή η βιβλιοθήκη ενσωματώνει τον περισσότερο από τον κώδικα που η Dashbit χρησιμοποιεί για το ίδιο της το blog, όπως παρουσιάζεται στο άρθρο τους [Welcome to our blog: how it was made!](https://dashbit.co/blog/welcome-to-our-blog-how-it-was-made) - όπου και εξηγούν γιατί επέλεξαν να επεξεργάζονται το περιεχόμενο από τοπικά αρχεία αντί να χρησιμοποιήσουν μια βάση δεδομένων ή ένα πιο περίπλοκο CMS.

## Δημιουργώντας το περιεχόμενό σας

Ας χτίσουμε το δικό μας blog.
Στο παράδειγμά μας, χρησιμοποιούμε μια εφαρμογή Phoenix αλλά αυτό δεν είναι απαραίτητο.
Καθώς η NimblePublisher φροντίζει την επεξεργασία των τοπικών αρχείων, μπορείτε να την χρησιμοποιήσετε σε οποιαδήποτε εφαρμογή Elixir.

Αρχικά, ας δημιουργήσουμε μια νέα εφαρμογή Phoenix για το παράδειγμά μας.
Θα την ονομάσουμε NimbleSchool, και θα τη δημιουργήσουμε με την παρακάτω εντολή, καθώς δεν χρειαζόμαστε το Ecto:

```shell
mix phx.new nimble_school --no-ecto
```

Τώρα, ας προσθέσουμε μερικά άρθρα.
Θα χρειαστεί να δημιουργήσουμε ένα φάκελο στον οποίο θα περιλαμβάνονται τα άρθρα μας.
Θα τα κρατήσουμε οργανωμένα ανά χρόνο σε αυτή τη μορφή:

```
/priv/posts/YEAR/MONTH-DAY-ID.md
```

Για παράδειγμα, ας ξεκινήσουμε με αυτά τα δύο άρθρα:

```
/priv/posts/2020/10-28-hello-world.md
/priv/posts/2020/11-04-exciting-news.md
```

Ένα τυπικό άρθρο blog θα γραφτεί σε συντακτικό Markdown, με ένα τομέα μεταδεδομένων στην κορυφή, και το περιεχόμενο παρακάτω χωρισμένο με `---` ως εξής:

```
%{
  title: "Hello World!",
  author: "Jaime Iniesta",
  tags: ~w(hello),
  description: "Our first blog post is here"
}
---
Yes, this is **the post** you've been waiting for.
```

Θα σας αφήσω να είστε δημιουργικοί με τα δικά σας άρθρα.
Απλά βεβαιωθείτε ότι θα ακολουθήσετε το παραπάνω φορμάτ για τα μεταδεδομένα και το περιεχόμενο.

Με αυτά τα άρθρα στη θέση τους, ας εγκαταστήσουμε την NimblePublisher ώστε να επεξεργαστούμε το περιεχόμενο και να χτίσουμε το `Blog` context μας.

## Εγκαθιστώντας την NimblePublisher

Αρχικά, προσθέστε την `nimble_publisher` σαν εξάρτηση.
Μπορείτε προαιρετικά να συμπεριλάβετε επισημαντές κώδικα, σε αυτή την περίπτωση θα προσθέσουμε υποστήριξη για επισήμανση κώδικα Elixir και Erlang.

Στην εφαρμογή μας Phoenix, θα προσθέσουμε αυτό στο `mix.exs`:

```elixir
  defp deps do
    [
      ...,
      {:nimble_publisher, "~> 0.1.1"},
      {:makeup_elixir, ">= 0.0.0"},
      {:makeup_erlang, ">= 0.0.0"}
    ]
  end
```

Αφού τρέξετε την `mix deps.get` για να φέρετε τις εξαρτήσεις, είστε έτοιμοι να συνεχίσετε με τη δημιουργία του blog.

## Χτίζοντας το Blog context

Θα ορίσουμε μια δομή `Post` η οποία θα κρατάει το περιεχόμενο που επεξεργάζεται από τα αρχεία.
Θα περιμένει ένα κλειδί για κάθε κλειδί μεταδεδομένων, και επίσης ένα `:date` το οποίο θα επεξεργαστεί από το όνομα αρχείου.
Δημιουργήστε ένα αρχείο `lib/nimble_school/blog/post.ex` με το παρακάτω περιεχόμενο:

```elixir
defmodule NimbleSchool.Blog.Post do
  @enforce_keys [:id, :author, :title, :body, :description, :tags, :date]
  defstruct [:id, :author, :title, :body, :description, :tags, :date]

  def build(filename, attrs, body) do
    [year, month_day_id] = filename |> Path.rootname() |> Path.split() |> Enum.take(-2)
    [month, day, id] = String.split(month_day_id, "-", parts: 3)
    date = Date.from_iso8601!("#{year}-#{month}-#{day}")
    struct!(__MODULE__, [id: id, date: date, body: body] ++ Map.to_list(attrs))
  end
end
```

Η ενότητα `Post` ορίζει τη δομή για τα μεταδεδομένα και το περιεχόμενο, και επίσης ορίζει μια συνάρτηση `build/3` με τη λογική που χρειάζεται για να επεξεργαστεί ένα αρχείο με τα περιεχόμενα του άρθρου.

Με τη δομή `Post` στη θέση της, μπορούμε να ορίσουμε το `Blog` context μας το οποίο θα χρησιμοποιήσει την NimblePublisher για να επεξεργαστεί τα τοπικά αρχεία σε άρθρα.
Δημιουργήστε το αρχείο `lib/nimble_school/blog/blog.ex` με αυτό το περιεχόμενο:

```elixir
defmodule NimbleSchool.Blog do
  alias NimbleSchool.Blog.Post

  use NimblePublisher,
    build: Post,
    from: Application.app_dir(:nimble_school, "priv/posts/**/*.md"),
    as: :posts,
    highlighters: [:makeup_elixir, :makeup_erlang]

  # The @posts variable is first defined by NimblePublisher.
  # Let's further modify it by sorting all posts by descending date.
  @posts Enum.sort_by(@posts, & &1.date, {:desc, Date})

  # Let's also get all tags
  @tags @posts |> Enum.flat_map(& &1.tags) |> Enum.uniq() |> Enum.sort()

  # And finally export them
  def all_posts, do: @posts
  def all_tags, do: @tags
end
```

Όπως μπορείτε να δείτε, το `Blog` context χρησιμοποιεί την NimblePublisher για να χτίσει τη συλλογή των `Post` από το δεδομένο τοπικό φάκελο, χρησιμοποιώντας τους επισημαντές κώδικα που θέλουμε.

Η NimblePublisher θα δημιουργήσει τη μεταβλητή `@posts`, την οποία αργότερα θα επεξεργαστούμε για να ταξινομήσουμε τα άρθρα με φθίνουσα σειρά κατά την `:date` όπως κανονικά θέλουμε σε ένα blog.

Θα ορίσουμε επίσης `@tags` διαβάζοντάς τα από τα `@posts`.

Τελικά, θα ορίσουμε τις `all_posts/0` και `all_tags/0` οι οποίες θα επιστρέφουν ότι επεξεργάστηκε αντίστοιχα.

Ας τις δοκιμάσουμε!
Ανοίξτε μια κονσόλα με την `iex -S mix` και τρέξτε:

```elixir
iex(1)> NimbleSchool.Blog.all_posts()
[
  %NimbleSchool.Blog.Post{
    author: "Jaime Iniesta",
    body: "<p>\nAwesome, this is our second post in our great blog.</p>\n",
    date: ~D[2020-11-04],
    description: "Second blog post",
    id: "exciting-news",
    tags: ["exciting", "news"],
    title: "Exciting News!"
  },
  %NimbleSchool.Blog.Post{
    author: "Jaime Iniesta",
    body: "<p>\nYes, this is <strong>the post</strong> you've been waiting for.</p>\n",
    date: ~D[2020-10-28],
    description: "Our first blog post is here",
    id: "hello-world",
    tags: ["hello"],
    title: "Hello World!"
  }
]

iex(2)> NimbleSchool.Blog.all_tags()
["exciting", "hello", "news"]
```

Δεν είναι φοβερό;
Ήδη έχουμε όλα τα άρθρα μας επεξεργασμένα, αλλαγμένα βάσει του συντακτικού Markdown και έτοιμα.
Το ίδιο έχει συμβεί με τις ετικέτες!

Τώρα, είναι σημαντικό να δείτε ότι η NimblePublisher έχει φροντίσει την επεξεργασία αρχείων και το χτίσιμο της μεταβλητής `@posts` με όλα αυτά, και εσείς λαμβάνετε δράση από εκεί και πέρα στο να ορίσετε τις συναρτήσεις που θέλετε.
Για παράδειγμα, αν θέλουμε μια συνάρτηση για να παίρνουμε τα πρόσφατα άρθρα, μπορούμε να την ορίσουμε ώς εξής:

```elixir
def recent_posts(num \\ 5), do: Enum.take(all_posts(), num)
```

Όπως μπορείτε να δείτε, αποφύγαμε να χρησιμοποιήσουμε την `@posts` μέσα στη νέα μας συνάρτηση και αντ' αυτού χρησιμοποιήσαμε την συνάρτηση `all_posts()`.
Διαφορετικά, η μεταβλητή `@posts` θα είχε ανοιχθεί από τον μεταγλωττιστή δύο φορές, κάνοντας αντίστοιχα δύο αντίγραφα όλων των άρθρων μας.

Ας ορίσουμε μερικές ακόμα συναρτήσεις για να έχουμε ένα πλήρες παράδειγμα blog.
Θα χρειαστεί να βρούμε ένα άρθρο από το id του και επίσης να πάρουμε μια λίστα άρθρων για μια δεδομένη ετικέτα.
Ορίστε τα παρακάτω μέσα στο `Blog` context:

```elixir
defmodule NotFoundError, do: defexception [:message, plug_status: 404]

def get_post_by_id!(id) do
  Enum.find(all_posts(), &(&1.id == id)) ||
    raise NotFoundError, "post with id=#{id} not found"
end

def get_posts_by_tag!(tag) do
  case Enum.filter(all_posts(), &(tag in &1.tags)) do
    [] -> raise NotFoundError, "posts with tag=#{tag} not found"
    posts -> posts
  end
end
```

## Παρουσιάζοντας το περιεχόμενο σας

Τώρα που έχουμε ένα τρόπο να πάρουμε όλα τα άρθρα και τις ετικέτες μας, η παρουσίασή τους απλά σημαίνει η σύνδεση διαδρομών, χειριστών, προβολών και προτύπων με το γνωστό τρόπο.
Για αυτό το παράδειγμα θα μείνουμε στα απλά και απλά θα προβάλουμε μια λίστα όλων των άρθρων και θα δούμε ένα άρθρο από το id του.
Μένει σαν άσκηση στον αναγνώστη να πάρει μια λίστα άρθρων από την ετικέτα και να επεκτείνετε τη δομή με τα πρόσφατα άρθρα.

### Διαδρομές

Ορίστε τις παρακάτω διαδρομές στο `lib/nimble_school_web/router.ex`:

```elixir
scope "/", NimbleSchoolWeb do
  pipe_through :browser

  get "/blog", BlogController, :index
  get "/blog/:id", BlogController, :show
end
```

### Χειριστής

Ορίστε έναν χειριστή για να προβάλετε τα άρθρα στο `lib/nimble_school_web/controllers/blog_controller.ex`:

```elixir
defmodule NimbleSchoolWeb.BlogController do
  use NimbleSchoolWeb, :controller

  alias NimbleSchool.Blog

  def index(conn, _params) do
    render(conn, "index.html", posts: Blog.all_posts())
  end

  def show(conn, %{"id" => id}) do
    render(conn, "show.html", post: Blog.get_post_by_id!(id))
  end
end
```

### Προβολή

Δημιουργήστε την ενότητα προβολής όπου μπορείτε να τοποθετήσετε τις βοηθητικές συναρτήσεις για την προβολή.
Ως τώρα είναι απλά:

```elixir
defmodule NimbleSchoolWeb.BlogView do
  use NimbleSchoolWeb, :view
end
```

### Πρότυπο

Τελικά, δημιουργήστε τα HTML αρχεία για να προβάλετε το περιεχόμενο.
Στο `lib/nimble_school_web/templates/blog/index.html.eex` γράψτε το παρακάτω για να δείξετε μια λίστα άρθρων:

```html
<h1>Listing all posts</h1>

<%= for post <- @posts do %>
  <div id="<%= post.id %>" style="margin-bottom: 3rem;">
    <h2>
      <%= link post.title, to: Routes.blog_path(@conn, :show, post)%>
    </h2>

    <p>
      <time><%= post.date %></time> by <%= post.author %>
    </p>

    <p>
      Tagged as <%= Enum.join(post.tags, ", ") %>
    </p>

    <%= raw post.description %>
  </div>
<% end %>
```

Και δημιουργήστε το `lib/nimble_school_web/templates/blog/show.html.eex` για να προβάλλετε ένα μοναδικό άρθρο:

```html
<%= link "← All posts", to: Routes.blog_path(@conn, :index)%>

<h1><%= @post.title %></h1>

<p>
  <time><%= @post.date %></time> by <%= @post.author %>
</p>

<p>
  Tagged as <%= Enum.join(@post.tags, ", ") %>
</p>

<%= raw @post.body %>
```

### Περιηγηθείτε στα άρθρα σας

Είστε έτοιμοι!

Ανοίξτε τον εξυπηρετητή web σας με την `iex -S mix phx.server` και επισκευθείτε την τοποθεσία [http://localhost:4000/blog](http://localhost:4000/blog) για να δείτε το νέο σας blog σε δράση!

## Επεκτείνοντας τα μεταδεδομένα

Η NimblePublisher είναι πολύ ευέλικτη σε ότι έχει να κάνει με τον ορισμό της δομής άρθρων και μεταδεδομένων.
Για παράδειγμα, ας πούμε ότι θέλουμε να προσθέσουμε ένα κλειδί `:published` για να μαρκάρουμε τα άρθρα μας και να προβάλλουμε μόνο όσα το έχουν στην τιμή `true`.

Απλά πρέπει να προσθέσουμε το κλειδί `:published` στη δομή μας `Post` και επίσης στα μεταδεδομένα των άρθρων.
Στην ενότητα `Blog` μπορούμε να ορίσουμε:

```elixir
def all_posts, do: @posts

def published_posts, do: Enum.filter(all_posts(), &(&1.published == true))

def recent_posts(num \\ 5), do: Enum.take(published_posts(), num)
```

## Επισήμανση Συντακτικού

Η NimblePublisher χρησιμοποιεί τη βιβλιοθήκη Makeup για επισήμανση συντακτικού.
Θα χρειαστεί να παράξετε τις κλάσεις CSS για το στυλ που επιθυμείτε από αυτά που ορίζονται [εδώ](https://hexdocs.pm/makeup/Makeup.Styles.HTML.StyleMap.html).

Για παράδειγμα, θα χρησιμοποιήσουμε το `:tango_style`.
Από μια συνεδρία `iex -S mix`, καλέστε την:

```elixir
Makeup.stylesheet(:tango_style, "makeup") |> IO.puts()
```

Και τοποθετήστε τις παραγόμενες κλάσεις CSS στα στυλ σας.

## Προβάλλοντας άλλο περιεχόμενο

Η NimblePublisher μπορεί να χρησιμοποιηθεί για να χτίσει άλλου είδους περιεχόμενο με παρόμοια δομή.

Για παράδειγμα, θα μπορούσαμε να χειριστούμε μια συλλογή από Συχνές Ερωτήσεις (FAQs), σε αυτή την περίπτωση πιθανότατα δεν θα χρειαστούμε ημερομηνίες ή συγγραφείς αλλά μια πιο απλή δομή με τα πεδία `:id`, `:question`, και `:answer` θα ήταν εξαιρετική.

Θα μπορούσαμε να τοποθετήσουμε τα αρχεία περιεχομένου μας σε μια διαφορετική δομή φακέλων, για παράδειγμα:

```
/priv/faqs/is-there-a-free-trial.md
/priv/faqs/when-did-it-start.md
```

Και να ορίσουμε τη δομή μας `Faq` με τη συνάρτησή μας build στο `lib/nimble_school/faqs/faq.ex` ως εξής:

```elixir
defmodule NimbleSchool.Faqs.Faq do
  @enforce_keys [:id, :question, :answer]
  defstruct [:id, :question, :answer]

  def build(filename, attrs, body) do
    [id] = filename |> Path.rootname() |> Path.split() |> Enum.take(-1)
    struct!(__MODULE__, [id: id, answer: body] ++ Map.to_list(attrs))
  end
end
```

Το `Faqs` context μας στο `lib/nimble_school/faqs/faqs.ex` θα είναι κάτι σαν αυτό:

```elixir
defmodule NimbleSchool.Faqs do
  alias NimbleSchool.Faqs.Faq

  use NimblePublisher,
    build: Faq,
    from: Application.app_dir(:nimble_school, "priv/faqs/*.md"),
    as: :faqs

  # The @faqs variable is first defined by NimblePublisher.
  # Let's further modify it by sorting all posts by ascending question
  @faqs Enum.sort_by(@faqs, & &1.question)

  # And finally export them
  def all_faqs, do: @faqs
end
```

## Πηγαίος κώδικας για το παράδειγμα blog

Μπορείτε να βρείτε τον κώδικα για αυτό το παράδειγμα στο [https://github.com/jaimeiniesta/nimble_school](https://github.com/jaimeiniesta/nimble_school)


text:
bool LineTypeSeriesProp::CalcMaxMin(const CRect & rect, size_t start, size_t size, double & max, double &min)
{
	auto plotWndProp = (PlotWndPropLineType *)(this->GetPlotWndProp());
	double maxValue, minValue;

	int width = rect.Width();

	bool initialized = false;

	for (int i = 0; i < width; i++)
	{
		size_t mappedIdx = (start+size) - i * size / width;
		if (mappedIdx >= this->DataSize())
			continue;

		int y;
		bool succ = this->GetData(mappedIdx, y);
		double yT = ::TransformCoordinate(y, plotWndProp->isLog);

		if (!initialized)
		{
			maxValue = yT;
			minValue = yT;
			initialized = true;
		}
		else
		{
			maxValue = max(maxValue, yT);
			minValue = min(minValue, yT);
		}
	}

	if (initialized)
	{
		max = maxValue;
		min = minValue;
	}

	return initialized;
}


text:
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.interactions;

/**
 * Interface representing basic mouse operations.
 *
 * @deprecated Use {@link Actions} and the {@link PointerInput} instead.
 */
@Deprecated
public interface Mouse {
  void click(Coordinates where);

  void doubleClick(Coordinates where);

  void mouseDown(Coordinates where);

  void mouseUp(Coordinates where);

  void mouseMove(Coordinates where);

  /* Offset from the current location of the mouse pointer. */
  void mouseMove(Coordinates where, long xOffset, long yOffset);

  // Right-clicks an element.
  void contextClick(Coordinates where);

  // TODO: Scroll wheel support
}


text:
package org.apache.james.repository.file;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.StreamCorruptedException;

/**
 * A special ObjectInputStream to handle highly transient classes hosted by
 * Avalon components that are juggling many classloaders.
 */
public class ClassLoaderObjectInputStream extends ObjectInputStream {
    private ClassLoader m_classLoader;

    public ClassLoaderObjectInputStream(final ClassLoader classLoader, final InputStream inputStream) throws IOException {
        super(inputStream);
        m_classLoader = classLoader;
    }

    protected Class resolveClass(final ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException {
        final Class clazz = Class.forName(objectStreamClass.getName(), false, m_classLoader);

        if (null != clazz) {
            return clazz; // the classloader knows of the class
        } else {
            // classloader knows not of class, let the super classloader do it
            return super.resolveClass(objectStreamClass);
        }
    }
}


text:
ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: ec2_vpc_egress_igw
short_description: Manage an AWS VPC Egress Only Internet gateway
description:
    - Manage an AWS VPC Egress Only Internet gateway
version_added: "2.5"
author: Daniel Shepherd (@shepdelacreme)
options:
  vpc_id:
    description:
      - The VPC ID for the VPC that this Egress Only Internet Gateway should be attached.
    required: true
  state:
    description:
      - Create or delete the EIGW
    default: present
    choices: [ 'present', 'absent' ]
extends_documentation_fragment:
    - aws
    - ec2
'''

EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.

# Ensure that the VPC has an Internet Gateway.
# The Internet Gateway ID is can be accessed via {{eigw.gateway_id}} for use in setting up NATs etc.
ec2_vpc_egress_igw:
  vpc_id: vpc-abcdefgh
  state: present
register: eigw

'''

RETURN = '''
gateway_id:
    description: The ID of the Egress Only Internet Gateway or Null.
    returned: always
    type: str
    sample: eigw-0e00cf111ba5bc11e
vpc_id:
    description: The ID of the VPC to attach or detach gateway from.
    returned: always
    type: str
    sample: vpc-012345678
'''

from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import (
    boto3_conn,
    ec2_argument_spec,
    get_aws_connection_info,
    camel_dict_to_snake_dict
)

try:
    import botocore
except ImportError:
    pass  # will be picked up by HAS_BOTO3 in AnsibleAWSModule

def delete_eigw(module, conn, eigw_id):
    """
    Delete EIGW.

    module     : AnsibleModule object
    conn       : boto3 client connection object
    eigw_id    : ID of the EIGW to delete
    """
    changed = False

    try:
        response = conn.delete_egress_only_internet_gateway(DryRun=module.check_mode, EgressOnlyInternetGatewayId=eigw_id)
    except botocore.exceptions.ClientError as e:
        # When boto3 method is run with DryRun=True it returns an error on success
        # We need to catch the error and return something valid
        if e.response.get('Error', {}).get('Code') == "DryRunOperation":
            changed = True
        else:
            module.fail_json_aws(e, msg="Could not delete Egress-Only Internet Gateway {0} from VPC {1}".format(eigw_id, module.vpc_id))
    except botocore.exceptions.BotoCoreError as e:
        module.fail_json_aws(e, msg="Could not delete Egress-Only Internet Gateway {0} from VPC {1}".format(eigw_id, module.vpc_id))

    if not module.check_mode:
        changed = response.get('ReturnCode', False)

    return changed

def create_eigw(module, conn, vpc_id):
    """
    Create EIGW.

    module       : AnsibleModule object
    conn         : boto3 client connection object
    vpc_id       : ID of the VPC we are operating on
    """
    gateway_id = None
    changed = False

    try:
        response = conn.create_egress_only_internet_gateway(DryRun=module.check_mode, VpcId=vpc_id)
    except botocore.exceptions.ClientError as e:
        # When boto3 method is run with DryRun=True it returns an error on success
        # We need to catch the error and return something valid
        if e.response.get('Error', {}).get('Code') == "DryRunOperation":
            changed = True
        elif e.response.get('Error', {}).get('Code') == "InvalidVpcID.NotFound":
            module.fail_json_aws(e, msg="invalid vpc ID '{0}' provided".format(vpc_id))
        else:
            module.fail_json_aws(e, msg="Could not create Egress-Only Internet Gateway for vpc ID {0}".format(vpc_id))
    except botocore.exceptions.BotoCoreError as e:
        module.fail_json_aws(e, msg="Could not create Egress-Only Internet Gateway for vpc ID {0}".format(vpc_id))

    if not module.check_mode:
        gateway = response.get('EgressOnlyInternetGateway', {})
        state = gateway.get('Attachments', [{}])[0].get('State')
        gateway_id = gateway.get('EgressOnlyInternetGatewayId')

        if gateway_id and state in ('attached', 'attaching'):
            changed = True
        else:
            # EIGW gave back a bad attachment state or an invalid response so we error out
            module.fail_json(msg='Unable to create and attach Egress Only Internet Gateway to VPCId: {0}. Bad or no state in response'.format(vpc_id),
                             **camel_dict_to_snake_dict(response))

    return changed, gateway_id

def describe_eigws(module, conn, vpc_id):
    """
    Describe EIGWs.

    module     : AnsibleModule object
    conn       : boto3 client connection object
    vpc_id     : ID of the VPC we are operating on
    """
    gateway_id = None

    try:
        response = conn.describe_egress_only_internet_gateways()
    except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
        module.fail_json_aws(e, msg="Could not get list of existing Egress-Only Internet Gateways")

    for eigw in response.get('EgressOnlyInternetGateways', []):
        for attachment in eigw.get('Attachments', []):
            if attachment.get('VpcId') == vpc_id and attachment.get('State') in ('attached', 'attaching'):
                gateway_id = eigw.get('EgressOnlyInternetGatewayId')

    return gateway_id

def main():
    argument_spec = ec2_argument_spec()
    argument_spec.update(dict(
        vpc_id=dict(required=True),
        state=dict(default='present', choices=['present', 'absent'])
    ))

    module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)

    region, ec2_url, aws_connect_params = get_aws_connection_info(module, boto3=True)
    connection = boto3_conn(module, conn_type='client', resource='ec2', region=region, endpoint=ec2_url, **aws_connect_params)

    vpc_id = module.params.get('vpc_id')
    state = module.params.get('state')

    eigw_id = describe_eigws(module, connection, vpc_id)

    result = dict(gateway_id=eigw_id, vpc_id=vpc_id)
    changed = False

    if state == 'present' and not eigw_id:
        changed, result['gateway_id'] = create_eigw(module, connection, vpc_id)
    elif state == 'absent' and eigw_id:
        changed = delete_eigw(module, connection, eigw_id)

    module.exit_json(changed=changed, **result)

if __name__ == '__main__':
    main()


text:
<component name="libraryTable">
  <library name="Leiningen: org.apache.httpcomponents/httpcore:4.4.1">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
<title>Zend Gdata API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="css/jquery-ui.css" type="text/css"></link><link rel="stylesheet" href="css/docblox/jquery-ui-1.8.16.custom.css" type="text/css"></link><link rel="stylesheet" href="css/jquery.treeview.css" type="text/css"></link><link rel="stylesheet" href="css/theme.css" type="text/css"></link>

API Documentation

Zend/Gdata/Media/Extension/MediaContent.php

              Show:
              inherited

                          Classes

\Zend_Gdata_Media_Extension_MediaContent

              Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.

Category

Zend

Copyright

Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)

License

New BSD License

Package

Zend_Gdata

Subpackage

Media

Version

$Id: MediaContent.php 24593 2012-01-05 20:35:02Z matthew $

\Zend_Gdata_Media_Extension_MediaContent
jump to top

Package: Zend\Gdata\Media
Represents the media:content element of Media RSS.

Represents media objects.  Multiple media objects representing
the same content can be represented using a
media:group (Zend_Gdata_Media_Extension_MediaGroup) element.

Parent(s)

\Zend_Gdata_Extension
            <
            \Zend_Gdata_App_Extension
            <
            \Zend_Gdata_App_Base

Children

\Zend_Gdata_YouTube_Extension_MediaContent

Category

Zend

Copyright

Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)

License

New BSD License

Properties

int
                 $_bitrate= 'null'

Default valuenullDetails

Type

int

int
                 $_channels= 'null'

Default valuenullDetails

Type

int

int
                 $_duration= 'null'

Default valuenullDetails

Type

int

string
                 $_expression= 'null'

Default valuenullDetails

Type

string

int
                 $_fileSize= 'null'

Default valuenullDetails

Type

int

int
                 $_framerate= 'null'

Default valuenullDetails

Type

int

int
                 $_height= 'null'

Default valuenullDetails

Type

int

string
                 $_isDefault= 'null'

Default valuenullDetails

Type

string

string
                 $_lang= 'null'

Default valuenullDetails

Type

string

string
                 $_medium= 'null'

Default valuenullDetails

Type

string

                 $_rootElement= ''content''

Default value'content'Details

Type

                 $_rootNamespace= ''media''

Default value'media'Details

Type

int
                 $_samplingrate= 'null'

Default valuenullDetails

Type

int

string
                 $_type= 'null'

Default valuenullDetails

Type

string

string
                 $_url= 'null'

Default valuenullDetails

Type

string

int
                 $_width= 'null'

Default valuenullDetails

Type

int

Methods

__construct(
           $url
              =
              null,  $fileSize
              =
              null,  $type
              =
              null,  $medium
              =
              null,  $isDefault
              =
              null,  $expression
              =
              null,  $bitrate
              =
              null,  $framerate
              =
              null,  $samplingrate
              =
              null,  $channels
              =
              null,  $duration
              =
              null,  $height
              =
              null,  $width
              =
              null,  $lang
              =
              null
          )

        :
          void

Creates an individual MediaContent object.

Parameters

Name
Type
Description

$url

$fileSize

$type

$medium

$isDefault

$expression

$bitrate

$framerate

$samplingrate

$channels

$duration

$height

$width

$lang

__toString(

          )

        :
          string

Returns the URL representing this MediaContent object

Returns

Type
Description

string
The URL representing this MediaContent object.

getBitrate(

          )

        :
          int

Returns

Type
Description

int

getChannels(

          )

        :
          int

Returns

Type
Description

int

getDOM(
          \DOMDocument $doc
              =
              null,  $majorVersion
              =
              1,  $minorVersion
              =
              null
          )

        :
          \DOMElement

Retrieves a DOMElement which corresponds to this element and all
child properties.  This is used to build an entry back into a DOM
and eventually XML text for sending to the server upon updates, or
for application storage/persistence.

Parameters

Name
Type
Description

$doc
\DOMDocument

The DOMDocument used to construct DOMElements

$majorVersion

$minorVersion

Returns

Type
Description

\DOMElement
The DOMElement representing this element and all child properties.

getDuration(

          )

        :
          int

Returns

Type
Description

int

getExpression(

          )

        :
          string

Returns

Type
Description

string

getFileSize(

          )

        :
          int

Returns

Type
Description

int
The size of the media in bytes

getFramerate(

          )

        :
          int

Returns

Type
Description

int

getHeight(

          )

        :
          int

Returns

Type
Description

int

getIsDefault(

          )

        :
          bool

Returns

Type
Description

bool

getLang(

          )

        :
          string

Returns

Type
Description

string

getMedium(

          )

        :
          string

Returns

Type
Description

string

getSamplingrate(

          )

        :
          int

Returns

Type
Description

int

getType(

          )

        :
          string

Returns

Type
Description

string

getUrl(

          )

        :
          string

Returns

Type
Description

string
The direct URL to the media object

getWidth(

          )

        :
          int

Returns

Type
Description

int

setBitrate(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setChannels(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setDuration(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setExpression(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

string

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setFileSize(
          int $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value
int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setFramerate(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setHeight(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setIsDefault(
          bool $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value
bool

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setLang(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

string

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setMedium(
          string $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value
string

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setSamplingrate(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setType(
          string $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value
string

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setUrl(
          string $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value
string

The direct URL to the media object

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

setWidth(
           $value
          )

        :
          \Zend_Gdata_Media_Extension_MediaContent

Parameters

Name
Type
Description

$value

int

Returns

Type
Description

\Zend_Gdata_Media_Extension_MediaContent
Provides a fluent interface

takeAttributeFromDOM(
          \DOMNode $attribute
          )

        :
          void

Given a DOMNode representing an attribute, tries to map the data into
instance members.  If no mapping is defined, the name and value are
stored in an array.

Parameters

Name
Type
Description

$attribute
\DOMNode

The DOMNode attribute needed to be handled

Documentation was generated by DocBlox 0.15.1.


text:
#pragma once
#include "stdafx.h"
#include <shellapi.h>
#include <atlctrlx.h>
#include "CrashRpt.h"

class CDocumentDlg : public CDialogImpl<CDocumentDlg>
{
public:
    enum { IDD = IDD_DOCUMENT };

    BEGIN_MSG_MAP(CDocumentDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        COMMAND_ID_HANDLER(IDOK, OnOK)
        COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
    END_MSG_MAP()

    // Handler prototypes (uncomment arguments if needed):
    //	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    //	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    //	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    {

        return 0;
    }

    LRESULT OnOK(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    {
        CloseDialog(0);
        return 0;
    }

    LRESULT OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    {
        CloseDialog(1);
        return 0;
    }

    void CloseDialog(int /*nVal*/)
    {
        DestroyWindow();
    }
};


text:
Modular Libraries
=========================

[![Build Status](https://travis-ci.org/Modular-Network/ethereum-libraries.svg?branch=master)](https://travis-ci.org/Modular-Network/ethereum-libraries)
[![codecov](https://codecov.io/gh/Modular-Network/ethereum-libraries/branch/master/graph/badge.svg)](https://codecov.io/gh/Modular-Network/ethereum-libraries)
[![Join the chat at https://gitter.im/Modular-Network/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Modular-Network/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Discord](https://img.shields.io/discord/102860784329052160.svg)](https://discord.gg/crxYSF2)
[![Waffle.io - Columns and their card count](https://badge.waffle.io/Modular-Network/ethereum-libraries.svg?columns=all)](https://waffle.io/Modular-Network/ethereum-libraries)

Modular Libraries is a group of packages built for use on blockchains utilizing the Ethereum Virtual Machine (EVM). All libraries are deployed and linkable in your smart contracts on both Rinkeby, Ropsten, and Ethereum Mainnet. [We also have an ethereum-contracts repository that currently holds ICO contracts](https://github.com/Modular-Network/ethereum-contracts "Github link").

Libraries and contracts are currently written in Solidity and Solidity Assembly. If you are not familiar with the workings of Ethereum, smart contracts, or Solidity [please educate yourself by clicking here before proceeding](https://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html "Solidity link").

If you want to contribute to the libraries or just join the discussion on smart contract development and security, please join our Discord at https://discordapp.com/invite/crxYSF2

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Why Modular Libraries?](#why-modular-libraries)
- [How to use](#how-to-use)
- [How to Contribute](#how-to-contribute)
  - [Feedback and Bug Reports](#feedback-and-bug-reports)
  - [Collaborations](#collaborations)
  - [Code Contributions](#code-contributions)
  - [Code Quality](#code-quality)
- [Why Libraries?](#why-libraries)
- [In Conclusion](#in-conclusion)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Why Modular Libraries?

Modular Libraries aims to supplement current projects such as [Open-Zeppelin](https://github.com/OpenZeppelin/ "Zeppelin github") and others by utilizing the facilities Ethereum has in place to provide reusable source code on-chain. Our library code has been tested, documented, and deployed with the purpose of being used in Ethereum smart contracts. Be sure to familiarize yourself with libraries as well as the benefits and drawbacks to ensure you pick solutions that best fits your needs.

**DISCLAIMER**

While we make every effort to write, review, secure, test, and document professional grade code, all code is released open source under the MIT license and "without warranty of any kind." We shall not be held liable for any damages or lost funds so please be careful and prudent with your implementation. Please review and familiarize yourself with the entire license and accompanying disclaimers.

**DISCLAIMER**

## How to use

Modular Libraries has been packaged such that each library is available independently from any other library. You can browse each folder and pick the library or libraries that you need for your smart contracts.

The README in each library contains the Rinkeby, Ropsten, and Mainnet address of the deployed library to link in your contract. You will find documentation for the functions and installation instructions for development and deployment use as well. Additionally, each library has as an ENS domain which is not of much use now but will provide a better experience as development proceeds. All deployed source code has been verified on etherscan.io for your viewing pleasure.

## How to Monitor Events Emmitted by Modular Libraries

In docs/LibraryLogHashes.csv, you can find a listing of all of the zero-topic hashes for the events that our libraries emit.  You can use these in your web app to monitor events that contracts that use our libraries emit.

## How to Contribute

Feedback, bug reports, library submissions, collaborations, and contributions are all welcome! We will be rewarding contributions so please do not hesitate to reach out to us.

### Feedback and Bug Reports
If you have feedback about our libraries or questions about our documentation, or find a bug in our code, please contact us as soon as possible at contact@modular.network or reach out to us on on Gitter or Discord channel.  Significant contributions will be rewarded.

### Collaborations
As part of the global Ethereum/Blockchain community, we at Modular want to do our part in supporting fellow projects and enthusiasts in the community.  If you need an audit, advice, help building a secure ICO or Ethereum Dapp, or any other type of collaboration, please get in touch at contact@modular.network where we can discuss the collaboration.

### Code Contributions
If you see an issue in our repo or a piece of code in our Libraries you want to improve, please don't hesitate to dive in.  We welcome help in any form and are more than willing to offer our assistance to developers who want to contribute to documentation, code fixes, or even new libraries or functionality!  We ask that you follow a few guidelines when making changes to the repo:

1. Create a branch separate from master for any changes.
2. Create separate branches and submissions for unrelated changes.
3. Please adhere to [Ethereum Natural Specification Format Guidelines](https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format) for function documentation.  Also, leave comments on functional blocks in the code so that any functionality is easy to understand by any moderately competent developer reading the code.
5. If you are making significant changes, include a README with function signatures, inputs, outputs, and a detailed description of the functionality.
6. Include the description of the changes on the Pull Request.
7. When creating a pull request on the main repo, do not submit it to master.  Either submit it to an existing branch that was allocated for the changes, or submit it to a new branch you create with the PR.

### Code Quality

We strive to maintain high standards at Modular. To accomplish this, we have included unit tests and a coverage report tool. We are using the [solitidy-coverage](https://github.com/sc-forks/solidity-coverage) tool and [Codecov](https://codecov.io/gh/Modular-Network/ethereum-libraries) to host our reports and analysis. Let's keep growing our coverage percentage as much as we can!

## Why Libraries?

Utilizing libraries has some of the following benefits:

* Reduce deployment costs

   The overall bytecode load you deploy for your own contracts is reduced because your contract will not contain the function used from a linked library's external function. Your contract will make external calls to a linked library.

* Provide reliability

   Common libraries and reusable source code naturally receive higher visibility and scrutiny. This provides better code for developers as well as a known location to report and review bugs after many use cases.

* Improve security

   Libraries help to improve the security of your code because of the same circumstances that provide reliability. With that said **please review the license and disclaimer before use**.

Utilizing libraries has some of the following drawbacks:

* Increase execution costs

   Using external calls to library functions on-chain causes some overhead that does not exist when using internal functions. So, while contract deployments are less expensive, contract gas usage increases with execution. If this is a concern and you have a higher need to reduce gas usage upon execution than to reduce gas usage upon deployment, you can modify the contract function with an internal modifier. This will pull the function into your contract when you deploy. [Please review the Solidity docs on libraries if you are not familiar with this](http://solidity.readthedocs.io/en/develop/contracts.html#libraries "Solidity Libraries").

* Deployed libraries are immutable

   This is a concern more for our approach rather than the approach other repositories use. Since our focus is on deployed libraries, the code at this address is as permanent as the blockchain. Don't hold your breath for changes. There are some upsides in that immutable code is guaranteed to never have a breaking change so you can rely on it for as long as it is relevant. There are initiatives we've seen, particularly with Aragon and OpenZepplein, that plan on making library code upgradable to a certain extent. We will keep an eye on these developments as well as continue our plans to help develop a versioning system on-chain.

* Understanding someone else's code

   For the same reason libraries give us the benefit of reusable community code, it requires us to understand someone else's logic. Again, we strive for excellence, but sometimes it may not be the best implementation. Such as when we have used Solidity Assembly to improve our own competence in the language, the same thing could be done just as efficiently in basic Solidity. Our approach to this downside is to ensure we verify the deployed code and provide adequate documentation.

## In Conclusion

As always you should stay informed and determine what works best for you and your project. We look forward to working with everyone and we welcome anyone that wants to collaborate. [Please visit modular.network](https://modular.network"Modular website") to see more information about us and opportunities.


text:
This repository is meant for the use of explicit users only. Pull Requests will only be accepted from specific users.

This is a project for designing a Business Application for a mobile platorm using Cloud / Web storage and services. The specific problem for which it needs to solve shall be assigned on 09/30/2016, an duntil then all code written will be infrastructure only.

Project being made using the Framework7 JS / CSS style


text:
r"""

============
Traits Types
============

.. currentmodule:: bqplot.traits

.. autosummary::
   :toctree: _generate/

   Date
"""

from traitlets import TraitError, TraitType

import numpy as np
import pandas as pd
import warnings
import datetime as dt
import six

# Date

def date_to_json(value, obj):
    if value is None:
        return value
    else:
        # Dropping microseconds and only keeping milliseconds to conform
        # with JavaScript's Data.toJSON's behavior - and prevent bouncing
        # back updates from the front-end.
        return value.strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'

def date_from_json(value, obj):
    if value:
        return dt.datetime.strptime(value.rstrip('Z'), '%Y-%m-%dT%H:%M:%S.%f')
    else:
        return value

date_serialization = dict(to_json=date_to_json, from_json=date_from_json)

class Date(TraitType):

    """
    A datetime trait type.

    Converts the passed date into a string format that can be used to
    construct a JavaScript datetime.
    """

    def validate(self, obj, value):
        try:
            if isinstance(value, dt.datetime):
                return value
            if isinstance(value, dt.date):
                return dt.datetime(value.year, value.month, value.day)
            if np.issubdtype(np.dtype(value), np.datetime64):
                # TODO: Fix this. Right now, we have to limit the precision
                # of time to microseconds because np.datetime64.astype(datetime)
                # returns date values only for precision <= 'us'
                value_truncated = np.datetime64(value, 'us')
                return value_truncated.astype(dt.datetime)
        except Exception:
            self.error(obj, value)
        self.error(obj, value)

    def __init__(self, default_value=dt.datetime.today(), **kwargs):
        super(Date, self).__init__(default_value=default_value, **kwargs)
        self.tag(**date_serialization)

def convert_to_date(array, fmt='%m-%d-%Y'):
    # If array is a np.ndarray with type == np.datetime64, the array can be
    # returned as such. If it is an np.ndarray of dtype 'object' then conversion
    # to string is tried according to the fmt parameter.

    if(isinstance(array, np.ndarray) and np.issubdtype(array.dtype, np.datetime64)):
        # no need to perform any conversion in this case
        return array
    elif(isinstance(array, list) or (isinstance(array, np.ndarray) and array.dtype == 'object')):
        return_value = []
        # Pandas to_datetime handles all the cases where the passed in
        # data could be any of the combinations of
        #            [list, nparray] X [python_datetime, np.datetime]
        # Because of the coerce=True flag, any non-compatible datetime type
        # will be converted to pd.NaT. By this comparison, we can figure
        # out if it is date castable or not.
        if(len(np.shape(array)) == 2):
            for elem in array:
                temp_val = pd.to_datetime(
                    elem, errors='coerce', infer_datetime_format=True)
                temp_val = elem if isinstance(temp_val[0], type(pd.NaT)) else temp_val
                return_value.append(temp_val)
        elif(isinstance(array, list)):
            temp_val = pd.to_datetime(
                array, errors='coerce', infer_datetime_format=True)
            return_value = array if isinstance(temp_val[0], type(pd.NaT)) else temp_val
        else:
            temp_val = pd.to_datetime(
                array, errors='coerce', infer_datetime_format=True)
            return_value = array if isinstance(temp_val[0], type(pd.NaT)) else temp_val
        return return_value
    elif(isinstance(array, np.ndarray)):
        warnings.warn("Array could not be converted into a date")
        return array

def array_from_json(value, obj=None):
    if value is not None:
        # this will accept regular json data, like an array of values, which can be useful it you want
        # to link bqplot to other libraries that use that
        if isinstance(value, list):
            if len(value) > 0 and (isinstance(value[0], dict) and 'value' in value[0]):
                subarrays = [array_from_json(k) for k in value]
                if len(subarrays) > 0:
                    expected_length = len(subarrays[0])
                    # if a 'ragged' array, we should explicitly pass dtype=object
                    if any(len(k) != expected_length for k in subarrays[1:]):
                        return np.array(subarrays, dtype=object)
                return np.array(subarrays)
            elif len(value) > 0 and isinstance(value[0], list):
                return np.array(value, dtype=object)
            else:
                return np.array(value)
        elif 'value' in value:
            try:
                ar = np.frombuffer(value['value'], dtype=value['dtype']).reshape(value['shape'])
            except AttributeError:
                # in some python27/numpy versions it does not like the memoryview
                # we go the .tobytes() route, but since i'm not 100% sure memory copying
                # is happening or not, we one take this path if the above fails.
                ar = np.frombuffer(value['value'].tobytes(), dtype=value['dtype']).reshape(value['shape'])
            if value.get('type') == 'date':
                assert value['dtype'] == 'float64'
                ar = ar.astype('datetime64[ms]')
            return ar

def array_to_json(ar, obj=None, force_contiguous=True):
    if ar is None:
        return None

    array_type = None

    if ar.dtype.kind == 'O':
        # Try to serialize the array of objects
        is_string = np.vectorize(lambda x: isinstance(x, six.string_types))
        is_timestamp = np.vectorize(lambda x: isinstance(x, pd.Timestamp))
        is_array_like = np.vectorize(lambda x: isinstance(x, (list, np.ndarray)))

        if np.all(is_timestamp(ar)):
            ar = ar.astype('datetime64[ms]').astype(np.float64)
            array_type = 'date'
        elif np.all(is_string(ar)):
            ar = ar.astype('U')
        elif np.all(is_array_like(ar)):
            return [array_to_json(np.array(row), obj, force_contiguous) for row in ar]
        else:
            raise ValueError("Unsupported dtype object")

    if ar.dtype.kind in ['S', 'U']:  # strings to as plain json
        return ar.tolist()

    if ar.dtype.kind == 'M':
        # since there is no support for int64, we'll use float64 but as ms
        # resolution, since that is the resolution the js Date object understands
        ar = ar.astype('datetime64[ms]').astype(np.float64)
        array_type = 'date'

    if ar.dtype.kind not in ['u', 'i', 'f']:  # ints and floats, and datetime
        raise ValueError("Unsupported dtype: %s" % (ar.dtype))

    if ar.dtype == np.int64:  # JS does not support int64
        ar = ar.astype(np.int32)

    if force_contiguous and not ar.flags["C_CONTIGUOUS"]:  # make sure it's contiguous
        ar = np.ascontiguousarray(ar)

    if not ar.dtype.isnative:
        dtype = ar.dtype.newbyteorder()
        ar = ar.astype(dtype)

    return {'value': memoryview(ar), 'dtype': str(ar.dtype), 'shape': ar.shape, 'type': array_type}

array_serialization = dict(to_json=array_to_json, from_json=array_from_json)

def array_squeeze(trait, value):
    if len(value.shape) > 1:
        return np.squeeze(value)
    else:
        return value

def array_dimension_bounds(mindim=0, maxdim=np.inf):
    def validator(trait, value):
        dim = len(value.shape)
        if dim < mindim or dim > maxdim:
            raise TraitError('Dimension mismatch for trait %s of class %s: expected an \
                array of dimension comprised in interval [%s, %s] and got an array of shape %s' % (
                trait.name, trait.this_class, mindim, maxdim, value.shape))
        return value
    return validator

def array_supported_kinds(kinds='biufMSUO'):
    def validator(trait, value):
        if value.dtype.kind not in kinds:
            raise TraitError('Array type not supported for trait %s of class %s: expected a \
                array of kind in list %r and got an array of type %s (kind %s)' % (
                trait.name, trait.this_class, list(kinds), value.dtype, value.dtype.kind))
        return value
    return validator

# DataFrame

def dataframe_from_json(value, obj):
    if value is None:
        return None
    else:
        return pd.DataFrame(value)

def dataframe_to_json(df, obj):
    if df is None:
        return None
    else:
        # Replacing NaNs with None as it's not valid JSON
        cleandf = df.fillna(np.nan).replace([np.nan], [None])
        return cleandf.to_dict(orient='records')

dataframe_serialization = dict(to_json=dataframe_to_json, from_json=dataframe_from_json)

# dataframe validators

def dataframe_warn_indexname(trait, value):
    if value.index.name is not None:
        warnings.warn("The '%s' dataframe trait of the %s instance disregards the index name" % (trait.name, trait.this_class))
        value = value.reset_index()
    return value

# Series

def series_from_json(value, obj):
    return pd.Series(value)

def series_to_json(value, obj):
    return value.to_dict()

series_serialization = dict(to_json=series_to_json, from_json=series_from_json)

def _array_equal(a, b):
    """Really tests if arrays are equal, where nan == nan == True"""
    try:
        return np.allclose(a, b, 0, 0, equal_nan=True)
    except (TypeError, ValueError):
        return False


text:
package org.deuce.transaction.tl2cm.cm;

import org.deuce.transaction.tl2cm.Context;
import org.deuce.transaction.tl2cm.field.ReadFieldAccess;
import org.deuce.transaction.tl2cm.field.WriteFieldAccess;
import org.deuce.transform.Exclude;

/**
 * The Karma LockStealer contention manager resolves conflicts exactly the same as the {@code Karma} contention manager. The only
 * difference is that Karma LockStealer will not suffice with killing the other transaction, it will also attempt to steal its lock.
 *
 * @author Yoav Cohen, yoav.cohen@cs.tau.ac.il
 * @since 1.4
 */
@Exclude
public class KarmaLS extends AbstractContentionManager {

	private int counter = 0;

	@Override
	public void init() {
		counter = 0;
	}

	@Override
	public Action resolveReadConflict(ReadFieldAccess readField, Context me, Context other) {
		int statusRecord = other.getStatusRecord();
		int myPrio = me.getPriority();
		int otherPrio = other.getPriority();
		if (myPrio > otherPrio) {
			if (Context.getTxStatus(statusRecord) == Context.TX_ABORTED || other.kill(Context.getTxLocalClock(statusRecord))) {
				return Action.CONTINUE;
			}
			else {
				me.kill(-1);
				return Action.RESTART;
			}
		}
		return Action.RESTART;
	}

	public Action resolveWriteConflict(WriteFieldAccess writeField, Context me, Context other) {
		int statusRecord = other.getStatusRecord();
		int myPrio = me.getPriority();
		int otherPrio = other.getPriority();
		if (myPrio + counter > otherPrio) {
			// It is not allowed to steal a lock before the other transaction is aborted
			if (Context.getTxStatus(statusRecord) == Context.TX_ABORTED || other.kill(Context.getTxLocalClock(statusRecord))) {
				return Action.STEAL_LOCK;
			}
			else {
				me.kill(-1);
				return Action.RESTART;
			}
		}
		counter++;
		return Action.RETRY;
	}

	public boolean requiresPriorities() {
		return true;
	}

	public String getDescription() {
		return "KarmaLockStealer";
	}

}


text: Gamification Platform using the Spring Framework.


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2017 ProjectV Authors. All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="4dp"
    >

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/wi_completed_chkBx"
        android:layout_weight="1"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/wi_name_txtVw"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Wish"
        android:textColor="#040404"
        android:typeface="sans"
        android:textSize="15dip"
        android:textStyle="bold"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/wi_completed_chkBx"
        android:layout_toEndOf="@+id/wi_completed_chkBx" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:weightSum="1"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true">

        <ImageButton
            android:layout_height="30dp"
            android:background="@mipmap/ic_more_vert"
            android:id="@+id/wi_settings_imgBtn"
            android:layout_weight="1"
            android:layout_width="30dp" />
    </LinearLayout>

</RelativeLayout>


text:
package org.myire.quill.report;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;

import org.gradle.api.reporting.SingleFileReport;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import org.myire.quill.test.FileBasedTest;
import static org.myire.quill.report.ReportTests.createReportWithOutputLocation;

/**
 * JUnit tests for {@code XmlReportWriter}.
 *
 * @author Peter Franzen
 */
public class XmlReportWriterTest extends FileBasedTest
{
    @Test(expected = NullPointerException.class)
    public void constructorThrowsForNullReport() throws IOException
    {
        new XmlReportWriter(null);
    }

    @Test(expected = NullPointerException.class)
    public void constructorThrowsForNullOpenOptions() throws IOException
    {
        OpenOption[] aOptions = null;
        new XmlReportWriter(mock(SingleFileReport.class), aOptions);
    }

    @Test
    public void prologIsWrittenToFile() throws IOException
    {
        // Given
        Path aReportFile = createTemporaryFile("prologIsWrittenToFile", ".xml");
        XmlReportWriter aReportWriter = createXmlReportWriter(aReportFile);

        // When
        aReportWriter.writeProlog();
        aReportWriter.close();

        // Then
        List<String> aLines = Files.readAllLines(aReportFile);
        assertEquals(1, aLines.size());
        assertTrue(aLines.get(0).startsWith("<?xml version="));
    }

    @Test
    public void elementWithAttributesAndBodyIsWrittenToFile() throws IOException
    {
        // Given
        Path aReportFile = createTemporaryFile("elementWithAttributesAndBodyIsWrittenToFile", ".xml");
        XmlReportWriter aReportWriter = createXmlReportWriter(aReportFile);

        // When
        aReportWriter.writeElement(
            "parent",
            _s -> aReportWriter.writeAttribute("a", "b"),
            aReportWriter::writeEmptyElement,
            "child");
        aReportWriter.close();

        // Then
        List<String> aLines = Files.readAllLines(aReportFile);
        assertEquals(3, aLines.size());
        assertEquals("<parent a=\"b\">", aLines.get(0));
        assertEquals("  <child/>", aLines.get(1));
        assertEquals("</parent>", aLines.get(2));
    }

    @Test
    public void elementWithAttributesOnlyIsWrittenToFile() throws IOException
    {
        // Given
        Path aReportFile = createTemporaryFile("elementWithAttributesOnlyIsWrittenToFile", ".xml");
        XmlReportWriter aReportWriter = createXmlReportWriter(aReportFile);

        // When
        aReportWriter.writeEmptyElement(
            "empty",
            _a -> aReportWriter.writeAttribute(_a, "b"),
            "attr");
        aReportWriter.close();

        // Then
        List<String> aLines = Files.readAllLines(aReportFile);
        assertEquals(1, aLines.size());
        assertEquals("<empty attr=\"b\"/>", aLines.get(0));
    }

    @Test
    public void elementWithBodyOnlyIsWrittenToFile() throws IOException
    {
        // Given
        Path aReportFile = createTemporaryFile("elementWithBodyOnlyIsWrittenToFile", ".xml");
        XmlReportWriter aReportWriter = createXmlReportWriter(aReportFile);

        // When
        aReportWriter.writeElement(
            "parent",
            aReportWriter::writeEmptyElement,
            "child");
        aReportWriter.close();

        // Then
        List<String> aLines = Files.readAllLines(aReportFile);
        assertEquals(3, aLines.size());
        assertEquals("<parent>", aLines.get(0));
        assertEquals("  <child/>", aLines.get(1));
        assertEquals("</parent>", aLines.get(2));
    }

    @Test
    public void sequenceIsWrittenToFile() throws IOException
    {
        // Given
        Path aReportFile = createTemporaryFile("sequenceIsWrittenToFile", ".xml");
        XmlReportWriter aReportWriter = createXmlReportWriter(aReportFile);

        // When
        aReportWriter.writeSequence(
            "parent",
            "child",
            _v -> aReportWriter.writeAttribute("attr", _v),
            aReportWriter::writeEmptyElement,
            Arrays.asList("first", "second", "third"));
        aReportWriter.close();

        // Then
        List<String> aLines = Files.readAllLines(aReportFile);
        assertEquals(11, aLines.size());
        assertEquals("<parent>", aLines.get(0));
        assertEquals("  <child attr=\"first\">", aLines.get(1));
        assertEquals("    <first/>", aLines.get(2));
        assertEquals("  </child>", aLines.get(3));
        assertEquals("  <child attr=\"second\">", aLines.get(4));
        assertEquals("    <second/>", aLines.get(5));
        assertEquals("  </child>", aLines.get(6));
        assertEquals("  <child attr=\"third\">", aLines.get(7));
        assertEquals("    <third/>", aLines.get(8));
        assertEquals("  </child>", aLines.get(9));
        assertEquals("</parent>", aLines.get(10));
    }

    static private XmlReportWriter createXmlReportWriter(Path pReportFile) throws IOException
    {
        return new XmlReportWriter(createReportWithOutputLocation(pReportFile));
    }
}


text:
package com.homerenting.domain.modules.header.search;

/**
 * Created by Arthur on 17/04/14.
 */
public enum VillageTipologies {

    V1("v1"),
    V2("v2"),
    V3("v3"),
    V4("v4"),
    V5("v5"),
    V6("v6"),
    V6_OR_MORE("v6 or more");

    private final String vilageTipology;

    private VillageTipologies(String vilageTipology) {
        this.vilageTipology = vilageTipology;
    }

    public String getValue(){
        return this.vilageTipology;
    }
}


text:
import { clone } from 'lodash'
import { TRANSACTION_GROUPS } from '@config'

export default store => {
  store.getters['profile/all'].forEach(profile => {
    const lastFees = profile.lastFees

    const values = Object.values(lastFees || {})
    if (!values.length || values.every(value => typeof value === 'object')) {
      return
    }

    const updatedProfile = clone(profile)

    updatedProfile.lastFees = {
      [TRANSACTION_GROUPS.STANDARD]: {
        ...lastFees
      }
    }

    store.dispatch('profile/update', updatedProfile)
  })

  store.dispatch('app/setLatestAppliedMigration', '2.9.0')
}


text:
package discordbot.modules.reddit.pojo;

import com.google.gson.annotations.Expose;

/**
 * Created by Siddharth Verma on 24/4/16.
 */
public class InitialData {

    @Expose
    public Listing data;
    @Expose
    public String kind;
}


text:
title: SINDIKASI MEDIA ONLINE & DIREKTORI VISUAL SENI BUDAYA NUSANTARA
date: 2011-09-16 11:08:00 +07:00
nohibah: 689
inisiator: FG. PANDHUAGIE
lokasi: DIY, JOGJA
dana: 650 Juta Rupiah
topik: Meretas batas – kebhinekaan bermedia
lama: April – November 2012 (selama delapan bulan)
deskripsi: |-
  Sebuah upaya dan usaha pengembangan wacana pemahaman publik terhadap kemajemukan (baca: pluralisme) kebudayaan Nusantara melalui aplikasi publikasi seni budaya yang kontekstual dengan sistem kehidupan masyarakat, yang pada gilirannya akan menumbuhkan pengakuan, penghormatan, rasa-kepemilikan, dan kepedulian masyarakat pada keberagaman nilai-nilai seni dan budaya di Nusantara.

  Slogan Kenali Negerimu…Cintai Negerimu…
  Tentu tak sekedar menjadi deretan eksotisme kata tanpa arti belaka,
  akan halnya pepatah lama: Tak Kenal Maka Tak Sayang?
  Semua itu merujuk pada sebuah kesatuan spirit, sinergisitas, integritas dalam kemitraan yang harmonis meramu berbagai strategi kreatif, aksi, pembela,
  yang berangkat dari konten lokal dalam menjawab tantangan global.

  Pilot-project yang dijalankan ini, di awali dengan survei, pemetaan dan diskusi, serta workshop dokumentasi (foto dan video), dan workshop jurnalisme seni dan media online, yang nantinya dapat segera memulai pendataan, pengarsipan, dan mempublikasikan semua informasi (teks) dan
  data visual (foto dan video), melalui sindikasi Social Media: website, blog, twitter, facebook, dsbnya, yang berasal dari potensi kekayaan keanekaragaman seni budaya yang ada di Indonesia dalam format Sindikasi Media Online dan Direktori Visual Seni Budaya Nusantara.
masalah: Untuk meningkatkan dan memperdayakan sikap apresiasi, pengakuan, penghormatan,
  dan kepedulian masyarakat pada nilai-nilai seni dan budaya Nusantara yang beraneka-ragam,
  yang diharapkan mampu turut mendukung cara hidup bersama dalam masyarakat yang lebih
  baik dan berkualitas, dengan sikap pemahaman multikulturalisme (diversity, egality
  dan unity), yang memuliakan dan menjunjung tinggi hak azasi, demokrasi dan lingkungan
  tempat tinggal, baik di Indonesia maupun di dunia pada umumnya. Melalui keberadaan
  Sindikasi Media dan Online Direktori Visual Seni Budaya Nusantara.
solusi: |-
  Pluralisme dalam konteks pemberdayaan kesadaran bermedia yang dimaksud di atas, dapat kita atasi dengan jalan menyelenggarakan Survey, Mapping, Discuss, Workshop: Dokumentasi Foto dan Video, Workshop Jurnalisme Seni dan Media Online, serta mempublikasikan semua informasi (teks) dan data visual (foto dan video), dengan membangun Sindikasi Media Online dan Direktori Visual Seni Budaya Nusantara baru, yang murah, efisien dan efektif melalui jaringan Social Media (website, blog, twitter, facebook, dsbnya), yang berasal dari potensi kekayaan keanekaragaman seni budaya yang ada di Nusantara.
  Yang diuntungkan dari Pilot Project ini:
  1. Masyarakat Adat dan Seni Pertunjukan Nusantara,
  2. Pemerintah Pusat-Daerah, Dewan Kesenian/Kebudayaan dan LSM,
  3. Universitaria, Institusia dan Akademia,
  4. Jaringan Komunitas Seni Budaya Se-Nusantara,
  5. Scientis, Ilmuwan, Peneliti, dsbnya.

  Workshop di 7 (Tujuh) Kota:
  1. Medan (DI. Aceh, Sumut, Sumbar, Riau, Kepri)
  2. Bandar Lampung (Jambi, Bengkulu, Bangka Belitung, Sumsel, Lampung)
  3. Banjarmasin (Kalsel, Kalbar, Kalteng, Kaltim)
  4. Yogyakarta (Banten, DKI Jakarta, Jabar, Jateng, DIY)
  5. Denpasar (Jatim, Bali, NTB, NTT)
  6. Makassar (Sulsel, Sulbar, Sulteng, Gorontalo, Sulut, Sultra)
  7. Sorong (Maluku Utara, Maluku, Papua Barat, Papua)
keberhasilan: |-
  Keberhasilan yang menjadi acuan di sini adalah kesuksesan dalam mengatasi setiap kendala teknis dan non-teknis dari setiap kota atau wilayah yang menjadi target atau sampling dari pilot-project ini. Serta yang paling penting adalah dapat mengajak peran serta masyarakat seni, adat atau budaya agar sadar dan mulai bertindak dan berpartisipasi aktif, menghargai dan mengapresiasi setiap potensi kekayaan keanekaragaman seni dan budaya yang dimilikinya untuk kemudian secara arif dan bijak, bersama-sama membangun gerakan kolektif Sindikasi Media Online dan Direktori Visual Seni Budaya Nusantara di tanah air.
  Think Locally, Act Globally…Viva Media Action 4 Cultural Movement!!!
organisasi: NA
diuntungkan: 'Pluralisme dalam konteks pemberdayaan kesadaran bermedia yang dimaksud
  di atas, dapat kita atasi dengan jalan menyelenggarakan Survey, Mapping, Discuss,
  Workshop: Dokumentasi Foto dan Video, Workshop Jurnalisme Seni dan Media Online,
  serta mempublikasikan semua informasi (teks) dan data visual (foto dan video), dengan
  membangun satu kemasan Sindikasi Media Online dan Direktori Visual Seni Budaya Nusantara
  baru, yang murah, efisien dan efektif melalui jaringan Social Media (website, blog,
  twitter, facebook, dsbnya), yang berasal dari potensi kekayaan keanekaragaman seni
  budaya yang ada di Nusantara.'
layout: hibahcmb
---

![689](/static/img/hibahcmb/689.png){: .img-responsive }{: width="350" }

### {{ page.nohibah }} - {{ page.title }}

---


text:
#ifndef __ARCH_ARM_REGISTERS_HH__
#define __ARCH_ARM_REGISTERS_HH__

#include "arch/arm/generated/max_inst_regs.hh"
#include "arch/arm/intregs.hh"
#include "arch/arm/ccregs.hh"
#include "arch/arm/miscregs.hh"

namespace ArmISA {

// For a predicated instruction, we need all the
// destination registers to also be sources
const int MaxInstSrcRegs = ArmISAInst::MaxInstDestRegs +
    ArmISAInst::MaxInstSrcRegs;
using ArmISAInst::MaxInstDestRegs;
using ArmISAInst::MaxMiscDestRegs;

typedef uint16_t  RegIndex;

typedef uint64_t IntReg;

// floating point register file entry type
typedef uint32_t FloatRegBits;
typedef float FloatReg;

// cop-0/cop-1 system control register
typedef uint64_t MiscReg;

// condition code register; must be at least 32 bits for FpCondCodes
typedef uint64_t CCReg;

// Constants Related to the number of registers
const int NumIntArchRegs = NUM_ARCH_INTREGS;
// The number of single precision floating point registers
const int NumFloatV7ArchRegs  = 64;
const int NumFloatV8ArchRegs  = 128;
const int NumFloatSpecialRegs = 32;

const int NumIntRegs = NUM_INTREGS;
const int NumFloatRegs = NumFloatV8ArchRegs + NumFloatSpecialRegs;
const int NumCCRegs = NUM_CCREGS;
const int NumMiscRegs = NUM_MISCREGS;

#define ISA_HAS_CC_REGS

const int TotalNumRegs = NumIntRegs + NumFloatRegs + NumMiscRegs;

// semantically meaningful register indices
const int ReturnValueReg = 0;
const int ReturnValueReg1 = 1;
const int ReturnValueReg2 = 2;
const int NumArgumentRegs = 4;
const int NumArgumentRegs64 = 8;
const int ArgumentReg0 = 0;
const int ArgumentReg1 = 1;
const int ArgumentReg2 = 2;
const int ArgumentReg3 = 3;
const int FramePointerReg = 11;
const int StackPointerReg = INTREG_SP;
const int ReturnAddressReg = INTREG_LR;
const int PCReg = INTREG_PC;

const int ZeroReg = INTREG_ZERO;

const int SyscallNumReg = ReturnValueReg;
const int SyscallPseudoReturnReg = ReturnValueReg;
const int SyscallSuccessReg = ReturnValueReg;

// These help enumerate all the registers for dependence tracking.
const int FP_Reg_Base = NumIntRegs * (MODE_MAXMODE + 1);
const int CC_Reg_Base = FP_Reg_Base + NumFloatRegs;
const int Misc_Reg_Base = CC_Reg_Base + NumCCRegs;
const int Max_Reg_Index = Misc_Reg_Base + NumMiscRegs;

typedef union {
    IntReg   intreg;
    FloatReg fpreg;
    CCReg    ccreg;
    MiscReg  ctrlreg;
} AnyReg;

} // namespace ArmISA

#endif