text:
package com.dataart.spreadsheetanalytics.engine;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.FileInputStream;

import org.junit.BeforeClass;
import org.junit.Test;

import com.dataart.spreadsheetanalytics.api.model.IDataModel;
import com.dataart.spreadsheetanalytics.model.A1Address;

public class DataModelNamedItemsTest {

    static String dataModelPath = "src/test/resources/datamodel/DataModelNamedItems_Test.xlsx";
    static IDataModel dataModel;

    @BeforeClass
    public static void before() throws Exception {
        dataModel = Converters.toDataModel(new FileInputStream(dataModelPath));
    }

    @Test
    public void evaluate_ExcelFileWorkbook_DataModelWithNames() {
        // given
        Double expected_c2_value = 30.0;
        Double expected_c3_value = 7.325;
        Double expected_c4_value = 15.8;
        Double expected_c5_value = 17.1;
        Double expected_e5_value = 6.875;

        // when
        SpreadsheetEvaluator evaluator = new SpreadsheetEvaluator(dataModel);

        Object actual_c2_value = evaluator.evaluate(A1Address.fromA1Address("C2")).getResult().get();
        Object actual_c3_value = evaluator.evaluate(A1Address.fromA1Address("C3")).getResult().get();
        Object actual_c4_value = evaluator.evaluate(A1Address.fromA1Address("C4")).getResult().get();
        Object actual_c5_value = evaluator.evaluate(A1Address.fromA1Address("C5")).getResult().get();
        Object actual_e5_value = evaluator.evaluate(A1Address.fromA1Address("E5")).getResult().get();

        // then

        assertThat(actual_c2_value).isEqualTo(expected_c2_value);
        assertThat(actual_c3_value).isEqualTo(expected_c3_value);
        assertThat(actual_c4_value).isEqualTo(expected_c4_value);
        assertThat(actual_c5_value).isEqualTo(expected_c5_value);
        assertThat(actual_e5_value).isEqualTo(expected_e5_value);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>Barbecued Chicken Tinga</title>
      <categories>
        <cat>None</cat></categories>
      <yield>1</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>tablespoons</unit></amt>
        <item>Fresh lime juice</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>tablespoon</unit></amt>
        <item>Flavorful olive oil</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Garlic salt</item></ing>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Chicken thighs; skinned</item></ing>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Chicken breast halves; skinned</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>tablespoon</unit></amt>
        <item>Oil for sauteing</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>cups</unit></amt>
        <item>Chopped onions</item></ing>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Garlic cloves; minced</item></ing>
      <ing>
        <amt>
          <qty>1/4</qty>
          <unit>pounds</unit></amt>
        <item>Bulk Mexican chorizo sausage</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>pounds</unit></amt>
        <item>Tomatoes; peeled, seeded and chopped</item></ing>
      <ing>
        <amt>
          <qty>1/2</qty>
          <unit>cups</unit></amt>
        <item>Tomato puree (like Pomi)</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>tablespoons</unit></amt>
        <item>Chipotle puree (see note)</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit/></amt>
        <item>Bay leaf</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Dried oregano</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>tablespoon</unit></amt>
        <item>Brown sugar</item></ing>
      <ing>
        <amt>
          <qty>1/2</qty>
          <unit>teaspoons</unit></amt>
        <item>Salt (up to 1)</item></ing>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Red-skinned new potatoes; diced</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit/></amt>
        <item>Avocado; pitted, peeled and sliced</item></ing>
      <ing>
        <amt>
          <qty>Tinga</qty>
          <unit>is</unit></amt>
        <item>wonderful as a warming stew or a filling for burritos, empanadas</item></ing></ingredients>
    <directions>
      <step>  or tortas (Mexican sandwiches). The flavors improve and intensify with
  time, making this the perfect make-ahead dish.

  INSTRUCTIONS: Blend together lime juice, olive oil and garlic salt. Rub on
  chicken pieces. Grill over medium-hot coals or under a medium broiler. Cook
  breasts for about 10 minutes per side; thighs for about 15 minutes per
  side.

  Tip: If you are in a hurry, you can cheat by buying a grilled chicken --
  preferably from a Mexican deli. The chicken will finish cooking in the
  sauce where it will absorb all the delicious flavors. Heat oil in a large
  skillet. Add onions; saute until softened. Add garlic; saute for a minute
  or two longer. Remove onions from pan and reserve. Add chorizo to pan;
  saute until browned. Using paper towels, blot as much fat as possible from
  pan. Return onions to pan. Add tomatoes, then stir in tomato puree,
  chipotle, bay leaf, oregano, brown sugar and salt. Simmer for 20 to 30
  minutes. Cut grilled chicken meat off bones; add to simmering sauce along
  with diced potatoes. Simmer for 15 minutes, until potatoes are tender and
  flavors come together. Serve garnished with avocado slices and lots of warm
  corn tortillas. Note: To make chipotle puree from the softer, freshly
  smoked chipotles, cut chiles open and scrape out seeds. Place 6 chipotles
  in a blender with about 1/4 cup water, or just enough to facilitate
  blending; process until smooth. Serves 4.

  PER SERVING: 580 calories, 50 g protein, 50 g carbohydrate, 22 g fat (4 g
  saturated), 133 mg cholesterol, 1084 mg sodium,
        6 g  fiber. -------

  Posted to CHILE-HEADS DIGEST V4 #134 by Leslie Duncan <duncan@vianet.on.ca>
  on Sep 24, 1997

</step></directions></recipe></recipeml>

redpajama_set_name: RedPajamaGithub


text:
            ${nls.addToLayer}:
            <select data-dojo-type="dijit/form/Select" id="addShapesTargetLayer" name="addShapesTargetLayer"></select>

            <button type="button" id="btnClickPoints" name="btnClickPoints" data-dojo-type="dijit/form/ToggleButton" data-dojo-props="checked: false">${nls.clickPoints}</button>


text:
function C= close3d(A,B, resolution)
%function C= close3d(A,B, resolution)
% function implements 3d binary closing  function for cell array
% First input should be cell array of type int16, uint16, byte
% second should be close3d window size
% the output is a Unsigned cell
% B. T 24/06/08
%morph mex dll operate with
% enum eBinaryOperator
% {
% 	eBinary3dDilate =0
% 	eBinary3dErode=1
% 	eBinary3dOpen=2
% 	eBinary3dClose=3
% 	eBinary3dAreaOpen=4
% 	eBinary3dAreaClose=5
% 	eBinary3dFillHoles=6
% 	eBinary3dGetHoles=7
% 	eBinary3dLabeln=8
% }

% update 27/02/2013
% Copyright 2008-2013 F. Boray Tek.
% All rights reserved.
%
% This file is part of CT class.
%
% CT class is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% CT class is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.

% You should have received a copy of the GNU General Public License
% along with CT class.  If not, see <http://www.gnu.org/licenses/>.

cell_a = iscell(A);
if (nargin < 2)
    help close3d
    return
end

if (nargin == 2)
    resolution = [1.0 1.0 1.0];
end

if (cell_a)
    t= A{1}(1,1);
    if(isscalar(B))
        C = morph_mex_int16(A,resolution(1),resolution(2),resolution(3), B,3);
    else
        error('cell:erode3d','first argument should be a int16,uin16, or byte cell second argument is scalar window size  ');
    end
else
    error('cell:erode3d','first argument should be a int16,uin16, or byte cell');
end


text:
<!doctype html>
<title>fieldset default style</title>

<fieldset id=test></fieldset>


text:
package com.graphhopper.reader.osgb;

import static com.graphhopper.util.GHUtility.count;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;

import org.junit.Test;

import com.graphhopper.routing.util.DefaultEdgeFilter;
import com.graphhopper.storage.GraphHopperStorage;
import com.graphhopper.util.EdgeExplorer;
import com.graphhopper.util.EdgeIterator;

public class OneWayTest extends AbstractOsItnReaderTest{

    @Test
    public void testReadSimpleOneWay() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-simple-oneway.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkSimpleOneWayNetwork(graph, true);
        checkOneWay(graph, true);
    }

    @Test
    public void testReadSimpleOppositeDirectionOneWay() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-simple-oneway-2.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkSimpleOneWayNetwork(graph, false);
        checkOneWay(graph, false);
    }

    /**
     * One Way for everything EXCEPT buses. One way should be present.
     * @throws IOException
     */
    @Test
    public void testOneWayExceptBusesTrue() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-oneway-except-for-buses-true.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkSimpleOneWayNetwork(graph, true);
        checkOneWay(graph, true);
    }

    //BusTrue, MotorVehicle False

    /**
     * One Way for buses but nothing else. No one way should be present.
     * @throws IOException
     */
    @Test
    public void testOneWayExceptBusesFalse() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-oneway-except-for-buses-false.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkForNoOneWayInNetwork(graph);

        //checkOneWay(graph, false);
    }
    /**
     * One Way for everything EXCEPT Motor Vehicles. No one way should be present.
     * @throws IOException
     */
    @Test
    public void testOneWayExceptMotorVehiclesTrue() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-oneway-except-for-motor-vehicles-true.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkForNoOneWayInNetwork(graph);
    }
    /**
     * One Way for Motor Vehicles but nothing else. One way should be present.
     * @throws IOException
     */
    @Test
    public void testOneWayExceptMotorVehiclesFalse() throws IOException {
        boolean turnRestrictionsImport = true;
        boolean is3D = false;
        GraphHopperStorage graph = configureStorage(turnRestrictionsImport, is3D);

        File file = new File("./src/test/resources/com/graphhopper/reader/os-itn-oneway-except-for-motor-vehicles-false.xml");
        readGraphFile(graph, file);

        assertEquals(5, graph.getNodes());
        checkSimpleOneWayNetwork(graph, true);
        checkOneWay(graph, true);
    }

    private void checkOneWay(GraphHopperStorage graph, boolean direction) {
        System.err.println(carEncoder.getClass());
        carAllExplorer = graph.createEdgeExplorer(new DefaultEdgeFilter(carEncoder, true, true));
        EdgeIterator iter = carAllExplorer.setBaseNode(0);
        assertTrue(iter.next());
        evaluateRouting(iter, 4, direction ? false : true, direction ? true : false, false);
        evaluateRouting(iter, 3, true, true, false);
        evaluateRouting(iter, 2, true, true, false);
        evaluateRouting(iter, 1, true, true, true);
    }
   private void checkSimpleOneWayNetwork(GraphHopperStorage graph, boolean direction) {
        EdgeExplorer explorer = graph.createEdgeExplorer(carOutEdges);
        assertEquals(direction ? 3 : 4, count(explorer.setBaseNode(0)));
        assertEquals(1, count(explorer.setBaseNode(1)));
        assertEquals(1, count(explorer.setBaseNode(2)));
        assertEquals(1, count(explorer.setBaseNode(3)));
        assertEquals(direction ? 1 : 0, count(explorer.setBaseNode(4)));
    }
   private void checkForNoOneWayInNetwork(GraphHopperStorage graph) {
       EdgeExplorer explorer = graph.createEdgeExplorer(carOutEdges);
       assertEquals(4, count(explorer.setBaseNode(0)));
       assertEquals(1, count(explorer.setBaseNode(1)));
       assertEquals(1, count(explorer.setBaseNode(2)));
       assertEquals(1, count(explorer.setBaseNode(3)));
       assertEquals(1, count(explorer.setBaseNode(4)));
   }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>twilio.rest.conversations.v1.configuration — twilio-python 7.15.3 documentation</title>
<link href="../../../../../_static/alabaster.css" rel="stylesheet" type="text/css"/>
<link href="../../../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../../../genindex.html" rel="index" title="Index"/>
<link href="../../../../../search.html" rel="search" title="Search"/>
<link href="../../../../../_static/custom.css" rel="stylesheet" type="text/css"/>
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>

Source code for twilio.rest.conversations.v1.configuration

# coding=utf-8
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page
from twilio.rest.conversations.v1.configuration.webhook import WebhookList

[docs]class ConfigurationList(ListResource):

    def __init__(self, version):
        """
        Initialize the ConfigurationList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationList
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationList
        """
        super(ConfigurationList, self).__init__(version)

        # Path Solution
        self._solution = {}

        # Components
        self._webhooks = None

    @property
    def webhooks(self):
        """
        Access the webhooks

        :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookList
        :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookList
        """
        if self._webhooks is None:
            self._webhooks = WebhookList(self._version, )
        return self._webhooks

[docs]    def get(self):
        """
        Constructs a ConfigurationContext

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext
        """
        return ConfigurationContext(self._version, )

    def __call__(self):
        """
        Constructs a ConfigurationContext

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext
        """
        return ConfigurationContext(self._version, )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        return '<Twilio.Conversations.V1.ConfigurationList>'

[docs]class ConfigurationPage(Page):

    def __init__(self, version, response, solution):
        """
        Initialize the ConfigurationPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationPage
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationPage
        """
        super(ConfigurationPage, self).__init__(version, response)

        # Path Solution
        self._solution = solution

[docs]    def get_instance(self, payload):
        """
        Build an instance of ConfigurationInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        return ConfigurationInstance(self._version, payload, )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        return '<Twilio.Conversations.V1.ConfigurationPage>'

[docs]class ConfigurationContext(InstanceContext):

    def __init__(self, version):
        """
        Initialize the ConfigurationContext

        :param Version version: Version that contains the resource

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext
        """
        super(ConfigurationContext, self).__init__(version)

        # Path Solution
        self._solution = {}
        self._uri = '/Configuration'.format(**self._solution)

[docs]    def fetch(self):
        """
        Fetch the ConfigurationInstance

        :returns: The fetched ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        payload = self._version.fetch(method='GET', uri=self._uri, )

        return ConfigurationInstance(self._version, payload, )

[docs]    def update(self, default_chat_service_sid=values.unset,
               default_messaging_service_sid=values.unset,
               default_inactive_timer=values.unset,
               default_closed_timer=values.unset):
        """
        Update the ConfigurationInstance

        :param unicode default_chat_service_sid: The SID of the default Conversation Service that every new conversation will be associated with.
        :param unicode default_messaging_service_sid: The SID of the default Messaging Service that every new conversation will be associated with.
        :param unicode default_inactive_timer: Default ISO8601 duration when conversation will be switched to `inactive` state.
        :param unicode default_closed_timer: Default ISO8601 duration when conversation will be switched to `closed` state.

        :returns: The updated ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        data = values.of({
            'DefaultChatServiceSid': default_chat_service_sid,
            'DefaultMessagingServiceSid': default_messaging_service_sid,
            'DefaultInactiveTimer': default_inactive_timer,
            'DefaultClosedTimer': default_closed_timer,
        })

        payload = self._version.update(method='POST', uri=self._uri, data=data, )

        return ConfigurationInstance(self._version, payload, )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items())
        return '<Twilio.Conversations.V1.ConfigurationContext {}>'.format(context)

[docs]class ConfigurationInstance(InstanceResource):

    def __init__(self, version, payload):
        """
        Initialize the ConfigurationInstance

        :returns: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        super(ConfigurationInstance, self).__init__(version)

        # Marshaled Properties
        self._properties = {
            'account_sid': payload.get('account_sid'),
            'default_chat_service_sid': payload.get('default_chat_service_sid'),
            'default_messaging_service_sid': payload.get('default_messaging_service_sid'),
            'default_inactive_timer': payload.get('default_inactive_timer'),
            'default_closed_timer': payload.get('default_closed_timer'),
            'url': payload.get('url'),
            'links': payload.get('links'),
        }

        # Context
        self._context = None
        self._solution = {}

    @property
    def _proxy(self):
        """
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: ConfigurationContext for this ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext
        """
        if self._context is None:
            self._context = ConfigurationContext(self._version, )
        return self._context

    @property
    def account_sid(self):
        """
        :returns: The SID of the Account responsible for this configuration.
        :rtype: unicode
        """
        return self._properties['account_sid']

    @property
    def default_chat_service_sid(self):
        """
        :returns: The SID of the default Conversation Service that every new conversation is associated with.
        :rtype: unicode
        """
        return self._properties['default_chat_service_sid']

    @property
    def default_messaging_service_sid(self):
        """
        :returns: The SID of the default Messaging Service that every new conversation is associated with.
        :rtype: unicode
        """
        return self._properties['default_messaging_service_sid']

    @property
    def default_inactive_timer(self):
        """
        :returns: Default ISO8601 duration when conversation will be switched to `inactive` state.
        :rtype: unicode
        """
        return self._properties['default_inactive_timer']

    @property
    def default_closed_timer(self):
        """
        :returns: Default ISO8601 duration when conversation will be switched to `closed` state.
        :rtype: unicode
        """
        return self._properties['default_closed_timer']

    @property
    def url(self):
        """
        :returns: An absolute URL for this global configuration.
        :rtype: unicode
        """
        return self._properties['url']

    @property
    def links(self):
        """
        :returns: Absolute URLs to access the webhook and default service configurations.
        :rtype: unicode
        """
        return self._properties['links']

[docs]    def fetch(self):
        """
        Fetch the ConfigurationInstance

        :returns: The fetched ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        return self._proxy.fetch()

[docs]    def update(self, default_chat_service_sid=values.unset,
               default_messaging_service_sid=values.unset,
               default_inactive_timer=values.unset,
               default_closed_timer=values.unset):
        """
        Update the ConfigurationInstance

        :param unicode default_chat_service_sid: The SID of the default Conversation Service that every new conversation will be associated with.
        :param unicode default_messaging_service_sid: The SID of the default Messaging Service that every new conversation will be associated with.
        :param unicode default_inactive_timer: Default ISO8601 duration when conversation will be switched to `inactive` state.
        :param unicode default_closed_timer: Default ISO8601 duration when conversation will be switched to `closed` state.

        :returns: The updated ConfigurationInstance
        :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance
        """
        return self._proxy.update(
            default_chat_service_sid=default_chat_service_sid,
            default_messaging_service_sid=default_messaging_service_sid,
            default_inactive_timer=default_inactive_timer,
            default_closed_timer=default_closed_timer,
        )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items())
        return '<Twilio.Conversations.V1.ConfigurationInstance {}>'.format(context)

About twilio-python

    A Python module for communicating with the Twilio API and generating TwiML.

Useful Links

Twilio's Python Helper Library Docs

twilio @ PyPI

twilio-python @ GitHub

Related Topics

Documentation overview

Module code

twilio.rest

twilio.rest.conversations

twilio.rest.conversations.v1

Quick search

<form action="../../../../../search.html" class="search" method="get">
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>
</form>

      ©2019, Twilio.

      |
      Powered by Sphinx 1.8.0
      & Alabaster 0.7.12


text:
/**
 * Created by 柏然 on 2014/12/12.
 */
Flip.RenderGlobal = RenderGlobal;
function RenderGlobal(opt) {
  if(!(this instanceof RenderGlobal))return new RenderGlobal(opt);
  opt=makeOptions(opt,{defaultTaskName:'default'});
  this._tasks = {};
  this._defaultTaskName=opt.defaultTaskName;
  this._invalid=true;
  this._persistIndies=[];
  this._persistElement = createElement({ tagName: 'style', attributes: { 'data-flip': 'persist' } });
  this._styleElement = createElement({ tagName: 'style', attributes: { 'data-flip': 'frame' } });
}
inherit(RenderGlobal, Flip.util.Object, {
  get defaultTask(){
    var taskName=this._defaultTaskName,t=this._tasks[taskName];
    if(!t)this.add(t=new RenderTask(taskName));
    return t;
  },
  getTask:function(name,createIfNot){
    if(!name)return this.defaultTask;
    var r=this._tasks[name];
    if(!r&&createIfNot) {
      r=new RenderTask(name);
      this.add(r)
    }
    return r;
  },
  add: function (obj) {
    var task, taskName, tasks;
    if (obj instanceof RenderTask) {
      if (!(taskName = obj.name))
        throw Error('task must has a name');
      else if ((tasks=this._tasks).hasOwnProperty(taskName))
        throw Error('contains same name task');
      else if (tasks[taskName]=obj) {
        obj._global=this;
        obj.timeline.start();
        return this.invalid();
      }
    }
    else if (isObj(obj))
      return this.defaultTask.add(obj);
    return false;
  },
  immediate: function (){
    var styleSheet = this._persistElement.sheet,
      reusableIndies = this._persistIndies,
      insertedIndices = [],
      styles = arguments[0] instanceof Array ? arguments[0] : Array.prototype.slice.apply(arguments);
    styles.forEach(function (style){
      var currentIndex;
      if (reusableIndies.length) {
        currentIndex = reusableIndies.pop();
        styleSheet.deleteRule(currentIndex);
      }
      else {
        currentIndex = styleSheet.cssRules.length;
      }
      styleSheet.insertRule(style, currentIndex);
      insertedIndices.push(currentIndex);
    });
    return cancel;
    function cancel(){
      if(styleSheet){
        insertedIndices.forEach(function (currentIndex){
          styleSheet.deleteRule(currentIndex);
          styleSheet.insertRule('*{}', currentIndex);
          reusableIndies.push(currentIndex);
        });
        return !(styleSheet = null);
      }
    }
  },
  refresh:function(){
    this._foreceRender=true;
  },
  init: function () {
    if(typeof window==="object"){
      var head=document.head;
      if(!this._styleElement.parentNode){
        head.appendChild(this._styleElement);
        head.appendChild(this._persistElement);
      }
      Flip.fallback(window);
      //window.addEventListener('resize',function(){self.refresh()});
      this.loop();
    }
    this.init = function () {
      console.warn('The settings have been initiated,do not init twice');
    };
  },
  invalid:function(){
    return this._invalid=true;
  },
  loop: function (element) {
    loopGlobal(this);
    window.requestAnimationFrame(this.loop.bind(this), element||window.document.body);
  },
  createRenderState: function () {
    return {
      global: this,
      task: null,
      styleStack: [],
      forceRender: this._foreceRender,
      transformMap: {}
    }
  },
  css:function(selector,rule){
    return setDefaultImmediateStyle(this,'css',selector,rule)
  },
  transform:function(selector,rule){
    return setDefaultImmediateStyle(this,'transform',selector,rule)
  }
});
FlipScope.global = new RenderGlobal();
function setDefaultImmediateStyle(renderGlobal,property,selector,rule){
  var _cancel, ani = { _cssHandlerMap: {}, _matHandlerMap: {}, selector: isStr(selector) ? selector : '' };
  Animation.prototype[property].apply(ani,[selector,rule]);
  Flip(function () {
    var styles;
    if (property == 'css') {
      styles = renderAnimationCssProxies(ani).map(combineStyleText);
    }
    else if (property == 'transform') {
      var cache = {};
      styles = [];
      renderAnimationTransform(ani, cache);
      objForEach(cache, function (mat, selector){
        var cssProxy = new CssProxy();
        cssProxy.$withPrefix('transform', mat + '');
        styles.push(cssProxy.$styleText(selector))
      })
    }
    else {
      throw Error('invalid property:' + property);
    }
    _cancel = renderGlobal.immediate.apply(renderGlobal, styles);
  });
  return cancel;
  function cancel(){
    if(_cancel){
      ani=null;
      return _cancel();
    }
  }
}


text:
yoda_bot
========

Yoda Groupme bot


text:
package greenmoonsoftware.es.samples.docs.events;

import greenmoonsoftware.es.event.AbstractEvent;

import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public final class TextSelectionChangedEvent extends AbstractEvent {
    private final Set<Range> ranges = new HashSet<>();

    public TextSelectionChangedEvent(String aggregateId) {
        super(aggregateId, "selection-changed");
    }

    public Set<Range> getRanges() {
        return Collections.unmodifiableSet(ranges);
    }

    public TextSelectionChangedEvent addRange(int start, int end) {
        ranges.add(new Range(start, end));
        return this;
    }

    public static class Range implements Serializable {
        public final int start;
        public final int end;

        public Range(int start, int end) {
            this.start = start;
            this.end = end;
        }
    }
}


text:
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>

#import "BBABookmarkService.h"
#import "BBAConnection.h"
#import "BBANetworkConfiguration.h"

#import "BBAUserDetails.h"
#import "BBALibraryItem.h"
#import "BBALibraryItem.h"
#import "BBABookmarkItem.h"
#import "BBAAPIErrors.h"

#import "BBAConnectionTestsMocks.h"
#import "BBAMockConnection.h"
#import "BBATestHelper.h"

#import <OHHTTPStubs/OHHTTPStubs.h>
#import <OCMock/OCMock.h>
@interface BBABookmarkService (Testing)
@property (nonatomic, strong) Class connectionClass;
@end

@interface BBABookmarkServiceTests : XCTestCase{
    BBABookmarkService *service;
}

@end

@implementation BBABookmarkServiceTests

- (void)setUp {
    [super setUp];
    id mockAuthenticator = [BBAMockAuthenticator new];
    [[BBANetworkConfiguration defaultConfiguration] setSharedAuthenticator:mockAuthenticator];
    service = [BBABookmarkService new];
}

- (void)tearDown {
    service = nil;
    [OHHTTPStubs removeAllStubs];
    [[BBAMockConnection mockedConnections] removeAllObjects];
    [super tearDown];
}

#pragma mark - Get Multiple Bookmarks Tests

- (void) testGetBookmarkChangesThrowsForNilCompletion{
    XCTAssertThrows([service getBookmarkChangesForItem:[BBALibraryItem new]
                                             afterDate:[NSDate new]
                                             typesMask:BBABookmarkTypeAll
                                                  user:[BBAUserDetails new]
                                            completion:nil]);
}

- (void) testGetBookmarksSetsDateParameterWhenPassedDateIsNonNil{

    [service setConnectionClass:[BBAMockConnection class]];
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:0];
    NSString *expectedDate = @"1970-01-01T00:00:00Z";
    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:date
                             typesMask:BBABookmarkTypeAll
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    id passedDateParmater;
    passedDateParmater = [mockedConnection passedParameters][@"lastSyncDateTime"];

    XCTAssertEqualObjects(passedDateParmater, expectedDate);
}

- (void) testGetBookmarksDoesNotSetDateParameterWhenPassedDateIsNil{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:nil
                             typesMask:BBABookmarkTypeAll
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSDate *passedDateParmater;
    passedDateParmater = [mockedConnection passedParameters][@"lastSyncDateTime"];

    XCTAssertNil(passedDateParmater);
}

- (void) testGetBookmarksSetsCorrectBookmarkTypeParametersForBookmarkTypeBitmaskBookmarkTypeAll{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:nil
                             typesMask:BBABookmarkTypeAll
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    id passedBookmarkTypeParamater;
    passedBookmarkTypeParamater = [mockedConnection passedArrayParameters][@"bookmarkType"];
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"BOOKMARK"]);
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"HIGLIGHT"]);
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"LAST_READ_POSITION"]);
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"CROSS_REFERENCE"]);
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"NOTE"]);
}

- (void) testGetBookmarksSetsCorrectBookmarkTypeParametersForBookmarkTypeBitmaskBookmarkTypeBookmark{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:nil
                             typesMask:BBABookmarkTypeBookmark
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookmarkTypeParamater;
    passedBookmarkTypeParamater = [mockedConnection passedArrayParameters][@"bookmarkType"];
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"BOOKMARK"]);
    XCTAssertEqual(passedBookmarkTypeParamater.count, 1);
}

- (void) testGetBookmarksSetsCorrectBookmarkTypeParametersForBookmarkTypeBitmaskBookmarkTypeHighlight{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:nil
                             typesMask:BBABookmarkTypeHighlight
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookmarkTypeParamater;
    passedBookmarkTypeParamater = [mockedConnection passedArrayParameters][@"bookmarkType"];
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"HIGHLIGHT"]);
    XCTAssertEqual(passedBookmarkTypeParamater.count, 1);
}

- (void) testGetBookmarksSetsCorrectBookmarkTypeParametersForBookmarkTypeBitmaskBookmarkTypeHighlightAndBookmark{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:[BBALibraryItem new]
                             afterDate:nil
                             typesMask:BBABookmarkTypeHighlight | BBABookmarkTypeBookmark
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookmarkTypeParamater;
    passedBookmarkTypeParamater = [mockedConnection passedArrayParameters][@"bookmarkType"];
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"HIGHLIGHT"]);
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"BOOKMARK"]);
    XCTAssertEqual(passedBookmarkTypeParamater.count, 2);
}

- (void) testGetBookmarksDoesNotSetBookParameterForNilLibraryItem{
    [service setConnectionClass:[BBAMockConnection class]];

    [service getBookmarkChangesForItem:nil
                             afterDate:nil
                             typesMask:BBABookmarkTypeHighlight | BBABookmarkTypeBookmark
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookParamater;
    passedBookParamater = [mockedConnection passedArrayParameters][@"book"];
    XCTAssertNil(passedBookParamater);

}

- (void) testGetBookmarksSetsCorrectBookParameterForSpecifiedLibraryItem{
    [service setConnectionClass:[BBAMockConnection class]];

    BBALibraryItem *libraryItem;
    libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service getBookmarkChangesForItem:libraryItem
                             afterDate:nil
                             typesMask:BBABookmarkTypeHighlight | BBABookmarkTypeBookmark
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {

                            }];

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookParamater;
    passedBookParamater = [mockedConnection passedParameters][@"book"];
    XCTAssertEqualObjects(@"isbn", passedBookParamater);
}

- (void) testGetBookmarksReturnsBookmarkListGivenSuccessfulFetch{
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:200
                      responseFromFile:@"get_my_bookmarks_success.json"];

    BBA_PREPARE_ASYNC_TEST();
    BBALibraryItem *libraryItem;
    libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service getBookmarkChangesForItem:libraryItem
                             afterDate:nil
                             typesMask:BBABookmarkTypeHighlight | BBABookmarkTypeBookmark
                                  user:[BBAUserDetails new]
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {
                                XCTAssertEqual(bookmarkChanges.count, 1);
                                XCTAssertNil(error);
                                XCTAssertNotNil(syncDate);
                                BBA_FLAG_ASYNC_TEST_COMPLETE();
                            }];

    BBA_WAIT_FOR_ASYNC_TEST();
}

- (void) testGetBookmarksReturnsErrorGivenInternalServiceError{
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:500
                      responseFromFile:nil];
    BBA_PREPARE_ASYNC_TEST();

    BBALibraryItem *item = [BBALibraryItem new];
    BBAUserDetails *user = [BBAUserDetails new];
    [service getBookmarkChangesForItem:item
                             afterDate:nil
                             typesMask:BBABookmarkTypeAll
                                  user:user
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {
                                BBA_FLAG_ASYNC_TEST_COMPLETE();
                                XCTAssertNil(bookmarkChanges);
                                XCTAssertNil(syncDate);
                                XCTAssertEqual(error.code, BBAAPIServerError);
                            }];

    BBA_WAIT_FOR_ASYNC_TEST();

}

- (void) testGetBookmarksReturnsErrorGivenBadRequest{
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:400
                      responseFromFile:nil];
    BBA_PREPARE_ASYNC_TEST();

    BBALibraryItem *item = [BBALibraryItem new];
    BBAUserDetails *user = [BBAUserDetails new];
    [service getBookmarkChangesForItem:item
                             afterDate:nil
                             typesMask:BBABookmarkTypeAll
                                  user:user
                            completion:^(NSArray *bookmarkChanges, NSDate *syncDate, NSError *error) {
                                BBA_FLAG_ASYNC_TEST_COMPLETE();
                                XCTAssertNil(bookmarkChanges);
                                XCTAssertNil(syncDate);
                                XCTAssertEqual(error.code, BBAAPIErrorBadRequest);
                            }];

    BBA_WAIT_FOR_ASYNC_TEST();
}

#pragma mark - Delete Multiple Bookmarks Tests

- (void) testDeleteBookmarksForItemThrowsWithNilUser{
    XCTAssertThrows([service deleteBookmarksForItem:[BBALibraryItem new]
                                          typesMask:BBABookmarkTypeAll
                                               user:nil
                                         completion:^(BOOL success, NSError *error) {

                                         }]);
}

- (void) testDeleteBookmarksForItemThrowsWithNilItem{
    XCTAssertThrows([service deleteBookmarksForItem:nil
                                          typesMask:BBABookmarkTypeAll
                                               user:[BBAUserDetails new]
                                         completion:^(BOOL success, NSError *error) {

                                         }]);
}

- (void) testDeleteBookmarksForItemThrowsWithNilCompletion{
    XCTAssertThrows([service deleteBookmarksForItem:[BBALibraryItem new]
                                          typesMask:BBABookmarkTypeAll
                                               user:[BBAUserDetails new]
                                         completion:nil]);
}

- (void) testDeleteBookmarksSetsCorrectBookmarkTypeParametersForBookmarkTypeBitmaskBookmarkTypeHighlight{
    [service setConnectionClass:[BBAMockConnection class]];

    BBALibraryItem *item = [BBALibraryItem new];
    item.isbn = @"isbn";
    [service deleteBookmarksForItem:item
                          typesMask:BBABookmarkTypeBookmark
                               user:[BBAUserDetails new]
                         completion:^(BOOL success, NSError *error) {

                         }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookmarkTypeParamater;
    passedBookmarkTypeParamater = [mockedConnection passedArrayParameters][@"bookmarkType"];
    XCTAssertTrue([passedBookmarkTypeParamater containsObject:@"BOOKMARK"]);
    XCTAssertEqual(passedBookmarkTypeParamater.count, 1);
}

- (void) testDeleteBookmarksSetsCorrectBookParamater{
    [service setConnectionClass:[BBAMockConnection class]];

    BBALibraryItem *item = [BBALibraryItem new];
    item.isbn = @"isbn";
    [service deleteBookmarksForItem:item
                          typesMask:BBABookmarkTypeBookmark
                               user:[BBAUserDetails new]
                         completion:^(BOOL success, NSError *error) {

                         }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);

    BBAMockConnection *mockedConnection;
    mockedConnection = [[BBAMockConnection mockedConnections]firstObject];

    NSArray *passedBookParamater;
    passedBookParamater = [mockedConnection passedParameters][@"book"];

    XCTAssertEqualObjects(passedBookParamater, @"isbn");
}

- (void) testDeleteBookmarksReturnsSuccessWithSuccessfulResponse{
    [self assertDeleteBookmarksSucceeds:YES
                          withErrorCode:0
                         withStatusCode:204
                       responseFromFile:@"delete_bookmarks_success.json"];
}

- (void) testDeleteBookmarksReturnsErrorWithBookmarkNotFoundResponse{
    [self assertDeleteBookmarksSucceeds:NO
                          withErrorCode:BBAAPIErrorNotFound
                         withStatusCode:200
                       responseFromFile:nil];
}

- (void) testDeleteBookmarksReturnsErrorWithForbiddenResponse{
    [self assertDeleteBookmarksSucceeds:NO
                          withErrorCode:BBAAPIErrorForbidden
                         withStatusCode:403
                       responseFromFile:nil];
}

- (void) testDeleteBookmarksReturnsErrorWithBadRequestResponse{
    [self assertDeleteBookmarksSucceeds:NO
                          withErrorCode:BBAAPIErrorBadRequest
                         withStatusCode:400
                       responseFromFile:nil];
}

- (void) testDeleteBookmarksReturnsErrorWithServiceErrorResponse{
    [self assertDeleteBookmarksSucceeds:NO
                          withErrorCode:BBAAPIServerError
                         withStatusCode:500
                       responseFromFile:nil];
}

#pragma mark - Delete Single Bookmark Tests

- (void) testDeleteBookmarkThrowsWithNilBookmarkItem{
    XCTAssertThrows([service deleteBookmark:nil
                                       user:[BBAUserDetails new]
                                 completion:^(BOOL success, NSError *error) {

                                 }]);

}

- (void) testDeleteBookmarkThrowsWithNilCompletion{
    XCTAssertThrows([service deleteBookmark:[BBABookmarkItem new]
                                       user:[BBAUserDetails new]
                                 completion:nil]);

}

- (void) testDeleteBookmarkCreatesConnectionWithItemIdentifierInURL{
    BBABookmarkItem *item = [BBABookmarkItem new];
    item.identifier = @"1";
    [service setConnectionClass:[BBAMockConnection class]];

    [service deleteBookmark:item
                       user:[BBAUserDetails new]
                 completion:^(BOOL success, NSError *error) {

                 }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);
    BBAMockConnection *mockedConnection = [BBAMockConnection mockedConnections][0];
    NSString *expectedPath = [NSString stringWithFormat:@"/service/my/bookmarks/%@", item.identifier];
    XCTAssertEqualObjects([mockedConnection.URL path], expectedPath);
}

- (void) testDeleteBookmarkReturnsSuccessGivenSuccessResponse{
    [self assertDeleteBookmarkSucceeds:YES
                         withErrorCode:0
                        withStatusCode:204
                      responseFromFile:nil];
}

- (void) testDeleteBookmarkReturnsErrorGiveNotFoundResponse{
    [self assertDeleteBookmarkSucceeds:NO
                         withErrorCode:BBAAPIErrorNotFound
                        withStatusCode:404
                      responseFromFile:nil];
}

- (void) testDeleteBookmarkReturnsErrorGivenForbiddenResponse{
    [self assertDeleteBookmarkSucceeds:NO
                         withErrorCode:BBAAPIErrorForbidden
                        withStatusCode:403
                      responseFromFile:nil];
}

- (void) testDeleteBookmarkReturnsErrorGivenServerErrorResponse{
    [self assertDeleteBookmarkSucceeds:NO
                         withErrorCode:BBAAPIServerError
                        withStatusCode:500
                      responseFromFile:nil];
}

#pragma mark - Create Bookmark Tests

- (void) testCreateBookmarkThrowsWithNilBookmark{
    XCTAssertThrows([service addBookMark:nil
                                 forItem:[BBALibraryItem new]
                                    user:[BBAUserDetails new]
                              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {

                              }]);
}

- (void) testCreateBookmarkThrowsWithNilItem{
    XCTAssertThrows([service addBookMark:[BBABookmarkItem new]
                                 forItem:nil
                                    user:[BBAUserDetails new]
                              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {

                              }]);
}

- (void) testCreateBookmarkThrowsWithNilUser{
    XCTAssertThrows([service addBookMark:[BBABookmarkItem new]
                                 forItem:[BBALibraryItem new]
                                    user:nil
                              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {

                              }]);
}

- (void) testCreateBookmarkThrowsWithNilCompletion{
    XCTAssertThrows([service addBookMark:[BBABookmarkItem new]
                                 forItem:[BBALibraryItem new]
                                    user:[BBAUserDetails new]
                              completion:nil]);
}

- (void) testCreateBookmarkSetsBookmarkParamater{
    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;

    BBALibraryItem *libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service setConnectionClass:[BBAMockConnection class]];

    [service addBookMark:bookmarkItem
                 forItem:libraryItem
                    user:[BBAUserDetails new]
              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {

              }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);
    BBAMockConnection *mockedConnection = [BBAMockConnection mockedConnections][0];
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"book"], bookmarkItem.book);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"bookmarkType"], bookmarkItem.bookmarkType);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"position"], bookmarkItem.position);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"readingPercentage"], [bookmarkItem.readingPercentage stringValue]);
}

- (void) testCreateBookmarkReturnsBookmarkForSuccessfulResponse{
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:201
                      responseFromFile:@"create_bookmark_success.json"];

    BBA_PREPARE_ASYNC_TEST();

    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;

    BBALibraryItem *libraryItem;
    libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service addBookMark:bookmarkItem
                 forItem:libraryItem
                    user:[BBAUserDetails new]
              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"

                  XCTAssertEqualObjects(bookmarkItem.type, @"urn:blinkboxbooks:schema:bookmark");
                  XCTAssertEqualObjects(bookmarkItem.guid, @"urn:blinkboxbooks:id:bookmark:238630");
                  XCTAssertEqualObjects(bookmarkItem.identifier, @"238630");
                  XCTAssertEqualObjects(bookmarkItem.bookmarkType, @"LAST_READ_POSITION");
                  XCTAssertEqualObjects(bookmarkItem.book, @"9781615930005");
                  XCTAssertEqualObjects(bookmarkItem.position, @"epubcfi(/6/18!/4/44/7:24)");
                  XCTAssertEqualObjects(bookmarkItem.readingPercentage, @79);
                  XCTAssertEqualObjects(bookmarkItem.deleted, @0);
                  XCTAssertNil(error);
#pragma clang diagnostic pop
                  BBA_FLAG_ASYNC_TEST_COMPLETE();
              }];

    BBA_WAIT_FOR_ASYNC_TEST();
}

- (void) testCreateBookmarkReturnsErrorForForbiddenResponse{
    [self assertCreateBookmarkFailsWithErrorCode:BBAAPIErrorForbidden
                                  withStatusCode:403
                                responseFromFile:nil];
}

- (void) testCreateBookmarkReturnsErrorForConflictResponse{
    [self assertCreateBookmarkFailsWithErrorCode:BBAAPIErrorConflict
                                  withStatusCode:409
                                responseFromFile:nil];
}

- (void) testCreateBookmarkReturnsErrorForBadRequestResponse{
    [self assertCreateBookmarkFailsWithErrorCode:BBAAPIErrorBadRequest
                                  withStatusCode:400
                                responseFromFile:nil];
}

- (void) testCreateBookmarkReturnsErrorForServerErrorResponse{
    [self assertCreateBookmarkFailsWithErrorCode:BBAAPIServerError
                                  withStatusCode:500
                                responseFromFile:nil];
}

#pragma mark - Update Bookmark Tests

- (void) testUpdateBookmarkThrowsWithNilItem{
    XCTAssertThrows([service updateBookMark:nil
                                       user:[BBAUserDetails new]
                                 completion:^(BOOL success, NSError *error) {

                                 }]);
}

- (void) testUpdateBookmarkThrowsWithNilUser{
    XCTAssertThrows([service updateBookMark:[BBABookmarkItem new]
                                       user:nil
                                 completion:^(BOOL success, NSError *error) {

                                 }]);
}

- (void) testUpdateBookmarkThrowsWithNilCompletion{
    XCTAssertThrows([service updateBookMark:[BBABookmarkItem new]
                                       user:[BBAUserDetails new]
                                 completion:nil]);
}

- (void) testUpdateBookmarkSetsBookmarkParamater{
    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;
    bookmarkItem.identifier = @"1";

    BBALibraryItem *libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service setConnectionClass:[BBAMockConnection class]];

    [service updateBookMark:bookmarkItem
                       user:[BBAUserDetails new]
                 completion:^(BOOL success, NSError *error) {

                 }];

    XCTAssertEqual([BBAMockConnection mockedConnections].count, 1);
    BBAMockConnection *mockedConnection = [BBAMockConnection mockedConnections][0];
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"book"], bookmarkItem.book);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"bookmarkType"], bookmarkItem.bookmarkType);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"position"], bookmarkItem.position);
    XCTAssertEqualObjects(mockedConnection.passedParameters[@"readingPercentage"], [bookmarkItem.readingPercentage stringValue]);
}

- (void) testUpdateBookmarkReturnsBookmarkItemWithSuccesfulResponse{
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks/1"
                        withStatusCode:200
                      responseFromFile:@"update_bookmark_success.json"];

    BBA_PREPARE_ASYNC_TEST();

    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;
    bookmarkItem.identifier = @"1";

    BBALibraryItem *libraryItem;
    libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    [service updateBookMark:bookmarkItem
                       user:[BBAUserDetails new]
                 completion:^(BOOL success, NSError *error) {
                     XCTAssertTrue(success);
                     XCTAssertNil(error);
                     BBA_FLAG_ASYNC_TEST_COMPLETE();
                 }];

    BBA_WAIT_FOR_ASYNC_TEST();
}

- (void) testUpdateBookmarkReturnsErrorWithBadRequestResponse{
    [self assertUpdateBookmarkFailsWithErrorCode:BBAAPIErrorBadRequest
                                  withStatusCode:400
                                responseFromFile:nil];
}

- (void) testUpdateBookmarkReturnsErrorWithForbiddenResponse{
    [self assertUpdateBookmarkFailsWithErrorCode:BBAAPIErrorForbidden
                                  withStatusCode:403
                                responseFromFile:nil];
}

- (void) testUpdateBookmarkReturnsErrorWithNotFoundResponse{
    [self assertUpdateBookmarkFailsWithErrorCode:BBAAPIErrorNotFound
                                  withStatusCode:404
                                responseFromFile:nil];
}

- (void) testUpdateBookmarkReturnsErrorWithServerErrorResponse{
    [self assertUpdateBookmarkFailsWithErrorCode:BBAAPIServerError
                                  withStatusCode:500
                                responseFromFile:nil];
}

#pragma mark - Test Helpers

- (void) assertUpdateBookmarkFailsWithErrorCode:(NSInteger)errorCode
                                 withStatusCode:(int)statusCode
                               responseFromFile:(NSString *)responseFile{

    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.identifier = @"1";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks/1"
                        withStatusCode:statusCode
                      responseFromFile:responseFile];

    BBA_PREPARE_ASYNC_TEST();
    [service updateBookMark:bookmarkItem
                       user:[BBAUserDetails new]
                 completion:^(BOOL success, NSError *error) {
                     XCTAssertFalse(success);
                     XCTAssertEqual(error.code, errorCode);
                     BBA_FLAG_ASYNC_TEST_COMPLETE();
                 }];

    BBA_WAIT_FOR_ASYNC_TEST();

}

- (void) assertCreateBookmarkFailsWithErrorCode:(NSInteger)errorCode
                                 withStatusCode:(int)statusCode
                               responseFromFile:(NSString *)responseFile{
    BBALibraryItem *libraryItem = [BBALibraryItem new];
    libraryItem.isbn = @"isbn";

    BBABookmarkItem *bookmarkItem = [BBABookmarkItem new];
    bookmarkItem.book = @"isbn";
    bookmarkItem.bookmarkType = @"HIGHLIGHT";
    bookmarkItem.position = @"a cfi";
    bookmarkItem.readingPercentage = @99;
    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:statusCode
                      responseFromFile:responseFile];

    BBA_PREPARE_ASYNC_TEST();
    [service addBookMark:bookmarkItem
                 forItem:libraryItem
                    user:[BBAUserDetails new]
              completion:^(BBABookmarkItem *bookmarkItem, NSError *error) {
                  BBA_FLAG_ASYNC_TEST_COMPLETE();
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"

                  XCTAssertNil(bookmarkItem);
                  XCTAssertEqual(error.code, errorCode);
#pragma clang diagnostic pop
              }];
    BBA_WAIT_FOR_ASYNC_TEST();

}

- (void) assertDeleteBookmarksSucceeds:(BOOL)shouldSucceed
                         withErrorCode:(NSInteger)errorCode
                        withStatusCode:(int)statusCode
                      responseFromFile:(NSString *)responseFile{

    BBALibraryItem *item = [BBALibraryItem new];
    item.isbn = @"isbn";

    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:statusCode
                      responseFromFile:responseFile];

    BBA_PREPARE_ASYNC_TEST();
    [service deleteBookmarksForItem:item
                          typesMask:BBABookmarkTypeAll
                               user:[BBAUserDetails new]
                         completion:^(BOOL success, NSError *error) {
                             BBA_FLAG_ASYNC_TEST_COMPLETE();
                             XCTAssertEqual(success, shouldSucceed);
                             XCTAssertEqual(error.code, errorCode);
                         }];
    BBA_WAIT_FOR_ASYNC_TEST();
}

- (void) assertDeleteBookmarkSucceeds:(BOOL)shouldSucceed
                        withErrorCode:(NSInteger)errorCode
                       withStatusCode:(int)statusCode
                     responseFromFile:(NSString *)responseFile{

    BBABookmarkItem *item = [BBABookmarkItem new];
    item.identifier = @"1";

    [self stubBookmarkRequestsEndpoint:@"/my/bookmarks"
                        withStatusCode:statusCode
                      responseFromFile:responseFile];

    BBA_PREPARE_ASYNC_TEST();
    [service deleteBookmark:item
                       user:[BBAUserDetails new]
                 completion:^(BOOL success, NSError *error) {
                     BBA_FLAG_ASYNC_TEST_COMPLETE();
                     XCTAssertEqual(success, shouldSucceed);
                     XCTAssertEqual(error.code, errorCode);
                 }];
    BBA_WAIT_FOR_ASYNC_TEST();
}

- (void) stubBookmarkRequestsEndpoint:(NSString *)endpoint
                       withStatusCode:(int)statusCode
                     responseFromFile:(NSString *)responseFile{

    [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
        BOOL shouldStub = ([request.URL.path rangeOfString:endpoint].location != NSNotFound);
        return shouldStub;
    } withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) {
        if (responseFile) {
            NSString* fixture = OHPathForFileInBundle(responseFile,nil);
            return [OHHTTPStubsResponse responseWithFileAtPath:fixture
                                                    statusCode:statusCode
                                                       headers:@{@"Content-Type":@"application/json"}];
        }
        else {
            return [OHHTTPStubsResponse responseWithData:nil
                                              statusCode:statusCode
                                                 headers:@{@"Content-Type":@"application/json"}];
        }

    }];
}

@end


text:
<?php

namespace Oneup\SecurityAdvisory\Check;

use Oneup\SecurityAdvisory\Audit\AuditRunner;

class SecurityCheck extends \Backend implements \executable
{
    protected $auditCache;

    public function __construct()
    {
        parent::__construct();
    }

    public function run()
    {
        $objTemplate = new \BackendTemplate('be_security_check');

        $auditRunner = new AuditRunner();
        $auditRunner->addLockFile(TL_ROOT.'/composer/composer.lock');

        if (file_exists(TL_ROOT.'/composer.lock')) {
            $auditRunner->addLockFile(TL_ROOT.'/composer.lock');
        }

        // Init Audit.
        $audit = null;

        if ($auditRunner->hasRunOnce()) {
            $audit = $auditRunner->getCachedAudit();
        }

        if (\Input::post('run') != '') {
            // Perform an actual check against the web service and cache the result afterwards
            $audit = $auditRunner->run();
        }

        if (null !== $audit) {
            $objTemplate->isVulnerable = $audit->isVulnerable();
            $objTemplate->vulnerabilities = $audit->getVulnerabilities();
        }

        $objTemplate->hasRunOnce = $auditRunner->hasRunOnce();

        if ($auditRunner->hasRunOnce()) {
            $objTemplate->lastChecked = \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $auditRunner->getCacheLastModified());
        }

        // Language strings
        $objTemplate->headline = $GLOBALS['TL_LANG']['tl_security_advisory']['headline'];
        $objTemplate->disclaimer = $GLOBALS['TL_LANG']['tl_security_advisory']['disclaimer'];
        $objTemplate->runSecurityCheck = $GLOBALS['TL_LANG']['tl_security_advisory']['runSecurityCheck'];
        $objTemplate->auditOk = $GLOBALS['TL_LANG']['tl_security_advisory']['auditOk'];
        $objTemplate->noAuditFound = $GLOBALS['TL_LANG']['tl_security_advisory']['auditNotFound'];
        $objTemplate->auditFailed = $GLOBALS['TL_LANG']['tl_security_advisory']['auditFailed'];
        $objTemplate->lastCheckedLabel = $GLOBALS['TL_LANG']['tl_security_advisory']['lastCheckedLabel'];
        $objTemplate->requestToken = \RequestToken::get();
        $objTemplate->didNeverAnAudit = $GLOBALS['TL_LANG']['tl_security_advisory']['didNeverAnAudit'];

        return $objTemplate->parse();
    }

    public function isActive()
    {
        return false;
    }
}


text:
import * as React from 'react';
import Box from '@material-ui/core/Box';
import Slider from '@material-ui/core/Slider';

const marks = [
  {
    value: 0,
    label: '0°C',
  },
  {
    value: 20,
    label: '20°C',
  },
  {
    value: 37,
    label: '37°C',
  },
  {
    value: 100,
    label: '100°C',
  },
];

function valuetext(value: number) {
  return `${value}°C`;
}

function valueLabelFormat(value: number) {
  return marks.findIndex((mark) => mark.value === value) + 1;
}

export default function DiscreteSliderValues() {
  return (
    <Box sx={{ width: 300 }}>
      <Slider
        aria-label="Restricted values"
        defaultValue={20}
        valueLabelFormat={valueLabelFormat}
        getAriaValueText={valuetext}
        step={null}
        valueLabelDisplay="auto"
        marks={marks}
      />
    </Box>
  );
}


text: export { default } from './AdminPanel';


text:
from messenger import Skype, FacebookMessenger
from telegram import Updater
import keyring
import utils
import trollius
from trollius import From
import functools
import sys
from datetime import datetime
import web
import json
# conver unicode object to string
import unicodedata
# unicodedata.normalize('NFKD', string)

cfg = utils.parseConfig()
if cfg == False:
    print("Please check your config file, normally it is config.yml")
    sys.exit(0)

#unlock keyring
username = keyring.get_password('messagesReceiver', 'skypeUsernameKhanhpro')

def pushNotication(messenger, receiver, content, sender=None):
    if messenger == "Skype":
        ## get data from keyring
        username = keyring.get_password('messagesReceiver', 'skypeUsernameKhanhpro')
        password = keyring.get_password('messagesReceiver', 'skypePasswordKhanhpro')
        prefix = "%s_" % username
        token = keyring.get_password('messagesReceiver', prefix + 'skypeToken')
        registrationToken = keyring.get_password('messagesReceiver', prefix + 'skypeRegistrationToken')

        s = Skype(username, password, token, registrationToken)
        conversationsURL = receiver
        s.post(conversationsURL, content)

    if messenger == "FM":
        facebookMessengerCookies = keyring.get_password('messagesReceiver', 'facebookMessengerCookies')
        FMusername = keyring.get_password('messagesReceiver', 'FMusername')
        FMpassword = keyring.get_password('messagesReceiver', 'FMpassword')
        FMToken = keyring.get_password('messagesReceiver', 'FacebookMessengerToken')

        fm = FacebookMessenger(FMusername, FMpassword, FMToken, facebookMessengerCookies)

        conversationsURL = receiver
        if receiver == cfg.get("FM").get("khanhpro"):
            job = fm.post(conversationsURL, content, direct=True)
        else:
            job = fm.post(conversationsURL, content, direct=False)
        if job == 404:
            fm.reset()
            fm.login()
        return job

    if messenger == "Telegram":
        #get bot name
        botname = cfg.get(messenger).get("botname")
        #get token from keyring
        botToken = keyring.get_password('telegram', botname)
        updater = Updater(token = botToken)
        updater.bot.sendMessage(chat_id=receiver, text=content)

urls = (
    '/push', 'pushNoti',
    '/redmine', 'redmine',
    '/redmine/v2', 'redminev2'
)

app = web.application(urls, globals())

class pushNoti:
    def POST(self):
        messenger = web.input().messenger
        content = web.input().content
        receiver = web.input().receiver
        if messenger == "" or content == "" or receiver == "":
            return "nothing"
        content = utils.cleanStr(content)
        content = content.encode('utf-8')
        if receiver != None and messenger != None and content != None:
            for mesg in messenger.split(' '):
                receiver_id = cfg.get(mesg).get(receiver)
                #print receiver_id
                pushNotication(mesg, receiver_id, content)

class redmine:
    def POST(self):
        web.input()
        data = json.loads(web.ctx.data)
        payload = data.get("payload")
        action = payload.get("action")
        journal = payload.get("journal")
        private_notes = False
        if journal != None:
            notes = journal.get("notes")
            private_notes = journal.get("private_notes")
            updated_author = journal.get("author")
            updated_name = "%s %s" % (updated_author.get("firstname"), updated_author.get("lastname"))
        else:
            notes = ""
            updated_name = ""
        issue = payload.get("issue")
        subject = issue.get("subject")
        description = issue.get("description")
        author = issue.get("author")
        assignee = issue.get("assignee")
        is_private_issue = issue.get("is_private")
        if is_private_issue:
            subject = u"Nội dung nhạy cảm..."
            private_notes = True
        status = issue.get("status").get("name")
        if notes == "":
            notes = u"Status: %s" % status
        if private_notes:
            notes = u"Vào issue để xem update gì nhé :D"
        if assignee != None:
            assignee_name = "%s %s" % (assignee.get("firstname"), assignee.get("lastname"))
        else:
            assignee_name = "nobody"
        author_name = "%s %s" % (author.get("firstname"), author.get("lastname"))
        url = payload.get("url")
        messenger = cfg.get('redmine').get('messenger')
        receiver = cfg.get('redmine').get('skypegroup')
        content = None
        if action == "opened":
            content = u"%s đã tạo issue %s cho %s\n%s" % (author_name, url, assignee_name, subject)
        if action == "updated":
            content = u"%s đã cập nhật issue %s cho %s\n%s\n%s" % (updated_name, url, assignee_name, subject, notes)
        if content is not None:
            content = unicodedata.normalize('NFKD', content).encode('utf-8')
        #print(content, messenger, receiver)
        if receiver != None:
            pushNotication(messenger, receiver, content)

class redminev2:
    def POST(self):
        web.input()
        data = json.loads(web.ctx.data)
        print data
        payload = data.get("payload")
        print payload
        action = payload.get("action")
        journal = payload.get("journal")
        if journal != None:
            notes = journal.get("notes")
            private_notes = journal.get("private_notes")
            updated_author = journal.get("author")
            updated_name = "%s %s" % (updated_author.get("firstname"), updated_author.get("lastname"))
        else:
            notes = ""
            updated_name = ""
        issue = payload.get("issue")
        print issue
        subject = issue.get("subject")
        description = issue.get("description")
        author = issue.get("author")
        assignee = issue.get("assignee")
        status = issue.get("status").get("name")
        if notes == "":
            notes = "Status: %s" % status
        if assignee != None:
            assignee_name = "%s %s" % (assignee.get("firstname"), assignee.get("lastname"))
        else:
            assignee_name = "nobody"
        author_name = "%s %s" % (author.get("firstname"), author.get("lastname"))
        url = payload.get("url")
        messenger = cfg.get('redmine').get('messenger')
        receiver = cfg.get('redmine').get('skypegroup')
        content = None
        if action == "opened":
            content = u"%s đã tạo issue %s cho %s\n%s" % (author_name, url, assignee_name, subject)
        if action == "updated" and not private_notes:
            content = u"%s đã cập nhật issue %s cho %s\n%s\n%s" % (updated_name, url, assignee_name, subject, notes)
        if action == "updated" and private_notes:
            content = u"%s đã cập nhật issue %s cho %s\n%s" % (updated_name, url, assignee_name, subject)
        if content is not None:
            content = unicodedata.normalize('NFKD', content).encode('utf-8')
            print(action)
            print(content, messenger, receiver)
            #if receiver != None:
                #pushNotication(messenger, receiver, content)
        else:
            print("Nothing")

if __name__ == "__main__":
    app.run()


text:
'use strict';

const path = require('path');
const util = require('../util');

// Assume absolute paths can be classified by AVA.
const isFileImport = name => path.isAbsolute(name) || name.startsWith('./') || name.startsWith('../');

const create = context => {
	const filename = context.getFilename();
	const [overrides] = context.options;

	if (filename === '<input>' || filename === '<text>') {
		return {};
	}

	const resolveFrom = path.dirname(filename);

	let loadedAvaHelper = false;
	let avaHelper;

	const validateImportPath = (node, importPath) => {
		if (!importPath || typeof importPath !== 'string') {
			return;
		}

		if (!isFileImport(importPath)) {
			return;
		}

		if (!loadedAvaHelper) {
			avaHelper = util.loadAvaHelper(filename, overrides);
			loadedAvaHelper = true;
		}

		if (!avaHelper) {
			return {};
		}

		const {isTest} = avaHelper.classifyImport(path.resolve(resolveFrom, importPath));
		if (isTest) {
			context.report({
				node,
				message: 'Test files should not be imported.',
			});
		}
	};

	return {
		ImportDeclaration: node => {
			validateImportPath(node, node.source.value);
		},
		CallExpression: node => {
			if (!(node.callee.type === 'Identifier' && node.callee.name === 'require')) {
				return;
			}

			if (node.arguments[0]) {
				validateImportPath(node, node.arguments[0].value);
			}
		},
	};
};

const schema = [{
	type: 'object',
	properties: {
		extensions: {
			type: 'array',
		},
		files: {
			type: 'array',
		},
	},
}];

module.exports = {
	create,
	meta: {
		type: 'suggestion',
		docs: {
			url: util.getDocsUrl(__filename),
		},
		schema,
	},
};


text:
  Aniane est
      une commune géographiquement positionnée dans le département de Hérault en Languedoc-Roussillon. Elle totalisait 2 585 habitants en 2008.

La ville propose quelques  équipements sportifs, elle propose entre autres un terrain de tennis, un centre d'équitation et un terrain de sport.

Le nombre d'habitations, à Aniane, était réparti en 2011 en 309 appartements et 1 177 maisons soit
 un marché relativement équilibré.

À Aniane, le prix moyen à l'achat d'un appartement s'évalue à 1 711 € du m² en vente. La valeur moyenne d'une maison à l'achat se situe à 1 741 € du m². À la location le prix moyen se situe à 8,27 € du m² par mois.

À coté de Aniane sont positionnées géographiquement les communes de
Lagamas située à 5 km, 121 habitants,
Montpeyroux située à 6 km, 1 170 habitants,
Argelliers située à 7 km, 769 habitants,
Saint-André-de-Sangonis à 7 km, 4 690 habitants,
Puéchabon située à 4 km, 425 habitants,
Gignac à 4 km, 4 951 habitants,
 entre autres. De plus, Aniane est située à seulement 24 km de Montpellier.

À Aniane le salaire moyen par mois par habitant est situé à approximativement 2 079 €  net. Ceci est inférieur à la moyenne du pays.


text:
package id.crossbinder.hod.support;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import id.crossbinder.hod.ConfigurationProvider;
import id.crossbinder.hod.Crossbinder;
import id.crossbinder.hod.CrossbinderException;
import id.crossbinder.hod.GlobalLifecycleInterceptor;
import id.crossbinder.hod.Injector;
import id.crossbinder.hod.LifecycleInterceptor;
import id.crossbinder.hod.Locator;
import id.crossbinder.hod.MethodInterceptor;
import id.crossbinder.hod.support.binder.Binder;
import id.scanpath.ClasspathScanner;
import id.scanpath.ScanScope;

/**
 * @author indroneel
 *
 */

public class CrossbinderImpl extends Crossbinder {

	private static final Logger LOGGER = Logger.getLogger(CrossbinderImpl.class.getName());

	private ClasspathScanner            scanner;
	private ScanScope                   scope;
	private List<ConfigurationProvider> configProviders;
	private LocatorImpl                 locator;
	private LimitedLocator              lilocator;
	private InjectorImpl                injector;
	private EventHandlerImpl            evtHandler;
	private BinderCreator               bindCreator;
	private BinderOrdering              bindOrder;
	private boolean                     startFlag;

	public CrossbinderImpl() {
		scanner = new ClasspathScanner();
		locator = new LocatorImpl();
		lilocator = new LimitedLocator();
		evtHandler = new EventHandlerImpl(locator);
		configProviders = new ArrayList<>();
		injector = new InjectorImpl(locator, configProviders);

		bindCreator = new BinderCreator();
		bindCreator.setClasspathScanner(scanner);
		bindCreator.setLocator(locator);
		bindCreator.setLimitedLocator(lilocator);
		bindCreator.setInjector(injector);
		bindCreator.setEventHandler(evtHandler);
		bindCreator.setConfigurationProviders(configProviders);

		bindOrder = new BinderOrdering();
		bindOrder.setLocator(locator);
		startFlag = false;
	}

	////////////////////////////////////////////////////////////////////////////
	// Methods of base class CrossBinder

	@Override
	public Crossbinder scanClasses(ScanScope ss) {
		scope = ss;
		return this;
	}

	@Override
	public Crossbinder configure(ConfigurationProvider provider) {
		configProviders.add(provider);
		return this;
	}

	@Override
	public Crossbinder classLoader(ClassLoader cl) {
		scanner.setClassLoader(cl);
		bindCreator.setClassLoader(cl);
		return this;
	}

	@Override
	public Crossbinder addInterceptor(MethodInterceptor mi) {
		bindCreator.addInterceptor(mi);
		return this;
	}

	@Override
	public Crossbinder addInterceptor(LifecycleInterceptor li) {
		bindCreator.addInterceptor(li);
		return this;
	}

	@Override
	public Crossbinder addLocator(Locator loc) {
		locator.chain(loc);
		return this;
	}

	@Override
	public Crossbinder start() throws CrossbinderException {
		scanner.load(scope);

		bindCreator.loadScanned();
		locator.dumpState(); //for debug purposes

		CircularDependencies circDep = new CircularDependencies();
		circDep.setLocator(locator);
		circDep.check();

		bindOrder.resolve();

		for(Binder binder : bindOrder.getStage1Binders()) {
			binder.start();
		}
		LOGGER.fine("stage1 binders started");

		//activate the event handler to start handling events from this point onwards.
		evtHandler.getReady();

		for(Binder binder : bindOrder.getStage2Binders()) {
			binder.start();
		}
		LOGGER.fine("stage2 binders started");

		for(Binder binder : locator.getGlobalLifecycleInterceptors()) {
			GlobalLifecycleInterceptor glci = binder.getInstance(GlobalLifecycleInterceptor.class);
			if(glci != null) {
				glci.afterStart();
			}
		}
		startFlag = true;
		return this;
	}

	@Override
	public void stop() {

		for(Binder binder : locator.getGlobalLifecycleInterceptors()) {
			GlobalLifecycleInterceptor glci = binder.getInstance(GlobalLifecycleInterceptor.class);
			if(glci != null) {
				glci.beforeStop();
			}
		}

		for(Binder binder : bindOrder.getStage2Binders()) {
			binder.stop();
		}

		for(Binder binder : bindOrder.getStage1Binders()) {
			binder.stop();
		}
		startFlag = false;
	}

	@Override
	public boolean isStarted() {
		return startFlag;
	}

	@Override
	public Injector injector() {
		return injector;
	}

	@Override
	public Locator locator() {
		return locator;
	}

	@Override
	public Locator limitedLocator() {
		return lilocator;
	}
}


text:
// Copyright 2017 Google Inc.
//
// 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.

package codeu.chat.client;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import codeu.chat.common.Conversation;
import codeu.chat.common.ConversationSummary;
import codeu.chat.common.Message;
import codeu.chat.util.Logger;
import codeu.chat.util.Method;
import codeu.chat.util.Uuid;
import codeu.chat.util.store.Store;

public final class ClientConversation {

  private final static Logger.Log LOG = Logger.newLog(ClientConversation.class);

  private final Controller controller;
  private final View view;

  private ConversationSummary currentSummary = null;
  private Conversation currentConversation = null;

  private final ClientUser userContext;
  private ClientMessage messageContext = null;

  private final Map<Uuid, Conversation> conversationsByUuid = new HashMap<>();

  // This is the set of conversations known to the server.
  private final Map<Uuid, ConversationSummary> summariesByUuid = new HashMap<>();

  // This is the set of conversations known to the server, sorted by title.
  private Store<String, ConversationSummary> summariesSortedByTitle =
      new Store<>(String.CASE_INSENSITIVE_ORDER);

  private Map<ConversationSummary, String> summariesSortedByCreationTime =
	 new  TreeMap<ConversationSummary, String>(new sortByCreation());

  /**
   * Implements Comparator that orders ConversationSummaries
   * by the last message creation time of the conversation their
   * mapped to (newest to oldest) when inserted into the TreeMap
   * summariesSortedByCreationTime.
   * @author malikg
   *
   */
  class sortByCreation implements Comparator<ConversationSummary> {
	  @Override
	  public int compare(ConversationSummary a, ConversationSummary b) {
		  if (!Uuid.equals(a.lastMessage, Uuid.NULL) && !Uuid.equals(b.lastMessage, Uuid.NULL)) {

			  Message messageA = view.getMessageById(a.lastMessage);
			  Message messageB = view.getMessageById(b.lastMessage);
			  if (messageA.creation.inMs() > messageB.creation.inMs()) return -1;
			  else if (messageA.creation.inMs() < messageB.creation.inMs()) return 1;

		  return 0;
		  }
		  if (!Uuid.equals(a.lastMessage, Uuid.NULL)) return -1;
		  if (!Uuid.equals(b.lastMessage, Uuid.NULL)) return 1;

	  return 0;
	  }
  }

  public ClientConversation(Controller controller, View view, ClientUser userContext) {
    this.controller = controller;
    this.view = view;
    this.userContext = userContext;

    System.out.println(this.getClass().toString() + " instantiate ClientConversation");
  }

  public void setMessageContext(ClientMessage messageContext) {
    this.messageContext = messageContext;
  }

  // Validate the title of the conversation
  static public boolean isValidTitle(String title) {

    boolean clean = true;
    if ((title.length() <= 0) || (title.length() > 64)) {
      clean = false;
    } else {

      // TODO: check for invalid characters

    }
    System.out.println("Client Conversation " + " isValidTitle");
    return clean;
  }

  public boolean hasCurrent() {
	System.out.println(this.getClass().toString() + " hasCurrent()");
    return (currentSummary != null);
  }

  public ConversationSummary getCurrent() {
	System.out.println(this.getClass().toString() + " getCurrent()");
    return currentSummary;
  }

  public Uuid getCurrentId() {
	  System.out.println(this.getClass().toString() + " getCurrentId()");
	  return (currentSummary != null) ? currentSummary.id : null;
  }

  public int currentMessageCount() {
	System.out.println(this.getClass().toString() + " currentMessageCount()");
    return messageContext.currentMessageCount();
  }

  public void showCurrent() {
	System.out.println(this.getClass().toString() + " showCurrent()");
    printConversation(currentSummary, userContext);
  }

  public void startConversation(String title, Uuid owner) {
	System.out.println(this.getClass().toString() + " startConversation()");
    final boolean validInputs = isValidTitle(title);

    final Conversation conv = (validInputs) ? view.newConversation(title, owner) : null;

    if (conv == null) {
      System.out.format("Error: conversation not created - %s.\n",
          (validInputs) ? "server failure" : "bad input value");
      return;
    } else {
      LOG.info("New conversation: Title= \"%s\" UUID= %s", conv.title, conv.id);

      summariesByUuid.put(conv.summary.id, conv.summary);
      summariesSortedByTitle.insert(conv.summary.title, conv.summary);
      summariesSortedByCreationTime.put(conv.summary, conv.title);
      conversationsByUuid.put(conv.id, conv);

      currentSummary = conv.summary;

      updateAllConversations(currentSummary != null);
    }
  }

  public void setCurrent(ConversationSummary conv) {
	  System.out.println(this.getClass().toString() + " setCurrent()");
	  currentSummary = conv;
  }

  public void showAllConversations() {
	System.out.println(this.getClass().toString() + " showAllConversations()");
    updateAllConversations(false);

    for (final ConversationSummary c : summariesByUuid.values()) {
      printConversation(c, userContext);
    }
  }

  // Get a single conversation from the server.
  public Conversation getConversation(Uuid conversationId) {
	  // TODO: Could be optimized by saving conversations in memory
	    for (final Conversation c : view.getConversations(Arrays.asList(conversationId))) {
	    	return c;
	    }

    return null;
  }

  private void joinConversation(String match) {
    Method.notImplemented();
  }

  private void leaveCurrentConversation() {
    Method.notImplemented();
  }

  private void updateCurrentConversation() {
	System.out.println(this.getClass().toString() + " updateCurrentConversation()");
    if (currentSummary == null) {
      currentConversation = null;
    } else {
      currentConversation = getConversation(currentSummary.id);
      if (currentConversation == null) {
        LOG.info("GetConversation: current=%s, current.id=%s, but currentConversation == null",
            currentSummary, currentSummary.id);
      } else {
        LOG.info("Get Conversation: Title=\"%s\" UUID=%s first=%s last=%s\n",
            currentConversation.title, currentConversation.id, currentConversation.firstMessage,
            currentConversation.lastMessage);
      }
    }
  }

  public int conversationsCount() {
	  System.out.println(this.getClass().toString() + " conversationsCount()");
   return summariesByUuid.size();
  }

  public Iterable<ConversationSummary> getConversationSummaries() {
	  System.out.println(this.getClass().toString() + " getConversationSummaries()");
    return summariesSortedByTitle.all();
  }

  public Store<String, ConversationSummary> getConversationSummariesStore() {
	  System.out.println(this.getClass().toString() + " getConversationSummaries()");
    return summariesSortedByTitle;
  }

  public Map<ConversationSummary, String> getSummariesByCreationTime() {
	  return summariesSortedByCreationTime;
  }

  // Update the list of known Conversations.
  // If the input currentChanged is true, then re-establish the state of
  // the current Conversation, including its messages.
  public void updateAllConversations(boolean currentChanged) {
	System.out.println(this.getClass().toString() + " updateAllConversations()");
	// TODO: Conversation summaries aren't updated with lastMessage of
	// a conversation so removing if statement (if (summariesByUuid.size() == 0)) to allow re-order of conversations,
	// but this should be optimized to lower the number of calls to the server.
	// TODO: TAKE OUT CONVERSATION AND THEN PLACE IT BACK WHEN FINISHED

	    summariesByUuid.clear();
	    summariesSortedByTitle = new Store<>(String.CASE_INSENSITIVE_ORDER);

	    summariesSortedByCreationTime = new TreeMap<ConversationSummary, String>(new sortByCreation());

	    for (final ConversationSummary cs : view.getAllConversations()) {
	      summariesByUuid.put(cs.id, cs);
	      summariesSortedByTitle.insert(cs.title, cs);
	      summariesSortedByCreationTime.put(cs, cs.title);
	    }

	if (currentChanged) {
	    updateCurrentConversation();
	    messageContext.resetCurrent(true);
	 }
  }

  public void updateConversation(Conversation convo) {
	  if (!summariesByUuid.containsKey(convo.summary.id)) {
		  summariesByUuid.put(convo.summary.id, convo.summary);
	      summariesSortedByTitle.insert(convo.summary.title, convo.summary);
	      summariesSortedByCreationTime.put(convo.summary, convo.summary.title);
	      conversationsByUuid.put(convo.id, convo);
	  }
  }

  // Print Conversation.  User context is used to map from owner UUID to name.
  public static void printConversation(ConversationSummary c, ClientUser userContext) {
    if (c == null) {
      System.out.println("Null conversation");
    } else {
      final String name = (userContext == null) ? null : userContext.getName(c.owner);
      final String ownerName = (name == null) ? "" : String.format(" (%s)", name);
      System.out.format(" Title: %s\n", c.title);
      System.out.format("    Id: %s owner: %s%s created %s\n", c.id, c.owner, ownerName, c.creation);
    }
  }

  // Print Conversation outside of User context.
  public static void printConversation(ConversationSummary c) {
    printConversation(c, null);
  }
}


text:
package com.tinkerpop.gremlin.structure.strategy;

import com.tinkerpop.gremlin.process.graph.GraphTraversal;
import com.tinkerpop.gremlin.structure.Graph;
import com.tinkerpop.gremlin.structure.Property;
import com.tinkerpop.gremlin.structure.Vertex;
import com.tinkerpop.gremlin.structure.VertexProperty;
import com.tinkerpop.gremlin.structure.strategy.process.graph.StrategyWrappedElementTraversal;
import com.tinkerpop.gremlin.structure.util.StringFactory;
import com.tinkerpop.gremlin.util.StreamFactory;

import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class StrategyWrappedVertexProperty<V> extends StrategyWrappedElement implements VertexProperty<V>, StrategyWrapped, VertexProperty.Iterators {
    private final VertexProperty<V> baseVertexProperty;
    private final Strategy.Context<StrategyWrappedVertexProperty<V>> strategyContext;

    public StrategyWrappedVertexProperty(final VertexProperty<V> baseVertexProperty, final StrategyWrappedGraph strategyWrappedGraph) {
        super(baseVertexProperty, strategyWrappedGraph);
        this.strategyContext = new Strategy.Context<>(strategyWrappedGraph.getBaseGraph(), this);
        this.baseVertexProperty = baseVertexProperty;
    }

    @Override
    public GraphTraversal<VertexProperty, VertexProperty> start() {
        return new StrategyWrappedElementTraversal<>(this, strategyWrappedGraph);
    }

    @Override
    public Graph graph() {
        return this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyGraphStrategy(strategyContext),
                () -> this.strategyWrappedGraph).get();
    }

    @Override
    public Object id() {
        return this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyIdStrategy(strategyContext),
                this.baseVertexProperty::id).get();
    }

    @Override
    public String label() {
        return this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyLabelStrategy(strategyContext),
                this.baseVertexProperty::label).get();
    }

    @Override
    public Set<String> keys() {
        return this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyKeysStrategy(strategyContext),
                this.baseVertexProperty::keys).get();
    }

    @Override
    public Set<String> hiddenKeys() {
        return this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyHiddenKeysStrategy(strategyContext),
                this.baseVertexProperty::hiddenKeys).get();
    }

    @Override
    public Vertex element() {
        return new StrategyWrappedVertex(this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getVertexPropertyGetElementStrategy(strategyContext),
                this.baseVertexProperty::element).get(), strategyWrappedGraph);
    }

    @Override
    public VertexProperty.Iterators iterators() {
        return this;
    }

    @Override
    public <U> Property<U> property(final String key, final U value) {
        return new StrategyWrappedProperty<U>(this.strategyWrappedGraph.getStrategy().compose(
                s -> s.<U, V>getVertexPropertyPropertyStrategy(strategyContext),
                this.baseVertexProperty::property).<String, U>apply(key, value), this.strategyWrappedGraph);
    }

    @Override
    public String key() {
        return this.baseVertexProperty.key();
    }

    @Override
    public V value() throws NoSuchElementException {
        return this.baseVertexProperty.value();
    }

    @Override
    public boolean isHidden() {
        return this.baseVertexProperty.isHidden();
    }

    @Override
    public boolean isPresent() {
        return this.baseVertexProperty.isPresent();
    }

    @Override
    public void remove() {
        this.strategyWrappedGraph.getStrategy().compose(
                s -> s.getRemoveVertexPropertyStrategy(strategyContext),
                () -> {
                    this.baseVertexProperty.remove();
                    return null;
                }).get();
    }

    @Override
    public String toString() {
        final GraphStrategy strategy = strategyWrappedGraph.getStrategy().getGraphStrategy().orElse(GraphStrategy.DefaultGraphStrategy.INSTANCE);
        return StringFactory.graphStrategyPropertyString(strategy, this.baseVertexProperty);
    }

    @Override
    public <U> Iterator<Property<U>> propertyIterator(final String... propertyKeys) {
        return StreamFactory.stream(strategyWrappedGraph.getStrategy().compose(
                s -> s.<U, V>getVertexPropertyIteratorsPropertiesStrategy(strategyContext),
                (String[] pks) -> baseVertexProperty.iterators().propertyIterator(pks)).apply(propertyKeys))
                .map(property -> (Property<U>) new StrategyWrappedProperty<>(property, strategyWrappedGraph)).iterator();
    }

    @Override
    public <U> Iterator<U> valueIterator(final String... propertyKeys) {
        return strategyWrappedGraph.getStrategy().compose(
                s -> s.<U, V>getVertexPropertyIteratorsValuesStrategy(strategyContext),
                (String[] pks) -> baseVertexProperty.iterators().valueIterator(pks)).apply(propertyKeys);
    }
}