text:
import threading
import os
import json
import logging

from vcloud_cloudinfo import VcloudCloudInfo
from heat.engine.resources.cloudmanager.environmentinfo import *
from heat.engine.resources.cloudmanager.commonutils import *
from heat.openstack.common import log as logging

LOG=logging.getLogger(__name__)

def vcloud_cloud_2_dict(obj):
    result = {}
    result.update(obj.__dict__)
    return result

def dict_2_vcloud_cloud(vcloud_dict):

    vcloud_cloud = VcloudCloudInfo()

    vcloud_cloud.get_exist_cloud(cloud_id=vcloud_dict["cloud_id"],
                         vcloud_url=vcloud_dict["vcloud_url"],
                         vcloud_org=vcloud_dict["vcloud_org"],
                         vcloud_vdc=vcloud_dict["vcloud_vdc"],
                         vcloud_edgegw=vcloud_dict["vcloud_edgegw"],
                         username=vcloud_dict["username"],
                         passwd=vcloud_dict["passwd"],
                         region_name=vcloud_dict["region_name"],
                         availabilityzone=vcloud_dict["availabilityzone"],
                         azname=vcloud_dict["azname"],
                         cascaded_domain=vcloud_dict["cascaded_domain"],
                         cascaded_eip=vcloud_dict["cascaded_eip"],
                         vpn_eip=vcloud_dict["vpn_eip"],
                         cloud_proxy=vcloud_dict["cloud_proxy"],
                         driver_type=vcloud_dict["driver_type"],
                         access=vcloud_dict["access"],
                         with_ceph=vcloud_dict["with_ceph"])

    return vcloud_cloud

vcloud_cloud_data_file = os.path.join("/home/hybrid_cloud/data/vcloud",
                                   "vcloud_access_cloud.data")
vcloud_cloud_data_file_lock = threading.Lock()

class VcloudCloudDataHandler(object):
    def __init__(self):
        pass

    def list_vcloud_clouds(self):
        cloud_dicts = self.__read_vcloud_cloud_info__()
        return cloud_dicts.keys()

    def get_vcloud_cloud(self, cloud_id):
        cloud_dicts = self.__read_vcloud_cloud_info__()
        if cloud_id in cloud_dicts.keys():
            return dict_2_vcloud_cloud(cloud_dicts[cloud_id])
        else:
            return None

    def delete_vcloud_cloud(self, cloud_id):
        vcloud_cloud_data_file_lock.acquire()
        try:
            cloud_dicts = self.__read_vcloud_cloud_info__()
            cloud_dicts.pop(cloud_id)
            self.__write_vcloud_cloud_info__(cloud_dicts)
        except Exception as e:
            LOG.error("delete vcloud cloud data file error, "
                         "cloud_id: %s, error: %s"
                         % (cloud_id, e.message))
        finally:
            vcloud_cloud_data_file_lock.release()

    def add_vcloud_cloud(self, vcloud_cloud):
        vcloud_cloud_data_file_lock.acquire()
        try:
            cloud_dicts = self.__read_vcloud_cloud_info__()
            dict_temp = vcloud_cloud_2_dict(vcloud_cloud)
            cloud_dicts[vcloud_cloud.cloud_id] = dict_temp
            self.__write_vcloud_cloud_info__(cloud_dicts)
        except Exception as e:
            LOG.error("add vcloud cloud data file error, "
                         "vcloud_cloud: %s, error: %s"
                         % (vcloud_cloud, e.message))
        finally:
            vcloud_cloud_data_file_lock.release()

    @staticmethod
    def __read_vcloud_cloud_info__():
        if not os.path.exists(vcloud_cloud_data_file):
            LOG.error("read %s : No such file." % vcloud_cloud_data_file)
            cloud_dicts = {}
        else:
            with open(vcloud_cloud_data_file, 'r+') as fd:
                cloud_dicts = json.loads(fd.read())
        return cloud_dicts

    @staticmethod
    def __write_vcloud_cloud_info__(cloud_dicts):
        with open(vcloud_cloud_data_file, 'w+') as fd:
            fd.write(json.dumps(cloud_dicts, indent=4))


text:
module MarkLogic
  module Queries
    class BoostQuery< BaseQuery
      def initialize(matching_query, boosting_query)
        @matching_query = matching_query
        @boosting_query = boosting_query
      end

      def to_xqy
        %Q{cts:boost-query(#{@matching_query.to_xqy},#{@boosting_query.to_xqy})}
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package org.apache.flink.cep;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.typeutils.EitherTypeInfo;
import org.apache.flink.api.java.typeutils.TypeExtractor;
import org.apache.flink.cep.operator.CEPOperatorUtils;
import org.apache.flink.cep.pattern.Pattern;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.types.Either;
import org.apache.flink.util.Collector;

import java.util.List;
import java.util.Map;

/**
 * Stream abstraction for CEP pattern detection. A pattern stream is a stream which emits detected
 * pattern sequences as a map of events associated with their names. The pattern is detected using a
 * {@link org.apache.flink.cep.nfa.NFA}. In order to process the detected sequences, the user
 * has to specify a {@link PatternSelectFunction} or a {@link PatternFlatSelectFunction}.
 *
 *
Additionally it allows to handle partially matched event patterns which have timed out. For this
 * the user has to specify a {@link PatternTimeoutFunction} or a {@link PatternFlatTimeoutFunction}.
 *
 * @param <T> Type of the events
 */
public class PatternStream<T> {

	// underlying data stream
	private final DataStream<T> inputStream;

	private final Pattern<T, ?> pattern;

	PatternStream(final DataStream<T> inputStream, final Pattern<T, ?> pattern) {
		this.inputStream = inputStream;
		this.pattern = pattern;
	}

	public Pattern<T, ?> getPattern() {
		return pattern;
	}

	public DataStream<T> getInputStream() {
		return inputStream;
	}

	/**
	 * Applies a select function to the detected pattern sequence. For each pattern sequence the
	 * provided {@link PatternSelectFunction} is called. The pattern select function can produce
	 * exactly one resulting element.
	 *
	 * @param patternSelectFunction The pattern select function which is called for each detected
	 *                              pattern sequence.
	 * @param <R> Type of the resulting elements
	 * @return {@link DataStream} which contains the resulting elements from the pattern select
	 *         function.
	 */
	public <R> SingleOutputStreamOperator<R> select(final PatternSelectFunction<T, R> patternSelectFunction) {
		// we have to extract the output type from the provided pattern selection function manually
		// because the TypeExtractor cannot do that if the method is wrapped in a MapFunction

		TypeInformation<R> returnType = TypeExtractor.getUnaryOperatorReturnType(
			patternSelectFunction,
			PatternSelectFunction.class,
			1,
			-1,
			inputStream.getType(),
			null,
			false);

		return select(patternSelectFunction, returnType);
	}

	/**
	 * Applies a select function to the detected pattern sequence. For each pattern sequence the
	 * provided {@link PatternSelectFunction} is called. The pattern select function can produce
	 * exactly one resulting element.
	 *
	 * @param patternSelectFunction The pattern select function which is called for each detected
	 *                              pattern sequence.
	 * @param <R> Type of the resulting elements
	 * @param outTypeInfo Explicit specification of output type.
	 * @return {@link DataStream} which contains the resulting elements from the pattern select
	 *         function.
	 */
	public <R> SingleOutputStreamOperator<R> select(final PatternSelectFunction<T, R> patternSelectFunction, TypeInformation<R> outTypeInfo) {
		SingleOutputStreamOperator<Map<String, List<T>>> patternStream =
				CEPOperatorUtils.createPatternStream(inputStream, pattern);

		return patternStream.map(
			new PatternSelectMapper<>(
				patternStream.getExecutionEnvironment().clean(patternSelectFunction)))
			.returns(outTypeInfo);
	}

	/**
	 * Applies a select function to the detected pattern sequence. For each pattern sequence the
	 * provided {@link PatternSelectFunction} is called. The pattern select function can produce
	 * exactly one resulting element.
	 *
	 *
Applies a timeout function to a partial pattern sequence which has timed out. For each
	 * partial pattern sequence the provided {@link PatternTimeoutFunction} is called. The pattern
	 * timeout function can produce exactly one resulting element.
	 *
	 * @param patternTimeoutFunction The pattern timeout function which is called for each partial
	 *                               pattern sequence which has timed out.
	 * @param patternSelectFunction The pattern select function which is called for each detected
	 *                              pattern sequence.
	 * @param <L> Type of the resulting timeout elements
	 * @param <R> Type of the resulting elements
	 * @return {@link DataStream} which contains the resulting elements or the resulting timeout
	 * elements wrapped in an {@link Either} type.
	 */
	public <L, R> SingleOutputStreamOperator<Either<L, R>> select(
		final PatternTimeoutFunction<T, L> patternTimeoutFunction,
		final PatternSelectFunction<T, R> patternSelectFunction) {

		SingleOutputStreamOperator<Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>>> patternStream =
				CEPOperatorUtils.createTimeoutPatternStream(inputStream, pattern);

		TypeInformation<L> leftTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
			patternTimeoutFunction,
			PatternTimeoutFunction.class,
			1,
			-1,
			inputStream.getType(),
			null,
			false);

		TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
			patternSelectFunction,
			PatternSelectFunction.class,
			1,
			-1,
			inputStream.getType(),
			null,
			false);

		TypeInformation<Either<L, R>> outTypeInfo = new EitherTypeInfo<>(leftTypeInfo, rightTypeInfo);

		return patternStream.map(
			new PatternSelectTimeoutMapper<>(
				patternStream.getExecutionEnvironment().clean(patternSelectFunction),
				patternStream.getExecutionEnvironment().clean(patternTimeoutFunction)
			)
		).returns(outTypeInfo);
	}

	/**
	 * Applies a flat select function to the detected pattern sequence. For each pattern sequence
	 * the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
	 * can produce an arbitrary number of resulting elements.
	 *
	 * @param patternFlatSelectFunction The pattern flat select function which is called for each
	 *                                  detected pattern sequence.
	 * @param <R> Type of the resulting elements
	 * @return {@link DataStream} which contains the resulting elements from the pattern flat select
	 *         function.
	 */
	public <R> SingleOutputStreamOperator<R> flatSelect(final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) {
		// we have to extract the output type from the provided pattern selection function manually
		// because the TypeExtractor cannot do that if the method is wrapped in a MapFunction
		TypeInformation<R> outTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
			patternFlatSelectFunction,
			PatternFlatSelectFunction.class,
			1,
			0,
			inputStream.getType(),
			null,
			false);

		return flatSelect(patternFlatSelectFunction, outTypeInfo);
	}

	/**
	 * Applies a flat select function to the detected pattern sequence. For each pattern sequence
	 * the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
	 * can produce an arbitrary number of resulting elements.
	 *
	 * @param patternFlatSelectFunction The pattern flat select function which is called for each
	 *                                  detected pattern sequence.
	 * @param <R> Type of the resulting elements
	 * @param outTypeInfo Explicit specification of output type.
	 * @return {@link DataStream} which contains the resulting elements from the pattern flat select
	 *         function.
	 */
	public <R> SingleOutputStreamOperator<R> flatSelect(final PatternFlatSelectFunction<T, R> patternFlatSelectFunction, TypeInformation<R> outTypeInfo) {
		SingleOutputStreamOperator<Map<String, List<T>>> patternStream =
				CEPOperatorUtils.createPatternStream(inputStream, pattern);

		return patternStream.flatMap(
			new PatternFlatSelectMapper<>(
				patternStream.getExecutionEnvironment().clean(patternFlatSelectFunction)
			)).returns(outTypeInfo);
	}

	/**
	 * Applies a flat select function to the detected pattern sequence. For each pattern sequence
	 * the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
	 * can produce an arbitrary number of resulting elements.
	 *
	 *
Applies a timeout function to a partial pattern sequence which has timed out. For each
	 * partial pattern sequence the provided {@link PatternFlatTimeoutFunction} is called. The
	 * pattern timeout function can produce an arbitrary number of resulting elements.
	 *
	 * @param patternFlatTimeoutFunction The pattern flat timeout function which is called for each
	 *                                   partial pattern sequence which has timed out.
	 * @param patternFlatSelectFunction The pattern flat select function which is called for each
	 *                                  detected pattern sequence.
	 * @param <L> Type of the resulting timeout events
	 * @param <R> Type of the resulting events
	 * @return {@link DataStream} which contains the resulting events from the pattern flat select
	 * function or the resulting timeout events from the pattern flat timeout function wrapped in an
	 * {@link Either} type.
	 */
	public <L, R> SingleOutputStreamOperator<Either<L, R>> flatSelect(
		final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction,
		final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) {

		SingleOutputStreamOperator<Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>>> patternStream =
				CEPOperatorUtils.createTimeoutPatternStream(inputStream, pattern);

		TypeInformation<L> leftTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
			patternFlatTimeoutFunction,
			PatternFlatTimeoutFunction.class,
			1,
			-1,
			inputStream.getType(),
			null,
			false);

		TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
			patternFlatSelectFunction,
			PatternFlatSelectFunction.class,
			1,
			-1,
			inputStream.getType(),
			null,
			false);

		TypeInformation<Either<L, R>> outTypeInfo = new EitherTypeInfo<>(leftTypeInfo, rightTypeInfo);

		return patternStream.flatMap(
			new PatternFlatSelectTimeoutWrapper<>(
				patternStream.getExecutionEnvironment().clean(patternFlatSelectFunction),
				patternStream.getExecutionEnvironment().clean(patternFlatTimeoutFunction)
			)
		).returns(outTypeInfo);
	}

	/**
	 * Wrapper for a {@link PatternSelectFunction}.
	 *
	 * @param <T> Type of the input elements
	 * @param <R> Type of the resulting elements
	 */
	private static class PatternSelectMapper<T, R> implements MapFunction<Map<String, List<T>>, R> {
		private static final long serialVersionUID = 2273300432692943064L;

		private final PatternSelectFunction<T, R> patternSelectFunction;

		public PatternSelectMapper(PatternSelectFunction<T, R> patternSelectFunction) {
			this.patternSelectFunction = patternSelectFunction;
		}

		@Override
		public R map(Map<String, List<T>> value) throws Exception {
			return patternSelectFunction.select(value);
		}
	}

	private static class PatternSelectTimeoutMapper<T, L, R> implements MapFunction<Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>>, Either<L, R>> {

		private static final long serialVersionUID = 8259477556738887724L;

		private final PatternSelectFunction<T, R> patternSelectFunction;
		private final PatternTimeoutFunction<T, L> patternTimeoutFunction;

		public PatternSelectTimeoutMapper(
			PatternSelectFunction<T, R> patternSelectFunction,
			PatternTimeoutFunction<T, L> patternTimeoutFunction) {

			this.patternSelectFunction = patternSelectFunction;
			this.patternTimeoutFunction = patternTimeoutFunction;
		}

		@Override
		public Either<L, R> map(Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>> value) throws Exception {
			if (value.isLeft()) {
				Tuple2<Map<String, List<T>>, Long> timeout = value.left();

				return Either.Left(patternTimeoutFunction.timeout(timeout.f0, timeout.f1));
			} else {
				return Either.Right(patternSelectFunction.select(value.right()));
			}
		}
	}

	private static class PatternFlatSelectTimeoutWrapper<T, L, R> implements FlatMapFunction<Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>>, Either<L, R>> {

		private static final long serialVersionUID = 7483674669662261667L;

		private final PatternFlatSelectFunction<T, R> patternFlatSelectFunction;
		private final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction;

		public PatternFlatSelectTimeoutWrapper(
			PatternFlatSelectFunction<T, R> patternFlatSelectFunction,
			PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction) {
			this.patternFlatSelectFunction = patternFlatSelectFunction;
			this.patternFlatTimeoutFunction = patternFlatTimeoutFunction;
		}

		@Override
		public void flatMap(Either<Tuple2<Map<String, List<T>>, Long>, Map<String, List<T>>> value, Collector<Either<L, R>> out) throws Exception {
			if (value.isLeft()) {
				Tuple2<Map<String, List<T>>, Long> timeout = value.left();

				patternFlatTimeoutFunction.timeout(timeout.f0, timeout.f1, new LeftCollector<>(out));
			} else {
				patternFlatSelectFunction.flatSelect(value.right(), new RightCollector(out));
			}
		}

		private static class LeftCollector<L, R> implements Collector<L> {

			private final Collector<Either<L, R>> out;

			private LeftCollector(Collector<Either<L, R>> out) {
				this.out = out;
			}

			@Override
			public void collect(L record) {
				out.collect(Either.<L, R>Left(record));
			}

			@Override
			public void close() {
				out.close();
			}
		}

		private static class RightCollector<L, R> implements Collector<R> {

			private final Collector<Either<L, R>> out;

			private RightCollector(Collector<Either<L, R>> out) {
				this.out = out;
			}

			@Override
			public void collect(R record) {
				out.collect(Either.<L, R>Right(record));
			}

			@Override
			public void close() {
				out.close();
			}
		}
	}

	/**
	 * Wrapper for a {@link PatternFlatSelectFunction}.
	 *
	 * @param <T> Type of the input elements
	 * @param <R> Type of the resulting elements
	 */
	private static class PatternFlatSelectMapper<T, R> implements FlatMapFunction<Map<String, List<T>>, R> {

		private static final long serialVersionUID = -8610796233077989108L;

		private final PatternFlatSelectFunction<T, R> patternFlatSelectFunction;

		public PatternFlatSelectMapper(PatternFlatSelectFunction<T, R> patternFlatSelectFunction) {
			this.patternFlatSelectFunction = patternFlatSelectFunction;
		}

		@Override
		public void flatMap(Map<String, List<T>> value, Collector<R> out) throws Exception {
			patternFlatSelectFunction.flatSelect(value, out);
		}
	}
}


text:
<?php

namespace Symfony\Component\Form\Extension\Core\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Exception\LogicException;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\ReversedTransformer;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateType extends AbstractType
{
    public const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM;
    public const HTML5_FORMAT = 'yyyy-MM-dd';

    private const ACCEPTED_FORMATS = [
        \IntlDateFormatter::FULL,
        \IntlDateFormatter::LONG,
        \IntlDateFormatter::MEDIUM,
        \IntlDateFormatter::SHORT,
    ];

    private const WIDGETS = [
        'text' => TextType::class,
        'choice' => ChoiceType::class,
    ];

    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $dateFormat = \is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT;
        $timeFormat = \IntlDateFormatter::NONE;
        $calendar = \IntlDateFormatter::GREGORIAN;
        $pattern = \is_string($options['format']) ? $options['format'] : '';

        if (!\in_array($dateFormat, self::ACCEPTED_FORMATS, true)) {
            throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
        }

        if ('single_text' === $options['widget']) {
            if ('' !== $pattern && !str_contains($pattern, 'y') && !str_contains($pattern, 'M') && !str_contains($pattern, 'd')) {
                throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern));
            }

            $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
                $options['model_timezone'],
                $options['view_timezone'],
                $dateFormat,
                $timeFormat,
                $calendar,
                $pattern
            ));
        } else {
            if ('' !== $pattern && (!str_contains($pattern, 'y') || !str_contains($pattern, 'M') || !str_contains($pattern, 'd'))) {
                throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
            }

            $yearOptions = $monthOptions = $dayOptions = [
                'error_bubbling' => true,
                'empty_data' => '',
            ];
            // when the form is compound the entries of the array are ignored in favor of children data
            // so we need to handle the cascade setting here
            $emptyData = $builder->getEmptyData() ?: [];

            if ($emptyData instanceof \Closure) {
                $lazyEmptyData = static function ($option) use ($emptyData) {
                    return static function (FormInterface $form) use ($emptyData, $option) {
                        $emptyData = $emptyData($form->getParent());

                        return $emptyData[$option] ?? '';
                    };
                };

                $yearOptions['empty_data'] = $lazyEmptyData('year');
                $monthOptions['empty_data'] = $lazyEmptyData('month');
                $dayOptions['empty_data'] = $lazyEmptyData('day');
            } else {
                if (isset($emptyData['year'])) {
                    $yearOptions['empty_data'] = $emptyData['year'];
                }
                if (isset($emptyData['month'])) {
                    $monthOptions['empty_data'] = $emptyData['month'];
                }
                if (isset($emptyData['day'])) {
                    $dayOptions['empty_data'] = $emptyData['day'];
                }
            }

            if (isset($options['invalid_message'])) {
                $dayOptions['invalid_message'] = $options['invalid_message'];
                $monthOptions['invalid_message'] = $options['invalid_message'];
                $yearOptions['invalid_message'] = $options['invalid_message'];
            }

            if (isset($options['invalid_message_parameters'])) {
                $dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
                $monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
                $yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
            }

            $formatter = new \IntlDateFormatter(
                \Locale::getDefault(),
                $dateFormat,
                $timeFormat,
                // see https://bugs.php.net/66323
                class_exists(\IntlTimeZone::class, false) ? \IntlTimeZone::createDefault() : null,
                $calendar,
                $pattern
            );

            // new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/66323
            if (!$formatter) {
                throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code());
            }

            $formatter->setLenient(false);

            if ('choice' === $options['widget']) {
                // Only pass a subset of the options to children
                $yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years']));
                $yearOptions['placeholder'] = $options['placeholder']['year'];
                $yearOptions['choice_translation_domain'] = $options['choice_translation_domain']['year'];
                $monthOptions['choices'] = $this->formatTimestamps($formatter, '/[M|L]+/', $this->listMonths($options['months']));
                $monthOptions['placeholder'] = $options['placeholder']['month'];
                $monthOptions['choice_translation_domain'] = $options['choice_translation_domain']['month'];
                $dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days']));
                $dayOptions['placeholder'] = $options['placeholder']['day'];
                $dayOptions['choice_translation_domain'] = $options['choice_translation_domain']['day'];
            }

            // Append generic carry-along options
            foreach (['required', 'translation_domain'] as $passOpt) {
                $yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt];
            }

            $builder
                ->add('year', self::WIDGETS[$options['widget']], $yearOptions)
                ->add('month', self::WIDGETS[$options['widget']], $monthOptions)
                ->add('day', self::WIDGETS[$options['widget']], $dayOptions)
                ->addViewTransformer(new DateTimeToArrayTransformer(
                    $options['model_timezone'], $options['view_timezone'], ['year', 'month', 'day']
                ))
                ->setAttribute('formatter', $formatter)
            ;
        }

        if ('datetime_immutable' === $options['input']) {
            $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer());
        } elseif ('string' === $options['input']) {
            $builder->addModelTransformer(new ReversedTransformer(
                new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format'])
            ));
        } elseif ('timestamp' === $options['input']) {
            $builder->addModelTransformer(new ReversedTransformer(
                new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
            ));
        } elseif ('array' === $options['input']) {
            $builder->addModelTransformer(new ReversedTransformer(
                new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], ['year', 'month', 'day'])
            ));
        }
    }

    /**
     * {@inheritdoc}
     */
    public function finishView(FormView $view, FormInterface $form, array $options)
    {
        $view->vars['widget'] = $options['widget'];

        // Change the input to an HTML5 date input if
        //  * the widget is set to "single_text"
        //  * the format matches the one expected by HTML5
        //  * the html5 is set to true
        if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
            $view->vars['type'] = 'date';
        }

        if ($form->getConfig()->hasAttribute('formatter')) {
            $pattern = $form->getConfig()->getAttribute('formatter')->getPattern();

            // remove special characters unless the format was explicitly specified
            if (!\is_string($options['format'])) {
                // remove quoted strings first
                $pattern = preg_replace('/\'[^\']+\'/', '', $pattern);

                // remove remaining special chars
                $pattern = preg_replace('/[^yMd]+/', '', $pattern);
            }

            // set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy)
            // lookup various formats at http://userguide.icu-project.org/formatparse/datetime
            if (preg_match('/^([yMd]+)[^yMd]*([yMd]+)[^yMd]*([yMd]+)$/', $pattern)) {
                $pattern = preg_replace(['/y+/', '/M+/', '/d+/'], ['{{ year }}', '{{ month }}', '{{ day }}'], $pattern);
            } else {
                // default fallback
                $pattern = '{{ year }}{{ month }}{{ day }}';
            }

            $view->vars['date_pattern'] = $pattern;
        }
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $compound = function (Options $options) {
            return 'single_text' !== $options['widget'];
        };

        $placeholderDefault = function (Options $options) {
            return $options['required'] ? null : '';
        };

        $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) {
            if (\is_array($placeholder)) {
                $default = $placeholderDefault($options);

                return array_merge(
                    ['year' => $default, 'month' => $default, 'day' => $default],
                    $placeholder
                );
            }

            return [
                'year' => $placeholder,
                'month' => $placeholder,
                'day' => $placeholder,
            ];
        };

        $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) {
            if (\is_array($choiceTranslationDomain)) {
                $default = false;

                return array_replace(
                    ['year' => $default, 'month' => $default, 'day' => $default],
                    $choiceTranslationDomain
                );
            }

            return [
                'year' => $choiceTranslationDomain,
                'month' => $choiceTranslationDomain,
                'day' => $choiceTranslationDomain,
            ];
        };

        $format = function (Options $options) {
            return 'single_text' === $options['widget'] ? self::HTML5_FORMAT : self::DEFAULT_FORMAT;
        };

        $resolver->setDefaults([
            'years' => range((int) date('Y') - 5, (int) date('Y') + 5),
            'months' => range(1, 12),
            'days' => range(1, 31),
            'widget' => 'choice',
            'input' => 'datetime',
            'format' => $format,
            'model_timezone' => null,
            'view_timezone' => null,
            'placeholder' => $placeholderDefault,
            'html5' => true,
            // Don't modify \DateTime classes by reference, we treat
            // them like immutable value objects
            'by_reference' => false,
            'error_bubbling' => false,
            // If initialized with a \DateTime object, FormType initializes
            // this option to "\DateTime". Since the internal, normalized
            // representation is not \DateTime, but an array, we need to unset
            // this option.
            'data_class' => null,
            'compound' => $compound,
            'empty_data' => function (Options $options) {
                return $options['compound'] ? [] : '';
            },
            'choice_translation_domain' => false,
            'input_format' => 'Y-m-d',
            'invalid_message' => 'Please enter a valid date.',
        ]);

        $resolver->setNormalizer('placeholder', $placeholderNormalizer);
        $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);

        $resolver->setAllowedValues('input', [
            'datetime',
            'datetime_immutable',
            'string',
            'timestamp',
            'array',
        ]);
        $resolver->setAllowedValues('widget', [
            'single_text',
            'text',
            'choice',
        ]);

        $resolver->setAllowedTypes('format', ['int', 'string']);
        $resolver->setAllowedTypes('years', 'array');
        $resolver->setAllowedTypes('months', 'array');
        $resolver->setAllowedTypes('days', 'array');
        $resolver->setAllowedTypes('input_format', 'string');

        $resolver->setNormalizer('html5', function (Options $options, $html5) {
            if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
                throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class));
            }

            return $html5;
        });
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix(): string
    {
        return 'date';
    }

    private function formatTimestamps(\IntlDateFormatter $formatter, string $regex, array $timestamps)
    {
        $pattern = $formatter->getPattern();
        $timezone = $formatter->getTimeZoneId();
        $formattedTimestamps = [];

        $formatter->setTimeZone('UTC');

        if (preg_match($regex, $pattern, $matches)) {
            $formatter->setPattern($matches[0]);

            foreach ($timestamps as $timestamp => $choice) {
                $formattedTimestamps[$formatter->format($timestamp)] = $choice;
            }

            // I'd like to clone the formatter above, but then we get a
            // segmentation fault, so let's restore the old state instead
            $formatter->setPattern($pattern);
        }

        $formatter->setTimeZone($timezone);

        return $formattedTimestamps;
    }

    private function listYears(array $years)
    {
        $result = [];

        foreach ($years as $year) {
            $result[\PHP_INT_SIZE === 4 ? \DateTime::createFromFormat('Y e', $year.' UTC')->format('U') : gmmktime(0, 0, 0, 6, 15, $year)] = $year;
        }

        return $result;
    }

    private function listMonths(array $months)
    {
        $result = [];

        foreach ($months as $month) {
            $result[gmmktime(0, 0, 0, $month, 15)] = $month;
        }

        return $result;
    }

    private function listDays(array $days)
    {
        $result = [];

        foreach ($days as $day) {
            $result[gmmktime(0, 0, 0, 5, $day)] = $day;
        }

        return $result;
    }
}


text:
package options

import (
	"runtime"
	"time"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/kubernetes/pkg/kubelet/config"
)

const (
	// When these values are updated, also update test/e2e/framework/util.go
	defaultPodSandboxImageName    = "gcr.io/google_containers/pause"
	defaultPodSandboxImageVersion = "3.0"
	// From pkg/kubelet/rkt/rkt.go to avoid circular import
	defaultRktAPIServiceEndpoint = "localhost:15441"
)

var (
	defaultPodSandboxImage = defaultPodSandboxImageName +
		"-" + runtime.GOARCH + ":" +
		defaultPodSandboxImageVersion
)

// NewContainerRuntimeOptions will create a new ContainerRuntimeOptions with
// default values.
func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
	dockerEndpoint := ""
	if runtime.GOOS != "windows" {
		dockerEndpoint = "unix:///var/run/docker.sock"
	}

	return &config.ContainerRuntimeOptions{
		DockerEndpoint:            dockerEndpoint,
		DockershimRootDirectory:   "/var/lib/dockershim",
		DockerDisableSharedPID:    true,
		PodSandboxImage:           defaultPodSandboxImage,
		ImagePullProgressDeadline: metav1.Duration{Duration: 1 * time.Minute},
		RktAPIEndpoint:            defaultRktAPIServiceEndpoint,
		ExperimentalDockershim:    false,
	}
}


text:
/* tslint:disable */
/* eslint-disable */

import { ReaderFragment } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type CollectionsHubsHomepageNav_marketingHubCollections = ReadonlyArray<{
    readonly slug: string;
    readonly title: string;
    readonly thumbnail: string | null;
    readonly " $refType": "CollectionsHubsHomepageNav_marketingHubCollections";
}>;
export type CollectionsHubsHomepageNav_marketingHubCollections$data = CollectionsHubsHomepageNav_marketingHubCollections;
export type CollectionsHubsHomepageNav_marketingHubCollections$key = ReadonlyArray<{
    readonly " $data"?: CollectionsHubsHomepageNav_marketingHubCollections$data;
    readonly " $fragmentRefs": FragmentRefs<"CollectionsHubsHomepageNav_marketingHubCollections">;
}>;

const node: ReaderFragment = {
  "argumentDefinitions": [],
  "kind": "Fragment",
  "metadata": {
    "plural": true
  },
  "name": "CollectionsHubsHomepageNav_marketingHubCollections",
  "selections": [
    {
      "alias": null,
      "args": null,
      "kind": "ScalarField",
      "name": "slug",
      "storageKey": null
    },
    {
      "alias": null,
      "args": null,
      "kind": "ScalarField",
      "name": "title",
      "storageKey": null
    },
    {
      "alias": null,
      "args": null,
      "kind": "ScalarField",
      "name": "thumbnail",
      "storageKey": null
    }
  ],
  "type": "MarketingCollection"
};
(node as any).hash = '34bd7792d5ea1762efa545928881b4b5';
export default node;


text:
import numpy as np
import numpy.typing as npt

AR_f8: npt.NDArray[np.float64]

np.sin.nin + "foo"  # E: Unsupported operand types
np.sin(1, foo="bar")  # E: No overload variant

np.abs(None)  # E: No overload variant

np.add(1, 1, 1)  # E: No overload variant
np.add(1, 1, axis=0)  # E: No overload variant

np.matmul(AR_f8, AR_f8, where=True)  # E: No overload variant

np.frexp(AR_f8, out=None)  # E: No overload variant
np.frexp(AR_f8, out=AR_f8)  # E: No overload variant

np.absolute.outer()  # E: "None" not callable
np.frexp.outer()  # E: "None" not callable
np.divmod.outer()  # E: "None" not callable
np.matmul.outer()  # E: "None" not callable

np.absolute.reduceat()  # E: "None" not callable
np.frexp.reduceat()  # E: "None" not callable
np.divmod.reduceat()  # E: "None" not callable
np.matmul.reduceat()  # E: "None" not callable

np.absolute.reduce()  # E: "None" not callable
np.frexp.reduce()  # E: "None" not callable
np.divmod.reduce()  # E: "None" not callable
np.matmul.reduce()  # E: "None" not callable

np.absolute.accumulate()  # E: "None" not callable
np.frexp.accumulate()  # E: "None" not callable
np.divmod.accumulate()  # E: "None" not callable
np.matmul.accumulate()  # E: "None" not callable

np.frexp.at()  # E: "None" not callable
np.divmod.at()  # E: "None" not callable
np.matmul.at()  # E: "None" not callable


text:
<?php
$this->table->set_template($cp_pad_table_template);

$this->table->set_heading($header);

foreach($rows as $row)
{
    $this->table->add_row($row);
}

echo $this->table->generate();
/*   */

 /*lang('No:'),
    lang('name'),
    lang('mailing_subject'),
    lang('status'),
    lang('type'),
    lang('recipients'),
    lang('send'),
    lang('actions'),*/


text:
<?xml version="1.0" encoding="utf-8"?>
<lang value="fr">
  <item id="Please, provide a title.">Il manque un titre.</item>
  <item id="Please, provide an author.">Il manque un auteur.</item>
  <item id="Please, provide a date of publication.">Il manque une date de publication.</item>
  <item id="The news %s was successfully created.">L'article %s a été créé avec succès.</item>
  <item id="An unknown error occurred while creating the news in the database.">Une erreur inconnue s'est produite lors de l'ajout de l'article dans la base de données.</item>
  <item id="The news %s was successfully edited.">L'article %s a été modifié avec succès.</item>
  <item id="An unknown error occurred while editing the news in the database.">Une erreur inconnue s'est produite lors de la modification de l'article dans la base de données.</item>
  <item id="News not found.">L'article demandé n'existe pas.</item>
  <item id="The news %s was successfully deleted.">L'article "%s" a été supprimé avec succès.</item>
  <item id="Please, provide a name.">Veuillez spécifier un nom pour la nouvelle catégorie.</item>
  <item id="The category %s was successfully created.">La catégorie %s a été ajoutée avec succès.</item>
  <item id="An unknown error occurred while adding the category in the database.">Une erreur inconnue s'est produite lors de l'ajout de la catégorie dans la base de données.</item>
  <item id="The category %s was successfully edited.">La catégorie %s a été modifiée avec succès.</item>
  <item id="An unknown error occurred while editing the category in the database.">Une erreur inconnue s'est produite lors de la modification de la catégorie dans la base de données.</item>
  <item id="Category successfully deleted.">La catégorie a été supprimée avec succès.</item>
  <item id="The category was not found.">Cette catégorie n'existe pas.</item>
  <item id="The category you are trying to delete doesn't exist.">La catégorie que vous essayez de supprimer n'existe pas.</item>
  <item id="Add a category">Ajouter une catégorie</item>
  <item id="Name">Nom</item>
  <item id="Shortname">Nom court</item>
  <item id="Parent">Parent</item>
  <item id="Actions">Actions</item>
  <item id="Edit">Modifier</item>
  <item id="Delete">Supprimer</item>
  <item id="No category in database">Aucune catégorie dans la base de données.</item>
  <item id="None">Aucune</item>
  <item id="Delete a category">Supprimer une catégorie</item>
  <item id="Do you really want to delete this category?">Êtes-vous sûr de vouloir supprimer cette catégorie ?</item>
  <item id="Cancel">Annuler</item>
  <item id="Delete a news">Supprimer un article</item>
  <item id="Do you really want to delete the news %s?">Êtes-vous sûr de vouloir supprimer l'article %s ?</item>
  <item id="Add a news">Ajouter un article</item>
  <item id="Edit a news">Modifier un article</item>
  <item id="Title">Titre</item>
  <item id="URL">URL</item>
  <item id="Content">Contenu</item>
  <item id="Submit">Envoyer</item>
  <item id="Preview">Prévisualiser</item>
  <item id="Details">Détails</item>
  <item id="Published">Publiée</item>
  <item id="Date of publication">Date de publication</item>
  <item id="Hour of publication">Heure de publication</item>
  <item id="Author">Auteur</item>
  <item id="Image">Image</item>
  <item id="Created on %s">Créé le %s</item>
  <item id="Modified on %s">Modifié le %s</item>
  <item id="Categories">Catégories</item>
  <item id="SEO">Référencement</item>
  <item id="Meta Title">Balise titre</item>
  <item id="Meta Description">Balise description</item>
  <item id="News">Articles</item>
  <item id="Category">Catégorie</item>
  <item id="Views">Vues</item>
  <item id="Last modification">Dernière modification</item>
  <item id="No news in database.">Aucun article dans la base de données.</item>
</lang>


text:
package com.htisolutions.poolref.entities;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Entity
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @NotNull
    private String forename;

    @NotNull
    private String surname;

    @NotNull
    private String nickname;

    @NotNull
    private String hashedPassword;

    private Long securityQuestionId;

    private String securityQuestionAnswer;

    private Long twitterTokenId;

    public User() { }

    public User(Long id) {
        this.id = id;
    }

    public User(String forename, String surname, String nickname, String hashedPassword) {
        this.forename = forename;
        this.surname = surname;
        this.nickname = nickname;
        this.hashedPassword = hashedPassword;
        twitterTokenId = null;
    }

    public Long getId() {
        return this.id;
    }

    public String getForename() {
        return this.forename;
    }

    public String getSurname() {
        return this.surname;
    }

    public String getNickname() {
        return this.nickname;
    }

    public Long getTwitterTokenId() {
        return twitterTokenId;
    }

    public String getHashedpassword() {
        return this.hashedPassword;
    }

    public Long getSecurityQuestionId(){return securityQuestionId;}

    public void setTwitterTokenId(Long twitterTokenId){this.twitterTokenId = twitterTokenId;}

    public String getSecurityQuestionAnswer(){return securityQuestionAnswer;}

    public void setSecurityQuestionId(long securityQuestionId){this.securityQuestionId = securityQuestionId;}

    public void setSecurityQuestionAnswer(String securityQuestionAnswer){this.securityQuestionAnswer = securityQuestionAnswer;}

    public void setHashedPassword(String password){hashedPassword = password;}

    public String formatName() {
        return String.format("%s %s (%s)", forename, surname, nickname);
    }
}


text:
/*
 * This source file is part of an OSTIS project. For the latest info, see http://ostis.net
 * Distributed under the MIT License
 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
 */

#ifndef _utils_h_
#define _utils_h_

#include "sc_memory.h"

extern sc_memory_context * s_default_ctx;
extern sc_memory_context * s_garbage_ctx;

_SC_EXT_EXTERN sc_result initialize();
_SC_EXT_EXTERN sc_uint32 load_priority();
_SC_EXT_EXTERN sc_result shutdown();

#endif


text:
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Protobuf.WellKnownTypes {

  /// Holder for reflection information generated from google/protobuf/duration.proto
  public static partial class DurationReflection {

    #region Descriptor
    /// File descriptor for google/protobuf/duration.proto
    public static pbr::FileDescriptor Descriptor {
      get { return descriptor; }
    }
    private static pbr::FileDescriptor descriptor;

    static DurationReflection() {
      byte[] descriptorData = global::System.Convert.FromBase64String(
          string.Concat(
            "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
            "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
            "ASgFQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvUAFa",
            "MWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2R1cmF0",
            "aW9ucGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw",
            "ZXNiBnByb3RvMw=="));
      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
          new pbr::FileDescriptor[] { },
          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null)
          }));
    }
    #endregion

  }
  #region Messages
  ///
  /// A Duration represents a signed, fixed-length span of time represented
  /// as a count of seconds and fractions of seconds at nanosecond
  /// resolution. It is independent of any calendar and concepts like "day"
  /// or "month". It is related to Timestamp in that the difference between
  /// two Timestamp values is a Duration and it can be added or subtracted
  /// from a Timestamp. Range is approximately +-10,000 years.
  ///
  /// # Examples
  ///
  /// Example 1: Compute Duration from two Timestamps in pseudo code.
  ///
  ///     Timestamp start = ...;
  ///     Timestamp end = ...;
  ///     Duration duration = ...;
  ///
  ///     duration.seconds = end.seconds - start.seconds;
  ///     duration.nanos = end.nanos - start.nanos;
  ///
  ///     if (duration.seconds < 0 && duration.nanos > 0) {
  ///       duration.seconds += 1;
  ///       duration.nanos -= 1000000000;
  ///     } else if (duration.seconds > 0 && duration.nanos < 0) {
  ///       duration.seconds -= 1;
  ///       duration.nanos += 1000000000;
  ///     }
  ///
  /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  ///
  ///     Timestamp start = ...;
  ///     Duration duration = ...;
  ///     Timestamp end = ...;
  ///
  ///     end.seconds = start.seconds + duration.seconds;
  ///     end.nanos = start.nanos + duration.nanos;
  ///
  ///     if (end.nanos < 0) {
  ///       end.seconds -= 1;
  ///       end.nanos += 1000000000;
  ///     } else if (end.nanos >= 1000000000) {
  ///       end.seconds += 1;
  ///       end.nanos -= 1000000000;
  ///     }
  ///
  /// Example 3: Compute Duration from datetime.timedelta in Python.
  ///
  ///     td = datetime.timedelta(days=3, minutes=10)
  ///     duration = Duration()
  ///     duration.FromTimedelta(td)
  ///
  /// # JSON Mapping
  ///
  /// In JSON format, the Duration type is encoded as a string rather than an
  /// object, where the string ends in the suffix "s" (indicating seconds) and
  /// is preceded by the number of seconds, with nanoseconds expressed as
  /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
  /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
  /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
  /// microsecond should be expressed in JSON format as "3.000001s".
  ///
  public sealed partial class Duration : pb::IMessage<Duration>
  #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      , pb::IBufferMessage
  #endif
  {
    private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
    private pb::UnknownFieldSet _unknownFields;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pb::MessageParser<Duration> Parser { get { return _parser; } }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public static pbr::MessageDescriptor Descriptor {
      get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    pbr::MessageDescriptor pb::IMessage.Descriptor {
      get { return Descriptor; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public Duration() {
      OnConstruction();
    }

    partial void OnConstruction();

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public Duration(Duration other) : this() {
      seconds_ = other.seconds_;
      nanos_ = other.nanos_;
      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public Duration Clone() {
      return new Duration(this);
    }

    /// Field number for the "seconds" field.
    public const int SecondsFieldNumber = 1;
    private long seconds_;
    ///
    /// Signed seconds of the span of time. Must be from -315,576,000,000
    /// to +315,576,000,000 inclusive. Note: these bounds are computed from:
    /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public long Seconds {
      get { return seconds_; }
      set {
        seconds_ = value;
      }
    }

    /// Field number for the "nanos" field.
    public const int NanosFieldNumber = 2;
    private int nanos_;
    ///
    /// Signed fractions of a second at nanosecond resolution of the span
    /// of time. Durations less than one second are represented with a 0
    /// `seconds` field and a positive or negative `nanos` field. For durations
    /// of one second or more, a non-zero value for the `nanos` field must be
    /// of the same sign as the `seconds` field. Must be from -999,999,999
    /// to +999,999,999 inclusive.
    ///
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public int Nanos {
      get { return nanos_; }
      set {
        nanos_ = value;
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override bool Equals(object other) {
      return Equals(other as Duration);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public bool Equals(Duration other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (Seconds != other.Seconds) return false;
      if (Nanos != other.Nanos) return false;
      return Equals(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override int GetHashCode() {
      int hash = 1;
      if (Seconds != 0L) hash ^= Seconds.GetHashCode();
      if (Nanos != 0) hash ^= Nanos.GetHashCode();
      if (_unknownFields != null) {
        hash ^= _unknownFields.GetHashCode();
      }
      return hash;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public override string ToString() {
      return pb::JsonFormatter.ToDiagnosticString(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void WriteTo(pb::CodedOutputStream output) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      output.WriteRawMessage(this);
    #else
      if (Seconds != 0L) {
        output.WriteRawTag(8);
        output.WriteInt64(Seconds);
      }
      if (Nanos != 0) {
        output.WriteRawTag(16);
        output.WriteInt32(Nanos);
      }
      if (_unknownFields != null) {
        _unknownFields.WriteTo(output);
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
      if (Seconds != 0L) {
        output.WriteRawTag(8);
        output.WriteInt64(Seconds);
      }
      if (Nanos != 0) {
        output.WriteRawTag(16);
        output.WriteInt32(Nanos);
      }
      if (_unknownFields != null) {
        _unknownFields.WriteTo(ref output);
      }
    }
    #endif

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public int CalculateSize() {
      int size = 0;
      if (Seconds != 0L) {
        size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds);
      }
      if (Nanos != 0) {
        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
      }
      if (_unknownFields != null) {
        size += _unknownFields.CalculateSize();
      }
      return size;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(Duration other) {
      if (other == null) {
        return;
      }
      if (other.Seconds != 0L) {
        Seconds = other.Seconds;
      }
      if (other.Nanos != 0) {
        Nanos = other.Nanos;
      }
      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    public void MergeFrom(pb::CodedInputStream input) {
    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
      input.ReadRawMessage(this);
    #else
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
            break;
          case 8: {
            Seconds = input.ReadInt64();
            break;
          }
          case 16: {
            Nanos = input.ReadInt32();
            break;
          }
        }
      }
    #endif
    }

    #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
    void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
            break;
          case 8: {
            Seconds = input.ReadInt64();
            break;
          }
          case 16: {
            Nanos = input.ReadInt32();
            break;
          }
        }
      }
    }
    #endif

  }

  #endregion

}

#endregion Designer generated code


text:
set -e
INTEGRATION_DIR="$( cd "$( dirname "$0" )" && pwd )"
. "${INTEGRATION_DIR}"/functions.sh

echo "Launching core Trillian map components"
map_prep_test 1
TO_KILL+=(${RPC_SERVER_PIDS[@]})

echo "Running test"
cd "${INTEGRATION_DIR}"
set +e
TRILLIAN_SQL_DRIVER=mysql go test ${GOFLAGS} \
  -timeout=${GO_TEST_TIMEOUT:-5m} \
  ./maptest  --map_rpc_server="${RPC_SERVER_1}"
RESULT=$?
set -e

map_stop_test
TO_KILL=()

if [ $RESULT != 0 ]; then
    sleep 1
    echo "Server log:"
    echo "--------------------"
    cat "${TMPDIR}"/trillian_map_server.INFO
    exit $RESULT
fi


text:
# SQL Manager 2010 Lite for MySQL 4.6.0.5
# ---------------------------------------
# Host     : localhost
# Port     : 3306
# Database : jcorev2

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES latin1 */;

SET FOREIGN_KEY_CHECKS=0;

CREATE DATABASE `jcorev2`
    CHARACTER SET 'latin1'
    COLLATE 'latin1_swedish_ci';

USE `jcorev2`;

#
# Structure for the `account_classes` table :
#

DROP TABLE IF EXISTS `account_classes`;

CREATE TABLE `account_classes` (
  `acc_class_id` int(11) NOT NULL AUTO_INCREMENT,
  `acc_class` varchar(65) DEFAULT NULL,
  `acc_type_id` int(11) DEFAULT NULL,
  `other_desc` varchar(500) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  `is_locked` bit(1) DEFAULT b'0',
  PRIMARY KEY (`acc_class_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;

#
# Structure for the `account_info` table :
#

DROP TABLE IF EXISTS `account_info`;

CREATE TABLE `account_info` (
  `account_id` int(11) NOT NULL AUTO_INCREMENT,
  `acc_no` varchar(30) DEFAULT NULL,
  `acc_title` varchar(75) DEFAULT NULL,
  `acc_class_id` int(11) DEFAULT NULL,
  `other_description` varchar(100) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  PRIMARY KEY (`account_id`),
  UNIQUE KEY `acc_no` (`acc_no`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

#
# Structure for the `account_subclass` table :
#

DROP TABLE IF EXISTS `account_subclass`;

CREATE TABLE `account_subclass` (
  `subclass_id` int(11) NOT NULL AUTO_INCREMENT,
  `subclass` varchar(75) DEFAULT NULL,
  `acc_type_id` int(11) DEFAULT NULL,
  `description` varchar(500) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_locked` bit(1) DEFAULT b'0',
  PRIMARY KEY (`subclass_id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1;

#
# Structure for the `account_types` table :
#

DROP TABLE IF EXISTS `account_types`;

CREATE TABLE `account_types` (
  `acc_type_id` int(11) NOT NULL AUTO_INCREMENT,
  `acc_type` varchar(30) DEFAULT NULL,
  `acc_description` varchar(100) DEFAULT NULL,
  `is_locked` bit(1) DEFAULT b'1',
  PRIMARY KEY (`acc_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

#
# Structure for the `customer_info` table :
#

DROP TABLE IF EXISTS `customer_info`;

CREATE TABLE `customer_info` (
  `customer_id` int(11) NOT NULL AUTO_INCREMENT,
  `fname` varchar(65) DEFAULT NULL,
  `lname` varchar(65) DEFAULT NULL,
  `mname` varchar(65) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `email` varchar(70) DEFAULT NULL,
  `billing_address` varchar(100) DEFAULT NULL,
  `pri_contact` varchar(30) DEFAULT NULL,
  `sec_contact` varchar(30) DEFAULT NULL,
  `company` varchar(100) DEFAULT NULL,
  `balance` decimal(19,5) DEFAULT '0.00000',
  `created_by` int(11) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `modified_by` int(11) DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `deleted_by` int(11) DEFAULT NULL,
  `date_deleted` datetime DEFAULT NULL,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;

#
# Structure for the `department_info` table :
#

DROP TABLE IF EXISTS `department_info`;

CREATE TABLE `department_info` (
  `department_id` int(11) NOT NULL AUTO_INCREMENT,
  `department` varchar(100) DEFAULT NULL,
  `description` varchar(125) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  PRIMARY KEY (`department_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

#
# Structure for the `journal_entries` table :
#

DROP TABLE IF EXISTS `journal_entries`;

CREATE TABLE `journal_entries` (
  `journal_id` bigint(20) DEFAULT '0',
  `account_id` int(11) DEFAULT '0',
  `debit_amount` decimal(15,2) DEFAULT NULL,
  `credit_amount` decimal(15,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

#
# Structure for the `journal_info` table :
#

DROP TABLE IF EXISTS `journal_info`;

CREATE TABLE `journal_info` (
  `journal_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `ref_no` varchar(30) DEFAULT NULL,
  `txn_date` date DEFAULT NULL,
  `department_id` int(11) DEFAULT '0',
  `customer_id` varchar(20) DEFAULT '0',
  `supplier_id` varchar(20) DEFAULT '0',
  `method` varchar(50) DEFAULT NULL,
  `memo` varchar(500) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  PRIMARY KEY (`journal_id`),
  UNIQUE KEY `ref_no` (`ref_no`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;

#
# Structure for the `product_info` table :
#

DROP TABLE IF EXISTS `product_info`;

CREATE TABLE `product_info` (
  `prod_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `prod_code` varchar(60) DEFAULT NULL,
  `prod_description` varchar(100) DEFAULT NULL,
  `prod_srp` decimal(16,2) DEFAULT '0.00',
  `prod_cost` decimal(16,2) DEFAULT '0.00',
  `unit_id` int(11) DEFAULT '0',
  `warn_qty` decimal(11,2) DEFAULT '0.00',
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  `is_inventory` bit(1) DEFAULT b'1',
  PRIMARY KEY (`prod_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

#
# Structure for the `sales_invoice_info` table :
#

DROP TABLE IF EXISTS `sales_invoice_info`;

CREATE TABLE `sales_invoice_info` (
  `sales_invoice_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `invoice_no` varchar(35) DEFAULT NULL,
  `txn_date` datetime DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `bill_address` varchar(100) DEFAULT NULL,
  `ship_address` varchar(100) DEFAULT NULL,
  `invoice_amount` decimal(20,2) DEFAULT '0.00',
  `remarks` varchar(100) DEFAULT NULL,
  `is_active` bit(1) DEFAULT b'1',
  `is_deleted` bit(1) DEFAULT b'0',
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `created_by_user` int(11) DEFAULT NULL,
  `modified_by_user` int(11) DEFAULT NULL,
  PRIMARY KEY (`sales_invoice_id`),
  UNIQUE KEY `invoice_no` (`invoice_no`)
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=latin1;

#
# Structure for the `sales_invoice_items` table :
#

DROP TABLE IF EXISTS `sales_invoice_items`;

CREATE TABLE `sales_invoice_items` (
  `sales_invoice_id` bigint(20) DEFAULT NULL,
  `prod_id` bigint(20) DEFAULT NULL,
  `item_qty` int(11) DEFAULT '0',
  `item_discount` decimal(20,2) DEFAULT '0.00',
  `item_unit_price` decimal(20,2) DEFAULT '0.00',
  `item_line_total` decimal(20,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

#
# Structure for the `supplier_info` table :
#

DROP TABLE IF EXISTS `supplier_info`;

CREATE TABLE `supplier_info` (
  `supplier_id` int(11) NOT NULL AUTO_INCREMENT,
  `supplier` varchar(100) DEFAULT NULL,
  `address` varchar(125) DEFAULT NULL,
  `email` varchar(65) DEFAULT NULL,
  `pri_contact` varchar(55) DEFAULT NULL,
  `sec_contact` varchar(55) DEFAULT NULL,
  `contact_person` varchar(75) DEFAULT NULL,
  `fax_no` varchar(30) DEFAULT NULL,
  `website` varchar(40) DEFAULT NULL,
  `tin_no` varchar(45) DEFAULT NULL,
  `is_vatted` bit(1) DEFAULT b'1',
  `date_created` datetime DEFAULT NULL,
  `date_modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_active` bit(1) DEFAULT b'1',
  `is_delete` bit(1) DEFAULT b'0',
  PRIMARY KEY (`supplier_id`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;

#
# Definition for the `CreateInvoiceNo` function :
#

DROP FUNCTION IF EXISTS `CreateInvoiceNo`;

CREATE DEFINER = 'root'@'localhost' FUNCTION `CreateInvoiceNo`()
    RETURNS varchar(20) CHARSET latin1
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN

  DECLARE vCtrLastVal DOUBLE;
    DECLARE vCurrentYear VARCHAR(5);

    SET vCurrentYear=CAST(YEAR(NOW())as CHAR); /*Returns 4 Digit Year*/
    SET vCtrLastVal=(SELECT IFNULL(MAX(m.Ctr),0)+1 FROM
    	(
    		SELECT (CAST(REPLACE(invoice_no,CONCAT('INV',CAST(vCurrentYear AS CHAR),'-'),'')AS UNSIGNED))as Ctr
        	FROM sales_invoice_info WHERE invoice_no LIKE CONCAT('INV',vCurrentYear,'%')
    	)
    	as m);/*will retrieve last counter value of evaluation no with current year prefix*/

	/*FORMAT  E[YEAR][COUNTER] ie. E2015-00001*/
  	RETURN CONCAT('INV',vCurrentYear,'-',LPAD(vCtrLastVal,5,0));
END;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;