text:
[![Release](https://jitpack.io/v/jksiezni/permissive.svg)](https://jitpack.io/#jksiezni/permissive)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Permissive-green.svg?style=flat)](http://android-arsenal.com/details/1/4316)

# Permissive

Permissive is a lightweight, yet powerful Android library, that helps you restore control over permissions handling introduced in Android Marshmallow (API 23).

The _Permissive_ library perfectly fits into [Material Design - Permissions](https://www.google.com/design/spec/patterns/permissions.html) pattern, by providing a simple API to accomplish tasks requiring sensitive permissions.

All screenshots were taken from __sample__ app, which provides exemplary implementation of popular use-cases using the _Permissive_ library.

### Features

* Backward compatibility down to Android API 8 (not tested on earlier versions)
* __Java8__ ready (supports __retrolambda__ expressions)
* Thread-safe API
* Queueing __permissive__ ```Requests``` and ```Actions```
* Not using transparent *magic* Activities
* No messing with your Activities (well, actually adds a fragment, but it should not bother you in most cases)
* No additional dependencies
* No code generation
* Unique __Espresso__ compatible [Permissive Testing](https://github.com/jksiezni/permissive/wiki/Testing-Runtime-Permissions) library *(experimental)*

## Getting started

### Setup
 - Add it in your `build.gradle` at the end of repositories:
```gradle
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
```
 - Add the core dependency:
```gradle
	dependencies {
		compile 'com.github.jksiezni.permissive:permissive:0.2'
	}
```
 - (Optional) Add an extra library with helper fragments:
```gradle
	dependencies {
		// includes helper fragments based on Android Support v4 implementation (minSdkVersion 8)
		compile 'com.github.jksiezni.permissive:permissive-fragments:0.2'

		and/or

		// includes helper fragments based on native implementation (minSdkVersion 11)
		compile 'com.github.jksiezni.permissive:permissive-fragments-v13:0.2'
	}
```

### Usage

#### Requesting permissions
```Permissive.Request``` allows to simply ask user for a permission and (if allowed) do the task.
To request a permission you just need to create and execute ```Permissive.Request```:
```java
new Permissive.Request(Manifest.permission.ACCESS_FINE_LOCATION).execute(getActivity());
```

Add callback listeners that return results of the request. Also, you can ask for more permissions with a single _Request_:
```java
new Permissive.Request(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
    .whenPermissionsGranted(new PermissionsGrantedListener() {
      @Override
      public void onPermissionsGranted(String[] permissions) throws SecurityException {
        // given permissions are granted
      }
    })
    .whenPermissionsRefused(new PermissionsRefusedListener() {
      @Override
      public void onPermissionsRefused(String[] permissions) {
        // given permissions are refused
      }
    })
    .execute(getActivity());
```

#### Providing rationale
When requesting permissions, a rationale may be required. According to Material Design guidelines,
you should provide a proper rationale depending on clarity and importance of permission type you are requesting.
_Permissive_ API is very flexible and allows you to implement all strategies you may need when requesting permissions.
See [Request patterns](https://www.google.com/design/spec/patterns/permissions.html#permissions-request-patterns) suggested by Google.

##### Executing requests with ```Rationale```
To show a rationale simply add a new ```Rationale``` callback to the ```Permissive.Request```:
```java
new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
          .withRationale(/*YourRationale*/)
          .whenPermissionsGranted(/*listener*/)
          .whenPermissionsGranted(/*listener*/)
          .execute(getActivity());
```

You can also register a _global_ ```Rationale```, which will be used automatically when requesting permission:
```java
// registar global rationale
Permissive.registerGlobalRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE, /*YourRationale*/);
...
// perform a request
new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE).execute(getActivity());
```
>  **Note**: *A locally added rationale callback always takes precedence over global rationales.*

##### Building ```Rationale```
```Rationale``` implementation depends on the request pattern you choose to follow. Of course, it may vary from app to app,
so _Permissive_ library does not enforce you to use any of them. Instead, it provides some helpers, that make it easier to build
a well tailored ```Rationale```.

- This is an example of ```Rationale``` implementation using _AlertDialog_:
```java
    new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
      .withRationale(new Rationale() {
        @Override
        public void onShowRationale(Activity activity, String[] allowablePermissions, PermissiveMessenger messenger) {
          new AlertDialog.Builder(activity)
              .setTitle("Rationale title...")
              .setMessage("A rationale message.")
              .setPositiveButton(android.R.string.ok, null)
              .setOnDismissListener(new DialogInterface.OnDismissListener() {
                  @Override
                  public void onDismiss(DialogInterface dialog1) {
                    messenger.cancelPermissionsRequest();
                  }
              })
              .show();
        }
      }).execute(getActivity());
```
The ```onShowRationale(Activity activity, String[] allowablePermissions, PermissiveMessenger messenger)```
method is called when a rationale should be shown.
The '''allowablePermissions''' argument gives you a hint, what permissions you can still ask for.
It's a different approach to **'never ask again'** problem, where you would expect to have a list of blocked permissions.

The ```PermissiveMessenger``` object allows you to control current ```Request```. Use _repeatPermissionsRequest()_ or _cancelPermissionsRequest()_ methods to ask again for permissions or cancel ongoing request.
> **Note**: *Remember to call one of _repeatPermissionsRequest()_ or _cancelPermissionsRequest()_ methods, in order to continue processing requests. Otherwise your ```Requests``` and ```Actions``` will be dead-locked.*

Additionally, __Permissive__ comes with **permissive-fragments** library providing specialized fragments, that help simplify building rationales.
The main advantage of using those fragments, is when you want to preserve your request and rationale across [runtime changes](http://developer.android.com/guide/topics/resources/runtime-changes.html).
Here's an example of a previous AlertDialog which is encapsulated in ```RationaleDialogFragment```:
```java
public class ExampleRationaleFragment extends RationaleDialogFragment implements DialogInterface.OnClickListener {
  @NonNull
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    return new AlertDialog.Builder(getActivity())
        .setTitle("Rationale title...")
        .setMessage("A rationale message.")
        .setPositiveButton(android.R.string.ok, this)
        .setNegativeButton(android.R.string.no, this)
        .create();
  }
  @Override
  public void onClick(DialogInterface dialog, int which) {
    switch (which) {
      case DialogInterface.BUTTON_POSITIVE:
        getPermissiveMessenger().repeatRequest();
        break;
      case DialogInterface.BUTTON_NEGATIVE:
        getPermissiveMessenger().cancelRequest();
        break;
    }
  }
}
...
new Permissive.Request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
    .withRationale(new ExampleRationaleFragment())
    .execute(getActivity());
```

#### Running a ```Permissive.Action```

The ```Permissive.Action``` simply checks what permissions are granted or refused to the app. So, the main difference from ```Permissive.Request``` is that it doesn't show any dialogs to the user.
Also, it is executed in a queue as every other ```Permissive.Request```, what provides a big advantage when used with requests. In effect, every action will wait until other Actions or Requests are completed.
Actions can be used in background tasks (like _Services_), where no Activity exists, but a sensitive permission is still required.

```java
// here using Java 8 lambdas
new Permissive.Action<>(Manifest.permission.WRITE_EXTERNAL_STORAGE)
    .whenPermissionsGranted(this::onPermissionsGranted)
    .whenPermissionsRefused(this::onPermissionsRefused)
    .execute(getActivity());
```

## Advanced usage

#### Showing rationale first

For some use-cases the ```Rationale``` should be displayed before asking for a permission, for instance when educating users about unclear permissions. It can be done simply by adding _showRationaleFirst()_ call to the ```Permissive.Request```:
```java
new Permissive.Request(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
    .showRationaleFirst(true)
    .withRationale(new Rationale() {/*...*/})
    .execute(getActivity());
```

#### Checking permission in-place
Basically, it's a clone of _[Context.checkSelfPermission()](http://developer.android.com/reference/android/content/Context.html#checkSelfPermission%28java.lang.String%29)_ method:
```java
if(Permissive.checkPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)) {
    // permission is granted
}
```

## License
    Copyright 2016 Jakub Księżniak

    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.


text:
// No Conflict ######################################################################

/**
 * Return the `Storm` global to its previous assignment
 * and return Storm back to caller.
 * @return {Storm}
 * @namespace Storm.noConflict
 */
Storm.noConflict = function() {
	root.Storm = previousStorm;
	return this;
};

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <title>{% block title %}Shopify Application{% endblock %}</title>
  <link href="/static/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />

Shopify Demo Application

      {% if current_shop %}
          current shop {{ current_shop.domain }} |
          logout
      {% endif %}

Home

Design Help

    {% if messages %}
      {% for message in messages %}

{{ message }}

      {% endfor %}
    {% endif %}

      {% block content %}{% endblock %}


text:
package GUIObject;

@SuppressWarnings("serial")
public class LocaleRB extends RB {

    public LocaleRB (int i, String text) {
        super(i);
        setText(text);
    }

}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"
	logicalFilePath="denormalization-migration">
	<changeSet author="test" id="create-new-columns">
		<addColumn tableName="table_3">
			<column name="c1" type="varchar(10)"/>
		</addColumn>
		<addColumn tableName="table_3">
			<column name="c2" type="varchar(10)"/>
		</addColumn>
	</changeSet>
	<changeSet author="test" id="drop-old-foreignkeys">
		<dropForeignKeyConstraint baseTableName="table_2" constraintName="fk21"/>
		<dropForeignKeyConstraint baseTableName="table_3" constraintName="fk32"/>
	</changeSet>
	<changeSet author="test" id="migrate-data">
		<sql>update table_3 set c2 = table_2.c2 from table_2 where table_3.id = table_2.id</sql>
		<sql>update table_3 set c1 = table_1.c1 from table_1 where table_3.id = table_1.id</sql>
	</changeSet>
	<changeSet author="test" id="add-not-null-constraints">
		<addNotNullConstraint tableName="table_3" columnName="c1"/>
		<addNotNullConstraint tableName="table_3" columnName="c2"/>
	</changeSet>
	<changeSet author="test" id="drop-old-tables">
		<dropTable tableName="table_1" />
		<dropTable tableName="table_2" />
	</changeSet>
</databaseChangeLog>


text:
var PushPlugin = function() {};

PushPlugin.prototype.init = function(options,success, fail) {
	if (!options) {
		options = {account:''};
	}
	var params = {
		account: options.account,
	};

	return cordova.exec(success, fail, "PushPlugin", "init", [params]);
};

PushPlugin.prototype.initstate = function(success, fail) {
	return cordova.exec(success, fail, "PushPlugin", "initstate", [{}]);
};

PushPlugin.prototype.registerNotify = function(success, fail) {
	return cordova.exec(success, fail, "PushPlugin", "registerNotify", [{}]);
};
PushPlugin.prototype.getMessage = function(success, fail) {
	return cordova.exec(success, fail, "PushPlugin", "getMessage", [{}]);
};

window.pushPlugin = new PushPlugin();


text:
<project name="SecureData Vulnerability Database">

    <skin>
        <groupId>lt.velykis.maven.skins</groupId>
        <artifactId>reflow-maven-skin</artifactId>
        <version>1.1.1</version>
    </skin>

    <custom>
        <reflowSkin>
            <theme>bootswatch-spacelab</theme>
            <highlightJs>true</highlightJs>
            <brand>
                <name>
                    <![CDATA[
                    Fandanzle
                    ]]>
                </name>
                <href>/</href>
            </brand>
            <slogan>MongiORM | Vert.x 3</slogan>
            <titleTemplate>%2$s | %1$s</titleTemplate>
            <toc>top</toc>
            <tocTopMax>6</tocTopMax>

            <bottomDescription>
                <![CDATA[
                  Reflow is an Apache Maven site skin built on
                  Bootstrap.
                  It allows various structural and stylistic customizations to create a
                  modern-looking Maven-generated website.
                ]]>
            </bottomDescription>
            <bottomNav>

            </bottomNav>
            <bottomDescription>
                MongiORM | Vert.x 3
            </bottomDescription>
            <skinAttribution>false</skinAttribution>
            <pages>
                <index project="mongi">

                    <breadcrumbs>true</breadcrumbs>

                    <toc>false</toc>
                    <markPageHeader>false</markPageHeader>
                    <sections>
                        <carousel />
                        <columns>2</columns>

                        <sidebar />
                    </sections>
                </index>
                <contribute>
                    <breadcrumbs>false</breadcrumbs>
                </contribute>

                <source-repository>
                    <highlightJs>true</highlightJs>
                </source-repository>
                <issue-tracking>
                    <highlightJs>true</highlightJs>
                    <toc>false</toc>
                </issue-tracking>
                <license>
                    <highlightJs>false</highlightJs>
                    <toc>false</toc>
                </license>

                <dependencies>
                    <tocTopMax>4</tocTopMax>
                </dependencies>
            </pages>
        </reflowSkin>
    </custom>

    <publishDate position="right" />
    <version position="right" />

</project>


text:
title:  Миссионерская история
date:   13/04/2018
---

#### Гавайская свадьба. Часть 2

_Бенжи Лич_

Отец невесты, сопровождавший свою дочь, теперь улыбался, стоя перед гостями. Жених играл на гитаре и пел гавайскую свадебную песню.

Господь побудил меня обратиться к виновникам торжества с небольшой речью, а потом я объявил пару мужем и женой.

Ко мне подошла мать жениха и сказала нечто такое, что до сих пор вызывает у меня трепет.

— Я не думаю, что это была случайность, — произнесла она. — Видимо, так должно было случиться. Взгляните на свою рубашку.

Я посмотрел на свою одежду: джинсы и голубая рубашка, на кармане было вышито слово «Гавайи» и изображена красочная радуга. Я купил эту рубашку на Гавайях несколько лет назад, когда отдыхал там вместе с женой.

Мне на шею надели традиционную гавайскую гирлянду из цветов, и я подумал, что мое участие в этой свадьбе действительно было предопределено.

Мы преподнесли молодоженам небольшой свадебный подарок – книгу «Путь ко Христу». Они никогда не слышали об адвентистах седьмого дня.

Если бы история на этом закончилась, я уже был бы счастлив. Но меня ждало чудесное продолжение.

Два года спустя, когда я уже жил в Техасе, ранним субботним утром мне позвонил литературный евангелист из Колорадо.

— Вы помните пару, которую повенчали в национальном парке Роки-Маунтин? — спросил он.

Литературный евангелист рассказал, что те молодожены прочитали «Путь ко Христу» и пришли в церковь адвентистов, чтобы узнать о Боге побольше.

— Мы дали им и другие книги. Затем они захотели пройти библейские курсы, и на протяжении последних шести месяцев я изучал с этими людьми Библию. Вы, наверное, будете рады узнать, что сегодня они принимают крещение в Церкви адвентистов седьмого дня.

Несколько лет спустя меня пригласили провести молитвенную неделю в академии Кемпион. Собираясь выходить за кафедру для субботней проповеди, я увидел того литературного евангелиста, идущего вместе со знакомой супружеской парой и их ребенком.

После служения мне поведали всю историю.

Приняв крещение, молодые супруги пригласили своих друзей на евангельские встречи в церковь, и трое из них приняли крещение. Более того, мать бывшего жениха также стала членом церкви и теперь работала в адвентистском госпитале на Гавайях.

В тот памятный день у меня не было даже намерения заговаривать с людьми в белых одеждах. Но Господь смог использовать нескольких студентов и молодого служителя в гавайской рубашке, чтобы засвидетельствовать о Своей любви.

_Бенжи Лич совершает служение капеллана в Форт-Уэрте, штат Техас._


text:
/*@import "main.scss";
@import "calendar/layout.scss";
@import "calendar/controls.scss";
@import "calendar/calendar.scss";*/

/*# sourceMappingURL=master.css.map */


text:
"""
pymysensors - Python implementation of the MySensors SerialGateway
"""
import serial
import time
import threading
import logging
import pickle
import os
import json

# Correct versions will be dynamically imported when creating a gateway
global Internal, MessageType

LOGGER = logging.getLogger(__name__)

class Gateway(object):
    """ Base implementation for a MySensors Gateway. """

    def __init__(self, event_callback=None, persistence=False,
                 persistence_file="mysensors.pickle", protocol_version="1.4"):
        self.event_callback = event_callback
        self.sensors = {}
        self.metric = True   # if true - use metric, if false - use imperial
        self.debug = False   # if true - print all received messages
        self.persistence = persistence  # if true - save sensors to disk
        self.persistence_file = persistence_file    # path to persistence file
        if persistence:
            self._load_sensors()
        if protocol_version == "1.4":
            _const = __import__("mysensors.const_14", globals(), locals(), ['Internal', 'MessageType'], 0)
        elif protocol_version == "1.5":
            _const = __import__("mysensors.const_15", globals(), locals(), ['Internal', 'MessageType'], 0)
        global Internal, MessageType
        Internal = _const.Internal
        MessageType = _const.MessageType

    def _handle_presentation(self, msg):
        """ Processes a presentation message. """
        if msg.child_id == 255:
            # this is a presentation of the sensor platform
            self.add_sensor(msg.node_id)
            self.sensors[msg.node_id].type = msg.sub_type
            self.sensors[msg.node_id].version = msg.payload
            self.alert(msg.node_id)
        else:
            # this is a presentation of a child sensor
            self.sensors[msg.node_id].add_child_sensor(msg.child_id,
                                                       msg.sub_type)
            self.alert(msg.node_id)

    def _handle_set(self, msg):
        """ Processes a set message. """
        if self.is_sensor(msg.node_id, msg.child_id):
            self.sensors[msg.node_id].set_child_value(
                msg.child_id, msg.sub_type, msg.payload)
            self.alert(msg.node_id)

    def _handle_internal(self, msg):
        """ Processes an internal protocol message. """
        if msg.sub_type == Internal.I_ID_REQUEST:
            return msg.copy(ack=0,
                            sub_type=Internal.I_ID_RESPONSE,
                            payload=self.add_sensor())
        elif msg.sub_type == Internal.I_SKETCH_NAME:
            if self.is_sensor(msg.node_id):
                self.sensors[msg.node_id].sketch_name = msg.payload
                self.alert(msg.node_id)
        elif msg.sub_type == Internal.I_SKETCH_VERSION:
            if self.is_sensor(msg.node_id):
                self.sensors[msg.node_id].sketch_version = msg.payload
                self.alert(msg.node_id)
        elif msg.sub_type == Internal.I_CONFIG:
            return msg.copy(ack=0, payload='M' if self.metric else 'I')
        elif msg.sub_type == Internal.I_BATTERY_LEVEL:
            if self.is_sensor(msg.node_id):
                self.sensors[msg.node_id].battery_level = int(msg.payload)
                self.alert(msg.node_id)
        elif msg.sub_type == Internal.I_TIME:
            return msg.copy(ack=0, payload=int(time.time()))
        elif msg.sub_type == Internal.I_LOG_MESSAGE and self.debug:
            LOGGER.debug("n:%s c:%s t:%s s:%s p:%s",
                         msg.node_id,
                         msg.child_id,
                         msg.type,
                         msg.sub_type,
                         msg.payload)

    def send(self, message):
        """ Should be implemented by a child class. """
        pass

    def logic(self, data):
        """
        Parse the data and respond to it appropriately.
        Response is returned to the caller and has to be sent
        data is a mysensors command string
        """
        msg = Message(data)

        if msg.type == MessageType.presentation:
            self._handle_presentation(msg)
        elif msg.type == MessageType.set:
            self._handle_set(msg)
        elif msg.type == MessageType.internal:
            return self._handle_internal(msg)
        return None

    def _save_pickle(self, filename):
        """ Save sensors to pickle file """
        with open(filename, 'wb') as f:
            pickle.dump(self.sensors, f, pickle.HIGHEST_PROTOCOL)

    def _load_pickle(self, filename):
        """ Load sensors from pickle file """
        try:
            with open(filename, 'rb') as f:
                self.sensors = pickle.load(f)
        except IOError:
            pass

    def _save_json(self, filename):
        """ Save sensors to json file """
        with open(filename, 'w') as f:
            json.dump(self.sensors, f, cls=MySensorsJSONEncoder)

    def _load_json(self, filename):
        """ Load sensors from json file """
        with open(filename, 'r') as f:
            self.sensors = json.load(f, cls=MySensorsJSONDecoder)

    def _save_sensors(self):
        """ Save sensors to file """
        fname = os.path.realpath(self.persistence_file)
        exists = os.path.isfile(fname)
        dirname = os.path.dirname(fname)
        if (exists and os.access(fname, os.W_OK)) or \
           (not exists and os.access(dirname, os.W_OK)):
            self._perform_file_action(fname, 'save')
        else:
            LOGGER.info('Permission denied when writing to %s' % fname)

    def _load_sensors(self):
        """ Load sensors from file """
        exists = os.path.isfile(self.persistence_file)
        if exists and os.access(self.persistence_file, os.R_OK):
            self._perform_file_action(self.persistence_file, 'load')
        else:
            LOGGER.info('File does not exist or is not '
                        'readable: %s' % self.persistence_file)

    def _perform_file_action(self, filename, action):
        """
        Dynamic dispatch function for performing actions on
        specific file types.
        """
        path, ext = os.path.splitext(filename)
        fn = getattr(self, '_%s_%s' % (action, ext[1:]), None)
        if fn is None:
            raise Exception('Unsupported file type %s' % ext[1:])
        fn(filename)

    def alert(self, nid):
        """
        Tell anyone who wants to know that a sensor was updated. Also save
        sensors if persistence is enabled
        """
        if self.event_callback is not None:
            self.event_callback("sensor_update", nid)

        if self.persistence:
            self._save_sensors()

    def _get_next_id(self):
        """ Returns the next available sensor id. """
        if len(self.sensors):
            next_id = max(self.sensors.keys()) + 1
        else:
            next_id = 1
        if next_id <= 254:
            return next_id
        return None

    def add_sensor(self, sensorid=None):
        """ Adds a sensor to the gateway. """
        if sensorid is None:
            sensorid = self._get_next_id()

        if sensorid is not None and sensorid not in self.sensors:
            self.sensors[sensorid] = Sensor(sensorid)
            return sensorid
        return None

    def is_sensor(self, sensorid, child_id=None):
        """ Returns True if a sensor and its child exists. """
        if sensorid not in self.sensors:
            return False
        if child_id is not None:
            return child_id in self.sensors[sensorid].children
        return True

class SerialGateway(Gateway, threading.Thread):
    """ MySensors serial gateway. """
    # pylint: disable=too-many-arguments

    def __init__(self, port, event_callback=None, persistence=False,
                 persistence_file="mysensors.pickle", protocol_version="1.4",
                 baud=115200, timeout=1.0, reconnect_timeout=10.0):
        threading.Thread.__init__(self)
        Gateway.__init__(self, event_callback, persistence, persistence_file,
                         protocol_version)
        self.serial = None
        self.port = port
        self.baud = baud
        self.timeout = timeout
        self.reconnect_timeout = reconnect_timeout
        self._stop_event = threading.Event()

    def connect(self):
        """ Connects to the serial port. """
        if self.serial:
            return True
        try:
            self.serial = serial.Serial(self.port, self.baud,
                                        timeout=self.timeout)
        except serial.SerialException:
            LOGGER.exception('Unable to connect to %s', self.port)
            return False
        return True

    def disconnect(self):
        """ Disconnects from the serial port. """
        if self.serial is not None:
            self.serial.close()
            self.serial = None

    def stop(self):
        """ Stops the background thread. """
        self._stop_event.set()

    def run(self):
        """ Background thread that reads messages from the gateway. """
        while not self._stop_event.is_set():
            if self.serial is None and not self.connect():
                time.sleep(self.reconnect_timeout)
                continue
            try:
                line = self.serial.readline()
                if not line:
                    continue
            except serial.SerialException:
                LOGGER.exception('Serial exception')
                continue
            except TypeError:
                # pyserial has a bug that causes a TypeError to be thrown when
                # the port disconnects instead of a SerialException
                self.disconnect()
                continue
            try:
                msg = line.decode('utf-8')
                response = self.logic(msg)
            except ValueError:
                LOGGER.warning('Error decoding message from gateway, probably received bad byte.')
                continue
            if response is not None:
                try:
                    self.send(response.encode())
                except ValueError:
                    LOGGER.exception('Invalid response')
                    continue

    def send(self, message):
        """ Writes a Message to the gateway. """
        self.serial.write(message.encode())

class Sensor:
    """ Represents a sensor. """

    def __init__(self, sensor_id):
        self.sensor_id = sensor_id
        self.children = {}
        self.type = None
        self.sketch_name = None
        self.sketch_version = None
        self.battery_level = 0

    def add_child_sensor(self, child_id, child_type):
        """ Creates and adds a child sensor. """
        self.children[child_id] = ChildSensor(child_id, child_type)

    def set_child_value(self, child_id, value_type, value):
        """ Sets a child sensor's value. """
        if child_id in self.children:
            self.children[child_id].values[value_type] = value
        # TODO: Handle error

class ChildSensor:
    """ Represents a child sensor. """
    # pylint: disable=too-few-public-methods

    def __init__(self, child_id, child_type):
        self.id = child_id
        self.type = child_type
        self.values = {}

class Message:
    """ Represents a message from the gateway. """

    def __init__(self, data=None):
        self.node_id = 0
        self.child_id = 0
        self.type = ""
        self.ack = 0
        self.sub_type = ""
        self.payload = ""
        if data is not None:
            self.decode(data)

    def copy(self, **kwargs):
        """
        Copies a message, optionally replacing attributes with keyword
        arguments.
        """
        msg = Message(self.encode())
        for key, val in kwargs.items():
            setattr(msg, key, val)
        return msg

    def decode(self, data):
        """ Decode a message from command string. """
        data = data.rstrip().split(';')
        self.payload = data.pop()
        (self.node_id,
         self.child_id,
         self.type,
         self.ack,
         self.sub_type) = [int(f) for f in data]

    def encode(self):
        """ Encode a command string from message. """
        return ";".join([str(f) for f in [
            self.node_id,
            self.child_id,
            int(self.type),
            self.ack,
            int(self.sub_type),
            self.payload,
        ]]) + "\n"

class MySensorsJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, Sensor):
            return {
                'sensor_id': o.sensor_id,
                'children': o.children,
                'type': o.type,
                'sketch_name': o.sketch_name,
                'sketch_version': o.sketch_version,
                'battery_level': o.battery_level,
            }
        if isinstance(o, ChildSensor):
            return {
                'id': o.id,
                'type': o.type,
                'values': o.values,
            }
        return json.JSONEncoder.default(self, o)

class MySensorsJSONDecoder(json.JSONDecoder):
    def __init__(self):
        json.JSONDecoder.__init__(self, object_hook=self.dict_to_object)

    def dict_to_object(self, o):
        if not isinstance(o, dict):
            return o
        if 'sensor_id' in o:
            sensor = Sensor(o['sensor_id'])
            sensor.__dict__.update(o)
            return sensor
        elif all(k in o for k in ['id', 'type', 'values']):
            child = ChildSensor(o['id'], o['type'])
            child.values = o['values']
            return child
        elif all(k.isdigit() for k in o.keys()):
            return {int(k): v for k,v in o.items()}
        return o


text:
ACCEPTED

#### According to
IRMNG Homonym List

#### Published in
C. R. Acad. Sci. Paris, 104, 185.

#### Original name
null

### Remarks
null


text:
using namespace ofxCv;
using namespace cv;

void ofApp::setup() {
	ofSetVerticalSync(true);
	ofSetFrameRate(120);

	objectFinder.setup(ofToDataPath("haarcascade_frontalface_default.xml"));
	objectFinder.setPreset(ObjectFinder::Fast);
	cam.initGrabber(640, 480);
	cropped.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_COLOR);
}

void ofApp::update() {
	cam.update();
	if(cam.isFrameNew()) {
		objectFinder.update(cam);
		if(objectFinder.size() > 0) {
			cv::Rect roi = toCv(objectFinder.getObject(0));
			Mat camMat = toCv(cam);
			Mat croppedCamMat(camMat, roi);
			resize(croppedCamMat, cropped);
			cropped.update();
		}
	}
}

void ofApp::draw() {
	cropped.draw(0, 0);
}


text:
class AddTranslationsToMainModels < SpreeExtension::Migration[4.2]
  def up
    unless table_exists?(:spree_product_translations)
      params = { name: :string, description: :text, meta_description: :string,
                 meta_keywords: :string }
      Spree::Product.create_translation_table!(params, { migrate_data: true })
    end

    unless table_exists?(:spree_promotion_translations)
      params = { name: :string, description: :string }
      Spree::Promotion.create_translation_table!(params, { migrate_data: true })
    end

    unless table_exists?(:spree_option_type_translations)
      params = { name: :string, presentation: :string }
      Spree::OptionType.create_translation_table!(params, { migrate_data: true })
    end

    unless table_exists?(:spree_property_translations)
      params = { name: :string, presentation: :string }
      Spree::Property.create_translation_table!(params, { migrate_data: true })
    end

    unless table_exists?(:spree_taxonomy_translations)
      Spree::Taxonomy.create_translation_table!({ name: :string }, { migrate_data: true })
    end

    unless table_exists?(:spree_taxon_translations)
      params = { name: :string, description: :text, meta_title: :string,
                 meta_description: :string, meta_keywords: :string,
                 permalink: :string }
      Spree::Taxon.create_translation_table!(params, { migrate_data: true })
    end
  end

  def down
    Spree::Product.drop_translation_table! migrate_data: true
    Spree::Promotion.drop_translation_table! migrate_data: true
    Spree::Property.drop_translation_table! migrate_data: true
    Spree::OptionType.drop_translation_table! migrate_data: true
    Spree::Taxonomy.drop_translation_table! migrate_data: true
    Spree::Taxon.drop_translation_table! migrate_data: true
  end
end


text:
local myString = "Hi my name is Senthil"
print(typeof(myString))
print(myString)

-- This is a number variable

local myInteger = 32.67
print(typeof(myInteger))
print(myInteger)

local myBoolean = true
print(typeof(myBoolean))
print(myBoolean)


text:
import greenfoot.*;
import java.util.Random;
import javax.swing.JOptionPane;
import org.restlet.resource.ClientResource;
import org.restlet.representation.Representation;
import org.restlet.ext.json.JsonRepresentation;
import org.json.JSONObject;

/**
 * This is the central class for implenting the Game
 *
 * @author Green Techies
 * @version 1.0
 */
public class GameEngine extends Actor
{
    // instance variables - replace the example below with your own
    public int computerGuess;
    public static int enterendInput = 0;
    public static String chosedOperation = null;
    public String playerName = "";
    public String gameLevel="";
    public static int maxTurns = 20;

    /**
     * Constructor for objects of class GameEngine
     */
    public GameEngine(String playerName, String gameLevel, int computerGuess)
    {
      this.playerName = playerName;
      this.gameLevel =gameLevel;
      this.computerGuess = computerGuess;
      Random random = new Random();
    }

    /**
     * An example of a method - replace this comment with your own
     *
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y
     */
    public void act()
    {
        //
    }

    public int query(int numberOfGuess){
        boolean queryResult = false;
        int resp = 0;
        StringBuilder queryBuilder = new StringBuilder();
        queryBuilder.append("Guessed Number ");
        if(numberOfGuess>maxTurns){
            resp = 2;
        }
        else{
        switch(chosedOperation){
          case "gt":
           queryResult = (computerGuess >= enterendInput);
           queryBuilder.append(">= " + enterendInput);
           break;
          case "lt":
           queryResult = (computerGuess <= enterendInput);
           queryBuilder.append("<= " + enterendInput);
           break;
          case "mod":
           queryResult =(computerGuess % enterendInput) == 0;
           queryBuilder.append(" / by " + enterendInput);
           break;
        }
         if(queryResult)
            resp=1;
    }
        getWorldOfType(GamePlayWorld.class).previousQueryResultMap.put(queryBuilder.toString(),queryResult);
        return resp;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="weather_current_city_name">22.0sp</dimen>
    <dimen name="actionbar_height">48.0dip</dimen>
    <dimen name="actionbar_item_height">48.0dip</dimen>
    <dimen name="actionbar_item_width">48.0dip</dimen>
    <dimen name="base_action_bar_height">48.0dip</dimen>
    <dimen name="base_action_bar_overflow_item_height">48.0dip</dimen>
    <dimen name="base_action_bar_overflow_width">150.0dip</dimen>
    <dimen name="base_action_bar_title_padding_left">14.0dip</dimen>
    <dimen name="base_action_bar_overflow_icon_size">23.0dip</dimen>
    <dimen name="base_action_bar_item_padding">12.0dip</dimen>
    <dimen name="base_action_bar_item_padding_right">20.0dip</dimen>
    <dimen name="base_action_bar_title_size">21.0sp</dimen>
    <dimen name="base_listitem_img_width">73.0dip</dimen>
    <dimen name="base_listitem_img_height">53.0dip</dimen>
    <dimen name="base_listitem_padding_left_right">10.0dip</dimen>
    <dimen name="base_listitem_padding_top_bottom">5.0dip</dimen>
    <dimen name="base_listitem_img_padding">7.0dip</dimen>
    <dimen name="biz_list_head_padding_bottom">6.0dip</dimen>
    <dimen name="biz_topic_vote_header_width">58.0dip</dimen>
    <dimen name="biz_topic_vote_header_padding">15.0dip</dimen>
    <dimen name="biz_topic_vote_item_padding">5.0dip</dimen>
    <dimen name="biz_topic_vote_submit_btn_left_margin">20.0dip</dimen>
    <dimen name="biz_topic_vote_submit_btn_height_margin">16.0dip</dimen>
    <dimen name="biz_topic_vote_submit_btn_bottom_margin">20.0dip</dimen>
    <dimen name="biz_app_recommend_width">58.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend">22.0sp</dimen>
    <dimen name="biz_news_column_subscribe_recommend_padding">0.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_horizontalSpacing">10.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_verticalSpacing">10.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_title_marginTop">0.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_divider_marginLeft">10.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_divider_marginRight">10.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_button_marginBottom">15.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_padding_top">15.0dip</dimen>
    <dimen name="biz_news_column_subscribe_recommend_padding_bottom">15.0dip</dimen>
    <dimen name="biz_ad_show_new_version_margin_bottom">40.0dip</dimen>
    <dimen name="biz_topic_micro_header_width">24.0dip</dimen>
    <dimen name="biz_topic_micro_popup_vertical">7.0dip</dimen>
    <dimen name="biz_topic_micro_reply_padding_right">13.0dip</dimen>
    <dimen name="biz_topic_micro_child_username_size">12.0sp</dimen>
    <dimen name="biz_topic_micro_child_digest_size">14.0sp</dimen>
    <dimen name="biz_topic_micro_group_username_size">14.0sp</dimen>
    <dimen name="biz_topic_micro_group_time_size">11.0sp</dimen>
    <dimen name="biz_topic_micro_group_describ_size">11.0sp</dimen>
    <dimen name="biz_topic_micro_group_digest_size">16.0sp</dimen>
    <dimen name="biz_topic_micro_group_comment_size">14.0sp</dimen>
    <dimen name="biz_topic_micro_header_size">19.0sp</dimen>
    <dimen name="biz_topic_micro_header_digest_size">14.0sp</dimen>
    <dimen name="biz_topic_micro_padding_left">10.0dip</dimen>
    <dimen name="biz_topic_micro_padding_right">10.0dip</dimen>
    <dimen name="biz_topic_micro_padding_child_left">40.0dip</dimen>
    <dimen name="biz_topic_micro_padding_child_right">10.0dip</dimen>
    <dimen name="biz_widget_img_width">65.0dip</dimen>
    <dimen name="biz_widget_img_heigh">60.0dip</dimen>
    <dimen name="biz_widget_padding_left">10.0dip</dimen>
    <dimen name="biz_widget_padding_right">10.0dip</dimen>
    <dimen name="biz_widget_top_padding_left">10.0dip</dimen>
    <dimen name="biz_widget_top_padding_right">10.0dip</dimen>
    <dimen name="biz_widget_body_padding_left">2.0dip</dimen>
    <dimen name="biz_widget_body_padding_right">2.0dip</dimen>
    <dimen name="base_photoitem_img_width">288.0dip</dimen>
    <dimen name="base_photoitem_img_height">152.0dip</dimen>
    <dimen name="biz_photoset_list_paddingTop">10.0dip</dimen>
    <dimen name="biz_photoset_list_title_size">18.0sp</dimen>
    <dimen name="biz_photoset_list_comment_size">12.0sp</dimen>
    <dimen name="biz_photoset_list_title_paddingLeft">10.0dip</dimen>
    <dimen name="biz_photoset_list_comment_paddingRight">10.0dip</dimen>
    <dimen name="biz_pic_detail_setname_size">16.0sp</dimen>
    <dimen name="biz_pic_detail_setnum_size">14.0sp</dimen>
    <dimen name="biz_pic_detail_imgtitle_size">14.0sp</dimen>
    <dimen name="biz_pic_detail_desc_marginTop">0.0dip</dimen>
    <dimen name="biz_pic_detail_desc_padding">0.0dip</dimen>
    <dimen name="biz_pic_detail_action_comment_size">14.0sp</dimen>
    <dimen name="biz_pic_txtscroll_height">94.0dip</dimen>
    <dimen name="base_favority_photoitem_img_width">432.0dip</dimen>
    <dimen name="base_favority_photoitem_img_height">230.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_margin">10.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_nickname_padding">2.0dip</dimen>
    <dimen name="biz_pc_main_plugin_list_height">54.0dip</dimen>
    <dimen name="biz_pc_main_plugin_list_extra_icon_width">34.0dip</dimen>
    <dimen name="biz_pc_main_plugin_list_extra_icon_height">34.0dip</dimen>
    <dimen name="biz_pc_main_plugin_list_icon_size">22.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_head_size">65.0dip</dimen>
    <dimen name="base_pc_account_profile_head_margin">15.0dip</dimen>
    <dimen name="base_pc_account_profile_head_small_padding">1.5dip</dimen>
    <dimen name="biz_pc_main_plugin_list_icon_margin">12.0dip</dimen>
    <dimen name="biz_pc_main_plugin_list_title_margin">6.0dip</dimen>
    <dimen name="biz_pc_main_plugin_item_text_size">16.0sp</dimen>
    <dimen name="biz_pc_main_plugin_bottom_text_size">13.0sp</dimen>
    <dimen name="biz_pc_main_info_profile_nickname_text_size">14.0sp</dimen>
    <dimen name="biz_pc_main_info_profile_desc_text_size">12.0sp</dimen>
    <dimen name="biz_pc_main_info_profile_other_text_size">14.0sp</dimen>
    <dimen name="biz_pc_main_info_profile_bottom_btn_paddingTop">8.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_bottom_btn_paddingBottom">8.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_bottom_btn_paddingLeft">5.0dip</dimen>
    <dimen name="biz_pc_main_info_profile_bottom_btn_paddingRight">5.0dip</dimen>
    <dimen name="biz_pc_main_plugin_marginBottom">0.0dip</dimen>
    <dimen name="base_pc_account_profile_head_width">84.0dip</dimen>
    <dimen name="base_pc_account_profile_head_height">84.0dip</dimen>
    <dimen name="base_pc_account_profile_head_padding">3.5dip</dimen>
    <dimen name="biz_account_profile_margin">80.0dip</dimen>
    <dimen name="biz_account_profile_tablerow_height">64.0dip</dimen>
    <dimen name="biz_account_profile_table_margin">20.0dip</dimen>
    <dimen name="biz_account_profile_head_selector_height">100.0dip</dimen>
    <dimen name="biz_account_profile_selector_width">42.0dip</dimen>
    <dimen name="biz_account_profile_selector_height">42.0dip</dimen>
    <dimen name="biz_account_profile_selector_head_width">36.0dip</dimen>
    <dimen name="biz_account_profile_selector_head_height">36.0dip</dimen>
    <dimen name="biz_account_profile_selector_icon_width">16.0dip</dimen>
    <dimen name="biz_account_profile_selector_icon_height">16.0dip</dimen>
    <dimen name="biz_pc_profile_account_title_size">14.0sp</dimen>
    <dimen name="biz_account_profile_avatar_width">100.0dip</dimen>
    <dimen name="biz_account_profile_avatar_height">100.0dip</dimen>
    <dimen name="biz_pc_account_login_btn_text_size">16.0sp</dimen>
    <dimen name="biz_pc_account_login_btn_height">40.0dip</dimen>
    <dimen name="biz_pc_account_login_img_marginBottom">6.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_paddingTop">14.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_paddingBottom">7.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_paddingLeft">0.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_paddingRight">0.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_marginLeft">10.0dip</dimen>
    <dimen name="biz_pc_account_login_RelativeLayout02_marginRight">10.0dip</dimen>
    <dimen name="biz_pc_account_login_ssl_paddingLeft">0.0dip</dimen>
    <dimen name="biz_pc_account_login_ssl_paddingRight">0.0dip</dimen>
    <dimen name="biz_pc_account_login_ssl_marginTop">5.0dip</dimen>
    <dimen name="biz_pc_account_login_ssl_marginLeft">14.0dip</dimen>
    <dimen name="biz_pc_account_login_ssl_marginRight">14.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_paddingLeft">0.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_paddingRight">0.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_marginTop">14.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_marginLeft">14.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_marginRight">14.0dip</dimen>
    <dimen name="biz_pc_account_login_buttonlayout_marginBottom">14.0dip</dimen>
    <dimen name="biz_pc_account_login_button_marginLeft">10.0dip</dimen>
    <dimen name="biz_sns_publish_padding">16.0dip</dimen>
    <dimen name="biz_sns_publish_limit_size">14.0sp</dimen>
    <dimen name="biz_sns_publish_content_size">16.0sp</dimen>
    <dimen name="biz_sns_select_padding">16.0dip</dimen>
    <dimen name="biz_sns_select_title_size">20.0sp</dimen>
    <dimen name="biz_sns_select_item_title_size">12.0sp</dimen>
    <dimen name="biz_sns_select_verticalSpacing">0.0dip</dimen>
    <dimen name="biz_ad_img_width">320.0dip</dimen>
    <dimen name="biz_ad_img_height">433.0dip</dimen>
    <dimen name="biz_ad_sologn_height">118.0dip</dimen>
    <dimen name="biz_ad_copyright">11.0sp</dimen>
    <dimen name="biz_navi_list_height">52.0dip</dimen>
    <dimen name="biz_navi_list_paddingLeft">20.0dip</dimen>
    <dimen name="biz_navi_column_height">40.0dip</dimen>
    <dimen name="base_view_size_16">16.0dip</dimen>
    <dimen name="base_view_size_32">32.0dip</dimen>
    <dimen name="base_view_size_8">8.0dip</dimen>
    <dimen name="biz_news_column_subscribe_padding">8.0dip</dimen>
    <dimen name="biz_news_column_subscribe_group_item_minHeight">42.0dip</dimen>
    <dimen name="biz_news_column_subscribe_search_item_minHeight">56.0dip</dimen>
    <dimen name="biz_news_column_subscribe_margin">22.0dip</dimen>
    <dimen name="biz_news_column_subscribe_group_item_textsize">18.0sp</dimen>
    <dimen name="biz_news_column_subscribe_child_item_textsize">18.0sp</dimen>
    <dimen name="biz_news_column_subscribe_search_item_textsize">18.0sp</dimen>
    <dimen name="biz_news_column_subscribe_item_paddingRight">16.0dip</dimen>
    <dimen name="biz_news_column_subscribe_search_item_paddingRight">18.0dip</dimen>
    <dimen name="biz_news_searchnews_textsize">16.0sp</dimen>
    <dimen name="biz_news_searchnews_time_textsize">11.0sp</dimen>
    <dimen name="biz_news_searchnews_paddingLeft">10.0dip</dimen>
    <dimen name="biz_news_searchnews_paddingRight">10.0dip</dimen>
    <dimen name="biz_special_group_text_size">14.0sp</dimen>
    <dimen name="biz_special_newsitem_tile_size">16.0sp</dimen>
    <dimen name="biz_special_mediaitem_tile_size">13.0sp</dimen>
    <dimen name="biz_special_mediaitem_margin">8.0dip</dimen>
    <dimen name="biz_special_mediaitem_padding">16.0dip</dimen>
    <dimen name="biz_topic_vote_digest_size">16.0sp</dimen>
    <dimen name="biz_topic_vote_question_size">19.0sp</dimen>
    <dimen name="biz_topic_vote_datetime_size">12.0sp</dimen>
    <dimen name="biz_topic_vote_comment_size">12.0sp</dimen>
    <dimen name="biz_topic_vote_question_marginTop">5.0dip</dimen>
    <dimen name="biz_topic_vote_type_marginTop">8.0dip</dimen>
    <dimen name="biz_topic_vote_content_marginTop">5.0dip</dimen>
    <dimen name="biz_topic_vote_digest_lineSpacing">2.0dip</dimen>
    <dimen name="biz_topic_vote_question_lineSpacing">5.0dip</dimen>
    <dimen name="biz_topic_vote_result_item_marginTop">10.0dip</dimen>
    <dimen name="biz_topic_vote_progress_marginTop">5.0dip</dimen>
    <dimen name="biz_plugin_weather_divider_margin_top">33.5dip</dimen>
    <dimen name="biz_plugin_weather_divider_margin_bottom">28.0dip</dimen>
    <dimen name="biz_plugin_weather_divider_margin_left">10.0dip</dimen>
    <dimen name="biz_plugin_weather_divider_margin_right">10.0dip</dimen>
    <dimen name="biz_plugin_weather_first_item_margin_top">25.0dip</dimen>
    <dimen name="biz_plugin_weather_otherday_margin_left">6.0dip</dimen>
    <dimen name="biz_plugin_weather_otherday_margin_right">6.0dip</dimen>
    <dimen name="biz_plugin_weather_paddingTopAndBottom">5.0dip</dimen>
    <dimen name="biz_plugin_weather_paddingLeftAndRight">10.0dip</dimen>
    <dimen name="biz_plugin_weather_first_item_image_size">90.0dip</dimen>
    <dimen name="biz_plugin_weather_otherday_image_size">60.0dip</dimen>
    <dimen name="biz_plugin_weather_small_textsize">12.0sp</dimen>
    <dimen name="biz_plugin_weather_temperature_textsize">30.0sp</dimen>
    <dimen name="biz_plugin_weather_climate_textsize">20.0sp</dimen>
    <dimen name="biz_plugin_weather_updatetime_textsize">11.0sp</dimen>
    <dimen name="biz_plugin_weather_otherday_small_textsize">14.0sp</dimen>
    <dimen name="biz_plugin_weather_otherday_temperature_textsize">18.0sp</dimen>
    <dimen name="biz_plugin_weather_otherday_climate_textsize">13.0sp</dimen>
    <dimen name="biz_plugin_weather_selectcity_item_textsize">13.0sp</dimen>
    <dimen name="biz_plugin_weather_selectcity_indicator_textsize">12.0sp</dimen>
    <dimen name="biz_plugin_weather_selectcity_group_item_padding">14.0dip</dimen>
    <dimen name="biz_localnews_weather_paddingTop">10.0dip</dimen>
    <dimen name="biz_localnews_weather_paddingLeft">10.0dip</dimen>
    <dimen name="biz_localnews_weather_paddingRight">10.0dip</dimen>
    <dimen name="biz_localnews_weather_temperature_textsize">22.0sp</dimen>
    <dimen name="biz_localnews_weather_updatetime_textsize">11.0sp</dimen>
    <dimen name="biz_localnews_weather_image_size">60.0dip</dimen>
    <dimen name="biz_weather_pager_height">165.0dip</dimen>
    <dimen name="biz_weather_padding">10.0dip</dimen>
    <dimen name="biz_tie_user_avater_size">24.0dip</dimen>
    <dimen name="biz_tie_comment_toolbar_height">58.0dip</dimen>
    <dimen name="biz_tie_comment_toolbar_item_width">58.0dip</dimen>
    <dimen name="biz_tie_rank_top_title_size">16.0sp</dimen>
    <dimen name="biz_tie_rank_top_count_size">14.0sp</dimen>
    <dimen name="biz_tie_top_title_size">14.0sp</dimen>
    <dimen name="biz_tie_top_content_size">16.0sp</dimen>
    <dimen name="biz_tie_top_author_size">12.0sp</dimen>
    <dimen name="biz_tie_comment_floor_last_date">11.0sp</dimen>
    <dimen name="biz_tie_comment_floor_last_username">13.0sp</dimen>
    <dimen name="biz_tie_comment_floor_last_content">17.0sp</dimen>
    <dimen name="biz_tie_comment_floor_last_padding">16.0dip</dimen>
    <dimen name="biz_tie_comment_floor_last_lineSpacing">3.0dip</dimen>
    <dimen name="biz_tie_comment_floor_normal_content">17.0sp</dimen>
    <dimen name="biz_tie_comment_floor_normal_username">13.0sp</dimen>
    <dimen name="biz_tie_comment_floor_normal_num">11.0sp</dimen>
    <dimen name="biz_tie_comment_floor_normal_padding">10.0dip</dimen>
    <dimen name="biz_tie_comment_reply_height">54.0dip</dimen>
    <dimen name="biz_tie_comment_reply_text_size">14.0sp</dimen>
    <dimen name="biz_tie_comment_reply_padding">0.0dip</dimen>
    <dimen name="biz_live_header_team_flag_width">41.0dip</dimen>
    <dimen name="biz_live_header_team_flag_height">41.0dip</dimen>
    <dimen name="biz_live_news_live_team_title">14.0sp</dimen>
    <dimen name="biz_live_news_live_score_vs">22.0sp</dimen>
    <dimen name="biz_live_olympic_title_scores">28.0sp</dimen>
    <dimen name="biz_live_score_paddingLeftAndRight">0.0dip</dimen>
    <dimen name="biz_live_news_live_item_time_size">18.0sp</dimen>
    <dimen name="biz_live_news_live_item_content_size">18.0sp</dimen>
    <dimen name="base_text_size_12">12.0sp</dimen>
    <dimen name="base_text_size_18">18.0sp</dimen>
    <dimen name="biz_pc_recommend_list_padding_left">20.0dip</dimen>
    <dimen name="biz_pc_recommend_list_padding_right">20.0dip</dimen>
    <dimen name="biz_setting_guide_layout_height">84.0dip</dimen>
    <dimen name="biz_news_newspage_action_comment_padding_left">14.0dip</dimen>
    <dimen name="biz_news_newspage_action_comment_padding_right">16.0dip</dimen>
    <dimen name="system_status_bar_height">25.0dip</dimen>
    <dimen name="biz_news_column_list_height">48.0dip</dimen>
    <dimen name="base_dropdown_list_title">16.0sp</dimen>
    <dimen name="base_list_title_text_size">16.0sp</dimen>
    <dimen name="base_list_desc_text_size">13.0sp</dimen>
    <dimen name="base_list_tag_text_size">11.0sp</dimen>
    <dimen name="base_list_header_text_size">14.0sp</dimen>
    <dimen name="base_navi_width">180.0dip</dimen>
    <dimen name="base_navi_list_height">62.0dip</dimen>
    <dimen name="biz_special_intro_padding">5.0dip</dimen>
    <dimen name="biz_special_intro_padding_left">10.0dip</dimen>
    <dimen name="biz_sns_manager_icon_size">28.0dip</dimen>
    <dimen name="biz_fb_paddingx5">5.0dip</dimen>
    <dimen name="biz_fb_paddingx10">10.0dip</dimen>
    <dimen name="biz_fb_paddingx20">20.0dip</dimen>
    <dimen name="biz_yearplan_animation_lead_text_size">22.0sp</dimen>
    <dimen name="biz_yearplan_animation_small_text_size">18.0sp</dimen>
    <dimen name="biz_yearplan_animation_logo_text_size">16.0sp</dimen>
    <dimen name="biz_yearplan_animation_big_text_size">22.0sp</dimen>
    <dimen name="font_image_width">173.0dip</dimen>
    <dimen name="font_image_height">28.0dip</dimen>
</resources>


text:
package com.moilioncircle.redis.replicator;

import org.junit.Test;

/**
 * @author Leon Chen
 */
public class TestVersion {

    @Test
    public void testVersion() {
        System.out.println("========================================");
        System.out.println("java version: " + System.getProperty("java.version"));
        System.out.println("========================================");
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<tycho-version>0.15.0</tycho-version>
	</properties>

	<groupId>uk.co.sinjakli</groupId>
	<artifactId>uk.co.sinjakli.eclipserunhelper</artifactId>
	<version>1.0.2-SNAPSHOT</version>
	<packaging>eclipse-plugin</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho-version}</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<environments>
						<environment>
							<os>linux</os>
							<ws>gtk</ws>
							<arch>x86_64</arch>
						</environment>
						<environment>
							<os>linux</os>
							<ws>gtk</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>macosx</os>
							<ws>carbon</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>macosx</os>
							<ws>cocoa</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>macosx</os>
							<ws>cocoa</ws>
							<arch>x86_64</arch>
						</environment>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86_64</arch>
						</environment>
					</environments>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>eclipse-indigo</id>
			<url>http://download.eclipse.org/releases/indigo</url>
			<layout>p2</layout>
		</repository>
	</repositories>

</project>


text:
package gamePlayer.guiItemsListeners;

import javafx.beans.property.DoubleProperty;

/**
 *
 * @author Greg Lyons
 *
 */

public interface HealthListener {

	public void bindHealth(DoubleProperty healthRemaining);

}


text:
NSString *pathToCompletedTaskFile()
{
    NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *pathToDoc = pathList[0];
    NSString *pathToTasksFile = [[NSString alloc] initWithFormat:@"%@/myCompletedTasks.plist", pathToDoc];

    // Check if file myTasks.plist exist in Documents folder
    if (![[NSFileManager defaultManager] fileExistsAtPath:pathToTasksFile])
    {
        // If not - creting root array and writing to file
        NSArray *rootArray = [[NSArray alloc] init];
        [rootArray writeToFile:pathToTasksFile atomically:YES];
    }

    return pathToTasksFile;
}

@implementation CompletedTasksIO

+(NSArray *)loadCompletedTasksFromFile
{
    NSArray *arrayWithTasks = [[NSArray alloc] initWithContentsOfFile:pathToCompletedTaskFile()];

    return arrayWithTasks;
}

+(void)addCompletedTasksToFile:(NSDictionary *)tasksDictionary
{
    NSMutableArray *arrayFromFile = [[self loadCompletedTasksFromFile] mutableCopy];
    [arrayFromFile insertObject:tasksDictionary atIndex:0];

    [arrayFromFile writeToFile:pathToCompletedTaskFile() atomically:YES];
}

+(void)saveCompletedTaskArray:(NSMutableArray *)taskArray
{
    [taskArray writeToFile:pathToCompletedTaskFile() atomically:YES];
}

@end


text:
""" GL ES 2.0 API implemented via pyOpenGL library. Intended as a
fallback and for testing.
"""

from OpenGL import GL as _GL
import OpenGL.GL.framebufferobjects as _FBO

from ...util import logger

from . import _copy_gl_functions
from ._constants import *  # noqa

def _patch():
    """ Monkey-patch pyopengl to fix a bug in glBufferSubData. """
    import sys
    from OpenGL import GL
    if sys.version_info > (3,):
        buffersubdatafunc = GL.glBufferSubData
        if hasattr(buffersubdatafunc, 'wrapperFunction'):
            buffersubdatafunc = buffersubdatafunc.wrapperFunction
        _m = sys.modules[buffersubdatafunc.__module__]
        _m.long = int

    # Fix missing enum
    try:
        from OpenGL.GL.VERSION import GL_2_0
        GL_2_0.GL_OBJECT_SHADER_SOURCE_LENGTH = GL_2_0.GL_SHADER_SOURCE_LENGTH
    except Exception:
        pass

# Patch OpenGL package
_patch()

## Inject

def _make_unavailable_func(funcname):
    def cb(*args, **kwargs):
        raise RuntimeError('OpenGL API call "%s" is not available.' % funcname)
    return cb

def _get_function_from_pyopengl(funcname):
    """ Try getting the given function from PyOpenGL, return
    a dummy function (that shows a warning when called) if it
    could not be found.
    """
    func = None

    # Get function from GL
    try:
        func = getattr(_GL, funcname)
    except AttributeError:
        # Get function from FBO
        try:
            func = getattr(_FBO, funcname)
        except AttributeError:
            func = None

    # Try using "alias"
    if not bool(func):
        # Some functions are known by a slightly different name
        # e.g. glDepthRangef, glClearDepthf
        if funcname.endswith('f'):
            try:
                func = getattr(_GL, funcname[:-1])
            except AttributeError:
                pass

    # Set dummy function if we could not find it
    if func is None:
        func = _make_unavailable_func(funcname)
        logger.warning('warning: %s not available' % funcname)
    return func

def _inject():
    """ Copy functions from OpenGL.GL into _pyopengl namespace.
    """
    NS = _pyopengl2.__dict__
    for glname, ourname in _pyopengl2._functions_to_import:
        func = _get_function_from_pyopengl(glname)
        NS[ourname] = func

from . import _pyopengl2  # noqa

# Inject remaining functions from OpenGL.GL
# copies name to _pyopengl2 namespace
_inject()

# Inject all function definitions in _pyopengl2
_copy_gl_functions(_pyopengl2, globals())


text:
package njuse.ec.service;

import static org.junit.Assert.assertEquals;

import java.io.File;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * 文件测试.
 * @author 丞
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class FileServiceTest {

	/**
	 * 文件service.
	 */
	@Autowired
	private FileService fileService;

	/**
	 * 测试上传函数.
	 */
	@Test
	public final void testUpload() {
//		assertEquals(1, fileService.upload(null).getResultCode());
//		assertEquals(0, fileService.upload(new File("aaa")).getResultCode());
	}

}


text:
from collections import defaultdict

import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
                                 single_source_shortest_path_length)

def floyd_warshall_slow(graph, directed=False):
    N = graph.shape[0]

    #set nonzero entries to infinity
    graph[np.where(graph == 0)] = np.inf

    #set diagonal to zero
    graph.flat[::N + 1] = 0

    if not directed:
        graph = np.minimum(graph, graph.T)

    for k in range(N):
        for i in range(N):
            for j in range(N):
                graph[i, j] = min(graph[i, j], graph[i, k] + graph[k, j])

    graph[np.where(np.isinf(graph))] = 0

    return graph

def generate_graph(N=20):
    #sparse grid of distances
    rng = np.random.RandomState(0)
    dist_matrix = rng.random_sample((N, N))

    #make symmetric: distances are not direction-dependent
    dist_matrix += dist_matrix.T

    #make graph sparse
    i = (rng.randint(N, size=N * N / 2), rng.randint(N, size=N * N / 2))
    dist_matrix[i] = 0

    #set diagonal to zero
    dist_matrix.flat[::N + 1] = 0

    return dist_matrix

def test_floyd_warshall():
    dist_matrix = generate_graph(20)

    for directed in (True, False):
        graph_FW = graph_shortest_path(dist_matrix, directed, 'FW')
        graph_py = floyd_warshall_slow(dist_matrix.copy(), directed)

        assert_array_almost_equal(graph_FW, graph_py)

def test_dijkstra():
    dist_matrix = generate_graph(20)

    for directed in (True, False):
        graph_D = graph_shortest_path(dist_matrix, directed, 'D')
        graph_py = floyd_warshall_slow(dist_matrix.copy(), directed)

        assert_array_almost_equal(graph_D, graph_py)

def test_shortest_path():
    dist_matrix = generate_graph(20)
    # We compare path length and not costs (-> set distances to 0 or 1)
    dist_matrix[dist_matrix != 0] = 1

    for directed in (True, False):
        if not directed:
            dist_matrix = np.minimum(dist_matrix, dist_matrix.T)

        graph_py = floyd_warshall_slow(dist_matrix.copy(), directed)
        for i in range(dist_matrix.shape[0]):
            # Non-reachable nodes have distance 0 in graph_py
            dist_dict = defaultdict(int)
            dist_dict.update(single_source_shortest_path_length(dist_matrix, i))

            for j in range(graph_py[i].shape[0]):
                assert_array_almost_equal(dist_dict[j], graph_py[i, j])

def test_dijkstra_bug_fix():
    X = np.array([[0., 0., 4.],
                  [1., 0., 2.],
                  [0., 5., 0.]])
    dist_FW = graph_shortest_path(X, directed=False, method='FW')
    dist_D = graph_shortest_path(X, directed=False, method='D')
    assert_array_almost_equal(dist_D, dist_FW)

if __name__ == '__main__':
    import nose
    nose.runmodule()


text:
AnimationKit.Task is the parent class for all animations. It controls things like frame delays and general animation status information.

## Events

Event Completed ()

When the task has finished executing, after the final Perform event, the `Completed` event will fire. Will not fire if the task was cancelled.

Event Perform (Final As Boolean, Time As Double)

The current state of the animation should be updated. Will not fire if the object referenced by the Item property has gone out of scope. If `Final` is true, this is the last `Perform` event that will be fired for this task.

The `Time` parameter is a value returned by the Xojo `Microseconds` method used to coordinate the execution times of multiple animations. It is strongly recommended that developers calculate based on the `Time` parameter, and not by the value returned by `Microseconds`.

Event Started ()

The `Started` event triggers immediately before the first `Perform` event.

## Properties

Cancelled As Boolean // Read Only

`Cancelled` will be true if either the `Cancel` method has been called, or the object referenced by the `Item` property has gone out of scope. The task can no longer execute, and no more `Perform` events will trigger. Chained tasks will not be started.

Item As Object = Nil

The target of the animation. This is a weak reference, so that when the target goes out of scope, the animation will automatically cancel.

LastFrameTime As Double // Read Only

The time in microseconds that the last `Perform` event was triggered.

NextTask As AnimationKit.Task = Nil

When this task has completed, automatically start the task referenced in this property. The new value will always be set to the end of the chain. To break the chain, set this property to `Nil`. To replace an item in the chain, rather than append, set this property to `Nil` first, then to the intended value.

Started As Boolean // Read Only

The animation has started.

## Methods

Sub Cancel ()

Stops the animation where it is.

Sub Completed ()

Triggers an `UnsupportedOperationException`. Subclasses must override so the framework knows when a task is complete and can move on to the next task in the chain.

Function ElapsedTime (Time As Double) As Double

Amount of time in microseconds since `Time` that has elapsed since the task started execution.

Sub Perform (Time As Double)

Does some status checking and triggers the `Perform` event if necessary.

Sub Run ()

Begin the animation using the application global coordinator.

Sub Run (Coordinator As AnimationKit.Coordinator)

Begin the animation using the coordinator specified.

## Subclassing

Developers can create subclasses to implement new forms of animation.

The `Completed` method must be overridden.

## See Also

[AnimationKit.Coordinator](AnimationKit.Coordinator.md), [AnimationKit.MoveTask](AnimationKit.MoveTask.md)


text:
package org.webcurator.core.report.parameter;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.Errors;
import org.webcurator.ui.util.DateUtils;

/**
 * Parameter representing a Date.

 *

 * The date format is by default set to European format dd/MM/yyyy.
 *
 * @author MDubos
 */
public class DateParameter implements Parameter {

	protected String name;
	protected Date date;
	protected String description;
	protected Boolean optional;

	private SimpleDateFormat dateFormat = DateUtils.get().getDateFormat("core.common.fullDateMask");
	protected Log log = LogFactory.getLog(DateParameter.class);
	protected Date selectedDate;

	protected Date validDate;

	/**
	 * Default constructor
	 */
	public DateParameter(){
	}

	/**
	 * Constructor with full parameters
	 * @param name Name of parameter
	 * @param date Date of parameter
	 * @param description Description
	 * @param optional Is it an optional parameter?
	 */
	public DateParameter(String name, String date, String description, Boolean optional){
		this.name = name;
		this.description = description;
		this.optional = optional;
		setValue(date);
	}

	// A ID counter for allocating unique ID numbers
	private static int inputCt = 0;//TODO still necessary as long as we keep the order of the String parameters???

	/**
	 * Rendering of a Date as a text INPUT
	 */
	public String getInputRendering() throws IOException {
		StringBuffer sb = new StringBuffer();

		String dateInputID = "input_date_" + inputCt++ ;
		//String dateImgID = "input_button_" + inputCt++ ;

		sb.append("<input type=\"text\" name=\"parameters\" id=\"" + dateInputID + "\" value=\"" + getDisplayableSelectedValue() + "\" >");

		// Optional
		if(!optional){
			sb.append(" * ");
		}
		sb.append("" + dateFormat.toPattern() + "");
		if(optional){
			sb.append(" (Optional)");
		}

		return sb.toString();
	}

	public String getType() {
		return this.getClass().getName();
	}

	public Date getValue() {
		return date;
	}

	public void setValue(Object date) {
		if(date instanceof Date){
			this.date = (Date)date;
		}
		else if(date instanceof String){
			try{
				this.date = dateFormat.parse((String)date);
			}catch(Exception ex){
				log.warn("Error in setting date value: " + ex.getMessage());
			}
		}
	}

	/**
	 * Usefull displaying all properties
	 */
	public String toString(){
		return getName() + "|" + getValue() + "|" + getDescription() + "|" + getOptional();
	}

	/** Validation of the parameter */
	public void validate(Errors errors,
			String name, Object value, String description, Boolean optional){

		// Optional
		if( optional.booleanValue() ){
			return;
		}

		// null/blank
		log.debug("validate DateParameter: value=[" + value + "]");//TODO now s String but should be a date when I improve the code
		if( value == null || ((String)value).equals("") ){
			errors.reject("required",
					new Object[]{"The " + description},
					"A mandatory date is missing");
		}

		else{
			try{
				dateFormat.parse((String)value);
			} catch (ParseException e) {
				errors.reject("typeMismatch.java.text.DateFormat",
						new Object[]{description, dateFormat.toPattern()},
						"A date does not have the correct format " + dateFormat.toPattern()
						);;
			}

		}
	}

	/**
	 * @return Returns the dateFormat.
	 */
	public SimpleDateFormat getDateFormat() {
		return this.dateFormat;
	}

	/**
	 * @return Returns the description.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description The description to set.
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return Returns the optional.
	 */
	public Boolean getOptional() {
		return optional;
	}

	/**
	 * @param optional The optional to set.
	 */
	public void setOptional(Boolean optional) {
		this.optional = optional;
	}

	/**
	 * @param value Set the selected value (Date)
	 */
	public void setSelectedValue(Object value){
		validDate = (Date) value;
	}

	/**
	 * @return The selected value
	 */
	public Object getSelectedValue(){
		return validDate;
	}

	/**  Return the getSelectedValue as a
	 * displayable String */
	public String getDisplayableSelectedValue(){
		return (validDate == null ? "" : getDateFormat().format(validDate));
	}

}


text:
import {
  moduleForComponent,
  test
} from 'ember-qunit';

moduleForComponent('md-btn-submit', 'component:md-btn-submit', {
  unit: true
  // specify the other units that are required for this test
  // needs: ['component:foo', 'helper:bar']
});

test('button submit renders', function(assert) {
  assert.expect(2);

  // creates the component instance
  var component = this.subject();
  assert.equal(component._state, 'preRender');

  // appends the component to the page
  this.render();
  assert.equal(component._state, 'inDOM');
});

test('button submit is added to the page', function(assert) {
  this.subject();
  this.render();

  assert.ok($('button').length);
});


text:
/**
 *
 */
package com.netflix.conductor.core.config;

import com.google.inject.AbstractModule;
import com.netflix.conductor.core.events.ActionProcessor;
import com.netflix.conductor.core.events.EventProcessor;
import com.netflix.conductor.core.events.queue.dyno.DynoEventQueueProvider;
import com.netflix.conductor.core.execution.WorkflowSweeper;
import com.netflix.conductor.core.execution.batch.BatchSweeper;
import com.netflix.conductor.core.execution.batch.SherlockBatchProcessor;
import com.netflix.conductor.core.execution.tasks.*;

/**
 * @author Viren
 *
 */
public class CoreModule extends AbstractModule {

	@Override
	protected void configure() {
		bind(DynoEventQueueProvider.class).asEagerSingleton();
		bind(ActionProcessor.class).asEagerSingleton();
		bind(EventProcessor.class).asEagerSingleton();
		bind(WorkflowSweeper.class).asEagerSingleton();
		bind(SystemTaskWorkerCoordinator.class).asEagerSingleton();
		bind(SubWorkflow.class).asEagerSingleton();
		bind(Wait.class).asEagerSingleton();
		bind(Event.class).asEagerSingleton();
		bind(Fail.class).asEagerSingleton();
		bind(Output.class).asEagerSingleton();
		bind(UpdateTask.class).asEagerSingleton();
		bind(SherlockBatchProcessor.class).asEagerSingleton();
		bind(BatchSweeper.class).asEagerSingleton();
		bind(Batch.class).asEagerSingleton();
		bind(Terminate.class).asEagerSingleton();
		bind(Lambda.class).asEagerSingleton();
		bind(GetTaskData.class).asEagerSingleton();
		bind(GetWorkflowData.class).asEagerSingleton();
		bind(GetTaskStatus.class).asEagerSingleton();
		bind(GetWorkflowStatus.class).asEagerSingleton();
		bind(GetConfig.class).asEagerSingleton();
		bind(ErrorLookupTask.class).asEagerSingleton();
		bind(PriorityLookupTask.class).asEagerSingleton();
		bind(SetVariable.class).asEagerSingleton();
	}

}