text:
"""Builder and Buidler Configs for D4RL Datasets."""

from __future__ import annotations

import dataclasses
from typing import Any, Dict, FrozenSet, Optional

from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow as tf
from tensorflow_datasets.d4rl import dataset_utils
import tensorflow_datasets.public_api as tfds

@dataclasses.dataclass
class BuilderConfig(tfds.core.BuilderConfig):
  """Configuration of the dataset versions."""
  dataset_dir: str = 'gym_mujoco'
  file_suffix: str = 'medium'
  env: str = 'mujoco'
  # All use float32 except for the replay datasets.
  float_type: tf.DType = tf.float32
  # All datasets have step metadata except for mujoco v0.
  step_metadata_keys: FrozenSet[str] = frozenset([])
  episode_metadata_keys: FrozenSet[str] = frozenset([])
  has_policy_metadata: bool = False
  # Only used if the dataset has policy metadata
  has_policy_last_fc_log_std: bool = False
  policy_size: int = 256
  # Some datasets were regenerated with different metadata type.
  step_metadata_type: tf.DType = tf.float32

@dataclasses.dataclass
class DatasetConfig():
  """Configuration of the shape of the dataset.

  Attributes:
    name: name of the Mujoco task
    obs_len: first dimension of the obsercations.
    action_len: first dimension of the actions.
    qpos_len: first dimension of the infos/qpos field (ignored if the dataset
      does not include step metadata).
    qvel_len: first dimension of the infos/qvel field (ignored if the dataset
      does not include step metadata).
    goal_len: first dimension of the infos/goal field (ignored if the dataset
      does not include step metadata).
  """
  name: str
  obs_len: int
  action_len: int
  qpos_len: int
  qvel_len: int
  goal_len: Optional[int] = None

# Constants used to identify step metadata keys
_QPOS = 'qpos'
_QVEL = 'qvel'
_GOAL = 'goal'
_ACTION_LOG_PROBS = 'action_log_probs'
_ACTION_MEAN = 'action_mean'
_ACTION_LOGSTD = 'action_logstd'
_ACTION_LOG_STD = 'action_log_std'

_ADROIT_BODY_POS = 'adroit_body_pos'

_ADROIT_BODY_POS_KEYS = {
    'door': {
        'door_body_pos': (3,)
    },
    'hammer': {
        'board_pos': (3,),
        'target_pos': (3,),
    },
    'pen': {
        'desired_orien': (4,)
    },
    'relocate': {
        'hand_qpos': (30,),
        'obj_pos': (3,),
        'palm_pos': (3,),
        'target_pos': (3,),
    },
}

# Constants used to identify episode metadata keys
_ALGORITHM = 'algorithm'
_ITERATION = 'iteration'

# Data description
_MUJOCO_DESCRIPTION = ('See more details about the task and its versions in '
                       'https://github.com/rail-berkeley/d4rl/wiki/Tasks#gym')
_ADROIT_DESCRIPTION = (
    'See more details about the task and its versions in '
    'https://github.com/rail-berkeley/d4rl/wiki/Tasks#adroit')

# pytype: disable=wrong-keyword-args
MUJOCO_BUILDER_CONFIGS = [
    BuilderConfig(
        name='v0-expert',
        dataset_dir='gym_mujoco',
        env='mujoco',
        file_suffix='_expert',
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v0-medium',
        dataset_dir='gym_mujoco',
        env='mujoco',
        file_suffix='_medium',
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v0-medium-expert',
        dataset_dir='gym_mujoco',
        env='mujoco',
        file_suffix='_medium_expert',
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v0-mixed',
        dataset_dir='gym_mujoco',
        env='mujoco',
        file_suffix='_mixed',
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v0-random',
        dataset_dir='gym_mujoco',
        env='mujoco',
        file_suffix='_random',
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v1-expert',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_expert-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=True,
        policy_size=256,
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v1-medium',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_medium-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=True,
        policy_size=256,
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v1-medium-expert',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_medium_expert-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-medium-replay',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_medium_replay-v1',
        float_type=tf.float64,
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-full-replay',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_full_replay-v1',
        float_type=tf.float64,
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-random',
        dataset_dir='gym_mujoco_v1',
        env='mujoco',
        file_suffix='_random-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v2-expert',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_expert-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=True,
        policy_size=256,
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v2-full-replay',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_full_replay-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v2-medium',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_medium-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=True,
        policy_size=256,
        description=_MUJOCO_DESCRIPTION),
    BuilderConfig(
        name='v2-medium-expert',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_medium_expert-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v2-medium-replay',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_medium_replay-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        episode_metadata_keys=frozenset([_ALGORITHM, _ITERATION]),
        description=_MUJOCO_DESCRIPTION,
    ),
    BuilderConfig(
        name='v2-random',
        dataset_dir='gym_mujoco_v2',
        env='mujoco',
        file_suffix='_random-v2',
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ACTION_LOG_PROBS]),
        description=_MUJOCO_DESCRIPTION,
    ),
]
ADROIT_BUILDER_CONFIGS = [
    BuilderConfig(
        name='v0-human',
        dataset_dir='hand_dapg',
        env='adroit',
        file_suffix='-v0_demos_clipped',
        step_metadata_keys=frozenset([_QPOS, _QVEL]),
        description=_ADROIT_DESCRIPTION,
    ),
    BuilderConfig(
        name='v0-cloned',
        dataset_dir='hand_dapg',
        env='adroit',
        file_suffix='-demos-v0-bc-combined',
        float_type=tf.float64,
        step_metadata_type=tf.float64,
        step_metadata_keys=frozenset([_QPOS, _QVEL]),
        description=_ADROIT_DESCRIPTION,
    ),
    BuilderConfig(
        name='v0-expert',
        dataset_dir='hand_dapg',
        env='adroit',
        file_suffix='-v0_expert_clipped',
        step_metadata_keys=frozenset(
            [_QPOS, _QVEL, _ACTION_MEAN, _ACTION_LOGSTD]),
        description=_ADROIT_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-human',
        dataset_dir='hand_dapg_v1',
        env='adroit',
        file_suffix='-human-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ADROIT_BODY_POS]),
        description=_ADROIT_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-cloned',
        dataset_dir='hand_dapg_v1',
        env='adroit',
        file_suffix='-cloned-v1',
        step_metadata_keys=frozenset([_QPOS, _QVEL, _ADROIT_BODY_POS]),
        episode_metadata_keys=frozenset([_ALGORITHM]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=False,
        policy_size=256,
        description=_ADROIT_DESCRIPTION,
    ),
    BuilderConfig(
        name='v1-expert',
        dataset_dir='hand_dapg_v1',
        env='adroit',
        file_suffix='-expert-v1',
        step_metadata_keys=frozenset(
            [_QPOS, _QVEL, _ADROIT_BODY_POS, _ACTION_MEAN, _ACTION_LOG_STD]),
        episode_metadata_keys=frozenset([_ALGORITHM]),
        has_policy_metadata=True,
        has_policy_last_fc_log_std=True,
        policy_size=32,
        description=_ADROIT_DESCRIPTION,
    ),
]
# pytype: enable=wrong-keyword-args

def _get_step_metadata(
    builder_config: BuilderConfig,
    ds_config: DatasetConfig) -> Dict[str, tfds.features.FeatureConnector]:
  """Builds the features dict of the step metadata.

  Args:
    builder_config: builder config of the dataset.
    ds_config: config containing the dataset specs.

  Returns:
    Dictionary with the step metadata features of this dataset.
  """
  infos_dict = {}
  float_type = builder_config.step_metadata_type
  # Step metadata corresponds to state information.
  # See https://github.com/rail-berkeley/d4rl/wiki/Tasks#gym.
  for k in builder_config.step_metadata_keys:
    if k in _ACTION_LOG_PROBS:
      infos_dict[k] = float_type
    elif k == _QPOS:
      infos_dict[k] = tfds.features.Tensor(
          shape=(ds_config.qpos_len,), dtype=float_type)
    elif k == _QVEL:
      infos_dict[k] = tfds.features.Tensor(
          shape=(ds_config.qvel_len,), dtype=float_type)
    elif k == _GOAL:
      infos_dict[k] = tfds.features.Tensor(
          shape=(ds_config.goal_len,), dtype=float_type)
    elif k == _ADROIT_BODY_POS:
      # We use the task name to get the names of the body position keys.
      adroit_keys = _ADROIT_BODY_POS_KEYS[ds_config.name]
      for (ak, shape) in adroit_keys.items():
        infos_dict[ak] = tfds.features.Tensor(shape=shape, dtype=float_type)
    elif k in [_ACTION_MEAN, _ACTION_LOG_STD, _ACTION_LOGSTD]:
      infos_dict[k] = tfds.features.Tensor(
          shape=(ds_config.action_len,), dtype=float_type)
    else:
      raise ValueError(f'Unknown key in the step metadata {k}')
  return infos_dict

def _get_policy_info(
    builder_config: BuilderConfig,
    ds_config: DatasetConfig) -> Dict[str, tfds.typing.FeatureConnectorArg]:
  """Builds the features dict of the policy weights.

  Args:
    builder_config: builder config of the dataset.
    ds_config: config containing the dataset specs.

  Returns:
    Dictionary with the policy-related features of this dataset.
  """
  float_type = builder_config.float_type
  # The policy dictionary contains the weights of the policy used to
  # generate the dataset.
  # See https://github.com/rail-berkeley/d4rl/wiki/Tasks#gym.
  policy_dict = {
      'fc0': {
          'bias':
              tfds.features.Tensor(
                  shape=(builder_config.policy_size,), dtype=float_type),
          'weight':
              tfds.features.Tensor(
                  shape=(builder_config.policy_size, ds_config.obs_len),
                  dtype=float_type),
      },
      'fc1': {
          'bias':
              tfds.features.Tensor(
                  shape=(builder_config.policy_size,), dtype=float_type),
          'weight':
              tfds.features.Tensor(
                  shape=(builder_config.policy_size,
                         builder_config.policy_size),
                  dtype=float_type),
      },
      'last_fc': {
          'bias':
              tfds.features.Tensor(
                  shape=(ds_config.action_len,), dtype=float_type),
          'weight':
              tfds.features.Tensor(
                  shape=(ds_config.action_len, builder_config.policy_size),
                  dtype=float_type),
      },
      'nonlinearity': tf.string,
      'output_distribution': tf.string,
  }
  if builder_config.env == 'adroit' and builder_config.name == 'v1-cloned':
    # v1-cloned from d4rl_adroit uses a different policy shape
    policy_dict['fc0']['weight'] = tfds.features.Tensor(
        shape=(ds_config.obs_len, builder_config.policy_size), dtype=float_type)
    policy_dict['last_fc']['weight'] = tfds.features.Tensor(
        shape=(builder_config.policy_size, ds_config.action_len),
        dtype=float_type)
  if builder_config.has_policy_last_fc_log_std:
    policy_dict['last_fc_log_std'] = {
        'bias':
            tfds.features.Tensor(
                shape=(ds_config.action_len,), dtype=float_type),
        'weight':
            tfds.features.Tensor(
                shape=(ds_config.action_len, builder_config.policy_size),
                dtype=float_type),
    }

  return policy_dict

def get_features_dict(
    builder_config: BuilderConfig,
    ds_config: DatasetConfig) -> Dict[str, tfds.typing.FeatureConnectorArg]:
  """Builds the features dict of a D4RL dataset.

  Args:
    builder_config: builder config of the Mujoco dataset.
    ds_config: config of the Mujoco dataset containing the specs.

  Returns:
    Dictionary with the features of this dataset.
  """

  float_type = builder_config.float_type

  steps_dict = {
      'observation':
          tfds.features.Tensor(shape=(ds_config.obs_len,), dtype=float_type),
      'action':
          tfds.features.Tensor(shape=(ds_config.action_len,), dtype=float_type),
      'reward':
          float_type,
      'is_terminal':
          tf.bool,
      'is_first':
          tf.bool,
      'is_last':
          tf.bool,
      'discount':
          float_type,
  }
  if builder_config.env == 'adroit' and builder_config.name == 'v0-cloned':
    # D4RL adroit in the v0-cloned config, action uses a different float type
    # than the rest of the dataset.
    steps_dict['action'] = tfds.features.Tensor(
        shape=(ds_config.action_len,), dtype=tf.float32)

  if builder_config.step_metadata_keys:
    steps_dict['infos'] = _get_step_metadata(builder_config, ds_config)

  episode_metadata = {}
  if builder_config.episode_metadata_keys:
    for k in builder_config.episode_metadata_keys:
      if k == _ITERATION:
        episode_metadata[k] = tf.int32
      else:
        episode_metadata[k] = tf.string
  if builder_config.has_policy_metadata:
    episode_metadata['policy'] = _get_policy_info(builder_config, ds_config)

  features_dict = {
      'steps': tfds.features.Dataset(steps_dict),
  }
  if episode_metadata:
    features_dict.update(episode_metadata)

  return features_dict

class D4RLDatasetBuilder(
    tfds.core.GeneratorBasedBuilder, skip_registration=True):
  """DatasetBuilder for D4RL datasets."""

  def __init__(self, *, ds_config: DatasetConfig, **kwargs: Any):
    self._ds_config = ds_config
    super().__init__(**kwargs)

  def _info(self) -> tfds.core.DatasetInfo:
    """Returns the dataset metadata."""
    features_dict = get_features_dict(
        builder_config=self.builder_config, ds_config=self._ds_config)
    return tfds.core.DatasetInfo(
        builder=self,
        description=dataset_utils.description(),
        features=tfds.features.FeaturesDict(features_dict),
        supervised_keys=None,  # disabled
        homepage=dataset_utils.url(),
        citation=dataset_utils.citation(),
    )

  def _split_generators(self, dl_manager: tfds.download.DownloadManager):
    """Returns SplitGenerators."""
    ds_dir = self.builder_config.dataset_dir
    name = self._ds_config.name
    if name == 'walker2d' and self.builder_config.name == 'v0-mixed':
      # There is a mismatch in the name of the original files, where one of them
      # uses walker instead of walker2d.
      name = 'walker'
    ds_name = (name + self.builder_config.file_suffix + '.hdf5')
    path = dl_manager.download_and_extract({
        'file_path':
            'http://rail.eecs.berkeley.edu/datasets/offline_rl/' + ds_dir +
            '/' + ds_name
    })
    return {
        'train': self._generate_examples(path),
    }

  def _generate_examples(self, path):
    """Yields examples."""
    file_path = path['file_path']
    return dataset_utils.generate_examples(file_path)  # pytype: disable=wrong-arg-types


text:
FROM rdpanek/phantomjs:2.0.0

RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -

RUN apt-get install -y nodejs

RUN npm install bower ember-cli@2.8.0 -g

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace MauticPlugin\MauticSocialBundle\Integration;

/**
 * Class FoursquareIntegration
 */
class FoursquareIntegration extends SocialIntegration
{
    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'Foursquare';
    }

    /**
     * {@inheritdoc}
     */
    public function getPriority()
    {
        return 2;
    }

    /**
     * {@inheritdoc}
     */
    public function getIdentifierFields()
    {
        return array(
            'email',
            'twitter', //foursquare allows searching directly by twitter handle
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getAuthenticationUrl()
    {
        return 'https://foursquare.com/oauth2/authenticate';
    }

    /**
     * {@inheritdoc}
     */
    public function getAccessTokenUrl()
    {
        return 'https://foursquare.com/oauth2/access_token';
    }

    /**
     * {@inheritdoc}
     */
    public function getAuthenticationType()
    {
        return 'oauth2';
    }

    /**
     * @param string $endpoint
     * @param string $m
     *
     * @return string
     */
    public function getApiUrl($endpoint, $m = 'foursquare')
    {
        return "https://api.foursquare.com/v2/$endpoint?v=20140806&m={$m}";
    }

    /**
     * @param        $url
     * @param array  $parameters
     * @param string $method
     * @param array  $settings
     *
     * @return mixed|string
     */
    public function makeRequest($url, $parameters = array(), $method = 'GET', $settings = array())
    {
        $settings[$this->getAuthTokenKey()] = 'oauth_token';

        return parent::makeRequest($url, $parameters, $method, $settings);
    }

    /**
     * Get public data
     *
     * @param $identifier
     * @param $socialCache
     *
     * @return array
     */
    public function getUserData($identifier, &$socialCache)
    {
        if ($id = $this->getContactUserId($identifier, $socialCache)) {
            $url  = $this->getApiUrl("users/{$id}");
            $data = $this->makeRequest($url);
            if (!empty($data) && isset($data->response->user)) {
                $result = $data->response->user;
                $socialCache['profile'] = $this->matchUpData($result);
                if (isset($result->photo)) {
                    $socialCache['profile']['profileImage'] = $result->photo->prefix . '300x300' . $result->photo->suffix;
                }
                $socialCache['profile']['profileHandle'] = $id;
            }
        }
    }

    /**
     * {@inheritdoc}
     *
     * @param $identifier
     * @param $socialCache
     *
     * @return array|void
     */
    public function getPublicActivity($identifier, &$socialCache)
    {
        if ($id = $this->getContactUserId($identifier, $socialCache)) {
            $activity = array(
                //'mayorships' => array(),
                'tips'       => array(),
                //'lists'      => array()
            );

            /*
            //mayorships
            $url  = $this->getApiUrl("users/{$id}/mayorships");
            $data = $this->makeRequest($url);

            if (isset($data->response->mayorships) && count($data->response->mayorships->items)) {
                $limit = 5;
                foreach ($data->response->mayorships->items as $m) {
                    if (empty($limit)) {
                        break;
                    }
                    //find main category of venue
                    $category = '';
                    foreach ($m->venue->categories as $c) {
                        if ($c->primary) {
                            $category = $c->name;
                            break;
                        }
                    }
                    $contact = (!empty($m->contact->formattedPhone)) ? $m->contact->formattedPhone : '';
                    $activity['mayorships'][] = array(
                        'venueName'     => $m->venue->name,
                        'venueLocation' => $m->venue->location->formattedAddress,
                        'venueContact'  => $contact,
                        'venueCategory' => $category
                    );
                    $limit--;
                }
            }
            */

            //tips
            $url  = $this->getApiUrl("users/{$id}/tips") . "&limit=5&sort=recent";
            $data = $this->makeRequest($url);

            if (isset($data->response->tips) && count($data->response->tips->items)) {
                foreach ($data->response->tips->items as $t) {
                    //find main category of venue
                    $category = '';
                    foreach ($t->venue->categories as $c) {
                        if ($c->primary) {
                            $category = $c->name;
                            break;
                        }
                    }
                    $contact = (!empty($t->contact->formattedPhone)) ? $t->contact->formattedPhone : '';
                    $activity['tips'][] = array(
                        'createdAt'     => $t->createdAt,
                        'tipText'       => $t->text,
                        'tipUrl'        => $t->canonicalUrl,
                        'venueName'     => $t->venue->name,
                        'venueLocation' => $t->venue->location->formattedAddress,
                        'venueContact'  => $contact,
                        'venueCategory'  => $category
                    );
                }
            }

            /*
            //lists
            $url  = $this->getApiUrl("users/{$id}/lists") . "&limit=5&group=created";
            $data = $this->makeRequest($url);

            if (isset($data->response->lists) && count($data->response->lists->items)) {
                foreach ($data->response->lists->items as $l) {
                    if (!$l->listItems->count) {
                        continue;
                    }

                    $item = array(
                        'listName'        => $l->name,
                        'listDescription' => $l->description,
                        'listUrl'         => $l->canonicalUrl,
                        'listCreatedAt'   => (isset($l->createdAt)) ? $l->createdAt : '',
                        'listUpdatedAt'   => (isset($l->updatedAt)) ? $l->updatedAt : '',
                        'listItems'       => array()
                    );

                    //get a sample of the list items
                    $url      = "https://api.foursquare.com/v2/lists/{$l->id}?limit=5&sort=recent&v=20140719&oauth_token={$keys['access_token']}";
                    $listData = $this->makeRequest($url);

                    if (isset($listData->response->list->listItems) && count($listData->response->list->listItems->items)) {
                        foreach ($listData->response->list->listItems->items as $li) {
                            //find main category of venue
                            $category = '';
                            foreach ($li->venue->categories as $c) {
                                if ($c->primary) {
                                    $category = $c->name;
                                    break;
                                }
                            }
                            $contact = (!empty($li->contact->formattedPhone)) ? $li->contact->formattedPhone : '';

                            $item['listItems'][] = array(
                                'createdAt'     => $li->createdAt,
                                'venueName'     => $li->venue->name,
                                'venueLocation' => $li->venue->location->formattedAddress,
                                'venueContact'  => $contact,
                                'venueCategory'  => $category
                            );
                        }
                    }

                    $activity['lists'][] = $item;
                }
            }
            */

            if (!empty($activity)) {
                $socialCache['activity'] = $activity;
            }
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getErrorsFromResponse($response)
    {
        if (is_object($response) && isset($response->meta->errorDetail)) {
            return $response->meta->errorDetail . ' (' . $response->meta->code . ')';
        }

        return '';
    }

    /**
     * {@inheritdoc}
     */
    public function matchFieldName($field, $subfield = '')
    {
        if ($field == "contact" && in_array($subfield, array('facebook', 'twitter'))) {
            return $subfield . 'ProfileHandle';
        }

        return parent::matchFieldName($field, $subfield);
    }

    /**
     * {@inheritdoc}
     */
    public function getAvailableLeadFields($settings = array())
    {
        return array(
            "profileHandle" => array("type" => "string"),
            "firstName"     => array("type" => "string"),
            "lastName"      => array("type" => "string"),
            "gender"        => array("type" => "string"),
            "homeCity"      => array("type" => "string"),
            "bio"           => array("type" => "string"),
            "contact"       => array(
                "type"   => "object",
                "fields" => array(
                    "twitter",
                    "facebook",
                    "phone"
                )
            )
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getSupportedFeatures()
    {
        return array(
            'public_profile',
            'public_activity'
        );
    }

    /**
     * @param $identifier
     * @param $socialCache
     *
     * @return bool
     */
    private function getContactUserId(&$identifier, &$socialCache)
    {
        if (!empty($socialCache['id'])) {

            return $socialCache['id'];
        } elseif (empty($identifier)) {

            return false;
        }

        $cleaned = $this->cleanIdentifier($identifier);

        if (!is_array($cleaned)) {
            $cleaned = array($cleaned);
        }

        foreach ($cleaned as $type => $c) {
            $url  = $this->getApiUrl("users/search") . "&{$type}={$c}";
            $data = $this->makeRequest($url);

            if (!empty($data) && isset($data->response->results) && count($data->response->results)) {
                $socialCache['id'] = $data->response->results[0]->id;

                return $socialCache['id'];
            }
        }

        return false;
    }
}


text:
/**
 * @externs
 * @suppress {duplicate,checkTypes}
 */
// NOTE: generated by tsickle, do not edit.
/**
 * @record
 * @struct
 */
function Type() {}

/* TODO: PropertySignature: ['computedProp'] */

/**
 * @return {!Iterator<string>}
 */
Type.prototype[Symbol.iterator] = function() {};

/**
 * @return {number}
 */
Type.prototype['computedMethod'] = function() {};


text:
package jp.coppermine.neptunium.core.reflect;

import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;

import org.junit.Test;

/**
 * TODO documents required.
 *
 */
public class TypeAssignmentTest {

    @Test
    public void testOf() {
        TypeAssignment.of(String.class);
    }

    @Test(expected = NullPointerException.class)
    public void testOf_Null() {
        TypeAssignment.of(null);
    }

    @Test
    public void testIsAssignableFrom_Object() {
        assertThat(TypeAssignment.of(Object.class).isAssignableFrom(Object.class), is(true));
        assertThat(TypeAssignment.of(Object.class).isAssignableFrom(String.class), is(true));
        assertThat(TypeAssignment.of(Object.class).isAssignableFrom(Double.class), is(true));
        assertThat(TypeAssignment.of(Object.class).isAssignableFrom(double.class), is(true));
    }

    @Test
    public void testIsAssignableFrom_boolean() {
        assertThat(TypeAssignment.of(boolean.class).isAssignableFrom(boolean.class), is(true));
        assertThat(TypeAssignment.of(boolean.class).isAssignableFrom(Boolean.class), is(true));
        assertThat(TypeAssignment.of(Boolean.class).isAssignableFrom(boolean.class), is(true));
        assertThat(TypeAssignment.of(Boolean.class).isAssignableFrom(Boolean.class), is(true));
    }

    @Test
    public void testIsAssignableFrom_byte() {
        assertThat(TypeAssignment.of(byte.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(byte.class).isAssignableFrom(Byte.class), is(true));
        assertThat(TypeAssignment.of(Byte.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(Byte.class).isAssignableFrom(Byte.class), is(true));
    }

    @Test
    public void testIsAssignableFrom_char() {
        assertThat(TypeAssignment.of(char.class).isAssignableFrom(char.class), is(true));
        assertThat(TypeAssignment.of(char.class).isAssignableFrom(Character.class), is(true));
        assertThat(TypeAssignment.of(Character.class).isAssignableFrom(char.class), is(true));
        assertThat(TypeAssignment.of(Character.class).isAssignableFrom(Character.class), is(true));
    }

    @Test
    public void testIsAssignableFrom_short() {
        assertThat(TypeAssignment.of(short.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(short.class).isAssignableFrom(Short.class), is(true));
        assertThat(TypeAssignment.of(Short.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(Short.class).isAssignableFrom(Short.class), is(true));
        assertThat(TypeAssignment.of(short.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(short.class).isAssignableFrom(Byte.class), is(false));
        assertThat(TypeAssignment.of(Short.class).isAssignableFrom(byte.class), is(false));
        assertThat(TypeAssignment.of(Short.class).isAssignableFrom(Byte.class), is(false));
    }

    @Test
    public void testIsAssignableFrom_int() {
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(int.class), is(true));
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(Integer.class), is(true));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(int.class), is(true));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(Integer.class), is(true));
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(short.class), is(false));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(int.class).isAssignableFrom(Byte.class), is(false));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(byte.class), is(false));
        assertThat(TypeAssignment.of(Integer.class).isAssignableFrom(Byte.class), is(false));
    }

    @Test
    public void testIsAssignableFrom_long() {
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(long.class), is(true));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(Long.class), is(true));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(long.class), is(true));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(Long.class), is(true));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(int.class), is(true));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(int.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(short.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(long.class).isAssignableFrom(Byte.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(byte.class), is(false));
        assertThat(TypeAssignment.of(Long.class).isAssignableFrom(Byte.class), is(false));
    }

    @Test
    public void testIsAssignableFrom_float() {
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(float.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(Float.class), is(true));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(float.class), is(true));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(Float.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(long.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(Long.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(long.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(Long.class), is(false));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(int.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(int.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(short.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(float.class).isAssignableFrom(Byte.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(byte.class), is(false));
        assertThat(TypeAssignment.of(Float.class).isAssignableFrom(Byte.class), is(false));
    }

    @Test
    public void testIsAssignableFrom_double() {
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(double.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Double.class), is(true));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(double.class), is(true));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Double.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(float.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Float.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(float.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Float.class), is(false));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(long.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Long.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(long.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Long.class), is(false));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(int.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(int.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Integer.class), is(false));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(short.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(short.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Short.class), is(false));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(byte.class), is(true));
        assertThat(TypeAssignment.of(double.class).isAssignableFrom(Byte.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(byte.class), is(false));
        assertThat(TypeAssignment.of(Double.class).isAssignableFrom(Byte.class), is(false));
    }

    @Test
    public void testIsAssignableFrom_() {
        assertThat(TypeAssignment.of(CharSequence.class).isAssignableFrom(CharSequence.class), is(true));
        assertThat(TypeAssignment.of(CharSequence.class).isAssignableFrom(String.class), is(true));
        assertThat(TypeAssignment.of(CharSequence.class).isAssignableFrom(StringBuilder.class), is(true));
        assertThat(TypeAssignment.of(CharSequence.class).isAssignableFrom(StringBuffer.class), is(true));
        assertThat(TypeAssignment.of(CharSequence.class).isAssignableFrom(Character.class), is(false));
    }

}


text:
readonly LOG_INFO="INFO"
readonly LOG_WARNING="WARN"
readonly LOG_ERROR="ERROR"

##################################
# Format of the timestamp used in the log files
##################################
ts_format() {
	echo "%Y%m%d_%H%M%S"
}

##################################
# Append an information message in a log file
# 	The 2nd argument is optional, the function can also
#	read data from the pipe
# Param 1: log file name (incl. path)
# Param 2: text to be logged
##################################
log_info() {
	log "$LOG_INFO" "$@"
}

##################################
# Append a warning message in a log file
# 	The 2nd argument is optional, the function can also
#	read data from the pipe
# Param 1: log file name (incl. path)
# Param 2: text to be logged
##################################
log_warning() {
	log "$LOG_WARNING" "$@"
}

##################################
# Append an information message in a log file
# 	The 2nd argument is optional, the function can also
#	read data from the pipe
# Param 1: log file name (incl. path)
# Param 2: text to be logged
##################################
log_error() {
	log "$LOG_ERROR" "$@"
}

##################################
# Append a line into a log file
# 	The 3rd argument is optional, the function can also
#	read data from the pipe
# Param 1: message criticality
# Param 2: path to the log file
# Param 3: message to be logged (optional)
# return: 1 if a bad log file path was provided
#	  0 otherwise
##################################
log() {
	local criticality logfile text line local_ifs returnCode
	criticality="$1"
	logfile="$2"

	# If the text to be logged was provided through as the 3rd argument
	if [ -n "$3" ]; then
		text=`format_log_txt "$criticality" "$3"`
		if [ -z "$logfile" ]; then
			echo "EMPTY LOG FILE NAME: $text"
			return 1
		elif ! echo "$logfile" | grep ".*[.]log$" >/dev/null; then
			echo "BAD LOG FILE EXTENSION ($logfile): $text"
			return 1
		elif [ ! -d `dirname "$logfile"` ]; then
			echo "LOG DIR NOT EXISTING ($logfile): $text"
			return 1
		else
			echo "$text" >> $logfile
			return 0
		fi

	# If the text to be logged was provided through the pipe
	else
		# IFS need to be changed so that the read cmd does not remove leading spaces
		local_ifs="$IFS"
		IFS=""

		returnCode="0"
		while read line; do
			# recursive call with pipe to avoid to handle this case specially
			log "$criticality" "$logfile" "$line" || returnCode="1"
		done

		# setting IFS back to its initial value
		IFS="$local_ifs"

		return "$returnCode"
	fi
}

##################################
# Append the date to the line to be logged
# Param 1: message criticality
# Param 2: text to be logged
##################################
format_log_txt() {

	local criticality text timestamp criticality_txt

	criticality="$1"
	text="$2"

	tsFormat=`ts_format`

	timestamp=`$BIN_DATE +$tsFormat`

	echo "$timestamp	$criticality	$text"

	return 0
}

##################################
# Echo the timestamp (in sec since 1970)
# of the oldest entry in the log file
#
# Param 1: file path
# Return : 0 if no error occured
#	   1 if the log file does not exist
#	   2 if the timestamp could not be computed
##################################
get_log_oldest_ts() {

	local f timestamp timestamp1970 tsFormat ret_code

	f="$1"
	tsFormat=`ts_format`

	# Check if the file exists
	if [ ! -s "$f" ]; then
		echo "The file \"$f\" does not exists"
		return 1
	fi

	# get the timestamp of the 1st log entry
	timestamp=`sed "1"!d "$f" | awk '{ print $1 }'`
 	timestamp1970=`$BIN_DATE -j -f "$tsFormat" "$timestamp" +"%s" 2>/dev/null`
	ret_code="$?"

	# check if the timestamp1970 could be extracted
	if [ "$ret_code" -eq "0" ]; then
		echo $timestamp1970
		return 0
	else
		echo "Timestamp could not be extracted of the log file"
		return 2
	fi
}

##################################
# Returns an extract of a log file
# The functions returns the log entries generated
# during the last x seconds (see args)
#
# Param 1: file path
# Param 2: duration (in seconds)
# Return : 0 if no error occurs
#	   1 if the log file does not exist
#	   2 if the log file does not contain any entry that is newer than
#		the given timestamp
##################################
get_log_entries() {
	local f t

	f="$1"
	t="$2"

	targetTimestamp1970=`$BIN_DATE -j -v-"$t"S +"%s"`

	get_log_entries_ts "$f" "$targetTimestamp1970"

	return "$?"
}

##################################
# Returns an extract of a log file
# The functions returns the log entries generated
# during since the timestamp (see args)
#
# Param 1: file path
# Param 2: timestamp (in seconds since 1970)
# Return : 0 if no error occurs
#	   1 if the log file does not exist
#	   2 if the log file does not contain any entry that is newer than
#		the given timestamp
##################################
get_log_entries_ts() {
	local f targetTimestamp1970 tsFormat nbLinesInFile firstLine lastLine diffLines \
		midLine currentLine timestamp currentTimestamp1970 diffTimestamp \
		firstLineTimestamp1970 diffFirstLineTimestamp lastLineTimestamp1970 diffLastLineTimestamp

	f="$1"
	targetTimestamp1970="$2"

	tsFormat=`ts_format`

	# Check if the file exists
	if [ ! -s "$f" ]; then
		echo "Impossible to retrieve log file, the file \"$f\" does not exists"
		return 1
	fi

	nbLinesInFile=`wc -l "$f" | awk ' { print $1 } '`	# find number of lines

	# if the file does not contain at least 1 line
	if [ "$nbLinesInFile" -lt "1" ]; then
		echo "No data available in the log file"
		return 2
	fi

 	firstLine=1
	lastLine=$nbLinesInFile
	diffLines=$(($lastLine-$firstLine))

	# Find the oldest line to be returned using dichotomy
	while [ "$diffLines" -gt "1" ]
	do

		# get the line in the middle of the 1st and last one
		midLine=$((($lastLine+$firstLine)/2))
		currentLine=`sed "$midLine"!d "$f"`

		# get the timestamp of the line
		timestamp=`echo "$currentLine" | awk '{ print $1 }'`
 		currentTimestamp1970=`$BIN_DATE -j -f "$tsFormat" "$timestamp" +"%s" 2>/dev/null`

		if [ "$?" -ne "0" ]; then
			echo "Bad timestamp format ($timestamp) in log file. Skipping file"
			return 1
		fi

		# decide which range shall be taken next
		diffTimestamp=$(($targetTimestamp1970-$currentTimestamp1970))

		if [ "$diffTimestamp" -gt "0" ]; then
			firstLine=$midLine
			lastLine=$lastLine
		else
			firstLine=$firstLine
			lastLine=$midLine
		fi

		diffLines=$(($lastLine-$firstLine))
	done

	# Now diffLines should equal 1 or 0

	currentLine=`sed "$firstLine"!d "$f"`
	timestamp=`echo "$currentLine" | awk '{ print $1 }'`
	firstLineTimestamp1970=`$BIN_DATE -j -f "$tsFormat" "$timestamp" +"%s" 2>/dev/null`
	diffFirstLineTimestamp=$(($targetTimestamp1970-$firstLineTimestamp1970))

	currentLine=`sed "$lastLine"!d "$f"`
	timestamp=`echo "$currentLine" | awk '{ print $1 }'`
	lastLineTimestamp1970=`$BIN_DATE -j -f "$tsFormat" "$timestamp" +"%s" 2>/dev/null`
	diffLastLineTimestamp=$(($targetTimestamp1970-$lastLineTimestamp1970))

	# refine the part of the log should be returned
	# If firstLine is new enough
	if [ "$diffFirstLineTimestamp" -le "0" ]; then
		tail -$(($nbLinesInFile-$firstLine+1)) "$f"
	# If lastLine is new enough
	elif [ "$diffLastLineTimestamp" -le "0" ]; then
		tail -$(($nbLinesInFile-$lastLine+1)) "$f"
	# Even the last line in the log is too old
	else
		echo "The data available in the log file are too old"
		return 2
	fi

	return 0
}


text:
require_relative '../lib/encryption_cipher'
require_relative '../lib/digraph'

describe EncryptionCipher do

  let(:encryption_cipher) { EncryptionCipher.new('meet me at hammersmith bridge tonight', 'CHARLES') }

  let(:cipher_with_invalid_keyword) { EncryptionCipher.new('Test Message', '')}

  let(:cipher_with_letter_j_present) { EncryptionCipher.new('Meet me in Hammersmith', 'JAMJAR')}

  it 'should return a message and digraph' do
    expect(encryption_cipher.message).to eq('meet me at hammersmith bridge tonight')

    expect(encryption_cipher.digraph.keyword.keyword).to eq('CHARLES')
  end

  it 'should take digraph array and message pairs' do
    encrypted_message = encryption_cipher.encrypt_message

    expect(encrypted_message).to eq('GDVBYTBCPRRKYKDCDIMPASHMEMDOUGKIRP')
  end

 it 'should return the original message pairs when decrypting the message' do
    encryption_message = encryption_cipher.encrypt_message

    decrypted_message = encryption_cipher.decrypt_message(encryption_message)

    expect(decrypted_message).to eq('MEXETMEATHAMXMERSMITHBRIDGETONIGHT')
  end

  it 'should return the correct encryption when a key containing letter J is used' do
    encryption_message = cipher_with_letter_j_present.encrypt_message

    expect(encryption_message).to eq('ELMLSRCMOKMRMEFMXERPLV')
  end

  context 'error should be thrown if an invalid keyword is entered' do
    subject { cipher_with_invalid_keyword }

    it { expect { subject}.to raise_error(ArgumentError) }
  end
end


text:
NEURAL_ARTISTIC_STYLE_DIR = '/home/daniel/app/neural_artistic_style'
import os
import subprocess
import shutil
import sys

def run():

	if os.path.isfile('.crunching.lck'):
		return False
	os.mknod('.crunching.lck')

	style = sys.argv[1]
	subject = sys.argv[2]

	if os.path.isdir(os.path.join('images', 'animation')):
		shutil.rmtree(os.path.join('images', 'animation'))
	args = ['python', '-u', os.path.join(NEURAL_ARTISTIC_STYLE_DIR, 'neural_artistic_style.py'), \
		'--style', style, \
		'--subject', subject, \
		'--iterations', '200', \
		'--vgg19', os.path.join(NEURAL_ARTISTIC_STYLE_DIR, 'imagenet-vgg-verydeep-19.mat'), \
		'--output', os.path.join('images', 'out.png'), \
		'--animation', os.path.join('images', 'animation')]

	with open('log.log', 'w') as log_file:
		p = subprocess.Popen(args, stdout=log_file)
		p.wait()

	os.remove('.crunching.lck')
	return True

if __name__ == '__main__':
	run()


text:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import Register from './login/register';

export default class App extends React.Component<{}, {}> {
    render() {
        return (
            <div>
                <Register />
            </div>
        );
    }
}

ReactDOM.render(
    <App />,
    document.getElementById("example")
);


text:
namespace media {

// Parser for WebM Tracks element.
class MEDIA_EXPORT WebMTracksParser : public WebMParserClient {
 public:
  explicit WebMTracksParser(const LogCB& log_cb);
  virtual ~WebMTracksParser();

  // Parses a WebM Tracks element in |buf|.
  //
  // Returns -1 if the parse fails.
  // Returns 0 if more data is needed.
  // Returns the number of bytes parsed on success.
  int Parse(const uint8* buf, int size);

  int64 audio_track_num() const { return audio_track_num_; }
  int64 video_track_num() const { return video_track_num_; }
  const std::set<int64>& ignored_tracks() const { return ignored_tracks_; }

  const std::string& audio_encryption_key_id() const {
    return audio_encryption_key_id_;
  }

  const AudioDecoderConfig& audio_decoder_config() {
    return audio_decoder_config_;
  }

  const std::string& video_encryption_key_id() const {
    return video_encryption_key_id_;
  }

  const VideoDecoderConfig& video_decoder_config() {
    return video_decoder_config_;
  }

  struct TextTrackInfo {
    TextKind kind;
    std::string name;
    std::string language;
  };

  typedef std::map<int64, TextTrackInfo> TextTracks;

  const TextTracks& text_tracks() const {
    return text_tracks_;
  }

 private:
  // WebMParserClient implementation.
  virtual WebMParserClient* OnListStart(int id) OVERRIDE;
  virtual bool OnListEnd(int id) OVERRIDE;
  virtual bool OnUInt(int id, int64 val) OVERRIDE;
  virtual bool OnFloat(int id, double val) OVERRIDE;
  virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE;
  virtual bool OnString(int id, const std::string& str) OVERRIDE;

  int64 track_type_;
  int64 track_num_;
  std::string track_name_;
  std::string track_language_;
  std::string codec_id_;
  std::vector<uint8> codec_private_;
  scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_;

  int64 audio_track_num_;
  int64 video_track_num_;
  TextTracks text_tracks_;
  std::set<int64> ignored_tracks_;
  std::string audio_encryption_key_id_;
  std::string video_encryption_key_id_;
  LogCB log_cb_;

  WebMAudioClient audio_client_;
  AudioDecoderConfig audio_decoder_config_;

  WebMVideoClient video_client_;
  VideoDecoderConfig video_decoder_config_;

  DISALLOW_COPY_AND_ASSIGN(WebMTracksParser);
};

}  // namespace media

#endif  // MEDIA_WEBM_WEBM_TRACKS_PARSER_H_


text:
using System;
using System.Linq;
using System.Net;
using System.Text;
using Ninefold.Core;

namespace Ninefold.Storage
{
    public class StorageCommandAuthenticator : IStorageCommandAuthenticator
    {
        public void AuthenticateRequest(WebRequest request, string base64Secret)
        {
            var secret = Convert.FromBase64String(base64Secret);
            var hashingAlg = new System.Security.Cryptography.HMACSHA1(secret);

            var canonHeaders = request.Headers.AllKeys
                .Where(h => h.StartsWith("x-emc", StringComparison.InvariantCultureIgnoreCase))
                .OrderBy(h => h.ToLowerInvariant())
                .Select(h => h + ":" + request.Headers[h].Trim())
                .Aggregate(string.Empty, (current, header) => current + header + "\n")
                .TrimEnd('\n');

            var contentType = request.ContentType ?? string.Empty;
            var range = request.Headers["range"] ?? string.Empty;
            var date = request.Headers["date"] ?? string.Empty;
            var requestRelativeUri = Uri.UnescapeDataString(request.RequestUri.Segments.Aggregate(string.Empty, (current, segment) => current + segment) + request.RequestUri.Query);

            var hashString = request.Method + "\n" +
                             contentType + "\n" +
                             range + "\n" +
                             date + "\n" +
                             requestRelativeUri + "\n" +
                             canonHeaders;

            var signature = Convert.ToBase64String(hashingAlg.ComputeHash(Encoding.Default.GetBytes(hashString)));
            request.Headers.Add("x-emc-signature", signature);
        }
    }
}


text:
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems                */
/*                                                                            */
/* 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.                                             */
/* -------------------------------------------------------------------------- */

define(function(require) {

  var Config = require('sunstone-config');

  function _counterAnimation(domClass, value, extra) {
    var time = 1500;

    if ( !Config.doCountAnimation ){
      time = 1;
    }

    if(!extra){
      extra = "";
    }
    $(domClass).each(function () {
      $(this).prop('Counter', 0).animate({
          Counter: value
      }, {
          duration: time,
          easing: 'swing',
          step: function (now) {
              $(this).text(Math.ceil(now) + " " + extra);
          }
      });
    });
  }

  function _counterAnimationDecimal(domClass, value, extra) {
    var time = 1500;

    if ( !Config.doCountAnimation ){
      time = 1;
    }

    if(!extra){
      extra = "";
    }
    $(domClass).each(function () {
      $(this).prop('Counter', 0).animate({
          Counter: value
      }, {
          duration: time,
          easing: 'swing',
          step: function (now) {
            $(this).text(Math.round(now*10)/10 + " " + extra);
          }
      });
    });
  }

  return {
    "counterAnimation": _counterAnimation,
    "counterAnimationDecimal": _counterAnimationDecimal
  };
});


text: python setup.py sdist bdist_wheel


text:
from __future__ import unicode_literals
from frappe.model.document import Document

class DataExport(Document):
	pass


text:
static PGresult *
db_query_v(PGconn *dbconn, const char *stmt, va_list ap)
{
	PGresult *res;
	char *buf;

	vasprintf(&buf, stmt, ap);

	res = PQexec(dbconn, buf);
	free(buf);
	if (PQresultStatus(res) != PGRES_TUPLES_OK)
	{
		debug("query status was %s", PQresStatus(PQresultStatus(res)));
		PQclear(res);
		return NULL;
	}

	return res;
}

PGresult *
db_query(PGconn *dbconn, const char *stmt, ...)
{
	PGresult *res;
	va_list ap;

	va_start(ap, stmt);
	res = db_query_v(dbconn, stmt, ap);
	va_end(ap);

	return res;
}

static int
db_command_v(PGconn *dbconn, const char *stmt, va_list ap)
{
	PGresult *res;
	char *buf;

	vasprintf(&buf, stmt, ap);

	res = PQexec(dbconn, buf);
	free(buf);
	// TODO: communicate the SQLSTATE via some global variable back to errno
	if (PQresultStatus(res) != PGRES_COMMAND_OK)
	{
		debug("command status was %s", PQresStatus(PQresultStatus(res)));
		PQclear(res);
		return -EIO;
	}

	return 0;
}

int
db_command(PGconn *dbconn, const char *stmt, ...)
{
	int res;
	va_list ap;

	va_start(ap, stmt);
	res = db_command_v(dbconn, stmt, ap);
	va_end(ap);

	return res;
}

int
db_row_exists(PGconn *dbconn, const char *stmt, ...)
{
	PGresult *res;
	int n;
	va_list ap;

	va_start(ap, stmt);
	res = db_query_v(dbconn, stmt, ap);
	va_end(ap);

	n = PQntuples(res);
	PQclear(res);

	return n > 0;
}

int
dbpath_exists(const struct dbpath *dbpath, PGconn *dbconn)
{
	if (dbpath_is_root(*dbpath))
		return 1;

	if (dbpath_is_database(*dbpath))
		return db_row_exists(dbconn, "SELECT 1 FROM pg_database WHERE datname = '%s';", dbpath->database);

	if (dbpath_is_schema(*dbpath))
		return db_row_exists(dbconn, "SELECT 1 FROM pg_namespace WHERE nspname = '%s';", dbpath->schema);

	if (dbpath_is_table(*dbpath))
		return db_row_exists(dbconn, "SELECT 1 FROM pg_namespace n, pg_class c WHERE n.oid = c.relnamespace AND nspname = '%s' AND relname = '%s';", dbpath->schema, dbpath->table);

	if (dbpath_is_row(*dbpath))
		return db_row_exists(dbconn, "SELECT 1 FROM %s.%s WHERE ctid = '%s';", dbpath->schema, dbpath->table, rowname_to_ctid(dbpath->row));

	if (dbpath_is_column(*dbpath))
		return db_row_exists(dbconn, "SELECT 1 FROM pg_namespace n, pg_class c, pg_attribute a WHERE n.oid = c.relnamespace AND c.oid = a.attrelid AND nspname = '%s' AND relname = '%s' AND to_char(attnum, 'FM00') || '_' || attname = '%s';", dbpath->schema, dbpath->table, dbpath->column);

	return 0;
}

const char *
rowname_to_ctid(const char *row)
{
	return strrchr(row, '(');
}


text:
(function ($, anim) {
  $(document).on('click', '.card', function (e) {
    if ($(this).children('.card-reveal').length) {
      var $card = $(e.target).closest('.card');
      if ($card.data('initialOverflow') === undefined) {
        $card.data(
          'initialOverflow',
          $card.css('overflow') === undefined ? '' : $card.css('overflow')
        );
      }
      let $cardReveal = $(this).find('.card-reveal');
      if ($(e.target).is($('.card-reveal .card-title')) || $(e.target).is($('.card-reveal .card-title i'))) {
        // Make Reveal animate down and display none
        anim({
          targets: $cardReveal[0],
          translateY: 0,
          duration: 225,
          easing: 'easeInOutQuad',
          complete: function(anim) {
            let el = anim.animatables[0].target;
            $(el).css({ display: 'none'});
            $card.css('overflow', $card.data('initialOverflow'));
          }
        });
      }
      else if ($(e.target).is($('.card .activator')) ||
               $(e.target).is($('.card .activator i')) ) {
        $card.css('overflow', 'hidden');
        $cardReveal.css({ display: 'block'});
        anim({
          targets: $cardReveal[0],
          translateY: '-100%',
          duration: 300,
          easing: 'easeInOutQuad'
        });
      }
    }
  });
}( cash, anime));


text:
using UnityEngine;
using System.Collections;

public class ScreenShake : MonoBehaviour {

    public Vector3 shakeScale = new Vector3(1f, 1f, 1f);  // Allows me to control how much this object shakes on each axis.

	float currentShake = 0f;   // How much the screen is currently shaking.
	float shakeAmount = 0.3f;   // How much the screen should shake at it's most shakey shaking.
    float shakeTimer = 0f;
    float vibrateAmount = 0.009f;    // How much the screen should vibrate to encourage zfighting.
	float decreaseFactor = 0.5f;    // How quickly the shake should decrease.
    float moveBackSpeed = 3f; // How quickly elements of the screen should move back to their original position after the shake ends.

    bool useDrift = false;

    // Ambient drift is used to make the screen drift apart when the gun is out of tune.
    const float ambientDriftMax = 0f;
    Vector3 currentDriftPosition = Vector3.zero;
    Vector3 driftNoiseTime = Vector3.zero;
    Vector3 driftNoiseOffset;
    const float DRIFT_NOISE_SPEED = 1f;

	Vector3 originalPosition;

	void Awake()
    {
		originalPosition = transform.localPosition;
        currentDriftPosition = originalPosition;

        driftNoiseOffset = Random.insideUnitSphere * 100f;
    }

	void Update()
    {
        // If the screen is currently shaking.
        if (shakeTimer > 0f)
        {
            // Get a random position relative to the drift position.
            Vector3 shakePosition = new Vector3(
                currentDriftPosition.x + Random.Range(-1f, 1f) * currentShake * shakeScale.x,
                currentDriftPosition.y + Random.Range(-1f, 1f) * currentShake * shakeScale.y,
                currentDriftPosition.z + Random.Range(-1f, 1f) * currentShake * shakeScale.z
            );

            // Update position.
            currentDriftPosition = shakePosition;

            // Decrease current shake.
            if (Time.timeScale == 0f) { currentShake = 0; }
            else { currentShake = Mathf.Clamp(currentShake - Time.deltaTime * decreaseFactor, 0f, 1000f); }
            //Debug.Log("current shake: " + currentShake);
            shakeTimer -= Time.deltaTime;
		}

        // If this object is not current shaking or has finished shaking.
        else if (useDrift)
        {
            // Set current shake to exaclty 0.
			currentShake = 0.0f;
            shakeTimer = 0f;

            // Move back towards original position.
            Vector3 newPosition = Vector3.Lerp(currentDriftPosition, originalPosition, moveBackSpeed * Time.deltaTime);
            currentDriftPosition = newPosition;
        }

        else {
            currentDriftPosition = originalPosition;
        }

        transform.localPosition = currentDriftPosition;
    }

    // Increase shake magnitude by a certain ammount.
	public void IncreaseShake(float increaseAmount) {
        currentShake += increaseAmount;
        shakeTimer = 0.5f;
	}

    // Set shake magnitude directly.
    public void SetShake(float magnitude, float time) {
        currentShake = magnitude;
        shakeTimer = time;
    }
}


text:
namespace osoa {
class TcpSession;
typedef boost::shared_ptr<TcpSession> TcpSessionPtr;
}  // namespace osoa

#endif  // SERVICE_COMMS_TCP_SESSION_FWD_H_


text:
[Amazon S3](https://aws.amazon.com/s3/) is a high-durability key-value store.

To use S3 with Perkeep, you need to:

* Sign up for an Amazon Web Services account.
* Sign into the AWS console, navigate to 'S3'.
* Create an S3 bucket for your Perkeep backups (Perkeep will not work if you put other files in this bucket).
* Configure your Perkeep server to sync blobs to the S3 bucket.

It is advisable to use a dedicated key/secret for Perkeep:

* Sign into the AWS console, navigate to 'Identity & Access Management' and click 'Users'.
* Click 'Create new users' and create a user for Perkeep (keep 'Generate an access key' checked).
* Click 'Show User Security Credentials' to get the users Access key and Secret key - these will be required to configure Perkeep and can't be obtained after you leave this screen.
* Go back to the user list and select the new user, and on the 'permissions' tab add the following 'inline policy' (replacing YOUR_BUCKET_NAME with the name of the bucket you created):

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Resource": [
                "arn:aws:s3:::YOUR_BUCKET_NAME",
                "arn:aws:s3:::YOUR_BUCKET_NAME/*"
            ],
            "Sid": "Stmt1464826210000",
            "Effect": "Allow",
            "Action": [
                "s3:DeleteObject",
                "s3:GetBucketLocation",
                "s3:GetObject",
                "s3:ListBucket",
                "s3:PutObject"
            ]
        }
    ]
}
```

Finally, add the s3 config line to your Perkeep `server-config.json`:
```
"s3": "accessKey:secretKey:bucketName[/optional/dir][:hostname]"
```

## B2

[Backblaze B2](https://www.backblaze.com/b2/cloud-storage.html) is simple, reliable, affordable object storage.

To use b2 with Perkeep, you need to:

* Sign up for a Backblaze account.
* Sign in to the Backblaze console, navigate to 'Buckets'.
* Create a bucket for your Perkeep backups (Perkeep will not work if you put other files on this bucket).
* Configure your perkeep server to sync blobs to the Backblaze bucket.

It is advisable to create a dedicated Application Key for Perkeep:

* Sign in to the Backblaze console, navigate to 'App Keys'.
* Click 'Add a New Application Key'.
* Give it a name, for example 'perkeep'.
* Allow access to the bucket that you just created.
* Choose 'Read and Write'.
* Click 'Create New Key'.

Finally, add the b2 config line to your perkeep `server-config.json`:
```
"b2": "accessKey:secretKey:bucketName[/optional/dir][:hostname]"
```

- `hostname` can be found on the backblaze buckets' interface https://secure.backblaze.com/b2_buckets.htm.

## Google Cloud Storage (GCS)

[Google Cloud Storage (GCS)](https://cloud.google.com/storage/) Reliable and secure object storage.

To use GCS with Perkeep, you need to:

* Sign up for a Google Cloud Platform account.
* Sign in to the GCP console, navigate to 'Storage'.
* [Create a bucket](https://cloud.google.com/storage/docs/creating-buckets#create_a_new_bucket)
* Configure your perkeep server to sync blobs to the GCS bucket by adding the following to your perkeep `service-config.json`:

```
"googlecloudstorage": "clientId:clientSecret:refreshToken:bucketName[/optional/dir]"
```

NOTE: The `clientId` and `clientSecret` could come from `$HOME/.config/gcloud/application_default_credentials.json`
or you could create a new service account following [this guide](https://support.google.com/workspacemigrate/answer/10839762).


text:
package com.commonsware.cwac.preso;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

/**
 * A WebViewFragment workalike that mirrors its WebView to a supplied
 * Mirror.
 */
public class MirroringWebViewFragment extends MirroringFragment {
  private WebView mWebView;
  private boolean mIsWebViewAvailable;

  /**
   * {@inheritDoc}
   */
  @Override
  protected View onCreateMirroredContent(LayoutInflater inflater,
                                         ViewGroup container,
                                         Bundle savedInstanceState) {
    if (mWebView != null) {
      mWebView.destroy();
    }

    mWebView=new WebView(getActivity());
    mIsWebViewAvailable=true;
    return mWebView;
  }

  /**
   * Called when the fragment is visible to the user and
   * actively running. Resumes the WebView.
   */
  @Override
  public void onPause() {
    super.onPause();

    mWebView.onPause();
  }

  /**
   * Called when the fragment is no longer resumed. Pauses
   * the WebView.
   */
  @Override
  public void onResume() {
    mWebView.onResume();

    super.onResume();
  }

  /**
   * Called when the WebView has been detached from the
   * fragment. The WebView is no longer available after this
   * time.
   */
  @Override
  public void onDestroyView() {
    mIsWebViewAvailable=false;
    super.onDestroyView();
  }

  /**
   * Called when the fragment is no longer in use. Destroys
   * the internal state of the WebView.
   */
  @Override
  public void onDestroy() {
    if (mWebView != null) {
      mWebView.destroy();
      mWebView=null;
    }
    super.onDestroy();
  }

  /**
   * Gets the WebView.
   */
  public WebView getWebView() {
    return mIsWebViewAvailable ? mWebView : null;
  }
}


text:
{-|
Copyright   : (c) Dave Laing, 2017
License     : BSD3
Maintainer  : dave.laing.80@gmail.com
Stability   : experimental
Portability : non-portable
-}
module Fragment.KiBase.Ast (
    module X
  ) where

import Fragment.KiBase.Ast.Kind as X


text:
define("dojox/layout/BorderContainer", ["dojo","dijit","dojox"], function(dojo,dijit,dojox){
dojo.provide("dojox.layout.BorderContainer");

console.error("dojox.layout.BorderContainer moved to dijit.layout.BorderContainer");
});


text:
import { Injectable } from '@angular/core';
import {Actions, Effect, toPayload} from '@ngrx/effects';
import { Observable } from 'rxjs/Observable';
import { Action } from '@ngrx/store';
import * as account from '../actions/account';
import { of } from 'rxjs/observable/of';
import {FbAccountService} from '../services/fbaccount.service';

@Injectable()
export class AccountEffects {
    /**
     * This effect makes use of the `startWith` operator to trigger
     * the effect immediately on startup.
     */
    @Effect()
    load$: Observable<Action> = this.actions$
        .ofType(account.LOAD)
        .startWith(new account.LoadAction())
        .switchMap(async () => {
            let accounts = await this.fbAccountService.getAll().toArray();
            return new account.LoadCompleteAction(accounts);
        });

    constructor(private actions$: Actions, private fbAccountService: FbAccountService) {
    }
}


text:
<?php
/**
 * PipelineBranchesitemTest
 *
 * PHP version 8.1.1
 *
 * @category Class
 * @package  OpenAPI\Server\Tests\Model
 * @author   openapi-generator contributors
 * @link     https://github.com/openapitools/openapi-generator
 */

/**
 * Swaggy Jenkins
 *
 * Jenkins API clients generated from Swagger / Open API specification
 *
 * The version of the OpenAPI document: 1.5.1-pre.0
 * Contact: blah@cliffano.com
 * Generated by: https://github.com/openapitools/openapi-generator.git
 *
 */

/**
 * NOTE: This class is auto generated by the openapi generator program.
 * https://github.com/openapitools/openapi-generator
 * Please update the test case below to test the model.
 */

namespace OpenAPI\Server\Model;

use PHPUnit\Framework\TestCase;

/**
 * PipelineBranchesitemTest Class Doc Comment
 *
 * @category    Class */
// * @description PipelineBranchesitem
/**
 * @package     OpenAPI\Server\Tests\Model
 * @author      openapi-generator contributors
 * @link        https://github.com/openapitools/openapi-generator
 */
class PipelineBranchesitemTest extends TestCase
{

    /**
     * Setup before running any test case
     */
    public static function setUpBeforeClass(): void
    {
    }

    /**
     * Setup before running each test case
     */
    public function setUp(): void
    {
    }

    /**
     * Clean up after running each test case
     */
    public function tearDown(): void
    {
    }

    /**
     * Clean up after running all test cases
     */
    public static function tearDownAfterClass(): void
    {
    }

    /**
     * Test "PipelineBranchesitem"
     */
    public function testPipelineBranchesitem()
    {
        $testPipelineBranchesitem = new PipelineBranchesitem();
    }

    /**
     * Test attribute "displayName"
     */
    public function testPropertyDisplayName()
    {
    }

    /**
     * Test attribute "estimatedDurationInMillis"
     */
    public function testPropertyEstimatedDurationInMillis()
    {
    }

    /**
     * Test attribute "name"
     */
    public function testPropertyName()
    {
    }

    /**
     * Test attribute "weatherScore"
     */
    public function testPropertyWeatherScore()
    {
    }

    /**
     * Test attribute "latestRun"
     */
    public function testPropertyLatestRun()
    {
    }

    /**
     * Test attribute "organization"
     */
    public function testPropertyOrganization()
    {
    }

    /**
     * Test attribute "pullRequest"
     */
    public function testPropertyPullRequest()
    {
    }

    /**
     * Test attribute "totalNumberOfPullRequests"
     */
    public function testPropertyTotalNumberOfPullRequests()
    {
    }

    /**
     * Test attribute "class"
     */
    public function testPropertyClass()
    {
    }
}


text:
app.directive('rsRequestBody', function($compile, PayloadTemplates) {
  return {
    restrict: 'E',
    scope: {
      payload: '='
    },
    link: function(scope, element, attrs) {
      // use the attribute type name to find the template
      var alt, name = (scope.payload.type ? scope.payload.type.name : null) || 'default';

      if(scope.payload.type) {
        scope.attributes = scope.payload.type.attributes;
      }

      if(name === 'Struct') {
        name = 'PraxisBody',
        alt = 'Struct'
      }

      PayloadTemplates.resolve(name, alt).then(function(template) {
        element.replaceWith($compile(template)(scope));
      });
    }
  }
});


text:
/*
 * (c) 2015 CenturyLink. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.centurylink.cloud.sdk.core.services.filter;

import com.centurylink.cloud.sdk.core.services.SdkThreadPool;

import java.util.List;
import java.util.stream.Stream;

import static com.centurylink.cloud.sdk.core.preconditions.Preconditions.checkNotNull;

/**
 * @author Ilya Drabenia
 */
public interface FilterService<F extends Filter<F>, M> {

    /**
     * Method find all resources satisfied by specified filter
     *
     * @param filter is not null search filter
     * @return list of found resource
     */
    default List<M> find(F filter) {
        checkNotNull(filter, "Filter must be not a null");

        return SdkThreadPool.executeParallel(findLazy(filter));
    }

    /**
     * Method find all resources satisfied by specified filter
     *
     * @param filter is not null search filter
     * @return stream of found resource
     */
    Stream<M> findLazy(F filter);

}


text:
<?xml version="1.0"?>
<package>
  <name>joy_motion</name>
  <version>0.0.1</version>
  <description>The joy_motion package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
 <maintainer email="eric@busboom.org">Eric Busboom</maintainer>

  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>rospy</build_depend>
  <run_depend>rospy</run_depend>
  <run_depend>motion_control</run_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>


text:
<?php echo $action; ?> Product

            <form name="frmOne" class="form-horizontal" action="" method="post">

                    Seller Name

                        <input type="text" value="<?php echo isset($post)?$post->name:''; ?>" class="form-control" name="batch[name]" id="get_names_product" placeholder="Enter S/C Name">

                    Paid

                        <input type="text" value="<?php echo isset($post)?$post->cash_amount:''; ?>" class="form-control" name="batch[cash_amount]" placeholder="Enter Amount Received">

                        <button type="submit" style="color:white; background:#3fa9f5;" class="btn btn-default" >Submit</button>

            </form>