text:
<?php
/**
 *
 *
 * PHP version 5
 *
 * @package
 * @author  Andrey Filippov <afi.work@gmail.com>
 */

namespace Solo\Logger;

use Solo\Logger\Writers\BaseWriter;

class Logger
{
	/**
	 * Name of logger
	 *
	 * @var string
	 */
	public $name = null;

	/**
	 * Enabled\disabled
	 *
	 * @var bool
	 */
	public $enabled = true;

	/**
	 * Pattern of log message
	 *
	 * @var string
	 */
	public $format = "{date-time} [{log-level}],{log-name}: {log-message}\nContext: {log-context}\n\n";

	/**
	 * Levels
	 *
	 * @var array
	 */
	public static $levels = array(
		100 => 'DEBUG',
		200 => 'INFO',
		250 => 'NOTICE',
		300 => 'WARNING',
		400 => 'ERROR',
		500 => 'CRITICAL',
		550 => 'ALERT',
		600 => 'EMERGENCY',
	);

	protected static $instances = array();

	/**
	 * @var BaseWriter[]
	 */
	protected $writers = array();

	private static $settings = array(

		// List of loggers
		"loggers" => [
			"default" => [
				"enabled" => true,
				"writers" => ["default"],
//				"format" => "{date-time} {log-level},{logger-name}: {message}\n"
			]
		],

		// List of writing ways
		"writers" => [

			"default" => [
				"enabled" => true,
				"level" => Level::DEBUG,
				"class" => "Solo\\Logger\\Writers\\ConsoleWriter",
				"ignoreErrors" => true,
				"writeOnlyCurrentLevel" => false,
				"options" => [ ]
			]
		],

		// List of classes to parse and fill log patterns
		"parsers" => [
			"bool" => "Solo\\Logger\\Parsers\\BoolParser",
			"numeric" => "Solo\\Logger\\Parsers\\NumericParser",
			"array" => "Solo\\Logger\\Parsers\\ArrayParser",
			"string" => "Solo\\Logger\\Parsers\\StringParser",
			"exception" => "Solo\\Logger\\Parsers\\ExceptionParser",
			"object" => "Solo\\Logger\\Parsers\\ObjectParser",
			"resource" => "Solo\\Logger\\Parsers\\ResourceParser",
			"ip" => "Solo\\Logger\\Parsers\\IpParser",
			"env" => "Solo\\Logger\\Parsers\\EnvParser",
			"builtin" => "Solo\\Logger\\Parsers\\BuiltInParser",
		]
	);

	/**
	 * Ctor
	 *
	 * @param string $name Name of logger
	 */
	public function __construct($name)
	{
		$this->name = $name;
	}

	/**
	 * Init the logger
	 *
	 * @param mixed $settings
	 *
	 * @return void
	 */
	public static function init($settings = null)
	{
		if (!is_null($settings))
			self::$settings = array_replace_recursive(self::$settings, $settings);
	}

	/**
	 * @param null $name
	 *
	 * @return Logger
	 */
	public static function get($name = null)
	{
		if (!$name)
			$name = "default";

		if (array_key_exists($name, self::$instances))
		{
			return self::$instances[$name];
		}
		else
		{
			$opts = @self::$settings["loggers"][$name];
			if (!$opts)
				throw new \RuntimeException("Logger '{$name}' is not defined");

			$logger = new Logger($name);
//			$logger->format = self::getOption($opts, "format", "{date-time} [{log-level}] {logger-name}: {message}\n");//$opts["format"];
			$logger->format = self::getOption($opts, "format", $logger->format);//$opts["format"];
			$logger->enabled = self::getOption($opts, "enabled", true);

			foreach ($opts["writers"] as $wr)
				$logger->addWriter($wr);

			self::$instances["name"] = $logger;
			return $logger;
		}
	}

	protected function addWriter($name)
	{
		$opts = @self::$settings["writers"][$name];
		if (!$opts)
			throw new \RuntimeException("Logger: can't create writer {$name}");

		$className = $opts["class"];
		$rc = new \ReflectionClass($className);
		$writer = $rc->newInstance();
		$writer->level =                 self::getOption($opts, "level", Level::DEBUG);//$opts["level"];
		$writer->ignoreErrors =          self::getOption($opts, "ignoreErrors", true);
		$writer->enabled =               self::getOption($opts, "enabled", true);
		$writer->writeOnlyCurrentLevel = self::getOption($opts, "writeOnlyCurrentLevel", false);

		foreach ($opts["options"] as $k => $v)
			$writer->$k = $v;

		$this->writers[$name] = $writer;
	}

	protected static function getOption($list, $key, $default)
	{
		if (array_key_exists($key, $list))
			return $list[$key];
		else
			return $default;
	}

	/**
	 * Write a message
	 *
	 * @param int $level Log level
	 * @param string $message Message
	 * @param mixed $context
	 *
	 * @throws \Exception
	 */
	public function write($level, $message, $context = null)
	{
		if (!is_string($message))
			throw new \InvalidArgumentException("Message must be a string");

		if ($this->enabled)
		{
			$record = new LogRecord();
			$record->context = $context;
			$record->message = $message;
			$record->loggerName = $this->name;
			$record->level = $level;
			$record->formatted = $this->format;

			$res = $record;
			foreach (self::$settings["parsers"] as $name => $className)
			{
				$inst = new $className($res);
				$res = $inst->parse();
			}

			foreach ($this->writers as $writer)
				$writer->handle($level, $res);
		}
	}

	public function debug($message, $context = null)
	{
		$this->write(Level::DEBUG, $message, $context);
	}

	public function error($message, $context = null)
	{
		$this->write(Level::ERROR, $message, $context);
	}

	public function info($message, $context = null)
	{
		$this->write(Level::INFO, $message, $context);
	}

	public function notice($message, $context = null)
	{
		$this->write(Level::NOTICE, $message, $context);
	}

	public function warning($message, $context = null)
	{
		$this->write(Level::WARNING, $message, $context);
	}

	public function critical($message, $context = null)
	{
		$this->write(Level::CRITICAL, $message, $context);
	}

	public function alert($message, $context = null)
	{
		$this->write(Level::ALERT, $message, $context);
	}

	public function emergency($message, $context = null)
	{
		$this->write(Level::EMERGENCY, $message, $context);
	}
}


text:
Optimal.

Die Techniken der optimierten Version sind beibehalten worden. Im Vergleich zur Standard-Version der
            BaRESS-Seite wurden hier einige Regeln zur Performance-Optimierung
            eingehalten. Eine einfache Liste der Regeln findest du hier:
            14 Performance Rules by Steve
                    Souders

            Von den Yahoo!-Entwicklern wurde eine ähnliche, etwas ausführlichere Liste zusammengetragen:

                    Best Practices for Speeding up your Web Site

Verbessert durch...

Liste der eingesetzten Optimierungs-Techniken:

                 Minification und Concatenation
                 on-the-fly durch Einsatz von
                    SmartOptimizer von Ali
                        Farhadi

                 GZIP Kompression
                 durch Einsatz des Apache-Moduls mod_deflate

                 Expires Header
                 durch Einsatz des Apache-Moduls mod_expires

                 CSS/JS richtig platzieren
                 Für schnelleren Seitenaufbau: CSS an den Anfang, JavaScript ans Ende

                 LazyLoading
                 Bilder nachladen, die nicht sichtbar sind, mittels unveil.js

redpajama_set_name: RedPajamaGithub


text:
package org.mycontroller.standalone.mysensors.structs;

import java.nio.ByteOrder;

import javolution.io.Struct;

/**
 * @author Jeeva Kandasamy (jkandasa)
 * @since 0.0.1
 */
public class FirmwareConfigRequest extends Struct {
    private final Unsigned16 type = new Unsigned16();
    private final Unsigned16 version = new Unsigned16();
    private final Unsigned16 blocks = new Unsigned16();
    private final Unsigned16 crc = new Unsigned16();
    private final Unsigned16 BLVersion = new Unsigned16();

    public ByteOrder byteOrder() {
        return ByteOrder.LITTLE_ENDIAN;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Type:").append(getType());
        builder.append(", Version:").append(getVersion());
        builder.append(", Blocks:").append(getBlocks());
        builder.append(", CRC:").append(getCrc());
        builder.append(", BLVersion:").append(getBLVersion());
        return builder.toString();
    }

    public Integer getVersion() {
        return version.get();
    }

    public Integer getType() {
        return type.get();
    }

    public Integer getBlocks() {
        return blocks.get();
    }

    public Integer getCrc() {
        return crc.get();
    }

    public Integer getBLVersion() {
        return BLVersion.get();
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <property name="jnlp.title"    value="JST DividerLocation" />
  <property name="jnlp.Name"     value="DividerLocation" />
  <property name="jnlp.name"     value="dividerlocation" />
  <property name="jnlp.codebase" value="https://ateraimemo.com/swing/dividerlocation/" />
  <property name="jnlp.homepage" value="https://ateraimemo.com/Swing/DividerLocation.html" />
</project>


text:
'use strict';

var test         = require('tape');
var objectExcept = require('./');

test('should get property from object', function (t) {
	t.plan(2);

	var obj = {
		foo: 'bar',
		bar: 'foo'
	};

	t.equal(undefined, objectExcept(obj, 'foo').foo);
	t.equal(undefined, objectExcept(obj, ['foo']).foo);
});

test('should get properties from object', function (t) {
	t.plan(4);

	var obj = {
		foo: 'bar',
		bar: 'foo',
		foobar: 2
	};

	var res = objectExcept(obj, ['foo', 'bar']);
	t.equal(undefined, res.bar);
	t.equal(undefined, res.foo);
	t.equal(2, res.foobar);

	var obj = {
		foo: {
			bar: 'foo'
		}
	};

	var res = objectExcept(obj, ['foo.bar']);
	t.equal(0, Object.keys(res).length);
});

test('should throw error with wrong arguments', function (t) {
	t.plan(2);

	try {
		objectExcept(null);
	} catch (e) {
		t.equal('`obj` should be object', e.message);
	}

	try {
		objectExcept({}, null);
	} catch (e) {
		t.equal('`keys` should be array', e.message);
	}
});


text:
package org.opengroup.osdu.core.common.http;

import com.google.common.base.Strings;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.storage.MessageContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Component
@RequestScope
public class RequestBodyExtractor {
	private static final String INVALID_PUBSUB_MESSAGE = "Invalid pubsub message";
	private static final Gson GSON = new Gson();
	private MessageContent messageContent;

	@Autowired
	private HttpServletRequest httpServletRequest;

	public Map<String, String> extractAttributesFromRequestBody() {
		if (this.messageContent == null) {
			this.messageContent = this.extractPubsubMessageFromRequestBody();
		}
		return this.messageContent.getAttributes();
	}

	public String extractDataFromRequestBody() {
		if (this.messageContent == null) {
			this.messageContent = this.extractPubsubMessageFromRequestBody();
		}
		return this.messageContent.getData();
	}

	private MessageContent extractPubsubMessageFromRequestBody() {
		try {
			JsonParser jsonParser = new JsonParser();
			BufferedReader reader = this.httpServletRequest.getReader();
			Stream<String> lines = reader.lines();
			String requestBody = lines.collect(Collectors.joining("\n"));
			JsonElement jsonRoot = jsonParser.parse(requestBody);
			if (!(jsonRoot instanceof JsonObject)) {
				throw new AppException(HttpStatus.SC_BAD_REQUEST, "RequestBody is not JsonObject.",
						"Request Body should be JsonObject to be processed.");
			}
			JsonElement message = jsonRoot.getAsJsonObject().get("message");
			if (message == null) {
				throw new AppException(HttpStatus.SC_BAD_REQUEST, INVALID_PUBSUB_MESSAGE, "message object not found");
			}
			MessageContent content = GSON.fromJson(message.toString(), MessageContent.class);

			Map<String, String> attributes = content.getAttributes();
			if (attributes.isEmpty()) {
				throw new AppException(HttpStatus.SC_BAD_REQUEST, INVALID_PUBSUB_MESSAGE, "attribute map not found");
			}
			Map<String, String> lowerCase = new HashMap<>();
			attributes.forEach((key, value) -> lowerCase.put(key.toLowerCase(), value));
			if (Strings.isNullOrEmpty(attributes.get(DpsHeaders.ACCOUNT_ID))
					&& Strings.isNullOrEmpty(attributes.get(DpsHeaders.DATA_PARTITION_ID))) {
				throw new AppException(HttpStatus.SC_BAD_REQUEST, INVALID_PUBSUB_MESSAGE,
						"No tenant information from pubsub message.");
			}
			content.setAttributes(lowerCase);

			String decoded = new String(Base64.getDecoder().decode(content.getData()));
			content.setData(decoded);

			return content;
		} catch (IOException e) {
			throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Request payload parsing error",
					"Unable to parse request payload.", e);
		}
	}
}


text:
var setProperty = function(obj, name, func, delayEval) {
	if(!delayEval) {
		obj[name] = func();
		return;
	}

	obj.__defineGetter__(name, function(){
		delete this[name];
		return this[name] = func();
	});
};

var setProperties = function(obj, func, attributes, delayEval) {
	if(!delayEval) {
		var result = func();
		for(var key in result) {
			obj[key] = result[key];
		}
		return;
	}

	var len = attributes.length;
	for(var i = 0; i < len; i++) {
		// set "FIRST" property
		obj.__defineGetter__(attributes[i],
			function(ownKey) {
				return function() {
					var result = func();
					for(var key in result) {
						delete this[key];
						this[key] = result[key];
					}
					return result[ownKey];
				};
			}(attributes[i])
		);
	}
};


text:
"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useAdaptivityWithMediaQueries = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

var React = _interopRequireWildcard(require("react"));

var _vkjs = require("@vkontakte/vkjs");

var _AdaptivityContext = require("../components/AdaptivityProvider/AdaptivityContext");

var _getOrDefault = require("../helpers/getOrDefault");

var _adaptivity = require("../lib/adaptivity");

var _useMediaQueries = require("./useMediaQueries");

var _usePlatform = require("./usePlatform");

/**
 * Высчитывает и возвращает параметры адаптивности при изменении вьюпорта.
 *
 * Берёт в приоритет значения из `AdaptivityContext.
 *
 * > ⚠ SSR
 * >
 * > Во избежания ошибок при гидрации, не используйте данный хук, если есть вероятность, что компонент будет отрендерен
 * > на стороне сервера.
 * >
 * > Лучше всего использовать для всплывающих окон, т.к. они вызывается только после загрузки
 * > страницы либо пользователем, либо программно.
 */
var useAdaptivityWithMediaQueries = function useAdaptivityWithMediaQueries() {
  var _React$useContext = React.useContext(_AdaptivityContext.AdaptivityContext),
      viewWidthContext = _React$useContext.viewWidth,
      viewHeightContext = _React$useContext.viewHeight,
      sizeXContext = _React$useContext.sizeX,
      sizeYContext = _React$useContext.sizeY,
      hasMouseContext = _React$useContext.hasMouse,
      deviceHasHoverContext = _React$useContext.deviceHasHover;

  var platform = (0, _usePlatform.usePlatform)();
  var mediaQueries = (0, _useMediaQueries.useMediaQueries)();

  var _React$useState = React.useState(function () {
    return [(0, _getOrDefault.getOrDefault)(viewWidthContext, (0, _adaptivity.getViewWidthByMediaQueries)(mediaQueries)), (0, _getOrDefault.getOrDefault)(viewHeightContext, (0, _adaptivity.getViewHeightByMediaQueries)(mediaQueries))];
  }),
      _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
      _React$useState2$ = (0, _slicedToArray2.default)(_React$useState2[0], 2),
      viewWidthLocal = _React$useState2$[0],
      viewHeightLocal = _React$useState2$[1],
      setViewSizeLocal = _React$useState2[1];

  var adaptivityProps = React.useMemo(function () {
    var hasMouse = (0, _getOrDefault.getOrDefault)(hasMouseContext, _vkjs.hasMouse);
    var deviceHasHover = (0, _getOrDefault.getOrDefault)(deviceHasHoverContext, _vkjs.hasHover);
    var viewWidth = (0, _getOrDefault.getOrDefault)(viewWidthContext, viewWidthLocal);
    var viewHeight = (0, _getOrDefault.getOrDefault)(viewHeightContext, viewHeightLocal);
    var sizeX = (0, _getOrDefault.getOrDefault)(sizeXContext, (0, _adaptivity.getSizeX)(viewWidth));
    var sizeY = (0, _getOrDefault.getOrDefault)(sizeYContext, (0, _adaptivity.getSizeY)(viewWidth, viewHeight, hasMouse));
    var isDesktop = (0, _adaptivity.checkIsDesktop)(viewWidth, viewHeight, hasMouse, platform);
    return {
      viewWidth: viewWidth,
      viewHeight: viewHeight,
      sizeX: sizeX,
      sizeY: sizeY,
      hasMouse: hasMouse,
      deviceHasHover: deviceHasHover,
      isDesktop: isDesktop
    };
  }, [viewWidthLocal, viewHeightLocal, viewWidthContext, viewHeightContext, sizeXContext, sizeYContext, hasMouseContext, deviceHasHoverContext, platform]);
  React.useEffect(function () {
    var handleMediaQuery = function handleMediaQuery() {
      setViewSizeLocal(function (prevSizeLocal) {
        var newViewWidthLocal = (0, _getOrDefault.getOrDefault)(viewWidthContext, (0, _adaptivity.getViewWidthByMediaQueries)(mediaQueries));
        var newViewHeightLocal = (0, _getOrDefault.getOrDefault)(viewHeightContext, (0, _adaptivity.getViewHeightByMediaQueries)(mediaQueries));

        var _prevSizeLocal = (0, _slicedToArray2.default)(prevSizeLocal, 2),
            prevViewWidthLocal = _prevSizeLocal[0],
            prevViewHeightLocal = _prevSizeLocal[1];

        if (prevViewWidthLocal !== newViewWidthLocal || prevViewHeightLocal !== newViewHeightLocal) {
          return [newViewWidthLocal, newViewHeightLocal];
        }

        return prevSizeLocal;
      });
    };

    if (!viewWidthContext) {
      mediaQueries.desktopPlus.addEventListener("change", handleMediaQuery);
      mediaQueries.tablet.addEventListener("change", handleMediaQuery);
      mediaQueries.smallTablet.addEventListener("change", handleMediaQuery);
      mediaQueries.mobile.addEventListener("change", handleMediaQuery);
    }

    if (!viewHeightContext) {
      mediaQueries.mediumHeight.addEventListener("change", handleMediaQuery);
      mediaQueries.mobileLandscapeHeight.addEventListener("change", handleMediaQuery);
    }

    return function () {
      mediaQueries.desktopPlus.removeEventListener("change", handleMediaQuery);
      mediaQueries.tablet.removeEventListener("change", handleMediaQuery);
      mediaQueries.smallTablet.removeEventListener("change", handleMediaQuery);
      mediaQueries.mobile.removeEventListener("change", handleMediaQuery);
      mediaQueries.mediumHeight.removeEventListener("change", handleMediaQuery);
      mediaQueries.mobileLandscapeHeight.removeEventListener("change", handleMediaQuery);
    };
  }, [mediaQueries, viewWidthContext, viewHeightContext]);
  return adaptivityProps;
};

exports.useAdaptivityWithMediaQueries = useAdaptivityWithMediaQueries;
//# sourceMappingURL=useAdaptivityWithMediaQueries.js.map


text:
"""Tests for rest component."""

import asyncio
from datetime import timedelta
from os import path
from unittest.mock import patch

import respx

from homeassistant import config as hass_config
from homeassistant.components.rest.const import DOMAIN
from homeassistant.const import (
    ATTR_ENTITY_ID,
    DATA_MEGABYTES,
    SERVICE_RELOAD,
    STATE_UNAVAILABLE,
)
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow

from tests.common import async_fire_time_changed

@respx.mock
async def test_setup_with_endpoint_timeout_with_recovery(hass):
    """Test setup with an endpoint that times out that recovers."""
    await async_setup_component(hass, "homeassistant", {})

    respx.get("http://localhost").mock(side_effect=asyncio.TimeoutError())
    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource": "http://localhost",
                    "method": "GET",
                    "verify_ssl": "false",
                    "timeout": 30,
                    "sensor": [
                        {
                            "unit_of_measurement": DATA_MEGABYTES,
                            "name": "sensor1",
                            "value_template": "{{ value_json.sensor1 }}",
                        },
                        {
                            "unit_of_measurement": DATA_MEGABYTES,
                            "name": "sensor2",
                            "value_template": "{{ value_json.sensor2 }}",
                        },
                    ],
                    "binary_sensor": [
                        {
                            "name": "binary_sensor1",
                            "value_template": "{{ value_json.binary_sensor1 }}",
                        },
                        {
                            "name": "binary_sensor2",
                            "value_template": "{{ value_json.binary_sensor2 }}",
                        },
                    ],
                }
            ]
        },
    )
    await hass.async_block_till_done()
    assert len(hass.states.async_all()) == 0

    respx.get("http://localhost").respond(
        status_code=200,
        json={
            "sensor1": "1",
            "sensor2": "2",
            "binary_sensor1": "on",
            "binary_sensor2": "off",
        },
    )

    # Refresh the coordinator
    async_fire_time_changed(hass, utcnow() + timedelta(seconds=31))
    await hass.async_block_till_done()

    # Wait for platform setup retry
    async_fire_time_changed(hass, utcnow() + timedelta(seconds=61))
    await hass.async_block_till_done()

    assert len(hass.states.async_all()) == 4

    assert hass.states.get("sensor.sensor1").state == "1"
    assert hass.states.get("sensor.sensor2").state == "2"
    assert hass.states.get("binary_sensor.binary_sensor1").state == "on"
    assert hass.states.get("binary_sensor.binary_sensor2").state == "off"

    # Now the end point flakes out again
    respx.get("http://localhost").mock(side_effect=asyncio.TimeoutError())

    # Refresh the coordinator
    async_fire_time_changed(hass, utcnow() + timedelta(seconds=31))
    await hass.async_block_till_done()

    assert hass.states.get("sensor.sensor1").state == STATE_UNAVAILABLE
    assert hass.states.get("sensor.sensor2").state == STATE_UNAVAILABLE
    assert hass.states.get("binary_sensor.binary_sensor1").state == STATE_UNAVAILABLE
    assert hass.states.get("binary_sensor.binary_sensor2").state == STATE_UNAVAILABLE

    # We request a manual refresh when the
    # endpoint is working again

    respx.get("http://localhost").respond(
        status_code=200,
        json={
            "sensor1": "1",
            "sensor2": "2",
            "binary_sensor1": "on",
            "binary_sensor2": "off",
        },
    )

    await hass.services.async_call(
        "homeassistant",
        "update_entity",
        {ATTR_ENTITY_ID: ["sensor.sensor1"]},
        blocking=True,
    )
    assert hass.states.get("sensor.sensor1").state == "1"
    assert hass.states.get("sensor.sensor2").state == "2"
    assert hass.states.get("binary_sensor.binary_sensor1").state == "on"
    assert hass.states.get("binary_sensor.binary_sensor2").state == "off"

@respx.mock
async def test_setup_minimum_resource_template(hass):
    """Test setup with minimum configuration (resource_template)."""

    respx.get("http://localhost").respond(
        status_code=200,
        json={
            "sensor1": "1",
            "sensor2": "2",
            "binary_sensor1": "on",
            "binary_sensor2": "off",
        },
    )
    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource_template": "{% set url = 'http://localhost' %}{{ url }}",
                    "method": "GET",
                    "verify_ssl": "false",
                    "timeout": 30,
                    "sensor": [
                        {
                            "unit_of_measurement": DATA_MEGABYTES,
                            "name": "sensor1",
                            "value_template": "{{ value_json.sensor1 }}",
                        },
                        {
                            "unit_of_measurement": DATA_MEGABYTES,
                            "name": "sensor2",
                            "value_template": "{{ value_json.sensor2 }}",
                        },
                    ],
                    "binary_sensor": [
                        {
                            "name": "binary_sensor1",
                            "value_template": "{{ value_json.binary_sensor1 }}",
                        },
                        {
                            "name": "binary_sensor2",
                            "value_template": "{{ value_json.binary_sensor2 }}",
                        },
                    ],
                }
            ]
        },
    )
    await hass.async_block_till_done()
    assert len(hass.states.async_all()) == 4

    assert hass.states.get("sensor.sensor1").state == "1"
    assert hass.states.get("sensor.sensor2").state == "2"
    assert hass.states.get("binary_sensor.binary_sensor1").state == "on"
    assert hass.states.get("binary_sensor.binary_sensor2").state == "off"

@respx.mock
async def test_reload(hass):
    """Verify we can reload."""

    respx.get("http://localhost") % 200

    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource": "http://localhost",
                    "method": "GET",
                    "verify_ssl": "false",
                    "timeout": 30,
                    "sensor": [
                        {
                            "name": "mockrest",
                        },
                    ],
                }
            ]
        },
    )
    await hass.async_block_till_done()
    await hass.async_start()
    await hass.async_block_till_done()

    assert len(hass.states.async_all()) == 1

    assert hass.states.get("sensor.mockrest")

    yaml_path = path.join(
        _get_fixtures_base_path(),
        "fixtures",
        "rest/configuration_top_level.yaml",
    )
    with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
        await hass.services.async_call(
            "rest",
            SERVICE_RELOAD,
            {},
            blocking=True,
        )
        await hass.async_block_till_done()

    assert hass.states.get("sensor.mockreset") is None
    assert hass.states.get("sensor.rollout")
    assert hass.states.get("sensor.fallover")

@respx.mock
async def test_reload_and_remove_all(hass):
    """Verify we can reload and remove all."""

    respx.get("http://localhost") % 200

    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource": "http://localhost",
                    "method": "GET",
                    "verify_ssl": "false",
                    "timeout": 30,
                    "sensor": [
                        {
                            "name": "mockrest",
                        },
                    ],
                }
            ]
        },
    )
    await hass.async_block_till_done()
    await hass.async_start()
    await hass.async_block_till_done()

    assert len(hass.states.async_all()) == 1

    assert hass.states.get("sensor.mockrest")

    yaml_path = path.join(
        _get_fixtures_base_path(),
        "fixtures",
        "rest/configuration_empty.yaml",
    )
    with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
        await hass.services.async_call(
            "rest",
            SERVICE_RELOAD,
            {},
            blocking=True,
        )
        await hass.async_block_till_done()

    assert hass.states.get("sensor.mockreset") is None

@respx.mock
async def test_reload_fails_to_read_configuration(hass):
    """Verify reload when configuration is missing or broken."""

    respx.get("http://localhost") % 200

    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource": "http://localhost",
                    "method": "GET",
                    "verify_ssl": "false",
                    "timeout": 30,
                    "sensor": [
                        {
                            "name": "mockrest",
                        },
                    ],
                }
            ]
        },
    )
    await hass.async_block_till_done()
    await hass.async_start()
    await hass.async_block_till_done()

    assert len(hass.states.async_all()) == 1

    yaml_path = path.join(
        _get_fixtures_base_path(),
        "fixtures",
        "rest/configuration_invalid.notyaml",
    )
    with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
        await hass.services.async_call(
            "rest",
            SERVICE_RELOAD,
            {},
            blocking=True,
        )
        await hass.async_block_till_done()

    assert len(hass.states.async_all()) == 1

def _get_fixtures_base_path():
    return path.dirname(path.dirname(path.dirname(__file__)))

@respx.mock
async def test_multiple_rest_endpoints(hass):
    """Test multiple rest endpoints."""

    respx.get("http://date.jsontest.com").respond(
        status_code=200,
        json={
            "date": "03-17-2021",
            "milliseconds_since_epoch": 1616008268573,
            "time": "07:11:08 PM",
        },
    )

    respx.get("http://time.jsontest.com").respond(
        status_code=200,
        json={
            "date": "03-17-2021",
            "milliseconds_since_epoch": 1616008299665,
            "time": "07:11:39 PM",
        },
    )
    respx.get("http://localhost").respond(
        status_code=200,
        json={
            "value": "1",
        },
    )
    assert await async_setup_component(
        hass,
        DOMAIN,
        {
            DOMAIN: [
                {
                    "resource": "http://date.jsontest.com",
                    "sensor": [
                        {
                            "name": "JSON Date",
                            "value_template": "{{ value_json.date }}",
                        },
                        {
                            "name": "JSON Date Time",
                            "value_template": "{{ value_json.time }}",
                        },
                    ],
                },
                {
                    "resource": "http://time.jsontest.com",
                    "sensor": [
                        {
                            "name": "JSON Time",
                            "value_template": "{{ value_json.time }}",
                        },
                    ],
                },
                {
                    "resource": "http://localhost",
                    "binary_sensor": [
                        {
                            "name": "Binary Sensor",
                            "value_template": "{{ value_json.value }}",
                        },
                    ],
                },
            ]
        },
    )
    await hass.async_block_till_done()
    assert len(hass.states.async_all()) == 4

    assert hass.states.get("sensor.json_date").state == "03-17-2021"
    assert hass.states.get("sensor.json_date_time").state == "07:11:08 PM"
    assert hass.states.get("sensor.json_time").state == "07:11:39 PM"
    assert hass.states.get("binary_sensor.binary_sensor").state == "on"


text:
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
	display: none;
}
.ui-helper-hidden-accessible {
	border: 0;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}
.ui-helper-reset {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	line-height: 1.3;
	text-decoration: none;
	font-size: 100%;
	list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
	content: "";
	display: table;
}
.ui-helper-clearfix:after {
	clear: both;
}
.ui-helper-clearfix {
	min-height: 0; /* support: IE7 */
}
.ui-helper-zfix {
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	position: absolute;
	opacity: 0;
	filter:Alpha(Opacity=0);
}

.ui-front {
	z-index: 100;
}

/* Interaction Cues
----------------------------------*/
.ui-state-disabled {
	cursor: default !important;
}

/* Icons
----------------------------------*/

/* states and images */
.ui-icon {
	display: block;
	text-indent: -99999px;
	overflow: hidden;
	background-repeat: no-repeat;
}

/* Misc visuals
----------------------------------*/

/* Overlays */
.ui-widget-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
.ui-resizable {
	position: relative;
}
.ui-resizable-handle {
	position: absolute;
	font-size: 0.1px;
	display: block;
}
.ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-autohide .ui-resizable-handle {
	display: none;
}
.ui-resizable-n {
	cursor: n-resize;
	height: 7px;
	width: 100%;
	top: -5px;
	left: 0;
}
.ui-resizable-s {
	cursor: s-resize;
	height: 7px;
	width: 100%;
	bottom: -5px;
	left: 0;
}
.ui-resizable-e {
	cursor: e-resize;
	width: 7px;
	right: -5px;
	top: 0;
	height: 100%;
}
.ui-resizable-w {
	cursor: w-resize;
	width: 7px;
	left: -5px;
	top: 0;
	height: 100%;
}
.ui-resizable-se {
	cursor: se-resize;
	width: 12px;
	height: 12px;
	right: 1px;
	bottom: 1px;
}
.ui-resizable-sw {
	cursor: sw-resize;
	width: 9px;
	height: 9px;
	left: -5px;
	bottom: -5px;
}
.ui-resizable-nw {
	cursor: nw-resize;
	width: 9px;
	height: 9px;
	left: -5px;
	top: -5px;
}
.ui-resizable-ne {
	cursor: ne-resize;
	width: 9px;
	height: 9px;
	right: -5px;
	top: -5px;
}
.ui-selectable-helper {
	position: absolute;
	z-index: 100;
	border: 1px dotted black;
}
.ui-button {
	display: inline-block;
	position: relative;
	padding: 0;
	line-height: normal;
	margin-right: .1em;
	cursor: pointer;
	vertical-align: middle;
	text-align: center;
	overflow: visible; /* removes extra width in IE */
}
.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
	text-decoration: none;
}
/* to make room for the icon, a width needs to be set here */
.ui-button-icon-only {
	width: 2.2em;
}
/* button elements seem to need a little more width */
button.ui-button-icon-only {
	width: 2.4em;
}
.ui-button-icons-only {
	width: 3.4em;
}
button.ui-button-icons-only {
	width: 3.7em;
}

/* button text element */
.ui-button .ui-button-text {
	display: block;
	line-height: normal;
}
.ui-button-text-only .ui-button-text {
	padding: .4em 1em;
}
.ui-button-icon-only .ui-button-text,
.ui-button-icons-only .ui-button-text {
	padding: .4em;
	text-indent: -9999999px;
}
.ui-button-text-icon-primary .ui-button-text,
.ui-button-text-icons .ui-button-text {
	padding: .4em 1em .4em 2.1em;
}
.ui-button-text-icon-secondary .ui-button-text,
.ui-button-text-icons .ui-button-text {
	padding: .4em 2.1em .4em 1em;
}
.ui-button-text-icons .ui-button-text {
	padding-left: 2.1em;
	padding-right: 2.1em;
}
/* no icon support for input elements, provide padding by default */
input.ui-button {
	padding: .4em 1em;
}

/* button icon element(s) */
.ui-button-icon-only .ui-icon,
.ui-button-text-icon-primary .ui-icon,
.ui-button-text-icon-secondary .ui-icon,
.ui-button-text-icons .ui-icon,
.ui-button-icons-only .ui-icon {
	position: absolute;
	top: 50%;
	margin-top: -8px;
}
.ui-button-icon-only .ui-icon {
	left: 50%;
	margin-left: -8px;
}
.ui-button-text-icon-primary .ui-button-icon-primary,
.ui-button-text-icons .ui-button-icon-primary,
.ui-button-icons-only .ui-button-icon-primary {
	left: .5em;
}
.ui-button-text-icon-secondary .ui-button-icon-secondary,
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
	right: .5em;
}

/* button sets */
.ui-buttonset {
	margin-right: 7px;
}
.ui-buttonset .ui-button {
	margin-left: 0;
	margin-right: -.3em;
}

/* workarounds */
/* reset extra padding in Firefox, see h5bp.com/l */
input.ui-button::-moz-focus-inner,
button.ui-button::-moz-focus-inner {
	border: 0;
	padding: 0;
}
.ui-slider {
	position: relative;
	text-align: left;
}
.ui-slider .ui-slider-handle {
	position: absolute;
	z-index: 2;
	width: 1.2em;
	height: 1.2em;
	cursor: default;
}
.ui-slider .ui-slider-range {
	position: absolute;
	z-index: 1;
	font-size: .7em;
	display: block;
	border: 0;
	background-position: 0 0;
}

/* For IE8 - See #6727 */
.ui-slider.ui-state-disabled .ui-slider-handle,
.ui-slider.ui-state-disabled .ui-slider-range {
	filter: inherit;
}

.ui-slider-horizontal {
	height: .8em;
}
.ui-slider-horizontal .ui-slider-handle {
	top: -.3em;
	margin-left: -.6em;
}
.ui-slider-horizontal .ui-slider-range {
	top: 0;
	height: 100%;
}
.ui-slider-horizontal .ui-slider-range-min {
	left: 0;
}
.ui-slider-horizontal .ui-slider-range-max {
	right: 0;
}

.ui-slider-vertical {
	width: .8em;
	height: 100px;
}
.ui-slider-vertical .ui-slider-handle {
	left: -.3em;
	margin-left: 0;
	margin-bottom: -.6em;
}
.ui-slider-vertical .ui-slider-range {
	left: 0;
	width: 100%;
}
.ui-slider-vertical .ui-slider-range-min {
	bottom: 0;
}
.ui-slider-vertical .ui-slider-range-max {
	top: 0;
}
.ui-spinner {
	position: relative;
	display: inline-block;
	overflow: hidden;
	padding: 0;
	vertical-align: middle;
}
.ui-spinner-input {
	border: none;
	background: none;
	color: inherit;
	padding: 0;
	margin: .2em 0;
	vertical-align: middle;
	margin-left: .4em;
	margin-right: 22px;
}
.ui-spinner-button {
	width: 16px;
	height: 50%;
	font-size: .5em;
	padding: 0;
	margin: 0;
	text-align: center;
	position: absolute;
	cursor: default;
	display: block;
	overflow: hidden;
	right: 0;
}
/* more specificity required here to overide default borders */
.ui-spinner a.ui-spinner-button {
	border-top: none;
	border-bottom: none;
	border-right: none;
}
/* vertical centre icon */
.ui-spinner .ui-icon {
	position: absolute;
	margin-top: -8px;
	top: 50%;
	left: 0;
}
.ui-spinner-up {
	top: 0;
}
.ui-spinner-down {
	bottom: 0;
}

/* TR overrides */
.ui-spinner .ui-icon-triangle-1-s {
	/* need to fix icons sprite */
	background-position: -65px -16px;
}


text:
.class final Lo/aj$ﹴ;
.super Lo/aj$ˊ;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lo/aj;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x18
    name = "\ufe74"
.end annotation

# direct methods
.method public constructor <init>(Lcom/google/android/gms/common/data/DataHolder;)V
    .locals 0

    invoke-direct {p0, p1}, Lo/aj$ˊ;-><init>(Lcom/google/android/gms/common/data/DataHolder;)V

    return-void
.end method

# virtual methods
.method public ˊ(Lo/fy;Lcom/google/android/gms/games/multiplayer/realtime/Room;I)V
    .locals 0

    invoke-interface {p1, p3, p2}, Lo/fy;->ˊ(ILcom/google/android/gms/games/multiplayer/realtime/Room;)V

    return-void
.end method


text:
package com.taskdesignsinc.android.myanimeviewer.util;

import android.content.Context;
import android.text.TextUtils;

import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.taskdesignsinc.android.myanimeviewer.R;
import com.taskdesignsinc.android.myanimeviewer.model.Anime;
import com.taskdesignsinc.android.myanimeviewer.model.DownloadRecord;
import com.taskdesignsinc.android.myanimeviewer.model.Episode;
import com.taskdesignsinc.android.myanimeviewer.model.FavoriteRecord;
import com.taskdesignsinc.android.myanimeviewer.model.FavoriteTag;
import com.taskdesignsinc.android.myanimeviewer.model.HistoryRecord;
import com.taskdesignsinc.android.myanimeviewer.model.OfflineHistoryRecord;
import com.taskdesignsinc.android.myanimeviewer.model.parse.AnimeRecord;
import com.taskdesignsinc.android.myanimeviewer.model.parse.EpisodeRecord;
import com.taskdesignsinc.android.myanimeviewer.repository.DataRepository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by salma on 8/5/2017.
 */
public class ParseManager implements DataRepository {

    private static String TAG = ParseManager.class.getSimpleName();
    private static ParseManager mInstance;

    public static ParseManager getInstance(Context context) {
        if (TextUtils.isEmpty(context.getString(R.string.parse_server)) || TextUtils.isEmpty(context.getString(R.string.parse_app_id))) {

        } else {
            if (mInstance == null)
                mInstance = new ParseManager(context);
        }
        return mInstance;
    }

    private ParseManager(Context context) {
        loadParseConfig(context);
    }

    private void loadParseConfig(Context context) {
        ParseObject.registerSubclass(AnimeRecord.class);
        ParseObject.registerSubclass(EpisodeRecord.class);
        Parse.initialize(new Parse.Configuration.Builder(context)
                .applicationId(context.getString(R.string.parse_app_id))
                .clientKey("")
                .server(context.getString(R.string.parse_server))
                .enableLocalDataStore()
                .build()
        );
    }

    public List<Anime> getAnimeList(int page) {
        ArrayList<Anime> animeList = new ArrayList<>();
        try {
            ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
            query.setSkip((page-1) * 100);
            for (AnimeRecord record : query.find()) {
                Anime anime = AnimeRecord.toAnime(record);
                if (anime != null)
                    animeList.add(anime);
            }
        } catch (ParseException e) {
            WriteLog.appendLogException(TAG, "getAnimeList failed", e);
        }
        return animeList;
    }

    @Override
    public List<Anime> getAnimeList() {
        ArrayList<Anime> animeList = new ArrayList<>();
        int limit = 10000;
        int page = 0;
        try {
            boolean endReached = false;
            do {
                ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
                query.setLimit(limit);
                query.setSkip(page * limit);
                List<AnimeRecord> list = query.find();
                if (list != null) {
                    for (AnimeRecord animeRecord : list) {
                        Anime anime = AnimeRecord.toAnime(animeRecord);
                        if (anime != null)
                            animeList.add(anime);
                    }
                    if (list.size() < limit)
                        endReached = true;
                    else
                        page++;
                } else
                    endReached = true;
            } while (!endReached);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        WriteLog.appendLog(TAG,"Anime loaded from server: " + animeList.size());
        return animeList;
    }

    @Override
    public HashMap<String, Anime> getAnimeMapByUrl(String url) {
        return null;
    }

    @Override
    public List<Anime> getAnimeListByUrl(String url) {
        ArrayList<Anime> animeList = new ArrayList<>();
        ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
        try {
            List<AnimeRecord> animeRecords = query.whereContains("url", url).find();
            for (AnimeRecord record : animeRecords) {
                Anime anime = AnimeRecord.toAnime(record);
                if (anime != null)
                    animeList.add(anime);
            }
        } catch (ParseException e) {
            WriteLog.appendLogException(TAG, "getAnimeListByUrl(" + url + ") failed", e);
        }
        return animeList;
    }

    @Override
    public List<Anime> getAnimeListByTitle(String title) {
        ArrayList<Anime> animeList = new ArrayList<>();
        ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
        try {
            List<AnimeRecord> animeRecords = query.whereContains("title", title).find();
            for (AnimeRecord record : animeRecords) {
                Anime anime = AnimeRecord.toAnime(record);
                if (anime != null)
                    animeList.add(anime);
            }
        } catch (ParseException e) {
            WriteLog.appendLogException(TAG, "getAnimeListByTitle(" + title + ") failed", e);
        }
        return animeList;
    }

    @Override
    public List<Anime> getAnimeListByTitle(String title, String url) {
        return null;
    }

    @Override
    public void insertAnimeList(List<Anime> animeList) {

    }

    @Override
    public void updateAnimeList(List<Anime> animeList) {

    }

    @Override
    public Anime getAnimeByUrl(String animeUrl) {
        return null;
    }

    @Override
    public Anime getAnimeByUrl(String animeUrl, boolean loadEpisodes) {
        return null;
    }

    @Override
    public String getCoverByUrl(String animeUrl) {
        return null;
    }

    @Override
    public void insertAnime(Anime anime) {

    }

    @Override
    public void updateAnime(Anime anime) {

    }

    @Override
    public void deleteAnime(String animeUrl) {

    }

    @Override
    public void insertEpisodeList(List<Episode> episodes) {

    }

    @Override
    public void deleteEpisodeList(Anime anime) {

    }

    @Override
    public void deleteEpisodes(String animeUrl) {

    }

    @Override
    public void updateEpisode(Episode episode) {

    }

    @Override
    public List<Episode> getEpisodes(String animeUrl) {
        return null;
    }

    @Override
    public Episode getEpisodeByUrl(String episodeUrl) {
        return null;
    }

    @Override
    public int getEpisodeCount(String animeUrl) {
        return 0;
    }

    @Override
    public String getEpisodeTitle(String url) {
        return null;
    }

    @Override
    public String getLastViewedEpisode(String animeUrl) {
        return null;
    }

    @Override
    public List<FavoriteRecord> getFavorites() {
        return null;
    }

    @Override
    public void insertFavorite(String animeUrl, int tagId) {

    }

    @Override
    public void deleteFavorite(String animeUrl) {

    }

    @Override
    public FavoriteTag getFavoriteTag(int id) {
        return null;
    }

    @Override
    public List<FavoriteTag> getFavoriteTags() {
        return null;
    }

    @Override
    public void insertFavoriteTag(int tagId, String title, int ribbonId) {

    }

    @Override
    public boolean deleteFavoriteTag(int tagId) {
        return false;
    }

    @Override
    public FavoriteRecord getFavoriteByAnimeUrl(String url) {
        return null;
    }

    @Override
    public boolean isFavorite(String animeUrl) {
        return false;
    }

    @Override
    public void deleteFavoriteRecordsByTagID(int tagId) {

    }

    @Override
    public boolean deleteFavoriteRecords() {
        return false;
    }

    @Override
    public void insertHistoryRecord(String animeUrl, String episodeUrl, boolean isViewed) {

    }

    @Override
    public HistoryRecord getHistoryRecord(String episodeUrl) {
        return null;
    }

    @Override
    public void deleteHistoryRecord(String episodeUrl) {

    }

    @Override
    public void deleteHistoryRecords() {

    }

    @Override
    public List<HistoryRecord> getHistoryRecords() {
        return null;
    }

    @Override
    public List<HistoryRecord> getHistoryRecords(String animeUrl) {
        return null;
    }

    @Override
    public List<DownloadRecord> getDownloadTasks(boolean isCompleted) {
        return null;
    }

    @Override
    public DownloadRecord getDownloadTask(String episodeUrl, boolean isCompleted) {
        return null;
    }

    @Override
    public void deleteDownloadTask(String episodeUrl) {

    }

    @Override
    public void deleteIncompleteDownloadTasks() {

    }

    @Override
    public DownloadRecord getDownloadTask(String episodeUrl) {
        return null;
    }

    @Override
    public void insertDownloadTask(DownloadRecord record) {

    }

    @Override
    public void updateDownloadTask(DownloadRecord record) {

    }

    @Override
    public void deleteOfflineHistoryRecord(String path) {

    }

    @Override
    public void deleteOfflineHistoryRecords() {

    }

    @Override
    public OfflineHistoryRecord getOfflineHistoryRecord(String path) {
        return null;
    }

    @Override
    public List<OfflineHistoryRecord> getOfflineHistoryRecords() {
        return null;
    }

    @Override
    public void insertOfflineHistoryRecord(String path, boolean isViewed) {

    }

    @Override
    public Boolean isPathViewed(String path) {
        return null;
    }

    @Override
    public String getLastViewedByPath(String parent) {
        return null;
    }

    public long getAnimeCount() {
        if (mInstance == null)
            return 0;
        ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
        try {
            return query.count();
        } catch (ParseException e) {

        }
        return 0;
    }

    @Override
    public HashMap<String, Anime> getAnimeMap() {
        return null;
    }
}


text:
from enum import Enum
import logging

LOG = logging.getLogger(__name__)

class TransformationTypes(Enum):
    ECS = 'ecs'
    FIG = 'fig'
    COMPOSE = 'compose'
    SYSTEMD = 'systemd'

class InputTransformationTypes(Enum):
    ECS = 'ecs'
    FIG = 'fig'
    COMPOSE = 'compose'

class OutputTransformationTypes(Enum):
    ECS = 'ecs'
    FIG = 'fig'
    COMPOSE = 'compose'
    SYSTEMD = 'systemd'

ARG_MAP = {
    'image': {
        TransformationTypes.ECS.value: {
            'name': 'image',
            'required': True,
        },
        TransformationTypes.FIG.value: {
            'name': 'image',
            'required': True,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'image',
            'required': True,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'image',
            'required': True,
        },
    },
    'name': {
        TransformationTypes.ECS.value: {
            'name': 'name',
            'required': True,
        },
        TransformationTypes.FIG.value: {
            'name': 'name',
            'required': True
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'name',
            'required': True
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'name',
            'required': True
        },
    },
    'cpu': {
        TransformationTypes.ECS.value: {
            'name': 'cpu',
            'required': True
        },
        TransformationTypes.FIG.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'cpu_shares',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'cpu_shares',
            'required': False
        },
    },
    'memory': {
        TransformationTypes.ECS.value: {
            'name': 'memory',
            'required': True
        },
        TransformationTypes.FIG.value: {
            'name': 'mem_limit',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'mem_limit',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'mem_limit',
            'required': False,
        },
    },
    'links': {
        TransformationTypes.ECS.value: {
            'name': 'links',
            'required': False,
        },
        TransformationTypes.FIG.value: {
            'name': 'links',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'links',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'links',
            'required': False,
        },
    },
    'port_mappings': {
        TransformationTypes.ECS.value: {
            'name': 'portMappings',
            'required': False,
        },
        TransformationTypes.FIG.value: {
            'name': 'ports',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'ports',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'ports',
            'required': False,
        },
    },
    'environment': {
        TransformationTypes.ECS.value: {
            'name': 'environment',
            'required': False,
        },
        TransformationTypes.FIG.value: {
            'name': 'environment',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'environment',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'environment',
            'required': False,
        },
    },
    'entrypoint': {
        TransformationTypes.ECS.value: {
            'name': 'entryPoint',
            'required': False,
        },
        TransformationTypes.FIG.value: {
            'name': 'entrypoint',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'entrypoint',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'entrypoint',
            'required': False,
        },
    },
    'command': {
        TransformationTypes.ECS.value: {
            'name': 'command',
            'required': False,
        },
        TransformationTypes.FIG.value: {
            'name': 'command',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'command',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'command',
            'required': False,
        },
    },
    'essential': {
        TransformationTypes.ECS.value: {
            'name': 'essential',
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'essential',
            'required': False
        },
    },
    'volumes_from': {
        TransformationTypes.ECS.value: {
            'name': 'volumesFrom',
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'volumes_from',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'volumes_from',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'volumes_from',
            'required': False
        },
    },
    'volumes': {
        TransformationTypes.ECS.value: {
            'name': 'mountPoints',
            'attribute': '',
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'volumes',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'volumes',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'volumes',
            'required': False
        },
    },
    'dns': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'dns',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'dns',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'dns',
            'required': False
        },
    },
    'work_dir': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'working_dir',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'working_dir',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'working_dir',
            'required': False
        },
    },
    'domain': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'domainname',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'domainname',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': None,
            'required': False
        },
    },
    'build': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'build',
            'required': False,
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'build',
            'required': False,
        },
        TransformationTypes.SYSTEMD.value: {
            'name': None,
            'required': False,
        },
    },
    'expose': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'expose',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'expose',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'expose',
            'required': False
        },
    },
    'network': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'net',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'net',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'net',
            'required': False
        },
    },
    'privileged': {
        TransformationTypes.ECS.value: {
            'name': None,
            'required': False
        },
        TransformationTypes.FIG.value: {
            'name': 'privileged',
            'required': False
        },
        TransformationTypes.COMPOSE.value: {
            'name': 'privileged',
            'required': False
        },
        TransformationTypes.SYSTEMD.value: {
            'name': 'privileged',
            'required': False
        },
    },

}


text:
jest.dontMock('../heading');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';

const Heading = require('../heading').default;

describe('Heading', () => {

	var heading = TestUtils.renderIntoDocument(
		<Heading>Test</Heading>
	);
	var headingNode = ReactDOM.findDOMNode(heading);

	it('Contains the proper child text', () => {
		expect(headingNode.textContent).toEqual('Test');
	});

	it('Is an H2 tag', () => {
		expect(headingNode.tagName).toEqual('H2');
	});

})


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

namespace DDDSkeletonNET.Infrastructure.Common.Domain
{
    public class ValueObjectIsInvalidException : Exception
    {
        public ValueObjectIsInvalidException(string message)
            : base(message)
        { }
    }
}


text:
#include "acsdk/Sample/Endpoint/EndpointAlexaVideoRecorderHandler.h"

#include <acsdk/Sample/Console/ConsolePrinter.h>
#include <AVSCommon/Utils/Logger/Logger.h>

/// String to identify log entries originating from this file.
#define TAG "EndpointAlexaVideoRecorderHandler"

/**
 * Create a LogEntry using this file's TAG and the specified event string.
 *
 * @param event The event string for this @c LogEntry.
 */
#define LX(event) alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

namespace alexaClientSDK {
namespace sampleApplications {
namespace common {

using namespace avsCommon::utils;
using namespace acsdkAlexaVideoRecorderInterfaces;

std::unique_ptr<EndpointAlexaVideoRecorderHandler> EndpointAlexaVideoRecorderHandler::create(
    const std::string endpointName) {
    auto videoRecorderHandler = std::unique_ptr<EndpointAlexaVideoRecorderHandler>(
        new EndpointAlexaVideoRecorderHandler(std::move(endpointName)));
    return videoRecorderHandler;
}

EndpointAlexaVideoRecorderHandler::EndpointAlexaVideoRecorderHandler(const std::string& endpointName) :
        m_endpointName{endpointName} {
}

VideoRecorderInterface::Response EndpointAlexaVideoRecorderHandler::searchAndRecord(
    std::unique_ptr<acsdkAlexaVideoRecorderInterfaces::VideoRecorderRequest>) {
    std::unique_lock<std::mutex> lock(m_mutex);

    ConsolePrinter::prettyPrint({"ENDPOINT: " + m_endpointName, "Search and Record"});
    lock.unlock();

    VideoRecorderInterface::Response videoRecorderResponse;
    videoRecorderResponse.type = VideoRecorderInterface::Response::Type::SUCCESS;
    videoRecorderResponse.message = "SCHEDULED";

    return videoRecorderResponse;
}

VideoRecorderInterface::Response EndpointAlexaVideoRecorderHandler::cancelRecording(
    std::unique_ptr<acsdkAlexaVideoRecorderInterfaces::VideoRecorderRequest>) {
    std::unique_lock<std::mutex> lock(m_mutex);

    ConsolePrinter::prettyPrint({"ENDPOINT: " + m_endpointName, "Cancel Recording Results"});
    lock.unlock();

    VideoRecorderInterface::Response videoRecorderResponse;
    return videoRecorderResponse;
}

VideoRecorderInterface::Response EndpointAlexaVideoRecorderHandler::deleteRecording(
    std::unique_ptr<acsdkAlexaVideoRecorderInterfaces::VideoRecorderRequest>) {
    std::unique_lock<std::mutex> lock(m_mutex);

    ConsolePrinter::prettyPrint({"ENDPOINT: " + m_endpointName, "Delete Recording Results"});
    lock.unlock();

    VideoRecorderInterface::Response videoRecorderResponse;
    return videoRecorderResponse;
}

bool EndpointAlexaVideoRecorderHandler::isExtendedRecordingGUIShown() {
    // must come from the physical or virtual endpoint device
    bool retVal = true;
    return retVal;
}

int EndpointAlexaVideoRecorderHandler::getStorageUsedPercentage() {
    // must come from the physical or virtual endpoint device
    int retVal = 100;
    return retVal;
}

}  // namespace common
}  // namespace sampleApplications
}  // namespace alexaClientSDK


text:
<!DOCTYPE html>

     <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Ristorante Con Fusion: About Us</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link href="css/bootstrap-social.css" rel="stylesheet">
    <link href="css/mystyles.css" rel="stylesheet">

                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    Toggle navigation

                </button>
                Ristorante Con Fusion

 Home

                         About

                         Menu

Appetizers

Main Courses

Desserts

Drinks

Specials

Lunch Buffet

Weekend Brunch

                     Contact

Ristorante con Fusion

We take inspiration from the World's best cuisines, and create a unique fusion experience. Our lipsmacking creations will tickle your culinary senses!

Home

Contact Us

Contact Us

Location Information

Our Address

                    <address style="font-size: 100%">
		              121, Clear Water Bay Road

		              Clear Water Bay, Kowloon

		              HONG KONG

		              : +852 1234 5678

		              : +852 8765 4321

		              :
                        confusion@food.net
		           </address>

Map of our Location

                   Call
                   Skype
                   Email

Send us your Feedback

              <form class="form-horizontal" role="form">

                     First Name

                     <input type="text" class="form-control" id="firstname" name="firstname" placeholder="Enter First Name">

                     Last Name

                         <input type="text" class="form-control" id="lastname" name="lastname" placeholder="Enter Last Name">

                    Contact Tel.

(

                                <input type="tel" class="form-control" id="areacode" name="areacode" placeholder="Area code">

)

                                <input type="tel" class="form-control" id="telnum" name="telnum" placeholder="Tel. number">

                    Email

                        <input type="email" class="form-control" id="emailid" name="emailid" placeholder="Email">

                            <input type="checkbox" name="approve" value="">
                            May we contact you?

                        <select class="form-control">
                            <option>Tel.</option>
                            <option>Email</option>
                        </select>

                   Your Feedback

                       <textarea class="form-control" id="feedback" name="feedback" rows="12"></textarea>

                       <button type="submit" class="btn btn-primary">Send Feedback</button>

             </form>

Links

Home

About

Menu

Contact

Our Address

                    <address>
		              121, Clear Water Bay Road

		              Clear Water Bay, Kowloon

		              HONG KONG

		              : +852 1234 5678

		              : +852 8765 4321

		              :
                        confusion@food.net
		           </address>

© Copyright 2015 Ristorante Con Fusion


text:
// Copyright 2011 The Closure Library 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.

goog.module('goog.fx.DragListGroupTest');
goog.setTestOnly();

const BrowserEvent = goog.require('goog.events.BrowserEvent');
const BrowserFeature = goog.require('goog.events.BrowserFeature');
const Coordinate = goog.require('goog.math.Coordinate');
const DragListDirection = goog.require('goog.fx.DragListDirection');
const DragListGroup = goog.require('goog.fx.DragListGroup');
const DragListPermission = goog.require('goog.fx.DragListPermission');
const Dragger = goog.require('goog.fx.Dragger');
const EventType = goog.require('goog.events.EventType');
const FxDragEvent = goog.require('goog.fx.DragEvent');
const GoogEvent = goog.require('goog.events.Event');
const TagName = goog.require('goog.dom.TagName');
const classlist = goog.require('goog.dom.classlist');
const dom = goog.require('goog.dom');
const events = goog.require('goog.events');
const googArray = goog.require('goog.array');
const googObject = goog.require('goog.object');
const style = goog.require('goog.style');
const testSuite = goog.require('goog.testing.testSuite');
const testingEvents = goog.require('goog.testing.events');

/** @type {DragListGroup} */
let dlg;

/** @type {dom.Element} */
let list;

/** @type {!dom.Element} */
let list2;

/** @type {BrowserEvent} */
let event;

/**
 * The number of event listeners registered by the DragListGroup after the
 * init() call.
 * @type {number}
 */
let initialListenerCount;

/**
 * Type of events fired by the DragListGroup.
 * @type {!Array<string>}
 */
let firedEventTypes;

/**
 * Asserts that the DragListGroup is in idle state.
 * @param {!DragListGroup} dlg The DragListGroup to examine.
 */
function assertIdle(dlg) {
  assertFalse(dlg.isDragging());
  assertNull('dragger element has been cleaned up', dlg.draggerEl_);
  assertNull('dragger has been cleaned up', dlg.dragger_);
  assertEquals(
      'the additional event listeners have been removed', initialListenerCount,
      googObject.getCount(dlg.eventHandler_.keys_));
}

/** @param {!DragListPermission} dragListPermission */
function setUpWithDragListPermission(dragListPermission) {
  dlg.dispose();
  const sandbox = dom.getElement('sandbox');
  dom.removeChildren(sandbox);

  list = dom.createDom(TagName.DIV, {'id': 'horiz_div'});
  list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('1')));
  list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('2')));
  list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('3')));
  sandbox.appendChild(list);

  list2 = dom.createDom(TagName.DIV, {'id': 'horiz_div2'});
  list2.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('A')));
  list2.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('B')));
  list2.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('C')));
  sandbox.appendChild(list2);

  dlg = new DragListGroup();
  dlg.addDragList(
      list, DragListDirection.RIGHT, null /** opt_unused */, 'test_hover_class',
      dragListPermission);
  dlg.addDragList(list2, DragListDirection.RIGHT);
  dlg.init();

  initialListenerCount = googObject.getCount(dlg.eventHandler_.keys_);

  event = new BrowserEvent();
  event.currentTarget = dom.getElementsByTagName(TagName.DIV, list)[0];

  firedEventTypes = [];
  events.listen(dlg, googObject.getValues(DragListGroup.EventType), (e) => {
    firedEventTypes.push(e.type);
  });
}

testSuite({
  setUp() {
    const sandbox = dom.getElement('sandbox');
    list = dom.createDom(TagName.DIV, {'id': 'horiz_div'});
    list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('1')));
    list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('2')));
    list.appendChild(dom.createDom(TagName.DIV, null, dom.createTextNode('3')));
    sandbox.appendChild(list);

    dlg = new DragListGroup();
    dlg.setDragItemHoverClass('opacity_40', 'cursor_move');
    dlg.setDragItemHandleHoverClass('opacity_40', 'cursor_pointer');
    dlg.setCurrDragItemClass('blue_bg', 'opacity_40');
    dlg.setDraggerElClass('cursor_move', 'blue_bg');
    dlg.addDragList(list, DragListDirection.RIGHT);
    dlg.init();

    initialListenerCount = googObject.getCount(dlg.eventHandler_.keys_);

    event = new BrowserEvent();
    event.currentTarget = dom.getElementsByTagName(TagName.DIV, list)[0];

    firedEventTypes = [];
    events.listen(dlg, googObject.getValues(DragListGroup.EventType), (e) => {
      firedEventTypes.push(e.type);
    });
  },

  tearDown() {
    dlg.dispose();
    dom.removeChildren(dom.getElement('sandbox'));
  },

  /**
   * Test the initial assumptions.
   * Verify that the setter methods work properly, i.e., the CSS classes are
   * stored in the private arrays after init() but are not added yet to target.
   * (Since initially, we are not yet hovering over any list, in particular,
   * over this target.)
   */
  testSettersAfterInit() {
    assertTrue(googArray.equals(
        dlg.dragItemHoverClasses_, ['opacity_40', 'cursor_move']));
    assertTrue(googArray.equals(
        dlg.dragItemHandleHoverClasses_, ['opacity_40', 'cursor_pointer']));
    assertTrue(
        googArray.equals(dlg.currDragItemClasses_, ['blue_bg', 'opacity_40']));

    assertFalse(
        'Should have no cursor_move class after init',
        classlist.contains(event.currentTarget, 'cursor_move'));
    assertFalse(
        'Should have no cursor_pointer class after init',
        classlist.contains(event.currentTarget, 'cursor_pointer'));
    assertFalse(
        'Should have no opacity_40 class after init',
        classlist.contains(event.currentTarget, 'opacity_40'));
    assertFalse(
        'Should not have blue_bg class after init',
        classlist.contains(event.currentTarget, 'blue_bg'));
  },

  /**
   * Test the effect of hovering over a list.
   * Check that after the MOUSEOVER browser event these classes are added to
   * the current target of the event.
   */
  testAddDragItemHoverClasses() {
    dlg.handleDragItemMouseover_(event);

    assertTrue(
        'Should have cursor_move class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'cursor_move'));
    assertTrue(
        'Should have opacity_40 class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'opacity_40'));
    assertFalse(
        'Should not have cursor_pointer class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'cursor_pointer'));
    assertFalse(
        'Should not have blue_bg class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'blue_bg'));
  },

  testAddDragItemHandleHoverClasses() {
    dlg.handleDragItemHandleMouseover_(event);

    assertFalse(
        'Should not have cursor_move class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'cursor_move'));
    assertTrue(
        'Should have opacity_40 class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'opacity_40'));
    assertTrue(
        'Should have cursor_pointer class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'cursor_pointer'));
    assertFalse(
        'Should not have blue_bg class after MOUSEOVER',
        classlist.contains(event.currentTarget, 'blue_bg'));
  },

  /**
   * Test the effect of stopping hovering over a list.
   * Check that after the MOUSEOUT browser event all CSS classes are removed
   * from the target (as we are no longer hovering over the it).
   */
  testRemoveDragItemHoverClasses() {
    dlg.handleDragItemMouseover_(event);
    dlg.handleDragItemMouseout_(event);

    assertFalse(
        'Should have no cursor_move class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'cursor_move'));
    assertFalse(
        'Should have no cursor_pointer class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'cursor_pointer'));
    assertFalse(
        'Should have no opacity_40 class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'opacity_40'));
    assertFalse(
        'Should have no blue_bg class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'blue_bg'));
  },

  testRemoveDragItemHandleHoverClasses() {
    dlg.handleDragItemHandleMouseover_(event);
    dlg.handleDragItemHandleMouseout_(event);

    assertFalse(
        'Should have no cursor_move class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'cursor_move'));
    assertFalse(
        'Should have no cursor_pointer class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'cursor_pointer'));
    assertFalse(
        'Should have no opacity_40 class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'opacity_40'));
    assertFalse(
        'Should have no blue_bg class after MOUSEOUT',
        classlist.contains(event.currentTarget, 'blue_bg'));
  },

  /**
   * Test the effect of dragging an item. (DRAGSTART event.)
   * Check that after the MOUSEDOWN browser event is handled by the
   * handlePotentialDragStart_() method the currDragItem has the CSS classes
   * set by the setter method.
   */
  testAddCurrentDragItemClasses() {
    const be = new BrowserEvent({
      type: EventType.MOUSEDOWN,
      button: BrowserFeature.HAS_W3C_BUTTON ? 0 : 1,
    });
    event.event_ = be;

    dlg.handlePotentialDragStart_(event);

    assertFalse(
        'Should have no cursor_move class after MOUSEDOWN',
        classlist.contains(dlg.currDragItem_, 'cursor_move'));
    assertFalse(
        'Should have no cursor_pointer class after MOUSEDOWN',
        classlist.contains(dlg.currDragItem_, 'cursor_pointer'));
    assertTrue(
        'Should have opacity_40 class after MOUSEDOWN',
        classlist.contains(dlg.currDragItem_, 'opacity_40'));
    assertTrue(
        'Should have blue_bg class after MOUSEDOWN',
        classlist.contains(dlg.currDragItem_, 'blue_bg'));
  },

  /**
   * Test the effect of dragging an item. (DRAGEND event.)
   * Check that after the MOUSEUP browser event handled by the handleDragEnd_()
   * method the currDragItem has no CSS classes set in the dispatched event.
   */
  testRemoveCurrentDragItemClasses() {
    const be = new BrowserEvent({
      type: EventType.MOUSEDOWN,
      button: BrowserFeature.HAS_W3C_BUTTON ? 0 : 1,
    });
    event.event_ = be;
    dlg.handlePotentialDragStart_(event);

    // Need to catch the dispatched event because the temporary fields
    // including dlg.currentDragItem_ are cleared after the dragging has ended.
    let currDragItem = dom.createDom(
        TagName.DIV, ['cursor_move', 'blue_bg'], dom.createTextNode('4'));
    events.listen(dlg, DragListGroup.EventType.DRAGEND, (e) => {
      currDragItem = dlg.currDragItem_;
    });

    const dragger = new Dragger(event.currentTarget);
    be.type = EventType.MOUSEUP;
    be.clientX = 1;
    be.clientY = 2;
    const dragEvent = new FxDragEvent(
        Dragger.EventType.END, dragger, be.clientX, be.clientY, be);
    dlg.handleDragEnd_(dragEvent);  // this method dispatches the DRAGEND event
    dragger.dispose();

    assertFalse(
        'Should have no cursor_move class after MOUSEUP',
        classlist.contains(currDragItem, 'cursor_move'));
    assertFalse(
        'Should have no cursor_pointer class after MOUSEUP',
        classlist.contains(currDragItem, 'cursor_pointer'));
    assertFalse(
        'Should have no opacity_40 class after MOUSEUP',
        classlist.contains(currDragItem, 'opacity_40'));
    assertFalse(
        'Should have no blue_bg class after MOUSEUP',
        classlist.contains(currDragItem, 'blue_bg'));
  },

  testFiredEvents() {
    testingEvents.fireClickSequence(list.firstChild);
    assertArrayEquals(
        'event types in case of zero distance dragging',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGSTART.toString(),
          DragListGroup.EventType.BEFOREDRAGEND.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
          DragListGroup.EventType.DRAGEND.toString(),
        ],
        firedEventTypes);
    assertIdle(dlg);
  },

  testFiredEventsWithHysteresis() {
    dlg.setHysteresis(2);

    testingEvents.fireClickSequence(list.firstChild);
    assertArrayEquals(
        'only clone events are fired on click if hysteresis is enabled',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;
    assertIdle(dlg);

    testingEvents.fireMouseDownEvent(
        list.firstChild, null, new Coordinate(0, 0));
    testingEvents.fireMouseMoveEvent(list.firstChild, new Coordinate(1, 0));
    assertArrayEquals(
        'only potential-start event is fired on click if hysteresis is enabled',
        [DragListGroup.EventType.DRAGGERCREATED.toString()], firedEventTypes);
    firedEventTypes.length = 0;

    testingEvents.fireMouseMoveEvent(list.firstChild, new Coordinate(3, 0));
    assertArrayEquals(
        'start+move events are fired over hysteresis distance',
        [
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGSTART.toString(),
          DragListGroup.EventType.BEFOREDRAGMOVE.toString(),
          DragListGroup.EventType.DRAGMOVE.toString(),
        ],
        firedEventTypes);
    assertTrue(dlg.isDragging());

    firedEventTypes.length = 0;
    testingEvents.fireMouseUpEvent(list.firstChild, null, new Coordinate(3, 0));
    assertArrayEquals(
        'end events are fired on mouseup',
        [
          DragListGroup.EventType.BEFOREDRAGEND.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
          DragListGroup.EventType.DRAGEND.toString(),
        ],
        firedEventTypes);
    assertIdle(dlg);
  },

  testPreventDefaultBeforeDragStart() {
    events.listen(
        dlg, DragListGroup.EventType.BEFOREDRAGSTART, GoogEvent.preventDefault);

    testingEvents.fireMouseDownEvent(list.firstChild);
    assertArrayEquals(
        'event types if dragging is prevented',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
    assertIdle(dlg);
  },

  testPreventDefaultBeforeDragStartWithHysteresis() {
    dlg.setHysteresis(5);
    events.listen(
        dlg, DragListGroup.EventType.BEFOREDRAGSTART, GoogEvent.preventDefault);

    testingEvents.fireMouseDownEvent(
        list.firstChild, null, new Coordinate(0, 0));
    testingEvents.fireMouseMoveEvent(list.firstChild, new Coordinate(10, 0));
    assertArrayEquals(
        'event types if dragging is prevented',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
    assertIdle(dlg);
  },

  testRightClick() {
    testingEvents.fireMouseDownEvent(
        list.firstChild, BrowserEvent.MouseButton.RIGHT);
    testingEvents.fireMouseUpEvent(
        list.firstChild, BrowserEvent.MouseButton.RIGHT);

    assertArrayEquals(
        'only clone events are fired on right click',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
    assertIdle(dlg);
  },

  /**
   * Tests that a new item can be added to a drag list after the control has
   * been initialized.
   */
  testAddItemToDragList() {
    const item =
        dom.createDom(TagName.DIV, null, dom.createTextNode('newItem'));

    dlg.addItemToDragList(list, item);

    assertEquals(item, list.lastChild);
    assertEquals(4, dom.getChildren(list).length);

    events.listen(
        dlg, DragListGroup.EventType.BEFOREDRAGSTART, GoogEvent.preventDefault);

    testingEvents.fireMouseDownEvent(item);
    assertArrayEquals(
        'Should fire beforedragstart event when clicked',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
  },

  /**
   * Tests that a new item added to a drag list after the control has been
   * initialized is inserted at the correct position.
   */
  testInsertItemInDragList() {
    const item =
        dom.createDom(TagName.DIV, null, dom.createTextNode('newItem'));

    dlg.addItemToDragList(list, item, 0);

    assertEquals(item, list.firstChild);
    assertEquals(4, dom.getChildren(list).length);

    events.listen(
        dlg, DragListGroup.EventType.BEFOREDRAGSTART, GoogEvent.preventDefault);

    testingEvents.fireMouseDownEvent(item);
    assertArrayEquals(
        'Should fire beforedragstart event when clicked',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGGERREMOVED.toString(),
        ],
        firedEventTypes);
  },

  testOnlyDropDragPermission_noItemDragEvents() {
    setUpWithDragListPermission(DragListPermission.ONLY_DROP);

    testingEvents.fireMouseDownEvent(list.firstChild);
    assertArrayEquals(
        'Expect no events to be fired on a list with only drop permission.', [],
        firedEventTypes);
    firedEventTypes.length = 0;

    testingEvents.fireMouseDownEvent(list2.firstChild);
    assertArrayEquals(
        'Expect normal events to be fired on a list with the default permission.',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGSTART.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;
  },

  testOnlyDropDragPermission_allowsDropOnList() {
    setUpWithDragListPermission(DragListPermission.ONLY_DROP);

    // When the user starts a drag on the first item of the second list.
    testingEvents.fireMouseDownEvent(list2.firstChild);
    assertEquals(
        'Expect the current drag item to be the first child of the second list.',
        dlg.currDragItem_, list2.firstChild);
    firedEventTypes.length = 0;

    const be = new BrowserEvent({
      type: EventType.MOUSEMOVE,
      button: BrowserFeature.HAS_W3C_BUTTON ? 0 : 1,
    });
    event.event_ = be;

    const posList2 = style.getPosition(list2.children[1]);
    be.clientX = posList2.x + 2;
    be.clientY = posList2.y + 2;

    let dragEvent = new FxDragEvent(
        Dragger.EventType.DRAG, dlg.dragger_, be.clientX, be.clientY, be);
    dlg.handleDragMove_(dragEvent);

    assertArrayEquals(
        'Expect drag events to be fired.',
        [
          DragListGroup.EventType.BEFOREDRAGMOVE.toString(),
          DragListGroup.EventType.DRAGMOVE.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;

    assertNotEquals(
        'Expect the current drag item to not start display: none.', 'none',
        dlg.currDragItem_.style.display);

    // When the user drags the item over the first list.
    const posList = style.getPosition(list.children[1]);
    be.clientX = posList.x + 2;
    dlg.draggerEl_.style.left = be.clientX + 'px';
    be.clientY = posList.y + 2;
    dlg.draggerEl_.style.top = be.clientY + 'px';

    dragEvent = new FxDragEvent(
        Dragger.EventType.DRAG, dlg.dragger_, be.clientX, be.clientY, be);

    dlg.handleDragMove_(dragEvent);
    assertArrayEquals(
        'Expect drag events to be fired.',
        [
          DragListGroup.EventType.BEFOREDRAGMOVE.toString(),
          DragListGroup.EventType.DRAGMOVE.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;
    assertTrue(dlg.isDragging());

    assertNotEquals(
        'Expect the current drag item to still not be shown.', 'none',
        dlg.currDragItem_.style.display);

    assertTrue(
        'Expect the first list to have the list hover class.',
        classlist.contains(list, 'test_hover_class'));
  },

  testOnlyDragOutDragPermission_hasItemDragEvents() {
    setUpWithDragListPermission(DragListPermission.ONLY_DRAG_OUT);

    testingEvents.fireMouseDownEvent(list.firstChild);
    assertArrayEquals(
        'Expect normal events to be fired on a list with the only drag out ' +
            'permission.',
        [
          DragListGroup.EventType.DRAGGERCREATED.toString(),
          DragListGroup.EventType.BEFOREDRAGSTART.toString(),
          DragListGroup.EventType.DRAGSTART.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;
  },

  testOnlyDragOutDragPermission_doesNotAllowDropOnList() {
    setUpWithDragListPermission(DragListPermission.ONLY_DRAG_OUT);

    // When the user starts a drag on the first item of the second list.
    testingEvents.fireMouseDownEvent(list2.firstChild);
    assertEquals(
        'Expect the current drag item to be the first child of the second list.',
        dlg.currDragItem_, list2.firstChild);
    firedEventTypes.length = 0;

    const be = new BrowserEvent({
      type: EventType.MOUSEMOVE,
      button: BrowserFeature.HAS_W3C_BUTTON ? 0 : 1,
    });
    event.event_ = be;

    const posList2 = style.getPosition(list2.children[1]);
    be.clientX = posList2.x + 2;
    be.clientY = posList2.y + 2;

    let dragEvent = new FxDragEvent(
        Dragger.EventType.DRAG, dlg.dragger_, be.clientX, be.clientY, be);
    dlg.handleDragMove_(dragEvent);

    assertArrayEquals(
        'Expect drag events to be fired.',
        [
          DragListGroup.EventType.BEFOREDRAGMOVE.toString(),
          DragListGroup.EventType.DRAGMOVE.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;

    assertNotEquals(
        'Expect the current drag item to not start display: none.', 'none',
        dlg.currDragItem_.style.display);

    // When the user drags the item over the first list.
    const posList = style.getPosition(list.children[1]);
    be.clientX = posList.x + 2;
    be.clientY = posList.y + 2;
    dlg.draggerEl_.style.left = be.clientX + 'px';
    dlg.draggerEl_.style.top = be.clientY + 'px';

    dragEvent = new FxDragEvent(
        Dragger.EventType.DRAG, dlg.dragger_, be.clientX, be.clientY, be);

    dlg.handleDragMove_(dragEvent);
    assertArrayEquals(
        'Expect drag events to be fired.',
        [
          DragListGroup.EventType.BEFOREDRAGMOVE.toString(),
          DragListGroup.EventType.DRAGMOVE.toString(),
        ],
        firedEventTypes);
    firedEventTypes.length = 0;
    assertTrue(dlg.isDragging());

    assertEquals(
        'Expect the current drag item to now be display: none.', 'none',
        dlg.currDragItem_.style.display);

    assertFalse(
        'Expect the first list to not have the list hover class.',
        classlist.contains(list, 'test_hover_class'));
  },
});


text:
title: Juju Install
canonical_url: 'https://docs.projectcalico.org/v2.6/getting-started/openstack/installation/juju'
---

You can use Ubuntu's [Juju Charms](https://jujucharms.com/) to quickly deploy a
Calico/OpenStack cluster.  All you need to do is download one of our bundles,
then deploy it to your Juju environment using [any of the standard
methods](https://docs.jujucharms.com/2.3/en/charms-bundles). This will get you a
simple OpenStack deployment with two compute nodes, which you can then easily
scale out by adding more instances of the `nova-compute` charm.

## Bundles

For Calico with Mitaka:
<https://jujucharms.com/u/project-calico/calico-mitaka-juju2>

For Calico with Liberty and earlier we don't have bundles published in the
charm store, but you can generate a bundle from our repo at
<https://github.com/projectcalico/bundle-openstack-calico>.  In particular
please see
<https://github.com/projectcalico/bundle-openstack-calico/blob/master/icehouse-kilo-liberty/README.rst>.

The default admin password for these deployments is "openstack" - you may wish
to update this in the bundle (search for the keystone "admin-password" option).

For more detailed information, please see [this blog
post](https://www.projectcalico.org/exploring-juju/) on the Calico blog.


text:
package com.vk.sdk.api.methods;

import android.support.annotation.Nullable;
import com.vk.sdk.api.VKParameters;
import com.vk.sdk.api.VKParser;
import com.vk.sdk.api.VKRequest;
import com.vk.sdk.api.model.VKApiFeedPage;
import org.json.JSONException;
import org.json.JSONObject;

public class VKApiFeed extends VKApiBase {
    public static final String START_FROM = "start_from";
    public static final String FILTERS = "filters";

    public static final String FILTERS_POST = "post";

    public VKRequest get() {
        return get(null);
    }

    public VKRequest get(@Nullable VKParameters params) {
        return prepareRequest("get", params, new VKParser() {
            @Override
            public Object createModel(JSONObject object) {
                try {
                    return new VKApiFeedPage().parse(object);
                } catch (JSONException e) {
                    return null;
                }
            }
        });
    }

    @Override
    protected String getMethodsGroup() {
        return "newsfeed";
    }
}


text:
"""FFI APIs for Relay program IR."""
import tvm._ffi

tvm._ffi._init_api("relay.ir", __name__)