text:
/* globals RocketChatFileEmojiCustomInstance */
Meteor.startup(function() {
	let storeType = 'GridFS';

	if (RocketChat.settings.get('EmojiUpload_Storage_Type')) {
		storeType = RocketChat.settings.get('EmojiUpload_Storage_Type');
	}

	const RocketChatStore = RocketChatFile[storeType];

	if (RocketChatStore == null) {
		throw new Error(`Invalid RocketChatStore type [${storeType}]`);
	}

	console.log(`Using ${storeType} for custom emoji storage`.green);

	let path = '~/uploads';
	if (RocketChat.settings.get('EmojiUpload_FileSystemPath') != null) {
		if (RocketChat.settings.get('EmojiUpload_FileSystemPath').trim() !== '') {
			path = RocketChat.settings.get('EmojiUpload_FileSystemPath');
		}
	}

	this.RocketChatFileEmojiCustomInstance = new RocketChatStore({
		name: 'custom_emoji',
		absolutePath: path
	});

	return WebApp.connectHandlers.use('/emoji-custom/', Meteor.bindEnvironment(function(req, res/*, next*/) {
		const params =
			{emoji: decodeURIComponent(req.url.replace(/^\//, '').replace(/\?.*$/, ''))};

		if (_.isEmpty(params.emoji)) {
			res.writeHead(403);
			res.write('Forbidden');
			res.end();
			return;
		}

		const file = RocketChatFileEmojiCustomInstance.getFileWithReadStream(encodeURIComponent(params.emoji));

		res.setHeader('Content-Disposition', 'inline');

		if (file == null) {
			//use code from username initials renderer until file upload is complete
			res.setHeader('Content-Type', 'image/svg+xml');
			res.setHeader('Cache-Control', 'public, max-age=0');
			res.setHeader('Expires', '-1');
			res.setHeader('Last-Modified', 'Thu, 01 Jan 2015 00:00:00 GMT');

			const reqModifiedHeader = req.headers['if-modified-since'];
			if (reqModifiedHeader != null) {
				if (reqModifiedHeader === 'Thu, 01 Jan 2015 00:00:00 GMT') {
					res.writeHead(304);
					res.end();
					return;
				}
			}

			const color = '#000';
			const initials = '?';

			const svg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" pointer-events="none" width="50" height="50" style="width: 50px; height: 50px; background-color: ${color};">
	<text text-anchor="middle" y="50%" x="50%" dy="0.36em" pointer-events="auto" fill="#ffffff" font-family="Helvetica, Arial, Lucida Grande, sans-serif" style="font-weight: 400; font-size: 28px;">
		${initials}
	</text>
</svg>`;

			res.write(svg);
			res.end();
			return;
		}

		let fileUploadDate = undefined;
		if (file.uploadDate != null) {
			fileUploadDate = file.uploadDate.toUTCString();
		}

		const reqModifiedHeader = req.headers['if-modified-since'];
		if (reqModifiedHeader != null) {
			if (reqModifiedHeader === fileUploadDate) {
				res.setHeader('Last-Modified', reqModifiedHeader);
				res.writeHead(304);
				res.end();
				return;
			}
		}

		res.setHeader('Cache-Control', 'public, max-age=0');
		res.setHeader('Expires', '-1');
		if (fileUploadDate != null) {
			res.setHeader('Last-Modified', fileUploadDate);
		} else {
			res.setHeader('Last-Modified', new Date().toUTCString());
		}
		if (/^svg$/i.test(params.emoji.split('.').pop())) {
			res.setHeader('Content-Type', 'image/svg+xml');
		} else {
			res.setHeader('Content-Type', 'image/jpeg');
		}
		res.setHeader('Content-Length', file.length);

		file.readStream.pipe(res);
	}));
});


text:
title:  Structura cărţii Daniel
date:   30/12/2019
---

Modul de aranjare a secţiunii aramaice a cărţii Daniel, capitolele 2-7 (anumite părţi din Daniel au fost scrise în ebraică şi altele în aramaică), ne arată următoarea structură, care, la rândul ei, consolidează ideea de mesaj central al acestei secţiuni şi al cărţii:

- A. Visul lui Nebucadneţar despre patru împărăţii (Daniel 2)
    - B. Dumnezeu îi eliberează pe prietenii lui Daniel din cuptorul aprins (Daniel 3)
        - C. Judecata asupra lui Nebucadneţar (Daniel 4)
        - C'. Judecata asupra lui Belşaţar (Daniel 5)
    - B'. Dumnezeu îl eliberează pe Daniel din groapa cu lei (Daniel 6)
- A'. Visul lui Daniel despre patru împărăţii (Daniel 7)

Această structură literară pune în evidenţă punctul central, notat aici cu C şi C' (Daniel 4 şi 5): Dumnezeu îi ia împărăţia lui Nebucadneţar (temporar) şi lui Belşaţar (permanent). Astfel, în capitolele 2-7 accentul cade pe suveranitatea iui Dumnezeu asupra împăraţilor pământului – El îi aduce la putere şi El îi îndepărtează.

O metodă eficientă de a transmite un mesaj şi de a demonstra o idee este repetiţia. Dumnezeu îi dă lui Faraon două vise despre viitorul apropiat al Egiptului care transmit aceeaşi idee: şapte ani de prosperitate urmaţi de şapte ani de foamete (Geneza 41:1-7).

Dumnezeu foloseşte repetiţia şi în cartea Daniel. Există patru cicluri profetice, repetiţii ale unei structuri de bază. La sfârşit, această structură ne arată suveranitatea supremă a lui Dumnezeu. Deşi fiecare plan profetic major prezintă o perspectivă distinctă, împreună, ele acoperă aceeaşi perioadă istorică – din vremea profetului până la sfârşit, după cum putem vedea mai jos:

Daniel 2
Daniel 7
Daniel 8 şi 9
Daniel 10-12

Babilon
Babilon

Medo-Persia
Medo-Persia
Medo-Persia
Medo-Persia

Grecia
Grecia
Grecia
Grecia

Roma
Roma
Roma
Roma

Împărăţia lui Dumnezeu
Judecata din ceruri, Noul Pământ
Curăţirea sanctuarului
Intervenţia lui Mihail, Ocrotitorul

`Ce speranţă ne aduc următoarele versete cu privire la perspectiva pe termen lung? Daniel 2:44, Psalmii 9:7-1 şi2 Petru 3:11-13.`

redpajama_set_name: RedPajamaGithub


text:
import { PlayOutline20 } from "../../";

export = PlayOutline20;


text:
"""
Automatically package and test a Python project against configurable
Python2 and Python3 based virtual environments. Environments are
setup by using virtualenv. Configuration is generally done through an
INI-style "tox.ini" file.
"""
from __future__ import with_statement

import tox
import py
import os
import sys
import subprocess
from tox._verlib import NormalizedVersion, IrrationalVersionError
from tox.venv import VirtualEnv
from tox.config import parseconfig
from tox.result import ResultLog
from subprocess import STDOUT

def now():
    return py.std.time.time()

def prepare(args):
    config = parseconfig(args)
    if config.option.help:
        show_help(config)
        raise SystemExit(0)
    elif config.option.helpini:
        show_help_ini(config)
        raise SystemExit(0)
    return config

def main(args=None):
    try:
        config = prepare(args)
        retcode = Session(config).runcommand()
        raise SystemExit(retcode)
    except KeyboardInterrupt:
        raise SystemExit(2)

def show_help(config):
    tw = py.io.TerminalWriter()
    tw.write(config._parser._format_help())
    tw.line()
    tw.line("Environment variables", bold=True)
    tw.line("TOXENV: comma separated list of environments "
            "(overridable by '-e')")
    tw.line("TOX_TESTENV_PASSENV: space-separated list of extra "
            "environment variables to be passed into test command "
            "environemnts")

def show_help_ini(config):
    tw = py.io.TerminalWriter()
    tw.sep("-", "per-testenv attributes")
    for env_attr in config._testenv_attr:
        tw.line("%-15s %-8s default: %s" %
                (env_attr.name, "<" + env_attr.type + ">", env_attr.default), bold=True)
        tw.line(env_attr.help)
        tw.line()

class Action(object):
    def __init__(self, session, venv, msg, args):
        self.venv = venv
        self.msg = msg
        self.activity = msg.split(" ", 1)[0]
        self.session = session
        self.report = session.report
        self.args = args
        self.id = venv and venv.envconfig.envname or "tox"
        self._popenlist = []
        if self.venv:
            self.venvname = self.venv.name
        else:
            self.venvname = "GLOB"
        if msg == "runtests":
            cat = "test"
        else:
            cat = "setup"
        envlog = session.resultlog.get_envlog(self.venvname)
        self.commandlog = envlog.get_commandlog(cat)

    def __enter__(self):
        self.report.logaction_start(self)

    def __exit__(self, *args):
        self.report.logaction_finish(self)

    def setactivity(self, name, msg):
        self.activity = name
        self.report.verbosity0("%s %s: %s" % (self.venvname, name, msg), bold=True)

    def info(self, name, msg):
        self.report.verbosity1("%s %s: %s" % (self.venvname, name, msg), bold=True)

    def _initlogpath(self, actionid):
        if self.venv:
            logdir = self.venv.envconfig.envlogdir
        else:
            logdir = self.session.config.logdir
        try:
            l = logdir.listdir("%s-*" % actionid)
        except py.error.ENOENT:
            logdir.ensure(dir=1)
            l = []
        num = len(l)
        path = logdir.join("%s-%s.log" % (actionid, num))
        f = path.open('w')
        f.flush()
        return f

    def popen(self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False):
        stdout = outpath = None
        resultjson = self.session.config.option.resultjson
        if resultjson or redirect:
            fout = self._initlogpath(self.id)
            fout.write("actionid: %s\nmsg: %s\ncmdargs: %r\nenv: %s\n\n" % (
                self.id, self.msg, args, env))
            fout.flush()
            self.popen_outpath = outpath = py.path.local(fout.name)
            fin = outpath.open()
            fin.read()  # read the header, so it won't be written to stdout
            stdout = fout
        elif returnout:
            stdout = subprocess.PIPE
        if cwd is None:
            # XXX cwd = self.session.config.cwd
            cwd = py.path.local()
        try:
            popen = self._popen(args, cwd, env=env,
                                stdout=stdout, stderr=STDOUT)
        except OSError as e:
            self.report.error("invocation failed (errno %d), args: %s, cwd: %s" %
                              (e.errno, args, cwd))
            raise
        popen.outpath = outpath
        popen.args = [str(x) for x in args]
        popen.cwd = cwd
        popen.action = self
        self._popenlist.append(popen)
        try:
            self.report.logpopen(popen, env=env)
            try:
                if resultjson and not redirect:
                    assert popen.stderr is None  # prevent deadlock
                    out = None
                    last_time = now()
                    while 1:
                        fin_pos = fin.tell()
                        # we have to read one byte at a time, otherwise there
                        # might be no output for a long time with slow tests
                        data = fin.read(1)
                        if data:
                            sys.stdout.write(data)
                            if '\n' in data or (now() - last_time) > 1:
                                # we flush on newlines or after 1 second to
                                # provide quick enough feedback to the user
                                # when printing a dot per test
                                sys.stdout.flush()
                                last_time = now()
                        elif popen.poll() is not None:
                            if popen.stdout is not None:
                                popen.stdout.close()
                            break
                        else:
                            py.std.time.sleep(0.1)
                            fin.seek(fin_pos)
                    fin.close()
                else:
                    out, err = popen.communicate()
            except KeyboardInterrupt:
                self.report.keyboard_interrupt()
                popen.wait()
                raise KeyboardInterrupt()
            ret = popen.wait()
        finally:
            self._popenlist.remove(popen)
        if ret and not ignore_ret:
            invoked = " ".join(map(str, popen.args))
            if outpath:
                self.report.error("invocation failed (exit code %d), logfile: %s" %
                                  (ret, outpath))
                out = outpath.read()
                self.report.error(out)
                if hasattr(self, "commandlog"):
                    self.commandlog.add_command(popen.args, out, ret)
                raise tox.exception.InvocationError(
                    "%s (see %s)" % (invoked, outpath), ret)
            else:
                raise tox.exception.InvocationError("%r" % (invoked, ), ret)
        if not out and outpath:
            out = outpath.read()
        if hasattr(self, "commandlog"):
            self.commandlog.add_command(popen.args, out, ret)
        return out

    def _rewriteargs(self, cwd, args):
        newargs = []
        for arg in args:
            if sys.platform != "win32" and isinstance(arg, py.path.local):
                arg = cwd.bestrelpath(arg)
            newargs.append(str(arg))

        # subprocess does not always take kindly to .py scripts
        # so adding the interpreter here.
        if sys.platform == "win32":
            ext = os.path.splitext(str(newargs[0]))[1].lower()
            if ext == '.py' and self.venv:
                newargs = [str(self.venv.getcommandpath())] + newargs

        return newargs

    def _popen(self, args, cwd, stdout, stderr, env=None):
        args = self._rewriteargs(cwd, args)
        if env is None:
            env = os.environ.copy()
        return self.session.popen(args, shell=False, cwd=str(cwd),
                                  universal_newlines=True,
                                  stdout=stdout, stderr=stderr, env=env)

class Reporter(object):
    actionchar = "-"

    def __init__(self, session):
        self.tw = py.io.TerminalWriter()
        self.session = session
        self._reportedlines = []
        # self.cumulated_time = 0.0

    def logpopen(self, popen, env):
        """ log information about the action.popen() created process. """
        cmd = " ".join(map(str, popen.args))
        if popen.outpath:
            self.verbosity1("  %s$ %s >%s" % (popen.cwd, cmd, popen.outpath,))
        else:
            self.verbosity1("  %s$ %s " % (popen.cwd, cmd))

    def logaction_start(self, action):
        msg = action.msg + " " + " ".join(map(str, action.args))
        self.verbosity2("%s start: %s" % (action.venvname, msg), bold=True)
        assert not hasattr(action, "_starttime")
        action._starttime = now()

    def logaction_finish(self, action):
        duration = now() - action._starttime
        # self.cumulated_time += duration
        self.verbosity2("%s finish: %s after %.2f seconds" % (
            action.venvname, action.msg, duration), bold=True)

    def startsummary(self):
        self.tw.sep("_", "summary")

    def info(self, msg):
        if self.session.config.option.verbosity >= 2:
            self.logline(msg)

    def using(self, msg):
        if self.session.config.option.verbosity >= 1:
            self.logline("using %s" % (msg,), bold=True)

    def keyboard_interrupt(self):
        self.error("KEYBOARDINTERRUPT")

#    def venv_installproject(self, venv, pkg):
#        self.logline("installing to %s: %s" % (venv.envconfig.envname, pkg))

    def keyvalue(self, name, value):
        if name.endswith(":"):
            name += " "
        self.tw.write(name, bold=True)
        self.tw.write(value)
        self.tw.line()

    def line(self, msg, **opts):
        self.logline(msg, **opts)

    def good(self, msg):
        self.logline(msg, green=True)

    def warning(self, msg):
        self.logline("WARNING:" + msg, red=True)

    def error(self, msg):
        self.logline("ERROR: " + msg, red=True)

    def skip(self, msg):
        self.logline("SKIPPED:" + msg, yellow=True)

    def logline(self, msg, **opts):
        self._reportedlines.append(msg)
        self.tw.line("%s" % msg, **opts)

    def verbosity0(self, msg, **opts):
        if self.session.config.option.verbosity >= 0:
            self.logline("%s" % msg, **opts)

    def verbosity1(self, msg, **opts):
        if self.session.config.option.verbosity >= 1:
            self.logline("%s" % msg, **opts)

    def verbosity2(self, msg, **opts):
        if self.session.config.option.verbosity >= 2:
            self.logline("%s" % msg, **opts)

    # def log(self, msg):
    #    py.builtin.print_(msg, file=sys.stderr)

class Session:

    def __init__(self, config, popen=subprocess.Popen, Report=Reporter):
        self.config = config
        self.popen = popen
        self.resultlog = ResultLog()
        self.report = Report(self)
        self.make_emptydir(config.logdir)
        config.logdir.ensure(dir=1)
        # self.report.using("logdir %s" %(self.config.logdir,))
        self.report.using("tox.ini: %s" % (self.config.toxinipath,))
        self._spec2pkg = {}
        self._name2venv = {}
        try:
            self.venvlist = [
                self.getvenv(x)
                for x in self.config.envlist
            ]
        except LookupError:
            raise SystemExit(1)
        self._actions = []

    def _makevenv(self, name):
        envconfig = self.config.envconfigs.get(name, None)
        if envconfig is None:
            self.report.error("unknown environment %r" % name)
            raise LookupError(name)
        venv = VirtualEnv(envconfig=envconfig, session=self)
        self._name2venv[name] = venv
        return venv

    def getvenv(self, name):
        """ return a VirtualEnv controler object for the 'name' env.  """
        try:
            return self._name2venv[name]
        except KeyError:
            return self._makevenv(name)

    def newaction(self, venv, msg, *args):
        action = Action(self, venv, msg, args)
        self._actions.append(action)
        return action

    def runcommand(self):
        self.report.using("tox-%s from %s" % (tox.__version__, tox.__file__))
        if self.config.minversion:
            minversion = NormalizedVersion(self.config.minversion)
            toxversion = NormalizedVersion(tox.__version__)
            if toxversion < minversion:
                self.report.error(
                    "tox version is %s, required is at least %s" % (
                        toxversion, minversion))
                raise SystemExit(1)
        if self.config.option.showconfig:
            self.showconfig()
        elif self.config.option.listenvs:
            self.showenvs()
        else:
            return self.subcommand_test()

    def _copyfiles(self, srcdir, pathlist, destdir):
        for relpath in pathlist:
            src = srcdir.join(relpath)
            if not src.check():
                self.report.error("missing source file: %s" % (src,))
                raise SystemExit(1)
            target = destdir.join(relpath)
            target.dirpath().ensure(dir=1)
            src.copy(target)

    def _makesdist(self):
        setup = self.config.setupdir.join("setup.py")
        if not setup.check():
            raise tox.exception.MissingFile(setup)
        action = self.newaction(None, "packaging")
        with action:
            action.setactivity("sdist-make", setup)
            self.make_emptydir(self.config.distdir)
            action.popen([sys.executable, setup, "sdist", "--formats=zip",
                          "--dist-dir", self.config.distdir, ],
                         cwd=self.config.setupdir)
            try:
                return self.config.distdir.listdir()[0]
            except py.error.ENOENT:
                # check if empty or comment only
                data = []
                with open(str(setup)) as fp:
                    for line in fp:
                        if line and line[0] == '#':
                            continue
                        data.append(line)
                if not ''.join(data).strip():
                    self.report.error(
                        'setup.py is empty'
                    )
                    raise SystemExit(1)
                self.report.error(
                    'No dist directory found. Please check setup.py, e.g with:\n'
                    '     python setup.py sdist'
                )
                raise SystemExit(1)

    def make_emptydir(self, path):
        if path.check():
            self.report.info("  removing %s" % path)
            py.std.shutil.rmtree(str(path), ignore_errors=True)
            path.ensure(dir=1)

    def setupenv(self, venv):
        if not venv.matching_platform():
            venv.status = "platform mismatch"
            return  # we simply omit non-matching platforms
        action = self.newaction(venv, "getenv", venv.envconfig.envdir)
        with action:
            venv.status = 0
            envlog = self.resultlog.get_envlog(venv.name)
            try:
                status = venv.update(action=action)
            except tox.exception.InvocationError:
                status = sys.exc_info()[1]
            if status:
                commandlog = envlog.get_commandlog("setup")
                commandlog.add_command(["setup virtualenv"], str(status), 1)
                venv.status = status
                self.report.error(str(status))
                return False
            commandpath = venv.getcommandpath("python")
            envlog.set_python_info(commandpath)
            return True

    def finishvenv(self, venv):
        action = self.newaction(venv, "finishvenv")
        with action:
            venv.finish()
            return True

    def developpkg(self, venv, setupdir):
        action = self.newaction(venv, "developpkg", setupdir)
        with action:
            try:
                venv.developpkg(setupdir, action)
                return True
            except tox.exception.InvocationError:
                venv.status = sys.exc_info()[1]
                return False

    def installpkg(self, venv, path):
        """Install package in the specified virtual environment.

        :param :class:`tox.config.VenvConfig`: Destination environment
        :param str path: Path to the distribution package.
        :return: True if package installed otherwise False.
        :rtype: bool
        """
        self.resultlog.set_header(installpkg=py.path.local(path))
        action = self.newaction(venv, "installpkg", path)
        with action:
            try:
                venv.installpkg(path, action)
                return True
            except tox.exception.InvocationError:
                venv.status = sys.exc_info()[1]
                return False

    def get_installpkg_path(self):
        """
        :return: Path to the distribution
        :rtype: py.path.local
        """
        if not self.config.option.sdistonly and (self.config.sdistsrc or
                                                 self.config.option.installpkg):
            path = self.config.option.installpkg
            if not path:
                path = self.config.sdistsrc
            path = self._resolve_pkg(path)
            self.report.info("using package %r, skipping 'sdist' activity " %
                             str(path))
        else:
            try:
                path = self._makesdist()
            except tox.exception.InvocationError:
                v = sys.exc_info()[1]
                self.report.error("FAIL could not package project - v = %r" %
                                  v)
                return
            sdistfile = self.config.distshare.join(path.basename)
            if sdistfile != path:
                self.report.info("copying new sdistfile to %r" %
                                 str(sdistfile))
                try:
                    sdistfile.dirpath().ensure(dir=1)
                except py.error.Error:
                    self.report.warning("could not copy distfile to %s" %
                                        sdistfile.dirpath())
                else:
                    path.copy(sdistfile)
        return path

    def subcommand_test(self):
        if self.config.skipsdist:
            self.report.info("skipping sdist step")
            path = None
        else:
            path = self.get_installpkg_path()
            if not path:
                return 2
        if self.config.option.sdistonly:
            return
        for venv in self.venvlist:
            if self.setupenv(venv):
                if venv.envconfig.usedevelop:
                    self.developpkg(venv, self.config.setupdir)
                elif self.config.skipsdist or venv.envconfig.skip_install:
                    self.finishvenv(venv)
                else:
                    self.installpkg(venv, path)

                # write out version dependency information
                action = self.newaction(venv, "envreport")
                with action:
                    pip = venv.getcommandpath("pip")
                    # we can't really call internal helpers here easily :/
                    # output = venv._pcall([str(pip), "freeze"],
                    #                      cwd=self.config.toxinidir,
                    #                      action=action)
                    output = py.process.cmdexec("%s freeze" % (pip))
                    packages = output.strip().split("\n")
                    action.setactivity("installed", ",".join(packages))
                    envlog = self.resultlog.get_envlog(venv.name)
                    envlog.set_installed(packages)

                self.runtestenv(venv)
        retcode = self._summary()
        return retcode

    def runtestenv(self, venv, redirect=False):
        if not self.config.option.notest:
            if venv.status:
                return
            venv.test(redirect=redirect)
        else:
            venv.status = "skipped tests"

    def _summary(self):
        self.report.startsummary()
        retcode = 0
        for venv in self.venvlist:
            status = venv.status
            if isinstance(status, tox.exception.InterpreterNotFound):
                msg = "  %s: %s" % (venv.envconfig.envname, str(status))
                if self.config.option.skip_missing_interpreters:
                    self.report.skip(msg)
                else:
                    retcode = 1
                    self.report.error(msg)
            elif status == "platform mismatch":
                msg = "  %s: %s" % (venv.envconfig.envname, str(status))
                self.report.skip(msg)
            elif status and status != "skipped tests":
                msg = "  %s: %s" % (venv.envconfig.envname, str(status))
                self.report.error(msg)
                retcode = 1
            else:
                if not status:
                    status = "commands succeeded"
                self.report.good("  %s: %s" % (venv.envconfig.envname, status))
        if not retcode:
            self.report.good("  congratulations :)")

        path = self.config.option.resultjson
        if path:
            path = py.path.local(path)
            path.write(self.resultlog.dumps_json())
            self.report.line("wrote json report at: %s" % path)
        return retcode

    def showconfig(self):
        self.info_versions()
        self.report.keyvalue("config-file:", self.config.option.configfile)
        self.report.keyvalue("toxinipath: ", self.config.toxinipath)
        self.report.keyvalue("toxinidir:  ", self.config.toxinidir)
        self.report.keyvalue("toxworkdir: ", self.config.toxworkdir)
        self.report.keyvalue("setupdir:   ", self.config.setupdir)
        self.report.keyvalue("distshare:  ", self.config.distshare)
        self.report.keyvalue("skipsdist:  ", self.config.skipsdist)
        self.report.tw.line()
        for envconfig in self.config.envconfigs.values():
            self.report.line("[testenv:%s]" % envconfig.envname, bold=True)
            for attr in self.config._parser._testenv_attr:
                self.report.line("  %-15s = %s"
                                 % (attr.name, getattr(envconfig, attr.name)))

    def showenvs(self):
        for env in self.config.envlist:
            self.report.line("%s" % env)

    def info_versions(self):
        versions = ['tox-%s' % tox.__version__]
        try:
            version = py.process.cmdexec("virtualenv --version")
        except py.process.cmdexec.Error:
            versions.append("virtualenv-1.9.1 (vendored)")
        else:
            versions.append("virtualenv-%s" % version.strip())
        self.report.keyvalue("tool-versions:", " ".join(versions))

    def _resolve_pkg(self, pkgspec):
        try:
            return self._spec2pkg[pkgspec]
        except KeyError:
            self._spec2pkg[pkgspec] = x = self._resolvepkg(pkgspec)
            return x

    def _resolvepkg(self, pkgspec):
        if not os.path.isabs(str(pkgspec)):
            return pkgspec
        p = py.path.local(pkgspec)
        if p.check():
            return p
        if not p.dirpath().check(dir=1):
            raise tox.exception.MissingDirectory(p.dirpath())
        self.report.info("determining %s" % p)
        candidates = p.dirpath().listdir(p.basename)
        if len(candidates) == 0:
            raise tox.exception.MissingDependency(pkgspec)
        if len(candidates) > 1:
            items = []
            for x in candidates:
                ver = getversion(x.basename)
                if ver is not None:
                    items.append((ver, x))
                else:
                    self.report.warning("could not determine version of: %s" %
                                        str(x))
            items.sort()
            if not items:
                raise tox.exception.MissingDependency(pkgspec)
            return items[-1][1]
        else:
            return candidates[0]

_rex_getversion = py.std.re.compile("[\w_\-\+\.]+-(.*)(\.zip|\.tar.gz)")

def getversion(basename):
    m = _rex_getversion.match(basename)
    if m is None:
        return None
    version = m.group(1)
    try:
        return NormalizedVersion(version)
    except IrrationalVersionError:
        return None


text:
<?php
namespace Desmond\test\functions\core;
use PHPUnit\Framework\TestCase;
use Desmond\test\helpers\RunnerTrait;

class IntQuestionTest extends TestCase
{
    use RunnerTrait;

    public function testIntQuestion()
    {
        $this->assertTrue($this->valueOf('(int? 7)'));
    }

    public function testFloat()
    {
        $this->assertFalse($this->valueOf('(int? 4.20)'));
    }

    public function testNotInt()
    {
        $this->assertFalse($this->valueOf('(int? "7")'));
    }

    /**
     * @expectedException Desmond\exceptions\ArgumentException
     * @expectedExceptionMessage "int?" expects an argument.
     */
    public function testNoArgument()
    {
        $this->resultOf('(int?)');
    }
}


text:
import webob

from nova.api.openstack import api_version_request
from nova.api.openstack.compute.legacy_v2.contrib import virtual_interfaces \
        as vi20
from nova.api.openstack.compute import virtual_interfaces as vi21
from nova import compute
from nova.compute import api as compute_api
from nova import context
from nova import exception
from nova import network
from nova.objects import virtual_interface as vif_obj
from nova import test
from nova.tests.unit.api.openstack import fakes

FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'

def compute_api_get(self, context, instance_id, expected_attrs=None,
                    want_objects=False):
    return dict(uuid=FAKE_UUID, id=instance_id, instance_type_id=1, host='bob')

def _generate_fake_vifs(context):
    vif = vif_obj.VirtualInterface(context=context)
    vif.address = '00-00-00-00-00-00'
    vif.network_id = 123
    vif.net_uuid = '22222222-2222-2222-2222-22222222222222222'
    vif.uuid = '00000000-0000-0000-0000-00000000000000000'
    fake_vifs = [vif]
    vif = vif_obj.VirtualInterface(context=context)
    vif.address = '11-11-11-11-11-11'
    vif.network_id = 456
    vif.net_uuid = '33333333-3333-3333-3333-33333333333333333'
    vif.uuid = '11111111-1111-1111-1111-11111111111111111'
    fake_vifs.append(vif)
    return fake_vifs

def get_vifs_by_instance(self, context, instance_id):
    return _generate_fake_vifs(context)

class FakeRequest(object):
    def __init__(self, context):
        self.environ = {'nova.context': context}

class ServerVirtualInterfaceTestV21(test.NoDBTestCase):
    wsgi_api_version = None
    expected_response = {
        'virtual_interfaces': [
            {'id': '00000000-0000-0000-0000-00000000000000000',
                'mac_address': '00-00-00-00-00-00'},
            {'id': '11111111-1111-1111-1111-11111111111111111',
                'mac_address': '11-11-11-11-11-11'}]}

    def setUp(self):
        super(ServerVirtualInterfaceTestV21, self).setUp()
        self.stubs.Set(compute.api.API, "get",
                       compute_api_get)
        self.stubs.Set(network.api.API, "get_vifs_by_instance",
                       get_vifs_by_instance)
        self._set_controller()

    def _set_controller(self):
        self.controller = vi21.ServerVirtualInterfaceController()

    def test_get_virtual_interfaces_list(self):
        req = fakes.HTTPRequest.blank('', version=self.wsgi_api_version)
        res_dict = self.controller.index(req, 'fake_uuid')
        self.assertEqual(res_dict, self.expected_response)

    def test_vif_instance_not_found(self):
        self.mox.StubOutWithMock(compute_api.API, 'get')
        fake_context = context.RequestContext('fake', 'fake')
        fake_req = FakeRequest(fake_context)
        fake_req.api_version_request = api_version_request.APIVersionRequest(
                                        self.wsgi_api_version)
        compute_api.API.get(fake_context, 'fake_uuid',
                            expected_attrs=None,
                            want_objects=True).AndRaise(
            exception.InstanceNotFound(instance_id='instance-0000'))

        self.mox.ReplayAll()
        self.assertRaises(
            webob.exc.HTTPNotFound,
            self.controller.index,
            fake_req, 'fake_uuid')

class ServerVirtualInterfaceTestV20(ServerVirtualInterfaceTestV21):

    def _set_controller(self):
        self.controller = vi20.ServerVirtualInterfaceController()

class ServerVirtualInterfaceTestV212(ServerVirtualInterfaceTestV21):
    wsgi_api_version = '2.12'

    expected_response = {
        'virtual_interfaces': [
            {'id': '00000000-0000-0000-0000-00000000000000000',
                'mac_address': '00-00-00-00-00-00',
                'net_id': '22222222-2222-2222-2222-22222222222222222'},
            {'id': '11111111-1111-1111-1111-11111111111111111',
                'mac_address': '11-11-11-11-11-11',
                'net_id': '33333333-3333-3333-3333-33333333333333333'}]}

class ServerVirtualInterfaceEnforcementV21(test.NoDBTestCase):

    def setUp(self):
        super(ServerVirtualInterfaceEnforcementV21, self).setUp()
        self.controller = vi21.ServerVirtualInterfaceController()
        self.req = fakes.HTTPRequest.blank('')

    def test_index_virtual_interfaces_policy_failed(self):
        rule_name = "os_compute_api:os-virtual-interfaces"
        self.policy.set_rules({rule_name: "project:non_fake"})
        exc = self.assertRaises(
            exception.PolicyNotAuthorized,
            self.controller.index, self.req, fakes.FAKE_UUID)
        self.assertEqual(
            "Policy doesn't allow %s to be performed." % rule_name,
            exc.format_message())


text: JK Scholarship


text:
function [params, names] = cmpndNoiseExtractParam(noise)

% CMPNDNOISEEXTRACTPARAM Extract parameters from the CMPND noise structure.
% FORMAT
% DESC extracts parameters from the compound
% noise structure into a vector of parameters for optimisation.
% ARG noise : the noise structure containing the parameters to be
% extracted.
% RETURN param : vector of parameters extracted from the noise. If
% the field 'transforms' is not empty in the noise structure, the
% parameters will be transformed before optimisation (for example
% positive only parameters could be logged before being returned).
%
% FORMAT
% DESC extracts parameters and parameter names from the compound
% noise structure.
% ARG noise : the noise structure containing the parameters to be
% extracted.
% RETURN param : vector of parameters extracted from the noise. If
% the field 'transforms' is not empty in the noise structure, the
% parameters will be transformed before optimisation (for example
% positive only parameters could be logged before being returned).
% RETURN names : cell array of strings containing names for each
% parameter.
%
% SEEALSO cmpndNoiseParamInit, cmpndNoiseExpandParam, noiseExtractParam, scg, conjgrad
%
% COPYRIGHT : Neil D. Lawrence, 2004, 2005
%
% GPMAT

params = zeros(1, noise.nParams);
if nargout > 1
  names = cell(1, noise.nParams);
end
startVal = 1;
endVal = 0;
for i = 1:length(noise.comp)
  endVal = endVal + noise.comp{i}.nParams;
  if nargout < 2
    params(1, startVal:endVal)  = noiseExtractParam(noise.comp{i});
  else
    [params(1, startVal:endVal), names(startVal:endVal)] = noiseExtractParam(noise.comp{i});
  end
  startVal = endVal + 1;
end
paramGroups = noise.paramGroups;
for i = 1:size(paramGroups, 2)
  ind = find(paramGroups(:, i));
  paramGroups(ind(2:end), i) = 0;
end
params = params*paramGroups;


text:
import { Observable, Subject, Subscription } from "rxjs/Rx";
import { Scheduler } from "rxjs/Scheduler";
import { PropertyChangedEventArgs } from "./events/property-changed-event-args";
import { invokeCommand } from "./operator/invoke-command";
import { ReactiveCommand } from "./reactive-command";
import { IViewBindingHelper } from "./view";

/**
 * Defines a class that represents a reactive object.
 * This is the base class for View Model classes, and it implements an event system that
 * allows notification of property changes, which is the basis of the observable pipeline.
 */
export class ReactiveObject {

    private _propertyChanged: Subject<PropertyChangedEventArgs<any>>;

    /**
     * The property that stores all of the data stored in this object.
     */
    private __data: any;

    /**
     * Creates a new reactive object.
     */
    constructor(obj?: Object | Array<string>) {
        this._propertyChanged = new Subject<PropertyChangedEventArgs<any>>();
        this.__data = {};
        if (obj) {
            if (Array.isArray(obj)) {
                obj.forEach(n => this.setupProperty(n, null));
            } else if (typeof obj === "object") {
                for (var key in obj) {
                    if (obj.hasOwnProperty(key)) {
                        var val = obj[key];
                        this.setupProperty(key, val);
                    }
                }
            }
        }
    }

    private setupProperty(name: string, val: any): void {
        if (!this.hasOwnProperty(name)) {
            Object.defineProperty(this, name, {
                configurable: true,
                enumerable: false,
                get: () => this.get(name),
                set: (v) => this.set(name, v)
            });
            this.set(name, val);
        }
    }

    /**
     * Gets the observable that represents the stream of "propertyChanged" events from this object.
     */
    public get propertyChanged(): Observable<PropertyChangedEventArgs<any>> {
        return this._propertyChanged;
    }

    protected createPropertyChangedEventArgs(propertyName: string, value: any): PropertyChangedEventArgs<any> {
        return new PropertyChangedEventArgs(this, propertyName, value)
    }

    /**
     * Emits a new property changed event for the given property from this object.
     */
    protected emitPropertyChanged(propertyName: string, newPropertyValue?: any): void {
        var propValue = newPropertyValue != null ? newPropertyValue : this.get(propertyName);
        this._propertyChanged.next(this.createPropertyChangedEventArgs(propertyName, propValue));
    }

    /**
     * Emits a new property changed event for the given property if it has changed from the previous value.
     */
    protected emitIfPropertyChanged(propertyName: string, oldPropertyValue: any): void {
        var currentValue = ReactiveObject.get(this, propertyName);
        if (currentValue !== oldPropertyValue) {
            this.emitPropertyChanged(propertyName, currentValue);
        }
    }

    /**
     * Records the given property before and after the given function is run and raises a property changed notification
     * if the property value changed.
     */
    protected trackPropertyChanges<T>(prop: string, callback: () => T): T {
        var val = ReactiveObject.get(this, prop);
        var ret = callback();
        this.emitIfPropertyChanged(prop, val);
        return ret;
    }

    private static getSingleProperty<TObj, T>(
        obj: TObj,
        property: string): T | any {
        if (typeof obj[property] !== "undefined" || !(obj instanceof ReactiveObject)) {
            return obj[property];
        } else {
            return ReactiveObject.getReactiveProperty(obj, property);
        }
    }

    private static getReactiveProperty<TObj, T>(
        obj: TObj,
        property: string): T | any {
        var value = (<ReactiveObject><any>obj).__data[property];
        if (typeof value === "undefined") {
            return null;
        } else {
            return value;
        }
    }

    private static getDeepProperty<TObj, T>(obj: TObj, evaluated: { children: string[], property: string }): T | any {
        var firstProp = evaluated.children[0];
        var otherProperties = evaluated.property.substring(firstProp.length + 1);
        var firstVal = ReactiveObject.get(obj, firstProp);
        if (typeof firstVal !== "undefined") {
            if (firstVal !== null) {
                return ReactiveObject.get<TObj, T>(firstVal, otherProperties);
            }
            else {
                return null;
            }
        } else {
            return undefined;
        }
    }

    private static get<TObj, T>(obj: TObj, property: string | ((vm: TObj) => T)): T | any {
        var evaluated = ReactiveObject.evaluateLambdaOrString(obj, property);
        if (evaluated.children.length === 1) {
            return ReactiveObject.getSingleProperty(obj, evaluated.property);
        } else {
            return ReactiveObject.getDeepProperty(obj, evaluated);
        }
    }

    /**
     * Gets the value of the given property from this object.
     * @param property The name of the property whose value should be retrieved.
     */
    public get<T>(property: string | ((vm: this) => T)): T | any {
        var evaluated = ReactiveObject.evaluateLambdaOrString(this, property);
        if (evaluated.children.length === 1) {
            return ReactiveObject.getReactiveProperty(this, evaluated.property);
        } else {
            return ReactiveObject.getDeepProperty(this, evaluated);
        }
    }

    private static setSingleProperty<TObj, T>(obj: TObj, property: string, value: T) {
        if (typeof obj[property] !== "undefined" || !(obj instanceof ReactiveObject)) {
            obj[property] = value;
        }
        else {
            ReactiveObject.setReactiveProperty(<ReactiveObject><any>obj, property, value);
        }
    }

    private static setReactiveProperty(obj: ReactiveObject, property: string, value: any) {
        var rObj: ReactiveObject = <any>obj;
        var oldValue = rObj.__data[property];
        if (value !== oldValue) {
            rObj.__data[property] = value;
            rObj.emitPropertyChanged(property, value);
        }
    }

    private static setDeepProperty<TObj, T>(obj: TObj, evaluated: { children: string[], property: string }, value: T) {
        var firstProp = evaluated.children[0];
        var otherProperties = evaluated.property.substring(firstProp.length + 1);
        var firstVal = ReactiveObject.get(obj, firstProp);
        if (firstVal !== null) {
            ReactiveObject.set(firstVal, otherProperties, value);
        } else {
            throw new Error("Null Reference Exception. Cannot set a child property on a null or undefined property of this object.");
        }
    }

    private static traverse<TObj, T>(
        obj: TObj,
        property: string | ((vm: TObj) => T),
        setSingle: (evaluated: { children: string[], property: string }) => void,
        setDeep: (evaluated: { children: string[], property: string }) => void) {
        var evaluated = ReactiveObject.evaluateLambdaOrString(obj, property);
        if (evaluated.children.length === 1) {
            setSingle(evaluated);
        } else {
            setDeep(evaluated);
        }
    }

    private static set<TObj, T>(obj: TObj, property: string | ((vm: TObj) => T), value: T) {
        ReactiveObject.traverse(obj, property, (evaluated) => {
            ReactiveObject.setSingleProperty(obj, evaluated.property, value);
        }, (evaluated) => {
            ReactiveObject.setDeepProperty(obj, evaluated, value)
        });
    }

    /**
     * Sets the value of the given property on this object and emits the "propertyChanged" event.
     * @param property The name of the property to change.
     * @param value The value to give the property.
     */
    public set<T>(property: string | ((vm: this) => T), value: T): void {
        ReactiveObject.traverse(this, property, (evaluated) => {
            ReactiveObject.setReactiveProperty(this, evaluated.property, value);
        }, (evaluated) => {
            ReactiveObject.setDeepProperty(this, evaluated, value)
        });
    }

    /**
     * Builds a proxy object that adds accessed property names to the given array if proxies are supported.
     * Returns null if proxies are not supported.
     */
    private static buildGhostObject(arr: string[]): any {
        function buildProxy(): Proxy {
            return new Proxy({}, {
                get(target: any, prop: string, reciever: Proxy): any {
                    arr.push(prop);
                    return buildProxy();
                }
            });
        }
        if (typeof Proxy !== 'undefined') {
            return buildProxy();
        }
        return null;
    }

    /**
     * Runs the given function against a dummy version of the given object.
     * object that builds a string that represents the properties that should be watched.
     * @param expr The function that represents the lambda expression.
     */
    private static evaluateLambdaExpression<TObj>(obj: TObj, expr: (o: TObj) => any): string {
        var path: string[] = [];
        var ghost = ReactiveObject.buildGhostObject(path);
        if (ghost) {
            expr(ghost);
        } else {
            ReactiveObject.evaluateLambdaErrors(path, expr);
        }
        return path.join(".");
    }

    private static evaluateLambdaErrors(path: string[], expr: (o: any) => any, currentObj: any = null): void {
        // Hack the errors that null reference exceptions return to retrieve property names
        // Works in IE 9+, Chrome 35+, Firefox 30+, Safari 7+
        // This hack is needed to support lambda expressions in browsers where proxy support is
        // not yet available.
        // Because lambda expressions need to represent any combination of valid property names for an object,
        // we need to be able to intercept any call to retrieve a property value.
        // In browsers that do not provide this functionality, we take advantage of the fact that error messages
        // include property names in them.
        // For example, in Chrome 50+, the following code:
        //
        // var myObj = null;
        // var myPropVar = myObj.myProp;
        //
        // throws the following error:
        //
        // "TypeError: Cannot read property 'myProp' of null"
        //
        // As you can read, the error contains the name of the property that was attempted to be accessed, which is exactly what we want. :)
        // The error message is mostly the same for IE and Firefox, but not for Safari, hence the second regex.
        try {
            expr(currentObj);
        } catch (ex) {
            if (ex instanceof TypeError) {
                var error = <TypeError>ex;
                var propertyName: string = null;
                // Regex for IE, Chrome & Firefox error messages
                var match = (/property\s+'(\w+)'/g).exec(error.message);
                if (match) {
                    propertyName = match[1];
                }
                if (!propertyName) {
                    // Regex for Safari (iOS & OS X) error messages
                    match = (/evaluating \'([\w]+\.?)+\'/g).exec(error.message);
                    if (match) {
                        propertyName = match[match.length - 1];
                    }
                }
                if (propertyName) {
                    path.push(propertyName);
                    currentObj = currentObj || {};
                    var currentPath = currentObj;
                    path.forEach((p, i) => {
                        currentPath[p] = i < path.length - 1 ? {} : null;
                        currentPath = currentPath[p];
                    });
                    ReactiveObject.evaluateLambdaErrors(path, expr, currentObj);
                    return;
                }
            }
            throw ex;
        }
    }

    private static evaluateLambdaOrString<TObj>(obj: TObj, expression: string | ((o: TObj) => any)) {
        var property: string;
        if (typeof expression === "function") {
            property = ReactiveObject.evaluateLambdaExpression(obj, expression);
        } else {
            property = <string>expression;
        }
        var children = property.split(".");
        return { children, property };
    }

    private static whenSingleProp(obj: any, prop: string, emitCurrentVal: boolean = false): Observable<PropertyChangedEventArgs<any>> {
        if (obj instanceof ReactiveObject) {
            var reactive: ReactiveObject = <ReactiveObject>obj;
            var observable = reactive.propertyChanged.filter(e => {
                return e.propertyName == prop;
            });
            if (emitCurrentVal) {
                return Observable.of(reactive.createPropertyChangedEventArgs(prop, reactive.get(prop))).concat(observable);
            } else {
                return observable;
            }
        } else {
            if (obj.__viewBindingHelper) {
                var helper: IViewBindingHelper = obj.__viewBindingHelper;
                return Observable.create((observer) => {
                    return helper.observeProp(obj, prop, emitCurrentVal, e => {
                        observer.next(e);
                    });
                });
            } else {
                throw new Error("Unable to bind to objects that do not inherit from ReactiveObject or provide __viewBindingHelper");
            }
        }
    }

    private static whenSingle<TObj, TProp>(obj: TObj, expression: (((o: TObj) => TProp) | string), emitCurrentVal: boolean = false): Observable<PropertyChangedEventArgs<TProp>> {
        var evaulatedExpression = ReactiveObject.evaluateLambdaOrString(obj, expression);
        var children = evaulatedExpression.children;
        var prop = evaulatedExpression.property;
        if (children.length === 1) {
            return ReactiveObject.whenSingleProp(obj, prop, emitCurrentVal);
        } else {
            // Assuming prop = "first.second.third"
            var firstProp = children[0]; // = "first"
            // All of the other properties = "second.third"
            var propertiesWithoutFirst = prop.substring(firstProp.length + 1);

            // Watch for changes to the "first" property on this object,
            // and subscribe to the rest of the properties on that object.
            // Switch between the observed values, so that only the most recent object graph
            // property changes are observed.

            // Store the number of times that the property has been changed at this level.
            // This way, we can be sure about whether to emit the current value or not, based on whether
            // we have observed 2 or more events at this level.
            var observationCount: number = 0;
            return ReactiveObject.whenSingleProp(obj, firstProp, true).map(change => {
                var obj: ReactiveObject = change.newPropertyValue;
                observationCount++;
                if (obj) {
                    return ReactiveObject.whenSingle(obj, propertiesWithoutFirst, emitCurrentVal || observationCount > 1);
                } else if (emitCurrentVal) {
                    return Observable.of(change);
                } else {
                    return Observable.empty<PropertyChangedEventArgs<any>>();
                }
            }).switch();
        }
    }

    /**
     * Gets an observable that resolves with the related property changed event whenever the given property updates.
     */
    public whenSingle(expression: string | ((o: this) => any), emitCurrentVal: boolean = false): Observable<PropertyChangedEventArgs<any>> {
        return ReactiveObject.whenSingle(this, expression, emitCurrentVal);
    }

    /**
     * Gets an observable that resolves with the related property changed event whenever the given property updates.
     * @param first The name of the first property to watch.
     */
    public whenAny<T1>(
        first: string | ((o: this) => T1)
    ): Observable<PropertyChangedEventArgs<T1>>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given property updates.
     * @param first The name of the first property to watch.
     * @param map A function that, given the event arguments for the property, maps to the desired return values.
     */
    public whenAny<T1, TResult>(
        first: string | ((o: this) => T1),
        map: (_1: PropertyChangedEventArgs<T1>) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     */
    public whenAny<T1, T2>(
        first: string | ((o: this) => T1),
        second: string
    ): Observable<PropertyChangedEventArgs<T1 | T2>[]>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     */
    public whenAny<T1, T2, T3>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string
    ): Observable<PropertyChangedEventArgs<T1 | T2 | T3>[]>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>, _3: PropertyChangedEventArgs<T3>) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, T4>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string
    ): Observable<PropertyChangedEventArgs<T1 | T2 | T3 | T4>[]>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, T4, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>, _3: PropertyChangedEventArgs<T3>, _4: PropertyChangedEventArgs<T4>) => TResult
    ): Observable<TResult | PropertyChangedEventArgs<any>>;

    // TODO: Add more variations
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, T4, T5, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>, _3: PropertyChangedEventArgs<T3>, _4: PropertyChangedEventArgs<T4>, _5: PropertyChangedEventArgs<T5>) => TResult
    ): Observable<TResult | PropertyChangedEventArgs<any>>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, T4, T5, T6, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        sixth: string | ((o: this) => T6),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>, _3: PropertyChangedEventArgs<T3>, _4: PropertyChangedEventArgs<T4>, _5: PropertyChangedEventArgs<T5>, _6: PropertyChangedEventArgs<T6>) => TResult
    ): Observable<TResult | PropertyChangedEventArgs<any>>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<T1, T2, T3, T4, T5, T6, T7, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        sixth: string | ((o: this) => T6),
        seventh: string | ((o: this) => T7),
        map: (_1: PropertyChangedEventArgs<T1>, _2: PropertyChangedEventArgs<T2>, _3: PropertyChangedEventArgs<T3>, _4: PropertyChangedEventArgs<T4>, _5: PropertyChangedEventArgs<T5>, _6: PropertyChangedEventArgs<T6>, _7: PropertyChangedEventArgs<T7>) => TResult
    ): Observable<TResult | PropertyChangedEventArgs<any>>;
    /**
     * Gets an observable that resolves with the related property changed event whenever the given properties update.
     * @param properties The names of the properties.
     * @param map A function that, given the event arguments for the properties, maps to the desired return values.
     */
    public whenAny<TResult>(
        ...args: (((o: this) => any) | string | ((...a: PropertyChangedEventArgs<any>[]) => TResult))[]
    ): Observable<TResult | PropertyChangedEventArgs<any>> {
        var finalProperties: string[] = [];
        var map: Function = this.getMapFunction(args);

        function iterateProperties(properties: any[]) {
            properties.forEach((p, i) => {
                var type = typeof p;
                if (type === "string" || type === "function") {
                    finalProperties.push(p);
                } else if (Array.isArray(p)) {
                    iterateProperties(p);
                }
            });
        }
        iterateProperties(map ? args.slice(0, args.length - 1) : args);
        var observableList = finalProperties.map(prop => {
            return this.whenSingle(prop, true);
        }).filter(o => o != null);
        if (map) {
            return Observable.combineLatest<TResult>(...observableList, map);
        } else {
            return Observable.combineLatest(...observableList, (...events: PropertyChangedEventArgs<any>[]): any => {
                if (events.length == 1) {
                    return events[0];
                } else {
                    return events;
                }
            });
        }
    }

    private getMapFunction(values: any[]): Function {
        var mapFunction: Function = null;
        var lastArg: any = values[values.length - 1];
        if (values.length > 1 && typeof lastArg === "function") {
            mapFunction = lastArg;
        }
        return mapFunction;
    }

    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     */
    public whenAnyValue<T1>(
        first: string | ((o: this) => T1)
    ): Observable<T1>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, TResult>(
        first: string | ((o: this) => T1),
        map: (_1: T1) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @param map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2>(
        first: string | ((o: this) => T1),
        second: string
    ): Observable<(T1 | T2)[]>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @param map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        map: (_1: T1, _2: T2) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string
    ): Observable<(T1 | T2 | T3)[]>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        map: (_1: T1, _2: T2, _3: T3) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, T4>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string
    ): Observable<(T1 | T2 | T3 | T4)[]>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, T4, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        map: (_1: T1, _2: T2, _3: T3, _4: T4) => TResult
    ): Observable<TResult>;

    // TODO: add more method alternatives

    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, T4, T5, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        map: (_1: T1, _2: T2, _3: T3, _4: T4, _5: T5) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, T4, T5, T6, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        sixth: string | ((o: this) => T6),
        map: (_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<T1, T2, T3, T4, T5, T6, T7, TResult>(
        first: string | ((o: this) => T1),
        second: string | ((o: this) => T2),
        third: string | ((o: this) => T3),
        fourth: string | ((o: this) => T4),
        fifth: string | ((o: this) => T5),
        sixth: string | ((o: this) => T6),
        seventh: string | ((o: this) => T7),
        map: (_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7) => TResult
    ): Observable<TResult>;
    /**
     * Gets an observable that resolves with the related property value(s) whenever the given properties update.
     * @map A function that, given the values for the properties, maps to the desired return value.
     */
    public whenAnyValue<TResult>(
        ...args: (((o: this) => any) | string | ((...a: any[]) => TResult))[]
    ): Observable<TResult> {
        var mapFunction = this.getMapFunction(args);
        var whenAnyArgs: any = mapFunction ? args.slice(0, args.length - 1) : args;
        var whenAny = this.whenAny.bind(this);
        return whenAny(...whenAnyArgs, (...events: PropertyChangedEventArgs<any>[]) => {
            var eventValues = events.map(e => e.newPropertyValue);
            if (mapFunction) {
                return mapFunction(...eventValues);
            } else if (eventValues.length == 1) {
                return eventValues[0];
            } else {
                return eventValues;
            }
        });
    }

    private mergeChanges<TChanges extends { value: any }>(...changes: Observable<TChanges>[]): Observable<TChanges> {
        return Observable.merge(...changes)
            .distinctUntilChanged((v1, v2) => v1 === v2, c => c.value);
    }

    /**
     * Binds the specified property on this object to the specified property on the given other object.
     * @param view The view whose property should be bound to one of this object's properties.
     * @param viewModelProp A function that maps this object to the property that should be bound to the view. Alternatively, a string can be used to point out the property.
     * @param viewProp A function that maps the view to the property that should be bound to this object. Alternatively, a string can be used.
     * @param scheduler The scheduler that changes to the properties should be observed on.
     */
    public bind<TView, TViewModelProp, TViewProp>(
        view: TView,
        viewModelProp: (((o: this) => TViewModelProp) | string),
        viewProp: (((o: TView) => TViewProp) | string),
        scheduler?: Scheduler
    ): Subscription {
        // Changes to the view and view model need to be consolidated
        // and mapped so that we can figure out two things:
        // 1. Whether the change is comming from the view model or the view.
        // 2. Whether the value changed, or if it is feedback from already propagating a change.

        var viewChanges = ReactiveObject.whenSingle(view, viewProp).map(c => ({
            fromVm: false,
            value: c.newPropertyValue
        }));
        var viewModelChanges = this.whenAny(viewModelProp).map(c => ({
            fromVm: true,
            value: c.newPropertyValue
        }));
        var changes = this.mergeChanges(viewChanges, viewModelChanges)
            // Make sure that the view model's value is piped to the
            // view at first.
            .startWith({
                fromVm: true,
                value: this.get<TViewModelProp>(viewModelProp)
            });

        // TODO: Add support for error handling
        return changes.subscribe(c => {
            if (c.fromVm) {
                // set property on view
                ReactiveObject.set(view, viewProp, c.value);
            } else {
                // set property on view model
                this.set(viewModelProp, c.value);
            }
        });
    }

    /**
     * Propagates values from the specified property on this object to the specified property on the given view object.
     * @param view The object that should be bound to this object.
     * @param viewModelProp The property on this object that should set to the other property.
     * @param viewProp The property on the view object that should recieve values from the other property.
     * @return Subscription
     */
    public oneWayBind<TView, TViewModelProp, TViewProp>(
        view: TView,
        viewModelProp: (((o: this) => TViewModelProp) | string),
        viewProp: (((o: TView) => TViewProp) | string),
        scheduler?: Scheduler
    ): Subscription {
        var viewModelChanges = this.whenAny(viewModelProp).map(c => ({
            fromVm: true,
            value: c.newPropertyValue
        }));
        var changes = this.mergeChanges(viewModelChanges)
            // Make sure that the view model's value is piped to the
            // view at first.
            .startWith({
                fromVm: true,
                value: this.get<TViewModelProp>(viewModelProp)
            });

        if (scheduler) {
            changes = changes.observeOn(scheduler);
        }

        // TODO: Add support for error handling
        return changes.subscribe(c => {
            if (c.fromVm) {
                // set property on view
                ReactiveObject.set(view, viewProp, c.value);
            }
        });
    }

    /**
     * Binds values recieved from the given observable to the specified property on the given object.
     * @param observable The Observable object whose values should be piped to the specified property.
     * @param view The object that the values should be piped to.
     * @param viewProp The property on the object that the values should be piped to.
     */
    public static bindObservable<TObserved, TView, TViewProp>(
        observable: Observable<TObserved>,
        view: TView,
        viewProp: (((o: TView) => TViewProp) | string),
        scheduler?: Scheduler): Subscription {
        var o = observable.distinctUntilChanged();
        if (scheduler) {
            o = o.observeOn(scheduler);
        }
        return o.subscribe(value => {
            ReactiveObject.set(view, viewProp, <any>value);
        });
    }

    public when<T>(observable: string | Observable<T>): Observable<T> {
        if (typeof observable === "string") {
            return this.whenSingle(observable, true).map(e => <Observable<T>>e.newPropertyValue).switch();
        } else {
            return observable;
        }
    }

    /**
     * Attempts to invoke the given command when the given Observable resolves with a new value.
     * The command will not be invoked unless it can execute.
     * Returns a cold Observable that resolves with the results of the executions.
     * The returned Observable MUST be subscribed to in order for the command to execute.
     *
     * @param observable The Observable object that should be used as the trigger for the command.
     *                   Additionally, if a property name is passed in, the most recent Observable stored at that property is used.
     * @param command The ReactiveCommand object that should be executed.
     *                If a property name is passed in, the most recent command stored at that property is used.
     */
    public invokeCommandWhen<T>(observable: string | Observable<any>, command: string | ReactiveCommand<any, T>): Observable<T> {
        return invokeCommand(this.when(observable), this, command);
    }

    /**
     * Creates a one way binding between the given observable and the specified property on this object.
     * @param observable The observable that should be bound to the property.
     * @param property The property that should assume the most recently observed value from the observable.
     * @param scheduler The scheduler that should be used to observe values from the given observable.
     */
    public toProperty<TObservable, TProp>(observable: Observable<TObservable>, property: (((o: this) => TProp) | string), scheduler?: Scheduler): Subscription {
        return ReactiveObject.bindObservable(observable, this, property, scheduler);
    }

    /**
     * Returns the data that should be used to convert this reactive object into a JSON string.
     */
    public toJSON(): any {
        return ReactiveObject.clone(this.__data);
    }

    /**
     * Returns the string representation of this reactive object.
     */
    public toString(): string {
        return JSON.stringify(this);
    }

    /**
     * Gets the list of enumerable property names that have been set on the given object.
     * @param obj The object whose enumerable property names should be returned.
     */
    public static keys(obj: Object): string[] {
        if (obj instanceof ReactiveObject) {
            return Object.keys(obj.__data);
        } else {
            return Object.keys(obj);
        }
    }

    private static clone(obj: any): any {
        var clone = {};
        for (var key in obj) {
            if (obj.hasOwnProperty(key)) {
                clone[key] = obj[key];
            }
        }
        return clone;
    }
}


text:
package androidx.constraintlayout.core.dsl;

import java.util.Arrays;

/**
 * This is the base Key for all the key (KeyCycle, KeyPosition, etc.) Objects
 */
public class Keys {

    protected String unpack(String[] str) {
        StringBuilder ret = new StringBuilder("[");
        for (int i = 0; i < str.length; i++) {

            ret.append((i == 0) ? "'" : ",'");

            ret.append(str[i]);
            ret.append("'");

        }
        ret.append("]");
        return ret.toString();
    }

    protected void append(StringBuilder builder, String name, int value) {
        if (value != Integer.MIN_VALUE) {
            builder.append(name);
            builder.append(":'").append(value).append("',\n");
        }
    }

    protected void append(StringBuilder builder, String name, String value) {
        if (value != null) {
            builder.append(name);
            builder.append(":'").append(value).append("',\n");
        }
    }

    protected void append(StringBuilder builder, String name, float value) {
        if (Float.isNaN(value)) {
            return;
        }
        builder.append(name);
        builder.append(":").append(value).append(",\n");

    }

    protected void append(StringBuilder builder, String name, String[] array) {
        if (array != null) {
            builder.append(name);
            builder.append(":").append(unpack(array)).append(",\n");
        }
    }

    protected void append(StringBuilder builder, String name, float[] array) {
        if (array != null) {
            builder.append(name);
            builder.append("percentWidth:").append(Arrays.toString(array)).append(",\n");
        }
    }

}


text:
package demo;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.client.test.OAuth2ContextConfiguration;
import org.springframework.util.LinkedMultiValueMap;

import sparklr.common.AbstractAuthorizationCodeProviderTests;

/**
 * @author Dave Syer
 */
@SpringApplicationConfiguration(classes = Application.class)
public class AuthorizationCodeProviderTests extends AbstractAuthorizationCodeProviderTests {

	@Test
	@OAuth2ContextConfiguration(resource = MyTrustedClient.class, initialize = false)
	public void testPostToProtectedResource() throws Exception {
		approveAccessTokenGrant("https://anywhere", true);
		assertNotNull(context.getAccessToken());
		LinkedMultiValueMap<String, String> form = new LinkedMultiValueMap<>();
		form.set("foo", "bar");
		assertEquals(HttpStatus.CREATED, http.postForStatus("/", form).getStatusCode());
	}

	@Test
	public void testWrongClientIdProvided() throws Exception {
		ResponseEntity<String> response = attemptToGetConfirmationPage("no-such-client", "https://anywhere");
		// With no client id you get an InvalidClientException on the server which is forwarded to /oauth/error
		assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
		String body = response.getBody();
		assertTrue("Wrong body: " + body, body.contains("<html"));
		assertTrue("Wrong body: " + body, body.contains("Bad client credentials"));
	}

	@Test
	public void testWrongClientIdAndOmittedResponseType() throws Exception {
	    // Test wrong client id together with an omitted response_type
	    ResponseEntity<String> response = attemptToGetConfirmationPage("no-such-client", "https://anywhere", null);
	    // With bad client id you get an InvalidClientException on the server which is forwarded to /oauth/error
	    assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
	    String body = response.getBody();
	    assertTrue("Wrong body: " + body, body.contains("<html"));
	    assertTrue("Wrong body: " + body, body.contains("Bad client credentials"));
	}

	@Test
	public void testWrongClientIdAndBadResponseTypeProvided() throws Exception {
	    // Test wrong client id together with an omitted response_type
	    ResponseEntity<String> response = attemptToGetConfirmationPage("no-such-client", "https://anywhere", "unsupported");
	    // With bad client id you get an InvalidClientException on the server which is forwarded to /oauth/error
	    assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
	    String body = response.getBody();
	    assertTrue("Wrong body: " + body, body.contains("<html"));
	    assertTrue("Wrong body: " + body, body.contains("Bad client credentials"));
	}

}


text:
package com.infinityrefactoring.reflections;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.function.Predicate;

import org.junit.Test;

/**
 * Class used to test the {@linkplain Predicates} class.
 *
 * @author Thomás Sousa Silva (ThomasSousa96)
 */
@SuppressWarnings("javadoc")
public class PredicatesTest {

	@Test
	public void testWithAnnotationAnnotatedWith() throws Exception {
		Predicate<AnnotatedElement> predicateA = Predicates.withAnnotationAnnotatedWith(A.class);
		assertFalse(predicateA.test(Person.class));

		Predicate<AnnotatedElement> predicateB = Predicates.withAnnotationAnnotatedWith(B.class);
		assertTrue(predicateB.test(Person.class));
	}

	@Test
	public void testWithMethodSignature() {
		Predicate<Method> predicate1 = Predicates.withMethodSignature(void.class, "testWithMethodSignature");
		Method method1 = ClassWrapper.wrap(PredicatesTest.class).getCompatibleMethodWithTypes("testWithMethodSignature");
		assertTrue(predicate1.test(method1));

		Predicate<Method> predicate2 = Predicates.withMethodSignature(CharSequence.class, true, "getName");
		Method method2 = ClassWrapper.wrap(Person.class).getCompatibleMethodWithTypes("getName");
		assertTrue(predicate2.test(method2));
	}

}


text:
#pragma once
#include <aws/backup-gateway/BackupGateway_EXPORTS.h>
#include <aws/backup-gateway/model/VirtualMachineDetails.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace BackupGateway
{
namespace Model
{
  class AWS_BACKUPGATEWAY_API GetVirtualMachineResult
  {
  public:
    GetVirtualMachineResult();
    GetVirtualMachineResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    GetVirtualMachineResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
This object contains the basic attributes of VirtualMachine
     * contained by the output of GetVirtualMachine

     */
    inline const VirtualMachineDetails& GetVirtualMachine() const{ return m_virtualMachine; }

    /**
     *
This object contains the basic attributes of VirtualMachine
     * contained by the output of GetVirtualMachine

     */
    inline void SetVirtualMachine(const VirtualMachineDetails& value) { m_virtualMachine = value; }

    /**
     *
This object contains the basic attributes of VirtualMachine
     * contained by the output of GetVirtualMachine

     */
    inline void SetVirtualMachine(VirtualMachineDetails&& value) { m_virtualMachine = std::move(value); }

    /**
     *
This object contains the basic attributes of VirtualMachine
     * contained by the output of GetVirtualMachine

     */
    inline GetVirtualMachineResult& WithVirtualMachine(const VirtualMachineDetails& value) { SetVirtualMachine(value); return *this;}

    /**
     *
This object contains the basic attributes of VirtualMachine
     * contained by the output of GetVirtualMachine

     */
    inline GetVirtualMachineResult& WithVirtualMachine(VirtualMachineDetails&& value) { SetVirtualMachine(std::move(value)); return *this;}

  private:

    VirtualMachineDetails m_virtualMachine;
  };

} // namespace Model
} // namespace BackupGateway
} // namespace Aws


text:
<body>
	Hello from your web front-end!
</body>


text:
<?xml version="1.0" encoding="UTF-8"?>
<folder exportedWithPermissions="false">
    <parent>/public/adhoc</parent>
    <name>topics</name>
    <label>Topics</label>
    <description>Topics</description>
    <creationDate>2014-12-01T20:55:57.493+01:00</creationDate>
    <updateDate>2014-11-29T00:29:14.747+01:00</updateDate>
    <resource>JSDiagnosticTopic</resource>
</folder>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
EngineController
</TITLE>

<META NAME="date" CONTENT="2011-03-08">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

edu.umass.cs.sase.engine

Class EngineController

java.lang.Object
  edu.umass.cs.sase.engine.EngineController

public class EngineController
extends java.lang.Object

This class is used to wrap the Engine class,
 such that when you write code, you can quickly locate the related methods.

Author:

haopeng

Constructor Summary

EngineController()

          Default constructor.

EngineController(java.lang.String engineType)

          Constructor, can set different kinds of engines by different parameters

Method Summary

 void
initializeEngine()

          Initializes the engine

 void
runEngine()

          starts to run the engine

 void
setInput(Stream input)

          Sets the input stream for the engine

 void
setNfa(java.lang.String nfaLocation)

          Sets the nfa for the engine.

 void
setNfa(java.lang.String selectionStrategy,
       java.lang.String nfaLocation)

          Sets the nfa and selection strategy for the engine

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

EngineController

public EngineController()

Default constructor.

EngineController

public EngineController(java.lang.String engineType)

Constructor, can set different kinds of engines by different parameters

Parameters:
engineType - specifies the engine type, currently supports "sharingengine"

Method Detail

initializeEngine

public void initializeEngine()

Initializes the engine

setNfa

public void setNfa(java.lang.String selectionStrategy,
                   java.lang.String nfaLocation)

Sets the nfa and selection strategy for the engine

Parameters:
selectionStrategy - the selection strategy
nfaLocation - the nfa file for the query

setNfa

public void setNfa(java.lang.String nfaLocation)

Sets the nfa for the engine.

Parameters:
nfaLocation - the nfa file for the query

setInput

public void setInput(Stream input)

Sets the input stream for the engine

Parameters:
input - the input stream

runEngine

public void runEngine()
               throws java.lang.CloneNotSupportedException,
                      net.sourceforge.jeval.EvaluationException

starts to run the engine

Throws:

java.lang.CloneNotSupportedException

net.sourceforge.jeval.EvaluationException

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
package org.marsik.bugautomation.services;

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

import org.junit.Test;
import org.marsik.bugautomation.facts.Bug;

public class BugMatchingServiceTest {
    BugMatchingService bugs = new BugMatchingService();

    @Test
    public void testBugUrl() throws Exception {
        assertThat(bugs.identifyBug("https://bugzilla.redhat.com/show_bug.cgi?id=1378310").get())
                .isNotNull();
    }

    @Test
    public void testShortBugUrl() throws Exception {
        assertThat(bugs.identifyBug("https://bugzilla.redhat.com/1378310").get())
                .isNotNull();
    }

    @Test
    public void testBugId() throws Exception {
        assertThat(bugs.identifyBug("[1378310]").get())
                .isNotNull();
    }

    @Test
    public void testPlainBugId() throws Exception {
        assertThat(bugs.identifyBug("1378310").get())
                .isNotNull();
    }

    @Test
    public void testStringBugId() throws Exception {
        assertThat(bugs.identifyBug("bug 1378310").get())
                .isNotNull();
    }

    @Test
    public void testStringBugIdNoSpace() throws Exception {
        assertThat(bugs.identifyBug("bug1378310").get())
                .isNotNull();
    }

    @Test
    public void testHashBugId() throws Exception {
        assertThat(bugs.identifyBug("#1378310").get())
                .isNotNull();
    }

    @Test
    public void testBzHashBugId() throws Exception {
        assertThat(bugs.identifyBug("bz#1378310").get())
                .isNotNull();
    }

    @Test
    public void testBugHashBugId() throws Exception {
        assertThat(bugs.identifyBug("bug#1378310").get())
                .isNotNull();
    }

    @Test
    public void testRhbzHashBugId() throws Exception {
        assertThat(bugs.identifyBug("rhbz#1378310").get())
                .isNotNull();
    }

    @Test
    public void testRhbzBugId() throws Exception {
        assertThat(bugs.identifyBug("rhbz1378310").get())
                .isNotNull();
    }

    @Test
    public void testBugIdMatching() throws Exception {
        final Bug rhbz1378310 = bugs.identifyBug("rhbz1378310").get();
        final Bug bug1378310 = bugs.identifyBug("bug#1378310").get();

        assertThat(rhbz1378310)
                .isNotNull()
                .isEqualTo(bug1378310);
    }
}


text:
package org.ms123.common.process.converter;

import java.util.Map;
import java.util.Arrays;
import org.activiti.bpmn.model.BaseElement;
import org.activiti.bpmn.model.FieldExtension;
import org.activiti.bpmn.model.FlowElement;
import org.activiti.bpmn.model.ImplementationType;
import org.activiti.bpmn.model.ServiceTask;
import org.activiti.bpmn.model.UserTask;
import org.activiti.bpmn.model.FormProperty;
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.activiti.editor.language.json.converter.*;
import flexjson.*;

/**
 */
@SuppressWarnings("unchecked")
public class Simpl4UserTaskJsonConverter extends UserTaskJsonConverter {

	protected JSONDeserializer m_ds = new JSONDeserializer();

	protected JSONSerializer m_jsPretty = new JSONSerializer();

	protected JSONSerializer m_js = new JSONSerializer();

	private final String FORMKEY_PROP = "formkey";
	private final String FORMKEY = "formkey";

	private final String CANDIDATEGROUPS_PROP = "candidategroups";
	private final String CANDIDATEGROUPS = "candidategroups";

	private final String CANDIDATEUSERS_PROP = "candidateusers";
	private final String CANDIDATEUSERS = "candidateusers";

	private final String ASSIGNEE_PROP = "assignee";
	private final String ASSIGNEE = "assignee";

	private final String VARMAPPING_PROP = "variablesmapping";
	private final String VARMAPPING = "variablesmapping";

	private final String FORMVARNAME_PROP = "formvarname";
	private final String FORMVARNAME = "formvarname";

	protected String getStencilId(FlowElement flowElement) {
		return "UserTask";
	}

	protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) {
		UserTask task = (UserTask) super.convertJsonToElement(elementNode, modelNode, shapeMap);
		m_jsPretty.prettyPrint(true);
		Map elementMap = (Map) m_ds.deserialize(elementNode.toString());
		Map<String, Object> propMap = (Map) elementMap.get("properties");
		String formkey = getString(propMap.get(FORMKEY_PROP));
		task.setFormKey("~"+formkey);
		String assignee = getString(propMap.get(ASSIGNEE_PROP));
		if( assignee != null){
			task.setAssignee(assignee);
		}
		String candidategroups = getString(propMap.get(CANDIDATEGROUPS_PROP));
		if (candidategroups != null) {
			task.setCandidateGroups(Arrays.asList(candidategroups.split(",")));
		}
		String candidateusers = getString(propMap.get(CANDIDATEUSERS_PROP));
		if (candidateusers != null) {
			task.setCandidateUsers(Arrays.asList(candidateusers.split(",")));
		}
		String variablesmapping = getVarMapping(propMap.get(VARMAPPING_PROP));
		if (variablesmapping != null) {
			FormProperty formProperty = new FormProperty();
			formProperty.setId(VARMAPPING);
			formProperty.setName(VARMAPPING);
			formProperty.setDefaultExpression("~" + variablesmapping);
			formProperty.setVariable("~" + variablesmapping);
			task.getFormProperties().add(formProperty);
		}
		String formVarname = getString(propMap.get(FORMVARNAME_PROP));
		if (formVarname != null) {
			FormProperty formProperty = new FormProperty();
			formProperty.setId(FORMVARNAME);
			formProperty.setName(FORMVARNAME);
			formProperty.setDefaultExpression("~"+formVarname);
			formProperty.setVariable("~"+formVarname);
			task.getFormProperties().add(formProperty);
		}
		return task;
	}

	public static void fillTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
		fillJsonTypes(convertersToBpmnMap);
	}

	public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) {
		convertersToBpmnMap.put("UserTask", Simpl4UserTaskJsonConverter.class);
	}

	private String checkNull(String name, Object value) {
		if (value == null)
			throw new RuntimeException("Simpl4UserTaskJsonConverter:" + name + " is null");
		return value.toString();
	}

	private String getVarMapping(Object value) {
		if (value == null || value.toString().trim().length() == 0) {
			return null;
		}
		return m_js.deepSerialize(value);
	}

	private String getString(Object value) {
		if (value == null)
			return null;
		return value.toString();
	}
}


text:
require 'spec_helper'

describe ReferencesOneComponent do

  model Post
  let(:record){Fabricate :post}

  field :user

  it '#index' do
    process(:index, record).should == ''
  end

  it '#form' do
    result = process(:form, record)
    result.should have_tag("input[name='post[user_id]'][type='text']")
  end

  it '#permitted_params' do
    component.permitted_params.should == 'user_id'
  end

end