text:
namespace boost { namespace gil {

// Methods for constructing any image views from other any image views
// Extends image view factory to runtime type-specified views (any_image_view)

namespace detail {

template <typename ResultView>
struct flipped_up_down_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{flipped_up_down_view(src)};
    }
};

template <typename ResultView>
struct flipped_left_right_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{flipped_left_right_view(src)};
    }
};

template <typename ResultView>
struct rotated90cw_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{rotated90cw_view(src)};
    }
};

template <typename ResultView>
struct rotated90ccw_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{rotated90ccw_view(src)};
    }
};

template <typename ResultView>
struct tranposed_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{tranposed_view(src)};
    }
};

template <typename ResultView>
struct rotated180_view_fn
{
    using result_type = ResultView;

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{rotated180_view(src)};
    }
};

template <typename ResultView>
struct subimage_view_fn
{
    using result_type = ResultView;

    subimage_view_fn(point_t const& topleft, point_t const& dimensions)
        : _topleft(topleft), _size2(dimensions)
    {}

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{subimage_view(src,_topleft,_size2)};
    }

    point_t _topleft;
    point_t _size2;
};

template <typename ResultView>
struct subsampled_view_fn
{
    using result_type = ResultView;

    subsampled_view_fn(point_t const& step) : _step(step) {}

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{subsampled_view(src,_step)};
    }

    point_t _step;
};

template <typename ResultView>
struct nth_channel_view_fn
{
    using result_type = ResultView;

    nth_channel_view_fn(int n) : _n(n) {}

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type(nth_channel_view(src,_n));
    }

    int _n;
};

template <typename DstP, typename ResultView, typename CC = default_color_converter>
struct color_converted_view_fn
{
    using result_type = ResultView;

    color_converted_view_fn(CC cc = CC()): _cc(cc) {}

    template <typename View>
    auto operator()(View const& src) const -> result_type
    {
        return result_type{color_converted_view<DstP>(src, _cc)};
    }

private:
    CC _cc;
};

} // namespace detail

/// \ingroup ImageViewTransformationsFlipUD
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto flipped_up_down_view(any_image_view<Views> const& src)
    -> typename dynamic_y_step_type<any_image_view<Views>>::type
{
    using result_view_t = typename dynamic_y_step_type<any_image_view<Views>>::type;
    return apply_operation(src, detail::flipped_up_down_view_fn<result_view_t>());
}

/// \ingroup ImageViewTransformationsFlipLR
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto flipped_left_right_view(any_image_view<Views> const& src)
    -> typename dynamic_x_step_type<any_image_view<Views>>::type
{
    using result_view_t = typename dynamic_x_step_type<any_image_view<Views>>::type;
    return apply_operation(src, detail::flipped_left_right_view_fn<result_view_t>());
}

/// \ingroup ImageViewTransformationsTransposed
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto transposed_view(const any_image_view<Views>& src)
    -> typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type
{
    using result_view_t = typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type;
    return apply_operation(src, detail::tranposed_view_fn<result_view_t>());
}

/// \ingroup ImageViewTransformations90CW
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto rotated90cw_view(const any_image_view<Views>& src)
    -> typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type
{
    using result_view_t = typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type;
    return apply_operation(src,detail::rotated90cw_view_fn<result_view_t>());
}

/// \ingroup ImageViewTransformations90CCW
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto rotated90ccw_view(const any_image_view<Views>& src)
    -> typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type
{
    return apply_operation(src,detail::rotated90ccw_view_fn<typename dynamic_xy_step_transposed_type<any_image_view<Views>>::type>());
}

/// \ingroup ImageViewTransformations180
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto rotated180_view(any_image_view<Views> const& src)
    -> typename dynamic_xy_step_type<any_image_view<Views>>::type
{
    using step_type = typename dynamic_xy_step_type<any_image_view<Views>>::type;
    return apply_operation(src, detail::rotated180_view_fn<step_type>());
}

/// \ingroup ImageViewTransformationsSubimage
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto subimage_view(
    any_image_view<Views> const& src,
    point_t const& topleft,
    point_t const& dimensions)
    -> any_image_view<Views>
{
    using subimage_view_fn = detail::subimage_view_fn<any_image_view<Views>>;
    return apply_operation(src, subimage_view_fn(topleft, dimensions));
}

/// \ingroup ImageViewTransformationsSubimage
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto subimage_view(
    any_image_view<Views> const& src,
    std::ptrdiff_t x_min, std::ptrdiff_t y_min, std::ptrdiff_t width, std::ptrdiff_t height)
    -> any_image_view<Views>
{
    using subimage_view_fn = detail::subimage_view_fn<any_image_view<Views>>;
    return apply_operation(src, subimage_view_fn(point_t(x_min, y_min),point_t(width, height)));
}

/// \ingroup ImageViewTransformationsSubsampled
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto subsampled_view(any_image_view<Views> const& src, point_t const& step)
    -> typename dynamic_xy_step_type<any_image_view<Views>>::type
{
    using step_type = typename dynamic_xy_step_type<any_image_view<Views>>::type;
    using subsampled_view = detail::subsampled_view_fn<step_type>;
    return apply_operation(src, subsampled_view(step));
}

/// \ingroup ImageViewTransformationsSubsampled
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto subsampled_view(any_image_view<Views> const& src, std::ptrdiff_t x_step, std::ptrdiff_t y_step)
    -> typename dynamic_xy_step_type<any_image_view<Views>>::type
{
    using step_type = typename dynamic_xy_step_type<any_image_view<Views>>::type;
    using subsampled_view_fn = detail::subsampled_view_fn<step_type>;
    return apply_operation(src, subsampled_view_fn(point_t(x_step, y_step)));
}

namespace detail {

template <typename View>
struct get_nthchannel_type { using type = typename nth_channel_view_type<View>::type; };

template <typename Views>
struct views_get_nthchannel_type : mp11::mp_transform<get_nthchannel_type, Views> {};

} // namespace detail

/// \ingroup ImageViewTransformationsNthChannel
/// \brief Given a runtime source image view, returns the type of a runtime image view over a single channel of the source view
template <typename Views>
struct nth_channel_view_type<any_image_view<Views>>
{
    using type = any_image_view<typename detail::views_get_nthchannel_type<Views>::type>;
};

/// \ingroup ImageViewTransformationsNthChannel
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename Views>
inline
auto nth_channel_view(const any_image_view<Views>& src, int n)
    -> typename nth_channel_view_type<any_image_view<Views>>::type
{
    using result_view_t = typename nth_channel_view_type<any_image_view<Views>>::type;
    return apply_operation(src,detail::nth_channel_view_fn<result_view_t>(n));
}

namespace detail {

template <typename View, typename DstP, typename CC>
struct get_ccv_type : color_converted_view_type<View, DstP, CC> {};

template <typename Views, typename DstP, typename CC>
struct views_get_ccv_type
{
private:
    // FIXME: Remove class name injection with detail:: qualification
    // Required as workaround for MP11 issue that treats unqualified metafunction
    // in the class definition of the same name as the specialization (Peter Dimov):
    //    invalid template argument for template parameter 'F', expected a class template
    template <typename T>
    using ccvt = detail::get_ccv_type<T, DstP, CC>;

public:
    using type = mp11::mp_transform<ccvt, Views>;
};

} // namespace detail

/// \ingroup ImageViewTransformationsColorConvert
/// \brief Returns the type of a runtime-specified view, color-converted to a given pixel type with user specified color converter
template <typename Views, typename DstP, typename CC>
struct color_converted_view_type<any_image_view<Views>,DstP,CC>
{
    using type = any_image_view<typename detail::views_get_ccv_type<Views, DstP, CC>::type>;
};

/// \ingroup ImageViewTransformationsColorConvert
/// \brief overload of generic color_converted_view with user defined color-converter
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename DstP, typename Views, typename CC>
inline
auto color_converted_view(const any_image_view<Views>& src, CC)
    -> typename color_converted_view_type<any_image_view<Views>, DstP, CC>::type
{
    using cc_view_t = typename color_converted_view_type<any_image_view<Views>, DstP, CC>::type;
    return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
}

/// \ingroup ImageViewTransformationsColorConvert
/// \brief Returns the type of a runtime-specified view, color-converted to a given pixel type with the default coor converter
template <typename Views, typename DstP>
struct color_converted_view_type<any_image_view<Views>,DstP>
{
    using type = any_image_view<typename detail::views_get_ccv_type<Views, DstP, default_color_converter>::type>;
};

/// \ingroup ImageViewTransformationsColorConvert
/// \brief overload of generic color_converted_view with the default color-converter
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename DstP, typename Views>
inline
auto color_converted_view(any_image_view<Views> const& src)
    -> typename color_converted_view_type<any_image_view<Views>, DstP>::type
{
    using cc_view_t = typename color_converted_view_type<any_image_view<Views>, DstP>::type;
    return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
}

/// \ingroup ImageViewTransformationsColorConvert
/// \brief overload of generic color_converted_view with user defined color-converter
///        These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename DstP, typename Views, typename CC>
inline
auto any_color_converted_view(const any_image_view<Views>& src, CC)
    -> typename color_converted_view_type<any_image_view<Views>, DstP, CC>::type
{
    using cc_view_t = typename color_converted_view_type<any_image_view<Views>, DstP, CC>::type;
    return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
}

/// \ingroup ImageViewTransformationsColorConvert
/// \brief overload of generic color_converted_view with the default color-converter
///        These are workarounds for GCC 3.4, which thinks color_converted_view is ambiguous with the same method for templated views (in gil/image_view_factory.hpp)
/// \tparam Views Models Boost.MP11-compatible list of models of ImageViewConcept
template <typename DstP, typename Views>
inline
auto any_color_converted_view(const any_image_view<Views>& src)
    -> typename color_converted_view_type<any_image_view<Views>, DstP>::type
{
    using cc_view_t = typename color_converted_view_type<any_image_view<Views>, DstP>::type;
    return apply_operation(src, detail::color_converted_view_fn<DstP, cc_view_t>());
}

/// \}

}}  // namespace boost::gil

#endif


text:
package org.robolectric.res;

import static com.google.common.truth.Truth.assertThat;

import java.nio.file.Path;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.robolectric.res.android.ResTable_config;

@RunWith(JUnit4.class)
public class DrawableResourceLoaderNoRunnerTest {

  @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder();

  private PackageResourceTable resourceTable;

  @Before
  public void setUp() {
    resourceTable = new ResourceTableFactory().newResourceTable("org.robolectric");
  }

  @Test
  public void shouldFindDrawableResources() throws Exception {
    Path testBaseDir = temporaryFolder.newFolder("res").toPath();
    temporaryFolder.newFolder("res", "drawable");
    temporaryFolder.newFile("res/drawable/foo.png");
    ResourcePath resourcePath = new ResourcePath(null, testBaseDir, null);

    DrawableResourceLoader testLoader = new DrawableResourceLoader(resourceTable);
    testLoader.findDrawableResources(resourcePath);

    assertThat(resourceTable.getValue(new ResName("org.robolectric", "drawable", "foo"), new ResTable_config()).isFile()).isTrue();
  }
}

redpajama_set_name: RedPajamaGithub


text:
package net.jini.core.constraint;

/**
 * Implemented by constraints that are expressed in terms of relative time,
 * to support conversion to absolute time constraints.
 *
 * @author Sun Microsystems, Inc.
 * @since 2.0
 */
public interface RelativeTimeConstraint extends InvocationConstraint {
    /**
     * Converts this constraint to absolute time.  Takes an absolute time,
     * specified in milliseconds from midnight, January 1, 1970 UTC, and
     * returns a constraint that has the same information content as this
     * constraint except that the relative times have been converted to
     * absolute times by adding the specified absolute time to each relative
     * time in this constraint. If the addition results in underflow or
     * overflow, a time value of Long.MIN_VALUE or
     * Long.MAX_VALUE is used, respectively. The returned
     * constraint will typically be an instance of a different constraint
     * class than this constraint.
     *
     * @param baseTime an absolute time, specified in milliseconds from
     * midnight, January 1, 1970 UTC
     * @return a constraint that has the relative times converted to absolute
     * times by adding the specified absolute time to each relative time
     */
    InvocationConstraint makeAbsolute(long baseTime);
}


text:
"""
    pickup
    ~~~~~~

    Implements pickup git/compress file

    :author:    Feei <feei@feei.cn>
    :homepage:  https://github.com/wufeifei/cobra
    :license:   MIT, see LICENSE for more details.
    :copyright: Copyright (c) 2017 Feei. All rights reserved
"""
import os
import re
import sys
import time
import shutil
import zipfile
import tarfile
import rarfile
import subprocess
from . import config
from .log import logger
from .config import package_path, source_path
from shutil import copyfile
from werkzeug.utils import secure_filename

try:
    from urllib import quote
except ImportError:
    from urllib.parse import quote

class Decompress(object):
    """Decompress zip, rar and tar.gz

    filename: filename without path
    filetype: file type display in MIME type.
    filepath: filename with path

    """

    filename = None
    filetype = None
    filepath = None

    def __init__(self, filename):
        """
        :param filename: a file name without path.
        """
        self.package_path = package_path
        self.filepath = os.path.join(package_path, secure_filename(filename))
        self.filename = filename
        copyfile(os.path.abspath(filename), self.filepath)
        self.dir_name = secure_filename(filename).split('.')[0]
        print(self.dir_name)

    def decompress(self):
        """
        Decompress a file.
        :return: a dict.
            code: -1 -> error, 1-> success
            msg: None or error message
            dir_name: decompressed directory name. Usually, the directory name is the filename without file extension.
        """

        if '.zip' in self.filename:
            return self.__decompress_zip(), self.get_real_directory()
        elif '.rar' in self.filename:
            return self.__decompress_rar(), self.get_real_directory()
        elif '.tgz' in self.filename or '.tar' in self.filename or '.gz' in self.filename:
            """
            Support Tar Extension
            .tar: .tar | .tar.gz | .tar.bz2
            .gz
            .tgz
            """
            return self.__decompress_tar_gz(), self.get_real_directory()
        else:
            return False, 'File type error, only zip, rar, tar.gz accepted.'

    def get_real_directory(self):
        """
        get real directory
        /path/project-v1.2/project-v1.2 -> /path/project-v1.2/
        :param:
        :return:
        """
        directory = os.path.join(self.package_path, self.dir_name)
        file_count = 0
        directory_path = None
        for filename in os.listdir(directory):
            directory_path = os.path.join(directory, filename)
            file_count += 1
        logger.info("Decompress path count: {0}, directory path: {1}".format(file_count, directory_path))
        if file_count == 1 and os.path.isdir(directory_path):
            return directory_path
        else:
            return directory

    def __decompress_zip(self):
        """unzip a file."""
        zip_file = zipfile.ZipFile(self.filepath)
        # check if there is a filename directory
        self.__check_filename_dir()

        # create the file directory to store the extract file.
        os.mkdir(os.path.join(self.package_path, self.dir_name))

        zip_file.extractall(os.path.join(self.package_path, self.dir_name))
        zip_file.close()

        return True

    def __decompress_rar(self):
        """extract a rar file."""
        rar_file = rarfile.RarFile(self.filepath)
        # check if there is a filename directory
        self.__check_filename_dir()

        os.mkdir(os.path.join(self.package_path, self.dir_name))

        rar_file.extractall(os.path.join(self.package_path, self.dir_name))
        rar_file.close()
        return True

    def __decompress_tar_gz(self):
        """extract a tar.gz file"""
        tar_file = tarfile.open(self.filepath)
        # check if there is a filename directory
        self.__check_filename_dir()

        os.mkdir(os.path.join(self.package_path, self.dir_name))

        tar_file.extractall(os.path.join(self.package_path, self.dir_name))
        tar_file.close()
        return True

    def __check_filename_dir(self):
        if os.path.isdir(os.path.join(self.package_path, self.dir_name)):
            shutil.rmtree(os.path.join(self.package_path, self.dir_name))

    def __repr__(self):
        return "<decompress - %r>" % self.filename

class Directory(object):
    def __init__(self, absolute_path):
        self.absolute_path = absolute_path

    file_sum = 0
    type_nums = {}
    result = {}
    file = []

    """
    :return {'.php': {'count': 2, 'list': ['/path/a.php', '/path/b.php']}}, file_sum, time_consume
    """

    def collect_files(self):
        t1 = time.clock()
        self.files(self.absolute_path)
        self.result['no_extension'] = {'count': 0, 'list': []}
        for extension, values in self.type_nums.items():
            extension = extension.strip()
            self.result[extension] = {'count': len(values), 'list': []}
            # .php : 123
            logger.debug('[PICKUP] [EXTENSION-COUNT] {0} : {1}'.format(extension, len(values)))
            for f in self.file:
                es = f.split(os.extsep)
                if len(es) >= 2:
                    # Exists Extension
                    # os.extsep + es[len(es) - 1]
                    if f.endswith(extension):
                        self.result[extension]['list'].append(f)
                else:
                    # Didn't have extension
                    self.result['no_extension']['count'] = int(self.result['no_extension']['count']) + 1
                    self.result['no_extension']['list'].append(f)
        if self.result['no_extension']['count'] == 0:
            del self.result['no_extension']
        t2 = time.clock()
        # reverse list count
        self.result = sorted(self.result.items(), key=lambda t: t[0], reverse=False)
        return self.result, self.file_sum, t2 - t1

    def files(self, absolute_path, level=1):
        if level == 1:
            logger.debug('[PICKUP] ' + absolute_path)
        try:
            if os.path.isfile(absolute_path):
                filename, directory = os.path.split(absolute_path)
                self.file_info(directory, filename)
            else:
                for filename in os.listdir(absolute_path):
                    directory = os.path.join(absolute_path, filename)

                    # Directory Structure
                    logger.debug('[PICKUP] [FILES] ' + '|  ' * (level - 1) + '|--' + filename)
                    if os.path.isdir(directory):
                        self.files(directory, level + 1)
                    if os.path.isfile(directory):
                        self.file_info(directory, filename)
        except OSError as e:
            logger.critical('[PICKUP] {msg}'.format(msg=e))
            exit()

    def file_info(self, path, filename):
        # Statistic File Type Count
        file_name, file_extension = os.path.splitext(path)
        self.type_nums.setdefault(file_extension.lower(), []).append(filename)

        path = path.replace(self.absolute_path, '')
        self.file.append(path)
        self.file_sum += 1

class File(object):
    def __init__(self, file_path):
        self.file_path = file_path

    def read_file(self):
        """
        读取文件内容
        :return:
        """
        f = open(self.file_path, 'r').read()
        return f

    def lines(self, line_rule):
        """
        获取指定行内容
        :param line_rule:
        :return:
        """
        param = ['sed', "-n", line_rule, self.file_path]
        p = subprocess.Popen(param, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        result, err = p.communicate()
        if len(err) is not 0:
            logger.critical('[PICKUP] {err}'.format(err=err.strip()))
        if len(result):
            try:
                content = result.decode('utf-8')
            except AttributeError as e:
                content = result
            if content == '':
                content = False
        else:
            content = False
        return content

class GitError(Exception):
    def __init__(self, message):
        Exception.__init__(self)
        self.message = message

    def __str__(self):
        return repr(self.message)

class NotExistError(GitError):
    def __init__(self, message):
        self.message = message

    def __str__(self):
        return repr(self.message)

class AuthError(GitError):
    def __init__(self, message):
        self.message = message

    def __str__(self):
        return repr(self.message)

class Git(object):
    """
    A Git class.
    You can clone, pull, diff the repo via this class.

    repo_address: the repo's url
    repo_directory: the repo's local path
    repo_username: the username for the repo's url
    repo_password: the password for the repo's password
    repo_branch: the repo branch
    """

    repo_address = None
    repo_directory = None
    repo_username = None
    repo_password = None
    repo_branch = None
    repo_author = None
    repo_name = None

    # https://github.com/<username>/<reponame>

    def __init__(self, repo_address, branch='master', username=None, password=None):

        # get upload directory
        self.upload_directory = source_path
        if os.path.isdir(self.upload_directory) is False:
            os.makedirs(self.upload_directory)

        self.repo_address = repo_address
        self.repo_username = username
        self.repo_password = password
        self.repo_branch = branch
        repo_user = self.repo_address.split('/')[-2]
        repo_name = self.repo_address.split('/')[-1].replace('.git', '')
        self.repo_author = repo_user
        self.repo_name = repo_name

        self.repo_directory = os.path.join(os.path.join(self.upload_directory, repo_user), repo_name)

    def pull(self):
        """Pull a repo from repo_address and repo_directory"""
        logger.info('[PICKUP] [PULL] pull repository...')

        if not self.__check_exist():
            return False, 'No local repo exist. Please clone first.'

        # change work directory to the repo
        repo_dir = self.repo_directory
        logger.debug('[PICKUP] cd directory: {0}'.format(repo_dir))
        os.chdir(repo_dir)

        if not self.checkout(self.repo_branch):
            os.chdir(repo_dir)
            return False, "Checkout failed."

        cmd = 'git pull origin ' + self.repo_branch
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        pull_out, pull_err = p.communicate()

        try:
            pull_out = pull_out.decode('utf-8')
            pull_err = pull_err.decode('utf-8')
        except AttributeError as e:
            pass

        logger.info('[PICKUP] [PULL] {o}'.format(o=pull_out.strip()))
        logger.info('[PICKUP] [PULL] {e}'.format(e=pull_err.strip().replace(u'\n', u' >')))

        self.parse_err(pull_err)

        pull_err = pull_err.replace('{0}:{1}'.format(self.repo_username, self.repo_password), '')

        # change work directory back.
        os.chdir(repo_dir)

        if 'Updating' in pull_out or 'up-to-date' in pull_out:
            logger.info('[PICKUP] [PULL] pull done.')
            return True, None
        else:
            return False, pull_err

    def clone(self):
        """Clone a repo from repo_address
        :return: True - clone success, False - clone error.
        """
        logger.info('[PICKUP] [CLONE] clone repository...')
        if self.__check_exist():
            logger.info('[PICKUP] [CLONE] repository already exist.')
            return self.pull()
            # call(['rm', '-rf', self.repo_directory])

        # if no username or password provide, it may be a public repo.
        if self.repo_username is None or self.repo_password is None:
            # public repo
            clone_address = self.repo_address
        else:
            # private repo
            clone_address = self.repo_address.split('://')[0] + '://' + quote(self.repo_username) + ':' + \
                            quote(self.repo_password) + '@' + self.repo_address.split('://')[1]
        # clone repo with username and password
        # "http[s]://username:password@gitlab.com/username/reponame"
        # !!! if add password in the url, .git/config will log your url with password
        cmd = 'git clone ' + clone_address + ' "' + self.repo_directory + '" -b ' + self.repo_branch

        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        (clone_out, clone_err) = p.communicate()
        clone_err = clone_err.replace('{0}:{1}'.format(self.repo_username, self.repo_password), '')

        logger.debug('[PICKUP] [CLONE] ' + clone_out.strip())
        logger.info('[PICKUP] [CLONE] ' + clone_err.strip())

        self.parse_err(clone_err)

        logger.info('[PICKUP] [CLONE] clone done. Switching to branch ' + self.repo_branch)
        # check out to special branch
        if self.checkout(self.repo_branch):
            return True, None
        else:
            return False, clone_err

    def diff(self, new_version, old_version, raw_output=False):
        """
        Diff between two version, in SHA hex.
        :param new_version: the new version in SHA hex.
        :param old_version: the old version in SHA hex.
        :param raw_output: True-return raw git diff result, False-return parsed result, only add content
        :return: the diff result in str, raw or formatted.
        """
        if not self.__check_exist():
            logger.info('No local repo exist. Please clone it first.')
            return False

        # change the work directory to the repo.
        current_dir = os.getcwd() + os.sep
        repo_dir = current_dir + self.repo_directory
        os.chdir(repo_dir)

        cmd = 'git diff ' + old_version + ' ' + new_version
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        (diff_out, diff_err) = p.communicate()
        logger.info(diff_out)

        # change the work directory back.
        os.chdir(current_dir)
        logger.info('diff done.')
        if raw_output:
            return diff_out
        else:
            return self.__parse_diff_result(diff_out)

    def checkout(self, branch):
        """
        Checkout to special branch.
        :param branch: branch name
        :return: True-checkout success or already on special branch
                 False-checkout failed. Maybe no branch name.
        """
        if not self.__check_exist():
            logger.info('[PICKUP] No repo directory.')
            return False

        current_dir = os.getcwd()
        os.chdir(self.repo_directory)

        cmd = "git fetch origin && git checkout " + branch
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        (checkout_out, checkout_err) = p.communicate()
        logger.info('[PICKUP] [CHECKOUT] ' + checkout_err.strip())

        # Already on
        # did not match
        # Switched to a new branch
        if 'did not match' in checkout_err:
            os.chdir(current_dir)
            return False
        else:
            os.chdir(current_dir)
            return True

    def __check_exist(self):
        """check if the repo has already cloned.
        :returns bool
            True : the repo already exist.
            False : the repo do not exist.
        """
        if os.path.isdir(self.repo_directory):
            return True
        else:
            return False

    @staticmethod
    def __parse_diff_result(content):
        """parse git diff output, return the format result
        :return: a dict, each key is the filename which has changed.
                 each value is a list store every changes.
        example:
                {'bb.txt': ['hhhhhhh'], 'aa.txt': ['ccccc', 'ddddd']}
                bb.txt add a line, the content is 'hhhhhhh'.
                aa.txt add two line, the content is 'ccccc' and 'ddddd'.
        """
        result = {}
        content = content.split('\n')
        tmp_filename = ''
        for x in content:
            if x != '' and x[0:3] == '+++':
                tmp_filename = x.split('/')[-1]
                result[tmp_filename] = []
            elif x != '' and x[0] == '+':
                if x[1:] != '':
                    result[tmp_filename].append(x[1:])

        return result

    def get_repo(self):
        """
        clone or pull the special repo.
        If the repo already exist in the "uploads" folder, it will pull the repo.
        If there is no repo in "uploads" folder, it will clone the repo.
        :return:
        """
        if self.__check_exist():
            logger.info('repo already exist. Try to pull the repo')
            return self.pull()
        else:
            return self.clone()

    @staticmethod
    def parse_err(err):
        if 'not found' in err or 'Not found' in err:
            raise NotExistError('Repo doesn\'t exist')
        elif 'already exists' in err:
            return False, 'repo has already cloned.'
        elif 'Authentication failed' in err:
            raise NotExistError('Authentication failed')

    @staticmethod
    def committer(directory, file_path, line_number, length=1):
        """
        git blame -L21,+1 -- git.py
        362d5798 (wufeifei 2016-09-10 12:19:44 +0800 21) logging = logger.getLogger(__name__)
        (?:.{8}\s\()(.*)\s(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})
        group #1: wufeifei
        group #2: 2016-09-10 12:19:44
        :param directory:
        :param file_path:
        :param line_number:
        :param length:
        :return: group#1, group#2
        """
        os.chdir(directory)
        cmd = "git blame -L{0},+{1} -- {2}".format(line_number, length, file_path.replace(directory, ''))
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        checkout_out, checkout_err = p.communicate()
        try:
            checkout_out = checkout_out.decode('utf-8')
        except AttributeError as e:
            pass
        if len(checkout_out) != 0:
            group = re.findall(r'(?:.{8}\s\()(.*)\s(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})', checkout_out)
            if len(group) > 0:
                return True, group[0][0], group[0][1]
            else:
                return False, None, None
        else:
            return False, None, None

    def __repr__(self):
        return "<Git - %r@%r>" % (self.repo_username, self.repo_address)

class Subversion(object):
    """Subversion Utility Class"""
    svn = '/usr/bin/svn'

    def __init__(self, filename, current_version=None, online_version=None):
        self.filename = filename
        self.current_version = current_version
        self.online_version = online_version

        self.username = config.Config('svn', 'username').value
        self.password = config.Config('svn', 'password').value

        # Test SVN
        cmd = self.svn + " info --no-auth-cache --non-interactive --username='%s' --password='%s' %s" % (
            self.username,
            self.password,
            self.filename
        )
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        (diff_out, diff_err) = p.communicate()
        if len(diff_err) == 0:
            logger.debug("[PICKUP] svn diff success")
        elif 'authorization failed' in diff_err:
            logger.warning("svn diff auth failed")
            sys.exit(1)
        elif 'Not a valid URL' in diff_err:
            logger.warning("[PICKUP] svn diff url not a valid")
            sys.exit(1)

    def log(self):
        cmd = self.svn + " log --no-auth-cache --non-interactive --username='%s' --password='%s' %s" % (
            self.username,
            self.password,
            self.filename
        )
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        log_out = p.communicate()[0]
        return log_out

    def diff(self):
        cmd = self.svn + " diff --no-auth-cache --non-interactive --username='%s' --password='%s' -r %s:%s %s" % (
            self.username,
            self.password,
            self.current_version,
            self.online_version,
            self.filename
        )
        p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
        diff_out = p.communicate()[0]

        added, removed, changed = [], [], []
        diff = {}
        for line in diff_out.split("\n"):
            if line[:3] in ('---', '+++', '==='):
                continue
            else:
                if len(line) > 0:
                    diff.setdefault(line[0], []).append(line[1:].strip())
                    if line[0] == '-':
                        removed.append(line[1:].strip())
                    elif line[0] == '+':
                        added.append(line[1:].strip())
                    elif line[0] == ' ':
                        changed.append(line[1:].strip())
                    else:
                        continue
        diff['code'] = diff_out
        return diff

    def commit(self):
        svn_log = subprocess.Popen(
            [self.svn, 'log', self.filename],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
        return svn_log


text:
#ifndef LIBAMQP_TRANSPORT_LOW_LEVEL_EVENT_THREAD_TEST_SUPPORT_H
#define LIBAMQP_TRANSPORT_LOW_LEVEL_EVENT_THREAD_TEST_SUPPORT_H

#include "Transport/LowLevel/EventThread.h"
#include "Context/TestSupport/ContextHolder.h"

namespace SuiteTransportLowLevel
{
    class EventThreadTestFixture :
            public virtual TestSupport::ContextHolder
    {
    public:
        EventThreadTestFixture();
        ~EventThreadTestFixture();

    public:
        amqp_event_thread_t *m_event_thread;
        static void basic_event_thread_handler(amqp_event_thread_t *event_thread);
    };
}

#endif


text:
package main

import (
	"fmt"
	"os"

	"github.com/spf13/cobra"
	"k8s.io/api/core/v1"

	"istio.io/istio/istioctl/pkg/kubernetes"
	"istio.io/istio/istioctl/pkg/writer/envoy/configdump"
	"istio.io/istio/pilot/pkg/model"
)

const (
	jsonOutput    = "json"
	summaryOutput = "short"
)

var (
	configCmd = &cobra.Command{
		Use:   "proxy-config",
		Short: "Retrieve information about proxy configuration from Envoy [kube only]",
		Long:  `A group of commands used to retrieve information about proxy configuration from the Envoy config dump`,
		Example: `  # Retrieve information about proxy configuration from an Envoy instance.
  istioctl proxy-config <clusters|listeners|routes|bootstap> <pod-name>`,
		Aliases: []string{"pc"},
	}

	fqdn, direction, subset string
	port                    int

	clusterConfigCmd = &cobra.Command{
		Use:   "cluster <pod-name>",
		Short: "Retrieves cluster configuration for the Envoy in the specified pod",
		Long:  `Retrieve information about cluster configuration for the Envoy instance in the specified pod.`,
		Example: `  # Retrieve summary about cluster configuration for a given pod from Envoy.
  istioctl proxy-config clusters <pod-name>

  # Retrieve cluster summary for clusters with port 9080.
  istioctl proxy-config clusters <pod-name> --port 9080

  # Retrieve full cluster dump for clusters that are inbound with a FQDN of details.default.svc.cluster.local.
  istioctl proxy-config clusters <pod-name> --fqdn details.default.svc.cluster.local --direction inbound -o json
`,
		Aliases: []string{"clusters", "c"},
		Args:    cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			podName := args[0]
			ns := handleNamespace()
			configWriter, err := setupEnvoyConfigWriter(podName, ns)
			if err != nil {
				return err
			}
			filter := configdump.ClusterFilter{
				FQDN:      model.Hostname(fqdn),
				Port:      port,
				Subset:    subset,
				Direction: model.TrafficDirection(direction),
			}
			switch outputFormat {
			case summaryOutput:
				return configWriter.PrintClusterSummary(filter)
			case jsonOutput:
				return configWriter.PrintClusterDump(filter)
			default:
				return fmt.Errorf("output format %q not supported", outputFormat)
			}
		},
	}

	address, listenerType string

	listenerConfigCmd = &cobra.Command{
		Use:   "listener <pod-name>",
		Short: "Retrieves listener configuration for the Envoy in the specified pod",
		Long:  `Retrieve information about listener configuration for the Envoy instance in the specified pod.`,
		Example: `  # Retrieve summary about listener configuration for a given pod from Envoy.
  istioctl proxy-config listeners <pod-name>

  # Retrieve listener summary for listeners with port 9080.
  istioctl proxy-config listeners <pod-name> --port 9080

  # Retrieve full listener dump for HTTP listeners with a wildcard address (0.0.0.0).
  istioctl proxy-config listeners <pod-name> --type HTTP --address 0.0.0.0 -o json
`,
		Aliases: []string{"listeners", "l"},
		Args:    cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			podName := args[0]
			ns := handleNamespace()
			configWriter, err := setupEnvoyConfigWriter(podName, ns)
			if err != nil {
				return err
			}
			filter := configdump.ListenerFilter{
				Address: address,
				Port:    uint32(port),
				Type:    listenerType,
			}

			switch outputFormat {
			case summaryOutput:
				return configWriter.PrintListenerSummary(filter)
			case jsonOutput:
				return configWriter.PrintListenerDump(filter)
			default:
				return fmt.Errorf("output format %q not supported", outputFormat)
			}
		},
	}

	routeName string

	routeConfigCmd = &cobra.Command{
		Use:   "route <pod-name>",
		Short: "Retrieves route configuration for the Envoy in the specified pod",
		Long:  `Retrieve information about route configuration for the Envoy instance in the specified pod.`,
		Example: `  # Retrieve summary about route configuration for a given pod from Envoy.
  istioctl proxy-config routes <pod-name>

  # Retrieve route summary for route 9080.
  istioctl proxy-config route <pod-name> --name 9080

  # Retrieve full route dump for route 9080
  istioctl proxy-config route <pod-name> --name 9080 -o json
`,
		Aliases: []string{"routes", "r"},
		Args:    cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			podName := args[0]
			ns := handleNamespace()
			configWriter, err := setupEnvoyConfigWriter(podName, ns)
			if err != nil {
				return err
			}
			filter := configdump.RouteFilter{
				Name: routeName,
			}
			switch outputFormat {
			case summaryOutput:
				return configWriter.PrintRouteSummary(filter)
			case jsonOutput:
				return configWriter.PrintRouteDump(filter)
			default:
				return fmt.Errorf("output format %q not supported", outputFormat)
			}
		},
	}

	bootstrapConfigCmd = &cobra.Command{
		Use:   "bootstrap <pod-name>",
		Short: "Retrieves bootstrap configuration for the Envoy in the specified pod",
		Long:  `Retrieve information about bootstrap configuration for the Envoy instance in the specified pod.`,
		Example: `  # Retrieve full bootstrap configuration for a given pod from Envoy.
  istioctl proxy-config bootstrap <pod-name>
`,
		Aliases: []string{"b"},
		Args:    cobra.ExactArgs(1),
		RunE: func(c *cobra.Command, args []string) error {
			podName := args[0]
			ns := handleNamespace()
			configWriter, err := setupEnvoyConfigWriter(podName, ns)
			if err != nil {
				return err
			}
			return configWriter.PrintBootstrapDump()
		},
	}
)

func handleNamespace() string {
	ns := namespace
	if ns == v1.NamespaceAll {
		ns = defaultNamespace
	}
	return ns
}

func setupEnvoyConfigWriter(podName, podNamespace string) (*configdump.ConfigWriter, error) {
	kubeClient, err := kubernetes.NewClient(kubeconfig, configContext)
	if err != nil {
		return nil, err
	}
	path := "config_dump"
	debug, err := kubeClient.EnvoyDo(podName, podNamespace, "GET", path, nil)
	if err != nil {
		return nil, err
	}
	cw := &configdump.ConfigWriter{Stdout: os.Stdout}
	err = cw.Prime(debug)
	if err != nil {
		return nil, err
	}
	return cw, nil
}

func init() {
	rootCmd.AddCommand(configCmd)
	configCmd.PersistentFlags().StringVarP(&outputFormat, "output", "o", summaryOutput, "Output format: one of json|short")

	clusterConfigCmd.PersistentFlags().StringVar(&fqdn, "fqdn", "", "Filter clusters by substring of Service FQDN field")
	clusterConfigCmd.PersistentFlags().StringVar(&direction, "direction", "", "Filter clusters by Direction field")
	clusterConfigCmd.PersistentFlags().StringVar(&subset, "subset", "", "Filter clusters by substring of Subset field")
	clusterConfigCmd.PersistentFlags().IntVar(&port, "port", 0, "Filter clusters by Port field")

	listenerConfigCmd.PersistentFlags().StringVar(&address, "address", "", "Filter listeners by address field")
	listenerConfigCmd.PersistentFlags().StringVar(&listenerType, "type", "", "Filter listeners by type field")
	listenerConfigCmd.PersistentFlags().IntVar(&port, "port", 0, "Filter listeners by Port field")

	routeConfigCmd.PersistentFlags().StringVar(&routeName, "name", "", "Filter listeners by route name field")

	configCmd.AddCommand(clusterConfigCmd, listenerConfigCmd, routeConfigCmd, bootstrapConfigCmd)
}


text:
namespace SyncApplication
{
    partial class ConflictForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBoxRemoteChange = new System.Windows.Forms.GroupBox();
            this.dataGridServerChange = new System.Windows.Forms.DataGridView();
            this.groupBoxLocalChange = new System.Windows.Forms.GroupBox();
            this.dataGridClientChange = new System.Windows.Forms.DataGridView();
            this.label1 = new System.Windows.Forms.Label();
            this.textBoxConflictType = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.textBoxError = new System.Windows.Forms.TextBox();
            this.buttonRetry = new System.Windows.Forms.Button();
            this.buttonForceWrite = new System.Windows.Forms.Button();
            this.buttonContinue = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.textBoxSyncStage = new System.Windows.Forms.TextBox();
            this.richTextBoxHelp = new System.Windows.Forms.RichTextBox();
            this.buttonRetryNextSync = new System.Windows.Forms.Button();
            this.groupBoxRemoteChange.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridServerChange)).BeginInit();
            this.groupBoxLocalChange.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridClientChange)).BeginInit();
            this.SuspendLayout();
            //
            // groupBoxRemoteChange
            //
            this.groupBoxRemoteChange.Controls.Add(this.dataGridServerChange);
            this.groupBoxRemoteChange.Location = new System.Drawing.Point(12, 123);
            this.groupBoxRemoteChange.Name = "groupBoxRemoteChange";
            this.groupBoxRemoteChange.Size = new System.Drawing.Size(679, 145);
            this.groupBoxRemoteChange.TabIndex = 0;
            this.groupBoxRemoteChange.TabStop = false;
            this.groupBoxRemoteChange.Text = "Remote Change";
            //
            // dataGridServerChange
            //
            this.dataGridServerChange.AllowUserToAddRows = false;
            this.dataGridServerChange.AllowUserToDeleteRows = false;
            this.dataGridServerChange.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
            this.dataGridServerChange.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
            this.dataGridServerChange.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridServerChange.GridColor = System.Drawing.SystemColors.ControlDarkDark;
            this.dataGridServerChange.Location = new System.Drawing.Point(21, 30);
            this.dataGridServerChange.Name = "dataGridServerChange";
            this.dataGridServerChange.Size = new System.Drawing.Size(636, 97);
            this.dataGridServerChange.TabIndex = 1;
            //
            // groupBoxLocalChange
            //
            this.groupBoxLocalChange.Controls.Add(this.dataGridClientChange);
            this.groupBoxLocalChange.Location = new System.Drawing.Point(12, 284);
            this.groupBoxLocalChange.Name = "groupBoxLocalChange";
            this.groupBoxLocalChange.Size = new System.Drawing.Size(679, 145);
            this.groupBoxLocalChange.TabIndex = 1;
            this.groupBoxLocalChange.TabStop = false;
            this.groupBoxLocalChange.Text = "Local Change";
            //
            // dataGridClientChange
            //
            this.dataGridClientChange.AllowUserToAddRows = false;
            this.dataGridClientChange.AllowUserToDeleteRows = false;
            this.dataGridClientChange.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
            this.dataGridClientChange.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
            this.dataGridClientChange.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridClientChange.GridColor = System.Drawing.SystemColors.ControlDarkDark;
            this.dataGridClientChange.Location = new System.Drawing.Point(21, 29);
            this.dataGridClientChange.Name = "dataGridClientChange";
            this.dataGridClientChange.Size = new System.Drawing.Size(636, 97);
            this.dataGridClientChange.TabIndex = 2;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 39);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(69, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Conflict Type";
            //
            // textBoxConflictType
            //
            this.textBoxConflictType.Location = new System.Drawing.Point(98, 36);
            this.textBoxConflictType.Name = "textBoxConflictType";
            this.textBoxConflictType.ReadOnly = true;
            this.textBoxConflictType.Size = new System.Drawing.Size(229, 20);
            this.textBoxConflictType.TabIndex = 3;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(12, 70);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(75, 13);
            this.label2.TabIndex = 4;
            this.label2.Text = "Error Message";
            //
            // textBoxError
            //
            this.textBoxError.Location = new System.Drawing.Point(98, 67);
            this.textBoxError.Multiline = true;
            this.textBoxError.Name = "textBoxError";
            this.textBoxError.ReadOnly = true;
            this.textBoxError.Size = new System.Drawing.Size(593, 48);
            this.textBoxError.TabIndex = 5;
            //
            // buttonRetry
            //
            this.buttonRetry.Location = new System.Drawing.Point(503, 534);
            this.buttonRetry.Name = "buttonRetry";
            this.buttonRetry.Size = new System.Drawing.Size(188, 23);
            this.buttonRetry.TabIndex = 6;
            this.buttonRetry.Text = "Retr&y";
            this.buttonRetry.UseVisualStyleBackColor = true;
            this.buttonRetry.Click += new System.EventHandler(this.buttonRetry_Click);
            //
            // buttonForceWrite
            //
            this.buttonForceWrite.Location = new System.Drawing.Point(503, 473);
            this.buttonForceWrite.Name = "buttonForceWrite";
            this.buttonForceWrite.Size = new System.Drawing.Size(188, 23);
            this.buttonForceWrite.TabIndex = 7;
            this.buttonForceWrite.Text = "&Force Write [Remote Wins]";
            this.buttonForceWrite.UseVisualStyleBackColor = true;
            this.buttonForceWrite.Click += new System.EventHandler(this.buttonForceWrite_Click);
            //
            // buttonContinue
            //
            this.buttonContinue.Location = new System.Drawing.Point(503, 443);
            this.buttonContinue.Name = "buttonContinue";
            this.buttonContinue.Size = new System.Drawing.Size(188, 23);
            this.buttonContinue.TabIndex = 8;
            this.buttonContinue.Text = "&Continue [Local Wins]";
            this.buttonContinue.UseVisualStyleBackColor = true;
            this.buttonContinue.Click += new System.EventHandler(this.buttonContinue_Click);
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(12, 9);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(62, 13);
            this.label3.TabIndex = 10;
            this.label3.Text = "Sync Stage";
            //
            // textBoxSyncStage
            //
            this.textBoxSyncStage.Location = new System.Drawing.Point(98, 6);
            this.textBoxSyncStage.Name = "textBoxSyncStage";
            this.textBoxSyncStage.ReadOnly = true;
            this.textBoxSyncStage.Size = new System.Drawing.Size(229, 20);
            this.textBoxSyncStage.TabIndex = 11;
            //
            // richTextBoxHelp
            //
            this.richTextBoxHelp.Location = new System.Drawing.Point(12, 445);
            this.richTextBoxHelp.Name = "richTextBoxHelp";
            this.richTextBoxHelp.ReadOnly = true;
            this.richTextBoxHelp.Size = new System.Drawing.Size(475, 112);
            this.richTextBoxHelp.TabIndex = 12;
            this.richTextBoxHelp.Text = "";
            //
            // buttonRetryNextSync
            //
            this.buttonRetryNextSync.Location = new System.Drawing.Point(503, 504);
            this.buttonRetryNextSync.Name = "buttonRetryNextSync";
            this.buttonRetryNextSync.Size = new System.Drawing.Size(188, 23);
            this.buttonRetryNextSync.TabIndex = 13;
            this.buttonRetryNextSync.Text = "&Retry Next Sync";
            this.buttonRetryNextSync.UseVisualStyleBackColor = true;
            this.buttonRetryNextSync.Click += new System.EventHandler(this.buttonRetryNextSync_Click);
            //
            // ConflictForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(703, 569);
            this.Controls.Add(this.buttonRetryNextSync);
            this.Controls.Add(this.richTextBoxHelp);
            this.Controls.Add(this.textBoxSyncStage);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.buttonContinue);
            this.Controls.Add(this.buttonForceWrite);
            this.Controls.Add(this.buttonRetry);
            this.Controls.Add(this.textBoxError);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.textBoxConflictType);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.groupBoxLocalChange);
            this.Controls.Add(this.groupBoxRemoteChange);
            this.Name = "ConflictForm";
            this.groupBoxRemoteChange.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridServerChange)).EndInit();
            this.groupBoxLocalChange.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridClientChange)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBoxRemoteChange;
        private System.Windows.Forms.GroupBox groupBoxLocalChange;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox textBoxConflictType;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox textBoxError;
        private System.Windows.Forms.DataGridView dataGridServerChange;
        private System.Windows.Forms.DataGridView dataGridClientChange;
        private System.Windows.Forms.Button buttonRetry;
        private System.Windows.Forms.Button buttonForceWrite;
        private System.Windows.Forms.Button buttonContinue;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox textBoxSyncStage;
        private System.Windows.Forms.RichTextBox richTextBoxHelp;
        private System.Windows.Forms.Button buttonRetryNextSync;
    }
}


text:
<?php

namespace xmarcos\Silex;

use Silex\Application;
use Elasticsearch\Client;
use InvalidArgumentException;
use Silex\ServiceProviderInterface;

class ElasticsearchServiceProvider implements ServiceProviderInterface
{
    protected $prefix;

    /**
     * @param string $prefix Prefix name used to register the service in Silex.
     */
    public function __construct($prefix = 'elasticsearch')
    {
        if (empty($prefix) || false === is_string($prefix)) {
            throw new InvalidArgumentException(
                sprintf('$prefix must be a non-empty string, "%s" given', gettype($prefix))
            );
        }

        $this->prefix = $prefix;
    }

    /**
     * {@inheritdoc}
     */
    public function register(Application $app)
    {
        $prefix           = $this->prefix;
        $params_key       = sprintf('%s.params', $prefix);
        $app[$params_key] = isset($app[$params_key]) ? $app[$params_key] : [];

        $app[$prefix] = $app->share(
            function (Application $app) use ($params_key) {
                return new Client($app[$params_key]);
            }
        );
    }

    /**
     * {@inheritdoc}
     * @codeCoverageIgnore
     */
    public function boot(Application $app)
    {
    }
}


text:
Difficulty: Easy

https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts/

Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times.

The returned string must contain only lowercase English letters. If there are multiples valid strings, return any of them.

**Example 1:**
```
Input: n = 4
Output: "pppz"
Explanation: "pppz" is a valid string since the character 'p' occurs three times and the character 'z' occurs once. Note that there are many other valid strings such as "ohhh" and "love".
```

**Example 2:**
```
Input: n = 2
Output: "xy"
Explanation: "xy" is a valid string since the characters 'x' and 'y' occur once. Note that there are many other valid strings such as "ag" and "ur".
```

**Example 3:**
```
Input: n = 7
Output: "holasss"
```

**Constraints:**

* 1 <= n <= 500


text:
#ifndef DMA_REQUEST_INTERNAL_H
#define DMA_REQUEST_INTERNAL_H

#include <dma/dma_request.h>

/**
 * generic representation of DMA requests
 */
struct dma_request
{
    dma_req_id_t id;            ///<
    dma_req_st_t state;         ///<
    dma_req_type_t type;        ///<
    errval_t err;

#if DMA_BENCH_ENABLED
    cycles_t timer_start;
#endif

    struct dma_req_setup setup; ///<
    struct dma_request *next;   ///<
    struct dma_request *prev;   ///<
};

dma_req_id_t dma_request_generate_req_id(struct dma_channel *chan);

/**
 * \brief initializes the common part of a DMA request
 *
 * \param req   DMA request to initialize
 * \param chan  Channel this request gets executed on
 * \param type  The type of the DMA request
 *
 * \return SYS_ERR_OK on success
 *         errval on failure
 */
errval_t dma_request_common_init(struct dma_request *req,
                                 struct dma_channel *chan,
                                 dma_req_st_t type);

/**
 * \brief handles the processing of completed DMA requests
 *
 * \param req   the DMA request to process
 *
 * \returns SYS_ERR_OK on sucess
 *          errval on failure
 */
errval_t dma_request_process(struct dma_request *req);

/**
 * \brief sets the next DMA request of the given request
 *
 * \param req   DMA request
 * \param next  DMA request
 */
void dma_request_set_next(struct dma_request *req,
                          struct dma_request *next);

#endif /* DMA_REQUEST_INTERNAL_H */


text:
<?php namespace Mja\Mail;

use Backend;
use Event;
use Mail;
use Mja\Mail\Models\Email;
use GuzzleHttp\Psr7\Response;
use Mja\Mail\Controllers\Mail as MailController;
use System\Classes\PluginBase;
use System\Models\MailTemplate;

/**
 * Plugin Information File
 */
class Plugin extends PluginBase
{
    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name'        => 'mja.mail::lang.plugin_name',
            'description' => 'mja.mail::lang.plugin_description',
            'author'      => 'Matiss Janis Aboltins',
            'homepage'    => 'http://mja.lv/',
            'icon'        => 'icon-envelope'
        ];
    }

    public function registerNavigation()
    {
        return [
            'mail' => [
                'label'       => 'mja.mail::lang.controllers.mail.title',
                'url'         => Backend::url('mja/mail/mail'),
                'icon'        => 'icon-paper-plane-o',
                'permissions' => ['mja.mail.*'],
                'order'       => 500,

                'sideMenu' => [
                    'template' => [
                        'label'       => 'mja.mail::lang.controllers.template.title',
                        'icon'        => 'icon-database',
                        'url'         => Backend::url('mja/mail/template'),
                        'permissions' => ['mja.mail.template']
                    ],
                    'mail' => [
                        'label'       => 'mja.mail::lang.controllers.mail.mails_sent',
                        'icon'        => 'icon-paper-plane',
                        'url'         => Backend::url('mja/mail/mail'),
                        'permissions' => ['mja.mail.mail']
                    ]
                ]
            ]
        ];
    }

    public function registerFormWidgets()
    {
        return [
            'Mja\Mail\FormWidgets\EmailGrid' => [
                'label' => 'mja.mail::lang.formwidget.title',
                'code'  => 'emailgrid'
            ]
        ];
    }

    public function registerPermissions()
    {
        return [
            'mja.mail.template' => ['tab' => 'mja.mail::lang.controllers.mail.title', 'label' => 'mja.mail::lang.permission.template'],
            'mja.mail.mail'     => ['tab' => 'mja.mail::lang.controllers.mail.title', 'label' => 'mja.mail::lang.permission.mail']
       ];
    }

    /**
     * Attach event listeners on boot.
     * @return void
     */
    public function boot()
    {
        // Before send: attach blank image that will track mail opens
        Event::listen('mailer.prepareSend', function($self, $view, $message) {
            $swift = $message->getSwiftMessage();

            $mail = Email::create([
                'code' => $view,
                'to' => $swift->getTo(),
                'cc' => $swift->getCc(),
                'bcc' => $swift->getBcc(),
                'subject' => $swift->getSubject(),
                'body' => $swift->getBody(),
                'sender' => $swift->getSender(),
                'reply_to' => $swift->getReplyTo(),
                'date' => $swift->getDate()
            ]);

            $url = Backend::url('mja/mail/image/image', [
                'id'   => $mail->id,
                'hash' => $mail->hash . '.png'
            ]);

            $swift->setBody($swift->getBody() . '<img src="'. $url .'" style="display:none;width:0;height:0;" />');
        });

        // After send: log the result
        Event::listen('mailer.send', function($self, $view, $message, $response) {
            $swift = $message->getSwiftMessage();

            $mail = Email::where('code', $view)
                 ->get()
                 ->last();

            if ($mail === null) return;

            if ($response instanceof Response) {
                $response = $response->getBody()->getContents();
            }

            $mail->response = $response;
            $mail->sent = true;
            $mail->save();
        });

        // Use for the mails sent list filter
        Event::listen('backend.filter.extendScopesBefore', function ($filter) {
            if (! ($filter->getController() instanceof MailController)) {
                return;
            }

            $filter->scopes['views']['options'] = [];

            $templates = MailTemplate::get();
            foreach ($templates as $template) {
                $filter->scopes['views']['options'][$template->code] = $template->code;
            }
        });

        // Extend the mail template so that we could have the number of sent emails
        // in the template list of this plugin.
        MailTemplate::extend(function($model) {

            // Email relation
            $model->addDynamicMethod('emails', function() use ($model) {
                return $model->hasMany('Mja\Mail\Models\Email', 'code', 'code');
            });

            // Emails sent
            $model->addDynamicMethod('getTimesSentAttribute', function() use ($model) {
                return (int) $model->emails()->count();
            });

            // Email opens
            $model->addDynamicMethod('getTimesOpenedAttribute', function() use ($model) {
                return (int) $model->opens()->count();
            });

            // Last time sent
            $model->addDynamicMethod('getLastSentAttribute', function() use ($model) {
                $email = $model->emails()->orderBy('id', 'desc')->first();
                return $email ? $email->created_at : null;
            });

            // Last time opened
            $model->addDynamicMethod('getLastOpenAttribute', function() use ($model) {
                $emails = $model->emails()->get();
                $last_open = null;

                foreach ($emails as $email) {
                    $lo = $email->opens()->orderBy('id', 'desc')->first();
                    if ($lo && ($lo->created_at < $last_open || $last_open === null))
                        $last_open = $lo->created_at;
                }

                return $last_open;
            });

            // Get the email opens by template
            $model->addDynamicMethod('opens', function() use ($model) {
                $model->setKeyName('code');
                $data = $model->hasManyThrough('Mja\Mail\Models\EmailOpens', 'Mja\Mail\Models\Email', 'code', 'email_id');
                $model->setKeyName('id');
                return $data;
            });
        });
    }
}


text:
package tdsr

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// CheckPermission invokes the tdsr.CheckPermission API synchronously
// api document: https://help.aliyun.com/api/tdsr/checkpermission.html
func (client *Client) CheckPermission(request *CheckPermissionRequest) (response *CheckPermissionResponse, err error) {
	response = CreateCheckPermissionResponse()
	err = client.DoAction(request, response)
	return
}

// CheckPermissionWithChan invokes the tdsr.CheckPermission API asynchronously
// api document: https://help.aliyun.com/api/tdsr/checkpermission.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) CheckPermissionWithChan(request *CheckPermissionRequest) (<-chan *CheckPermissionResponse, <-chan error) {
	responseChan := make(chan *CheckPermissionResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.CheckPermission(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// CheckPermissionWithCallback invokes the tdsr.CheckPermission API asynchronously
// api document: https://help.aliyun.com/api/tdsr/checkpermission.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) CheckPermissionWithCallback(request *CheckPermissionRequest, callback func(response *CheckPermissionResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *CheckPermissionResponse
		var err error
		defer close(result)
		response, err = client.CheckPermission(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// CheckPermissionRequest is the request struct for api CheckPermission
type CheckPermissionRequest struct {
	*requests.RpcRequest
	AliyunId string `position:"Query" name:"AliyunId"`
}

// CheckPermissionResponse is the response struct for api CheckPermission
type CheckPermissionResponse struct {
	*responses.BaseResponse
	RequestId  string `json:"RequestId" xml:"RequestId"`
	Success    bool   `json:"Success" xml:"Success"`
	ErrMessage string `json:"ErrMessage" xml:"ErrMessage"`
}

// CreateCheckPermissionRequest creates a request to invoke CheckPermission API
func CreateCheckPermissionRequest() (request *CheckPermissionRequest) {
	request = &CheckPermissionRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("tdsr", "2020-01-01", "CheckPermission", "", "")
	request.Method = requests.POST
	return
}

// CreateCheckPermissionResponse creates a response to parse from CheckPermission response
func CreateCheckPermissionResponse() (response *CheckPermissionResponse) {
	response = &CheckPermissionResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
SGFS API Reference
==================

The :class:`.SGFS` object is the main entrypoint into most functions
of this package. Generally, you construct a :class:`.SGFS` object and use it to
map entities to paths, get contexts from entities, and create structures.

Secondary classes such as :class:`.Context` are not created directly since they must remain connected to their original :class:`.SGFS`.

.. automodule:: sgfs.sgfs

    .. autoclass:: SGFS

Entities
--------

.. automethod:: sgfs.sgfs.SGFS.entities_from_path
.. automethod:: sgfs.sgfs.SGFS.entities_in_directory
.. automethod:: sgfs.sgfs.SGFS.path_for_entity

Templates
---------

.. automethod:: sgfs.sgfs.SGFS.find_template
.. automethod:: sgfs.sgfs.SGFS.path_from_template
.. automethod:: sgfs.sgfs.SGFS.template_from_path

Contexts
--------

.. automethod:: sgfs.sgfs.SGFS.context_from_path
.. automethod:: sgfs.sgfs.SGFS.context_from_entities

Structure
---------

.. automethod:: sgfs.sgfs.SGFS.structure_from_entities
.. automethod:: sgfs.sgfs.SGFS.create_structure
.. automethod:: sgfs.sgfs.SGFS.tag_existing_structure

Tags and Caches
---------------

.. automethod:: sgfs.sgfs.SGFS.tag_directory_with_entity
.. automethod:: sgfs.sgfs.SGFS.get_directory_entity_tags
.. automethod:: sgfs.sgfs.SGFS.entity_tags_in_directory
.. automethod:: sgfs.sgfs.SGFS.path_cache
.. automethod:: sgfs.sgfs.SGFS.rebuild_cache


text:
/*
 * 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 io.prestosql.rcfile.binary;

import io.airlift.slice.Slice;
import io.airlift.slice.SliceOutput;
import io.airlift.slice.Slices;
import io.prestosql.rcfile.ColumnData;
import io.prestosql.rcfile.EncodeOutput;
import io.prestosql.spi.block.Block;
import io.prestosql.spi.block.BlockBuilder;
import io.prestosql.spi.type.DecimalType;
import io.prestosql.spi.type.Decimals;
import io.prestosql.spi.type.Type;

import java.math.BigInteger;

import static com.google.common.base.Preconditions.checkState;
import static io.prestosql.rcfile.RcFileDecoderUtils.decodeVIntSize;
import static io.prestosql.rcfile.RcFileDecoderUtils.readVInt;
import static io.prestosql.rcfile.RcFileDecoderUtils.writeVInt;
import static io.prestosql.spi.type.Decimals.isShortDecimal;
import static io.prestosql.spi.type.Decimals.rescale;
import static java.lang.Math.toIntExact;

public class DecimalEncoding
        implements BinaryColumnEncoding
{
    private static final int BITS_IN_BYTE = 8;
    private static final int BYTES_IN_LONG_DECIMAL = 16;

    private final DecimalType type;
    private final byte[] resultBytes = new byte[BYTES_IN_LONG_DECIMAL];
    private final Slice resultSlice = Slices.wrappedBuffer(resultBytes);

    public DecimalEncoding(Type type)
    {
        this.type = (DecimalType) type;
    }

    @Override
    public void encodeColumn(Block block, SliceOutput output, EncodeOutput encodeOutput)
    {
        for (int position = 0; position < block.getPositionCount(); position++) {
            if (!block.isNull(position)) {
                encodeValueInto(block, position, output);
            }
            encodeOutput.closeEntry();
        }
    }

    @Override
    public void encodeValueInto(Block block, int position, SliceOutput output)
    {
        if (isShortDecimal(type)) {
            writeLong(output, type.getLong(block, position));
        }
        else {
            writeSlice(output, block, position);
        }
    }

    @Override
    public Block decodeColumn(ColumnData columnData)
    {
        int size = columnData.rowCount();
        BlockBuilder builder = type.createBlockBuilder(null, size);

        Slice slice = columnData.getSlice();
        for (int i = 0; i < size; i++) {
            int offset = columnData.getOffset(i);
            int length = columnData.getLength(i);
            if (length == 0) {
                builder.appendNull();
            }
            else if (isShortDecimal(type)) {
                type.writeLong(builder, parseLong(slice, offset));
            }
            else {
                type.writeSlice(builder, parseSlice(slice, offset));
            }
        }
        return builder.build();
    }

    @Override
    public int getValueOffset(Slice slice, int offset)
    {
        return 0;
    }

    @Override
    public int getValueLength(Slice slice, int offset)
    {
        // first vint is scale
        int scaleLength = decodeVIntSize(slice, offset);

        // second vint is data length
        int dataLengthLength = decodeVIntSize(slice, offset + scaleLength);
        int dataLength = toIntExact(readVInt(slice, offset + scaleLength));

        return scaleLength + dataLengthLength + dataLength;
    }

    @Override
    public void decodeValueInto(BlockBuilder builder, Slice slice, int offset, int length)
    {
        if (isShortDecimal(type)) {
            type.writeLong(builder, parseLong(slice, offset));
        }
        else {
            type.writeSlice(builder, parseSlice(slice, offset));
        }
    }

    private long parseLong(Slice slice, int offset)
    {
        // first vint is scale
        int scale = toIntExact(readVInt(slice, offset));
        offset += decodeVIntSize(slice, offset);

        // second vint is length
        int length = toIntExact(readVInt(slice, offset));
        offset += decodeVIntSize(slice, offset);

        checkState(length <= 8);

        // reset the results buffer
        if (slice.getByte(offset) >= 0) {
            resultSlice.setLong(0, 0L);
        }
        else {
            resultSlice.setLong(0, 0xFFFF_FFFF_FFFF_FFFFL);
        }

        resultSlice.setBytes(8 - length, slice, offset, length);

        long value = Long.reverseBytes(resultSlice.getLong(0));
        if (scale != type.getScale()) {
            return rescale(value, scale, type.getScale());
        }

        return value;
    }

    private Slice parseSlice(Slice slice, int offset)
    {
        // first vint is scale
        int scale = toIntExact(readVInt(slice, offset));
        offset += decodeVIntSize(slice, offset);

        // second vint is length
        int length = toIntExact(readVInt(slice, offset));
        offset += decodeVIntSize(slice, offset);

        checkState(length <= BYTES_IN_LONG_DECIMAL);

        // reset the results buffer
        if (slice.getByte(offset) >= 0) {
            resultSlice.setLong(0, 0L);
            resultSlice.setLong(8, 0L);
        }
        else {
            resultSlice.setLong(0, 0xFFFF_FFFF_FFFF_FFFFL);
            resultSlice.setLong(8, 0xFFFF_FFFF_FFFF_FFFFL);
        }

        resultSlice.setBytes(BYTES_IN_LONG_DECIMAL - length, slice, offset, length);

        // todo get rid of BigInteger
        BigInteger decimal = new BigInteger(resultBytes);
        if (scale != type.getScale()) {
            decimal = Decimals.rescale(decimal, scale, type.getScale());
        }

        return Decimals.encodeUnscaledValue(decimal);
    }

    private void writeLong(SliceOutput output, long value)
    {
        // first vint is scale
        writeVInt(output, type.getScale());

        // second vint is length
        int length = getWriteByteCount(value);
        writeVInt(output, length);

        // write value (big endian)
        for (int i = length - 1; i >= 0; i--) {
            output.writeByte((int) (value >> (i * 8)));
        }
    }

    private static int getWriteByteCount(long value)
    {
        // if the value is negative flip the bits, so we can always count leading zero bytes
        if (value < 0) {
            value = ~value;
        }

        // count number of leading zero bytes
        return (Long.SIZE - Long.numberOfLeadingZeros(value)) / BITS_IN_BYTE + 1;
    }

    private void writeSlice(SliceOutput output, Block block, int position)
    {
        // first vint is scale
        writeVInt(output, type.getScale());

        // second vint is length
        // todo get rid of BigInteger
        BigInteger decimal = Decimals.decodeUnscaledValue(type.getSlice(block, position));
        byte[] decimalBytes = decimal.toByteArray();
        writeVInt(output, decimalBytes.length);

        // write value (big endian)
        // NOTE: long decimals are stored in a slice in big endian encoding
        for (byte decimalByte : decimalBytes) {
            output.write(decimalByte);
        }
    }
}


text:
' Copyright (c) Microsoft Corporation.  All rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports Microsoft.WindowsAPICodePack.DirectX.Direct2D1

Namespace D2DShapes
	Friend Class BitmapShape
		Inherits DrawingShape
		#Region "Fields"
'INSTANT VB NOTE: The variable destRect was renamed since Visual Basic does not allow class members with the same name:
		Private destRect_Renamed As RectF
'INSTANT VB NOTE: The variable sourceRect was renamed since Visual Basic does not allow class members with the same name:
		Private sourceRect_Renamed As RectF
'INSTANT VB NOTE: The variable drawSection was renamed since Visual Basic does not allow class members with the same name:
		Private drawSection_Renamed As Boolean
'INSTANT VB NOTE: The variable opacity was renamed since Visual Basic does not allow class members with the same name:
		Private opacity_Renamed As Single
		#End Region

		#Region "Properties"
		<TypeConverter(GetType(ExpandableObjectConverter))> _
		Public Property DestRect() As RectF
			Get
				Return destRect_Renamed
			End Get
			Set(ByVal value As RectF)
				destRect_Renamed = value
			End Set
		End Property

		<TypeConverter(GetType(ExpandableObjectConverter))> _
		Public Property SourceRect() As RectF
			Get
				Return sourceRect_Renamed
			End Get
			Set(ByVal value As RectF)
				sourceRect_Renamed = value
			End Set
		End Property

		Public Property DrawSection() As Boolean
			Get
				Return drawSection_Renamed
			End Get
			Set(ByVal value As Boolean)
				drawSection_Renamed = value
			End Set
		End Property

		Public Property Opacity() As Single
			Get
				Return opacity_Renamed
			End Get
			Set(ByVal value As Single)
				opacity_Renamed = value
			End Set
		End Property
		#End Region

		Public Sub New(ByVal initialRenderTarget As RenderTarget, ByVal random As Random, ByVal d2DFactory As D2DFactory, ByVal bitmap As D2DBitmap)
			MyBase.New(initialRenderTarget, random, d2DFactory, bitmap)
			DestRect = RandomRect(CanvasWidth, CanvasHeight)
			opacity_Renamed = RandomOpacity()
			DrawSection = Random.NextDouble() < 0.25
			If drawSection_Renamed Then
				SourceRect = RandomRect(Me.Bitmap.PixelSize.Width, Me.Bitmap.PixelSize.Height)
			End If
		End Sub

		Protected Friend Overrides Sub ChangeRenderTarget(ByVal newRenderTarget As RenderTarget)
			'no rendertarget dependent members
		End Sub

		Protected Friend Overrides Sub Draw(ByVal renderTarget As RenderTarget)
			If DrawSection Then
				renderTarget.DrawBitmap(Bitmap, opacity_Renamed, BitmapInterpolationMode.Linear, DestRect, SourceRect)
			Else
				renderTarget.DrawBitmap(Bitmap, opacity_Renamed, BitmapInterpolationMode.Linear, DestRect)
			End If
		End Sub

		Public Overrides Function HitTest(ByVal point As Point2F) As Boolean
			Return DestRect.Top <= point.Y AndAlso DestRect.Bottom >= point.Y AndAlso DestRect.Left <= point.X AndAlso DestRect.Right >= point.X
		End Function
	End Class
End Namespace


text:
from contextlib import closing
import time
import urllib

for i in range(895, 2000):
    print i
    with closing(urllib.urlopen('http://ipsc.ksp.sk/2011/practice/problems/q.html')) as u:
        with open('{}.html'.format(i), 'wb') as f:
            f.write(u.read())
    time.sleep(10)


text:
package org.teavm.model.util;

import com.carrotsearch.hppc.IntIntHashMap;
import com.carrotsearch.hppc.IntIntMap;
import org.teavm.common.GraphSplittingBackend;
import org.teavm.model.BasicBlock;
import org.teavm.model.Program;

public class ProgramNodeSplittingBackend implements GraphSplittingBackend {
    private Program program;

    public ProgramNodeSplittingBackend(Program program) {
        this.program = program;
    }

    @Override
    public int[] split(int[] domain, int[] nodes) {
        int[] copies = new int[nodes.length];
        IntIntMap map = new IntIntHashMap();
        for (int i = 0; i < nodes.length; ++i) {
            int node = nodes[i];
            BasicBlock block = program.basicBlockAt(node);
            BasicBlock blockCopy = program.createBasicBlock();
            ProgramUtils.copyBasicBlock(block, blockCopy);
            copies[i] = blockCopy.getIndex();
            map.put(nodes[i], copies[i] + 1);
        }
        BasicBlockMapper copyBlockMapper = new BasicBlockMapper((int block) -> {
            int mappedIndex = map.get(block);
            return mappedIndex == 0 ? block : mappedIndex - 1;
        });
        for (int copy : copies) {
            copyBlockMapper.transform(program.basicBlockAt(copy));
        }
        for (int domainNode : domain) {
            copyBlockMapper.transform(program.basicBlockAt(domainNode));
        }
        return copies;
    }
}


text:
// Copyright 2022 Google LLC
//
// 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.google.firebase.appcheck.playintegrity.internal;

import static com.google.android.gms.common.internal.Preconditions.checkNotNull;
import static com.google.android.gms.common.util.Strings.emptyToNull;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import com.google.firebase.FirebaseException;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Client-side model of the GeneratePlayIntegrityChallengeResponse payload from the Firebase App
 * Check Token Exchange API.
 */
class GeneratePlayIntegrityChallengeResponse {

  @VisibleForTesting static final String CHALLENGE_KEY = "challenge";
  @VisibleForTesting static final String TIME_TO_LIVE_KEY = "ttl";

  private String challenge;
  private String timeToLive;

  @NonNull
  public static GeneratePlayIntegrityChallengeResponse fromJsonString(@NonNull String jsonString)
      throws FirebaseException, JSONException {
    JSONObject jsonObject = new JSONObject(jsonString);
    String challenge = emptyToNull(jsonObject.optString(CHALLENGE_KEY));
    String timeToLive = emptyToNull(jsonObject.optString(TIME_TO_LIVE_KEY));
    if (challenge == null || timeToLive == null) {
      throw new FirebaseException("Unexpected server response.");
    }
    return new GeneratePlayIntegrityChallengeResponse(challenge, timeToLive);
  }

  private GeneratePlayIntegrityChallengeResponse(
      @NonNull String challenge, @NonNull String timeToLive) {
    checkNotNull(challenge);
    checkNotNull(timeToLive);
    this.challenge = challenge;
    this.timeToLive = timeToLive;
  }

  @NonNull
  public String getChallenge() {
    return challenge;
  }

  @NonNull
  public String getTimeToLive() {
    return timeToLive;
  }
}


text:
<resources>
    <string name="app_name">IndoorLocation</string>
</resources>