text:
package pl.java.scalatech.config.connector;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(name = "nbp-service", fallback = NBPFeignResource.HystrixFallback.class)
@Component
public interface NBPFeignResource {

	@GetMapping(value = "/byCode/{code}")
	String getMutlipierByCode(@PathVariable("code") String code);

	@GetMapping(value = "/simple")
	String getMessage();

	@Component
	class HystrixFallback implements NBPFeignResource {

		private static final String TOO_SLOW = "too slow";

		@Override
		public String getMutlipierByCode(String code) {
			return TOO_SLOW;
		}

		@Override
		public String getMessage() {
			return TOO_SLOW;
		}

	}
}

redpajama_set_name: RedPajamaGithub


text:
package config

const (
	// ContainerIDEnvVarName contains name of env variable passed from virtlet to vmwrapper
	ContainerIDEnvVarName = "VIRTLET_CONTAINER_ID"
	// CpusetsEnvVarName contains name of env variable passed from virtlet to vmwrapper
	CpusetsEnvVarName = "VIRTLET_CPUSETS"
	// EmulatorEnvVarName contains name of env variable passed from virtlet to vmwrapper
	EmulatorEnvVarName = "VIRTLET_EMULATOR"
	// LogPathEnvVarName contains name of env variable passed from virtlet to vmwrapper
	LogPathEnvVarName = "VIRTLET_CONTAINER_LOG_PATH"
	// NetKeyEnvVarName contains name of env variable passed from virtlet to vmwrapper
	NetKeyEnvVarName = "VIRTLET_NET_KEY"
)


text:
dojo
====

This is the foundation package for the Dojo 1 Toolkit.  While still being maintained, new development is focused on Dojo 2.

Checkout the [Dojo 2 website](https://dojo.io/) or if you want a more detailed technical status and overview, checkout [`dojo/meta`](https://github.com/dojo/meta).

This package is sometimes
referred to as the "core", it contains the most generally applicable sub-packages
and modules. The dojo package covers a wide range of functionality like Ajax, DOM
manipulation, class-type programming, events, promises, data stores,
drag-and-drop and internationalization libraries.

Installing
----------

Installation instructions are available at
[dojotoolkit.org/download](<http://dojotoolkit.org/download/>).

Getting Started
---------------

If you are starting out with Dojo, the following resources are available to you:

-   [Tutorials](<http://dojotoolkit.org/documentation/>)

-   [Reference Guide](<http://dojotoolkit.org/reference-guide/>)

-   [API Documentation](<http://dojotoolkit.org/api/>)

-   [Community Forum](<http://dojotoolkit.org/community/>)

What to Use Dojo For and When to Use It
---------------------------------------

The following is a brief sampling of some of the areas where Dojo may prove to
be the right tool for your next project:

-   For keeping your code fast and maintainable, Dojo offers an asynchronous
    module definition (AMD) loader -- encapsulating pieces of code into useful
    units, loading small JavaScript files only when they are needed, and loading
    files separately even when they are dependent on one another.

-   When you want to easily extend existing classes, share functionality among a
    number of classes, and maximize code reuse, Dojo provides class-like
    inheritance and "mixins."

-   For creating advanced and customizable user interfaces out of refined,
    efficient, and modular pieces, Dojo's Dijit framework offers several dozen
    enterprise-ready widgets -- including buttons, textboxes, form widgets with
    built-in validation, layout elements, and much more -- along with themes to
    lend them a consistent look. All of this is available for mobile
    environments as well.

-   For working with advanced vector graphics, Dojo's GFX API can render
    graphics in a wide variety of formats, with support for seamless
    manipulation (skewing, rotating, resizing), gradients, responding to mouse
    events, and more.

-   The `dojox/charting` library supports powerful data visualization and
    dynamic charting, including a variety of 2D plots and animated charting
    elements.

-   When you need feature-rich, lightweight, and mobile-friendly grids/tables,
    Dojo offers the `dgrid` widget, along with customizable default themes and
    accompanying features such as in-cell editing, row/cell selection, column
    resizing/reordering, keyboard handling, pagination, and more.

-   Dojo is the officially supported framework for the ArcGIS API for
    JavaScript, one of the most widely used enterprise-grade APIs for web
    mapping and spatial analysis -- learning to use Dojo will open doors to
    creating richer web mapping applications using that API.

License and Copyright
---------------------

The Dojo Toolkit (including this package) is dual licensed under BSD 3-Clause
and AFL. For more information on the license please see the [License
Information](<http://dojotoolkit.org/license>). The Dojo Toolkit is Copyright
(c) 2005-2017, JS Foundation. All rights reserved.


text:
import re, xpath, os, os.path, jsonpath, json
from xml.dom import minidom

# IMPORTANT: Functions for assertions *MUST* be lower case

##############################################################################
# Status
##############################################################################
def status(assertion, request):
	assertion.expected, assertion.received = str(assertion.value).split('|'), str(request.resp_status)
	assertion.passed = True if assertion.received in assertion.expected else False

def statusnot(assertion, request):
	assertion.expected, assertion.received = str(assertion.value).split('|'), str(request.resp_status)
	assertion.passed = True if assertion.received not in assertion.expected else False

# Headers
def headerexists(assertion, request):
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	for k in request.resp_headers.keys():
		if k.lower() == assertion.expected.lower():
			assertion.received = k
			assertion.passed = True

def headervalueequals(assertion, request):
	if 'header' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "header" --', '-- unable to query --'
		assertion.passed = False
		return
	header = assertion.params['header']
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	for k in request.resp_headers.keys():
	    if k.lower() == header.lower():
			if request.resp_headers[k].lower() == assertion.expected.lower():
				assertion.passed = True
    			assertion.received = request.resp_headers[k]
	assertion.expected = 'Header "%s" with value "%s"' % (header, assertion.expected)

def headervaluecontains(assertion, request):
	if 'header' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "header" --', '-- unable to query --'
		assertion.passed = False
		return
	header = assertion.params['header']
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	for k in request.resp_headers.keys():
	    if k.lower() == header.lower():
			if assertion.expected.lower() in request.resp_headers[k].lower():
				assertion.passed = True
    			assertion.received = request.resp_headers[k]
	assertion.expected = 'Header "%s" with value "%s"' % (header, assertion.expected)

def headerkeyvalueequals(assertion, request):
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	try:
	   assertion.received = request.resp_headers.get(assertion.params['name'])
	   if assertion.received == assertion.expected:
	       assertion.passed = True
	except:
	   assertion.received, assertion.passed = 'Error parsing response', False

def headerkeyvaluecsontains(assertion, request):
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	try:
	   assertion.received = request.resp_headers[assertion.params['name']]
	   if assertion.expected in assertion.received:
	       assertion.passed = True
	except:
	   assertion.received, assertion.passed = 'Error parsing response', False

def headerkeyexists(assertion, request):
	assertion.expected, assertion.received = assertion.value, 'Not Found'
	assertion.passed = False
	try:
	   assertion.received = request.resp_headers[assertion.expected]
	   assertion.passed = True
	except:
	   assertion.received, assertion.passed = 'Error parsing response', False

##############################################################################
# Body
##############################################################################
def bodyany(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()[:80]
	assertion.passed = True

def bodyequals(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	assertion.passed = True if assertion.expected.lower() == assertion.received.decode(encoding='ascii', errors='replace').lower() else False

def bodycontains(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	assertion.passed = True if assertion.expected.lower() in assertion.received.decode(encoding='ascii', errors='replace').lower() else False

def bodycontainsoneof(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	for expect in assertion.expected.split("|"):
		if expect.lower() in assertion.received.decode(encoding='ascii', errors='replace').lower():
			assertion.passed = True
			return
	assertion.passed = False

def bodylengthequals(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	assertion.passed = True if len(assertion.received)==int(assertion.expected) else False

def bodylengthlessthan(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	assertion.passed = True if len(assertion.received)<int(assertion.expected) else False

def bodylengthmorethan(assertion, request):
	assertion.expected, assertion.received = assertion.value, request.resp_body.strip()
	assertion.passed = True if len(assertion.received)>int(assertion.expected) else False

# Body XPath
def bodyxpathany(assertion, request):
	assertion.expected = 'Any value for query "%s"' % assertion.value
	try:
		assertion.received = xpath.findvalue(assertion.value, minidom.parseString(request.resp_body))
		assertion.passed = True if assertion.received else False
	except:
		assertion.received, assertion.passed = 'Error parsing response XML', False

def bodyxpathequals(assertion, request):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" equals "%s"' % (assertion.params['query'], assertion.value)
	try:
		assertion.received = xpath.findvalues(assertion.params['query'], minidom.parseString(request.resp_body))
		for expected in assertion.value.split('|'):
			if expected in assertion.received:
				assertion.passed = True
				return
		assertion.passed = False
	except:
		assertion.received, assertion.passed = 'Error parsing response XML', False

def bodyxpathcountequals(assertion, request):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" has %s occurrences' % (assertion.params['query'], assertion.value)
	try:
		assertion.received = len(xpath.findvalues(assertion.params['query'], minidom.parseString(request.resp_body)))
		if str(assertion.received) in str(assertion.value).split('|'):
			assertion.passed = True
			return
		assertion.passed = False
	except:
		assertion.received, assertion.passed = 'Error parsing response XML', False

def bodyxpathcountmorethan(assertion, request, operation=">"):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" has %s%s occurrences' % (assertion.params['query'], operation, assertion.value)
	try:
		assertion.received = len(xpath.findvalues(assertion.params['query'], minidom.parseString(request.resp_body)))
		if operation==">":
			assertion.passed = True if assertion.received>int(assertion.value) else False
		else:
			assertion.passed = True if assertion.received<int(assertion.value) else False
	except:
		assertion.received, assertion.passed = 'Error parsing response XML', False

def bodyxpathcountlessthan(assertion, request):
	return bodyxpathcountmorethan(assertion, request, operation="<")

def bodyxpathordered(assertion, request):
	assertion.expected, assertion.received, assertion.passed = '', '', False
	pass

def bodyxpathallcontainsoneof(assertion, request):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" contains "%s"' % (assertion.params['query'], assertion.value)
	try:
		assertion.received = xpath.findvalues(arg, minidom.parseString(request.response.body))
		expectedList = assertion.value.split('|')
		passed = True
		if (len(assertion.received) > 0):
			for r in assertion.received:
				found = False
				for e in expectedList:
					if (e in r):
						found = True
				if (not found):
					passed = False
	except:
		received, passed = 'error parsing response xml', False

def bodyxpathequalscount(assertion, request):
	valuesFound = None
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	if 'value' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" with Value "%s" has %s occurrences' % (assertion.params['query'], assertion.params['value'], assertion.value)
	try:
		valuesFound = xpath.findvalues(assertion.params['query'], minidom.parseString(request.resp_body))
		assertion.received = valuesFound.count(assertion.params['value'])
		if str(assertion.received) in str(assertion.value).split('|'):
			assertion.passed = True
			return
		assertion.passed = False
	except:
		assertion.received, assertion.passed = 'Error parsing response XML', False

def filesizeeequals(assertion, request, operator='='):
	assertion.expected, assertion.received = assertion.value, '?'
	try:
		assertion.received = int(os.path.getsize('resources/%s' % arg))
		passed = False
		if operator=='=':
			passed = True if int(assertion.expected) == int(assertion.received) else False
		elif operator=='>':
			passed = True if int(assertion.received) > int(assertion.expected) else False
		elif operator=='<':
			passed = True if int(assertion.received) < int(assertion.expected) else False
	except:
		received, passed = 'error accessing file', False

def filesizeemorethan(assertion, request):
	return filesizeeequals(assertion, request, operator='>')

def filesizeelessthan(assertion, request):
	return filesizeeequals(assertion, request, operator='<')

# Body JsonPath
def bodyjsonxpathbiggestany(assertion, request): return bodyjsonpathbiggestany(assertion, request)
def bodyjsonpathbiggestany(assertion, request):
	assertion.expected = 'Any value for biggest value in query "%s"' % assertion.value
	try:
		biggest = 0
		for val in jsonpath.jsonpath(json.loads(request.resp_body), assertion.value):
			if val > biggest: biggest = val
		assertion.received = biggest
		assertion.passed = True if assertion.received else False
	except:
		assertion.received, assertion.passed = 'Error parsing response Json', False

def bodyjsonxpathany(assertion, request): return bodyjsonpathany(assertion, request)
def bodyjsonpathany(assertion, request):
	assertion.expected = 'Any value for query "%s"' % assertion.value
	try:
		assertion.received = jsonpath.jsonpath(json.loads(request.resp_body), assertion.value)[0]
		assertion.passed = True if assertion.received else False
	except:
		assertion.received, assertion.passed = 'Error parsing response Json', False

def bodyjsonxpathequals(assertion, request): return bodyjsonpathequals(assertion, request)
def bodyjsonpathequals(assertion, request):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" equals "%s"' % (assertion.params['query'], assertion.value)
	try:
		assertion.received = str(jsonpath.jsonpath(json.loads(request.resp_body), assertion.params['query'])[0])
		for assertion.value in assertion.value.split('|'):
			if assertion.value == assertion.received:
				assertion.passed = True
				return
		assertion.passed = False
	except:
		assertion.received, assertion.passed = 'Error parsing response Json', False

def bodyjsonxpathecontains(assertion, request): return bodyjsonpathcontains(assertion, request)
def bodyjsonxpathcontains(assertion, request): return bodyjsonpathcontains(assertion, request)
def bodyjsonpathcontains(assertion, request):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" contains "%s"' % (assertion.params['query'], assertion.value)
	try:
		assertion.received = jsonpath.jsonpath(json.loads(request.resp_body), assertion.params['query'])
		for assertion.value in assertion.value.split('|'):
			if assertion.value in assertion.received:
				assertion.passed = True
				return
		assertion.passed = False
	except:
		assertion.received, assertion.passed = 'Error parsing response Json', False

def bodyjsonxpathcountequals(assertion, request, operation='='): return bodyjsonpathcountequals(assertion, request, operation)
def bodyjsonpathcountequals(assertion, request, operation='='):
	if 'query' not in assertion.params.keys():
		assertion.expected, assertion.received = '-- Missing assertion attribute "query" --', '-- unable to query --'
		assertion.passed = False
		return
	assertion.expected = 'Query "%s" is %s %s occurrences' % (assertion.params['query'], operation, assertion.value)
	try:
		query = jsonpath.jsonpath(json.loads(unicode(request.resp_body)), assertion.params['query'])
		if not query: assertion.received = 0
		else: assertion.received = len(query)
		if operation == '<': assertion.passed = True if assertion.received < int(assertion.value) else False
		elif operation == '>': assertion.passed = True if assertion.received > int(assertion.value) else False
		else: assertion.passed = True if assertion.received == int(assertion.value) else False
	except:
		assertion.received, assertion.passed = 'Error parsing response Json', False

def bodyjsonxpathcountmorethan(assertion, request): return bodyjsonpathcountmorethan(assertion, request)
def bodyjsonpathcountmorethan(assertion, request):
    bodyjsonxpathcountequals(assertion, request, operation='>')

def bodyjsonxpathcountlessthan(assertion, request): return bodyjsonpathcountlessthan(assertion, request)
def bodyjsonpathcountlessthan(assertion, request):
    bodyjsonxpathcountequals(assertion, request, operation='<')

# Factory for assertions
def run_assertion(assertion, request):
	assertion_type = assertion.type.strip().lower()
	if assertion_type in globals().keys():
		globals()[assertion.type.strip().lower()](assertion, request)
		if assertion.params.get('inverse') == 'true': assertion.passed = not assertion.passed
		if len(str(assertion.received))>200: assertion.received = '%s[...]' % assertion.received[:200]
		return assertion.passed
	else:
		assertion.expected, assertion.received = str(assertion.value), '--Unkown Assertion Type--'
		assertion.passed = False
		return False


text:
<?php

namespace Bluemesa\Bundle\StorageBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Bluemesa\Bundle\CoreBundle\Entity\Entity;

/**
 * Content class
 *
 * @ORM\MappedSuperclass
 *
 * @author Radoslaw Kamil Ejsmont <radoslaw@ejsmont.net>
 */
abstract class RackContent extends Entity implements RackContentInterface
{
    use RackContentTrait;
}


text:
<?php

namespace kiwi;

use kiwi\Http\Router;
use kiwi\Filesystem\Loader;
use kiwi\Error\ErrorHandler;

class Kernel
{
    /**
     * Fancy constructor.
     *
     *  @return void
     */
    public static function run()
    {
        try {
            self::loadDependencies();

            Router::loadRoutes(
                'App' . DIRECTORY_SEPARATOR . 'routes.php'
            )->delegate();
        } catch (\Throwable $e) {
            ErrorHandler::render($e);
        }
    }

    /**
     * Load the environment configuration and dependencies.
     *
     * @return void
     */
    public static function loadDependencies()
    {
        Loader::run();

        Container::bindArray([
            'connection' => Database\Connection::class,
            'session'    => Authentication\Session::class,
            'bag'        => Http\ValidationBag::class,
            'auth'       => Auth::class,
            'app'        => Application::class
        ]);
    }
}


text:
package scavlink.link.nav

import akka.actor.Props
import scavlink.link.{Vehicle, VehicleOpSupervisor}

object NavOpSupervisor {
  def props(vehicle: Vehicle): Props = Props(classOf[NavOpSupervisor], vehicle)
}

/**
 * Supervisor for vehicle navigation operations.
 */
class NavOpSupervisor(vehicle: Vehicle) extends VehicleOpSupervisor[NavOp](vehicle) {
  val opClass = classOf[NavOp]
}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using IsoPixel;

namespace UnitTests
{
    [TestClass]
    public class CommandRemoveSubSpriteTests
    {
        [TestMethod]
        public void TestCommandRemoveSubSprite()
        {
            DepthContainer dc = new DepthContainer();

            new DepthSprite(4, 4, "id01", dc);
            new DepthSprite(8, 4, "id02", dc);
            dc["id02"].subSprites.Add(new SubSprite("id01", 0, 0, 0));

            CommandBase command = new CommandRemoveSubSprite(dc["id02"].subSprites[0], dc["id02"]);

            Assert.IsTrue(command.Execute());
            Assert.AreEqual(0, dc["id02"].subSprites.Count);

            command.Cancel();
            Assert.AreEqual("id01", dc["id02"].subSprites[0].id);

            CommandBase commandFail = new CommandRemoveSubSprite(new SubSprite("id01", 10, 0, 0), dc["id02"]);
            Assert.IsFalse(commandFail.Execute());

            Assert.AreEqual("RemoveSubSprite 'id01' from sprite 'id02'", command.ToString());
        }
    }
}


text:
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
  set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/Eigen")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
  if(BUILD_TYPE)
    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
  else()
    set(CMAKE_INSTALL_CONFIG_NAME "Release")
  endif()
  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
  if(COMPONENT)
    message(STATUS "Install component: \"${COMPONENT}\"")
    set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
  else()
    set(CMAKE_INSTALL_COMPONENT)
  endif()
endif()

if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Devel")
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include/eigen3/unsupported/Eigen/CXX11/src/Tensor" TYPE FILE FILES
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/Tensor.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h"
    "D:/tensorflow0.8/third_party/eigen-eigen-50812b426b7c/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h"
    )
endif()


text:
> **WARNING** this library is no longer actively developed, and will be integrated
> in the [docker/distribution][https://www.github.com/docker/distribution]
> repository in future.

Libtrust is library for managing authentication and authorization using public key cryptography.

Authentication is handled using the identity attached to the public key.
Libtrust provides multiple methods to prove possession of the private key associated with an identity.
 - TLS x509 certificates
 - Signature verification
 - Key Challenge

Authorization and access control is managed through a distributed trust graph.
Trust servers are used as the authorities of the trust graph and allow caching portions of the graph for faster access.

## Copyright and license

Code and documentation copyright 2014 Docker, inc. Code released under the Apache 2.0 license.
Docs released under Creative commons.


text:
package org.fastmongo.odm.bson.mapping.core;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.bson.BasicBSONEncoder;
import org.bson.types.*;
import org.fastmongo.odm.bson.repository.BsonMongoTemplate;
import org.fastmongo.odm.dbobject.mapping.core.ConverterHelper;
import org.fastmongo.odm.dbobject.mapping.core.DomainToDbObjectConverter;
import org.fastmongo.odm.dbobject.mapping.support.classname.ReflectionClassNameResolver;
import org.fastmongo.odm.document.Entity;
import org.fastmongo.odm.document.support.LazyCollectionProxy;
import org.fastmongo.odm.document.support.LazyProxy;
import org.fastmongo.odm.mapping.exception.EntitiesNotFoundException;
import org.fastmongo.odm.mapping.exception.MappingException;
import org.fastmongo.odm.mapping.support.converter.ConversionService;
import org.fastmongo.odm.model.*;
import org.fastmongo.odm.model.user.Group;
import org.fastmongo.odm.model.user.User;
import org.fastmongo.odm.util.DefaultMongoNamingService;
import org.fastmongo.odm.util.MongoUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;

import static com.mongodb.BasicDBObjectBuilder.start;

/**
 * @author Alexander Gulko
 */
public class BsonToDomainConverterTest {
    private DomainToDbObjectConverter toConverter;
    private BsonToDomainConverter fromConverter;
    private TestMongoTemplate testMongoTemplate;

    @BeforeClass
    public void initialize() throws Exception {
        DefaultMongoNamingService namingService = new DefaultMongoNamingService();
        String classPrefix = TestEntity.class.getPackage().getName() + ".";
        BsonClassNameResolver classNameResolver = new BsonClassNameResolver(TestEntity.class.getPackage().getName());

        testMongoTemplate = new TestMongoTemplate();

        fromConverter = new BsonToDomainConverter();
        fromConverter.setClassPrefix(classPrefix);
        fromConverter.setConversionService(new ConversionService());
        fromConverter.setClassNameResolver(classNameResolver);

        DefaultBsonLinkResolver linkResolver = new DefaultBsonLinkResolver(testMongoTemplate);
        linkResolver.setErrorOnMissingLinks(true);
        fromConverter.setLinkResolver(linkResolver);

        toConverter = new DomainToDbObjectConverter(new ConversionService(),
                new ReflectionClassNameResolver(TestEntity.class.getPackage().getName(), null), namingService);
        toConverter.setClassPrefix(classPrefix);
        toConverter.setCollectionClasses(Arrays.<Class<?>>asList(
                TestAllFieldTypesImpl.class,
                TestAllFieldTypes.class
        ));
    }

    @BeforeMethod
    public void clearTemplate() {
        testMongoTemplate.clear();
    }

    @Test
    public void test_readWithDummyFields() {
        User expected = new User();
        expected.setId(1L);
        expected.setName("expected-name");

        DBObject db = toConverter.toDbObject(expected);
        db.put("_id", 1L);

        // add dummy field, it should not be processed too
        db.put("dummyField", new BasicDBObject().append("subField", new BasicDBObject("anotherField", 123)));

        // add real field to last position
        db.removeField("name");
        db.put("name", expected.getName());

        byte[] bson = toBson(db);

        User actual = fromConverter.fromBson(User.class, bson);

        Assert.assertEquals(actual.getId(), expected.getId());
        Assert.assertEquals(actual.getName(), expected.getName());
    }

    @SuppressWarnings("ConstantConditions")
    @Test
    public void test_lazyConvertedCollections_isEmpty_first() {
        User expected = new User();
        expected.setSomeIds(Arrays.asList(1L, 2L, 3L));

        byte[] bson = toBson(expected);

        User actual = fromConverter.fromBson(User.class, bson);

        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy);

        Assert.assertFalse(actual.getSomeIds().isEmpty());
        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy); // still proxy

        Assert.assertEquals(actual.getSomeIds().size(), expected.getSomeIds().size());
        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy); // still proxy

        actual.getSomeIds().iterator(); // touch proxy and load actual object
        Assert.assertFalse(actual.getSomeIds() instanceof LazyProxy);
    }

    @SuppressWarnings("ConstantConditions")
    @Test
    public void test_lazyConvertedCollections_size_first() {
        User expected = new User();
        expected.setSomeIds(Arrays.asList(1L, 2L, 3L));

        byte[] bson = toBson(expected);

        User actual = fromConverter.fromBson(User.class, bson);

        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy);

        Assert.assertEquals(actual.getSomeIds().size(), expected.getSomeIds().size());
        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy); // still proxy

        // Assert.assertFalse(actual.getSomeIds().isEmpty());
        Assert.assertTrue(actual.getSomeIds() instanceof LazyProxy); // still proxy

        actual.getSomeIds().iterator(); // touch proxy and load actual object
        Assert.assertFalse(actual.getSomeIds() instanceof LazyProxy);
    }

    @SuppressWarnings({"ConstantConditions", "unchecked"})
    @Test
    public void test_methodsOnExternalProxiedCollection() {
        Group group = new Group();
        group.setUsers(Arrays.asList(
                new User(1L),
                new User(2L),
                new User(3L)
        ));

        testMongoTemplate.add(User.class, group.getUsers());

        byte[] bson = toBson(group);

        Group actual = fromConverter.fromBson(Group.class, bson);

        Assert.assertTrue(actual.getUsers() instanceof LazyProxy);
        Assert.assertFalse(actual.getUsers().isEmpty());
        Assert.assertTrue(actual.getUsers() instanceof LazyProxy);

        Assert.assertEquals(actual.getUsers().size(), group.getUsers().size());
        Assert.assertTrue(actual.getUsers() instanceof LazyProxy);

        actual.getUsers().iterator();
        Assert.assertFalse(actual.getUsers() instanceof LazyProxy);
    }

    @Test
    public void test_allFieldsForObject() {
        TestAllFieldTypesImpl expected = TestDomainObjectsFixtures.createTestAllFieldTypes();

        byte[] bson = toBson(expected);
        TestAllFieldTypesImpl actual = fromConverter.fromBson(TestAllFieldTypesImpl.class, bson);

        Assert.assertEquals(actual, expected);
    }

    @Test
    public void test_acceptNull() {
        Assert.assertNull(fromConverter.fromBson(User.class, null));

        // can be any class
        Assert.assertNull(fromConverter.fromBson(String.class, null));
        Assert.assertNull(fromConverter.fromBson(null, null));
    }

    @Test(
            expectedExceptions = IllegalStateException.class,
            expectedExceptionsMessageRegExp = "The type of field '.*?' should be string, but its type=.*"
    )
    public void test_exceptionOnUnknownClassForDocument() {
        DBObject db = start()
                .add(ConverterHelper.CLASS_KEY, 1)
                .get();

        fromConverter.fromBson(User.class, toBson(db));
    }

    @Test
    public void test_resolveClassByField() {
        Class<TestAllFieldTypesImpl> expectedClass = TestAllFieldTypesImpl.class;

        DBObject db = start()
                .add(ConverterHelper.CLASS_KEY, expectedClass.getSimpleName())
                .get();

        Object actual = fromConverter.fromBson(null, toBson(db));
        Assert.assertNotNull(actual);
        Assert.assertEquals(actual.getClass(), expectedClass);
    }

    @Test(
            expectedExceptions = MappingException.class,
            expectedExceptionsMessageRegExp = "Can't find concrete class for .+"
    )
    public void test_exceptionOnUnresolvedClass() {
        DBObject db = start()
                .add("id", 1L)
                .get();

        fromConverter.fromBson(Base.class, toBson(db));
    }

    @Test(
            dataProvider = "unsupportedValues",
            expectedExceptions = UnsupportedOperationException.class,
            expectedExceptionsMessageRegExp = "Converter doesn't understand type : .*? for field name: field"
    )
    public void test_exceptionOnUnsupportedFieldValue(Object unsupportedValue) {
        DBObject db = start()
                .add("field", unsupportedValue)
                .get();

        fromConverter.fromBson(TestAllFieldTypesImpl.class, toBson(db));
    }

    @DataProvider(name = "unsupportedValues")
    public Object[][] getUnsupportedByMapperValues() {
        return new Object[][]{
                new Object[]{Pattern.compile(".")},
                new Object[]{new Binary(new byte[0])},
                new Object[]{new Code("code")},
                new Object[]{new CodeWScope("code", start().get())},
                new Object[]{new BSONTimestamp()},
                new Object[]{new MaxKey()},
                new Object[]{new MinKey()}
        };
    }

    @SuppressWarnings("unchecked")
    @Test(
            expectedExceptions = EntitiesNotFoundException.class,
            expectedExceptionsMessageRegExp = "Can't find links in external collection " +
                    "class org.fastmongo.odm.model.TestAllFieldTypesImpl, " +
                    "missed 3 links: \\[1, 2, 3\\]"
    )
    public void test_exceptionOnLoadExternalCollection() {
        TestAllFieldTypesImpl parent = new TestAllFieldTypesImpl(0);
        List<TestAllFieldTypesImpl> children = Arrays.asList(
                new TestAllFieldTypesImpl(1),
                new TestAllFieldTypesImpl(2),
                new TestAllFieldTypesImpl(3)
        );
        parent.documentSet = new HashSet<>((List) children);

        DBObject parentDb = convert(parent);

        TestAllFieldTypesImpl actualParent = fromConverter.fromBson(TestAllFieldTypesImpl.class, toBson(parentDb));

        Assert.assertTrue(actualParent.documentSet instanceof LazyCollectionProxy);

        actualParent.documentSet.iterator();
    }

    @SuppressWarnings("unchecked")
    @Test
    public void test_loadExternalCollection() {
        TestAllFieldTypesImpl parent = new TestAllFieldTypesImpl(0);
        List<TestAllFieldTypesImpl> children = Arrays.asList(
                new TestAllFieldTypesImpl(1),
                new TestAllFieldTypesImpl(2),
                new TestAllFieldTypesImpl(3)
        );
        parent.documentSet = new HashSet<>((List) children);
        parent.documentList = new ArrayList<>(); // empty list

        DBObject parentDb = convert(parent);

        testMongoTemplate.add(TestAllFieldTypesImpl.class, children);

        TestAllFieldTypesImpl actualParent = fromConverter.fromBson(TestAllFieldTypesImpl.class, toBson(parentDb));

        Assert.assertTrue(actualParent.documentSet instanceof LazyCollectionProxy);

        Assert.assertEquals(actualParent.documentSet.size(), parent.documentSet.size());
        Assert.assertTrue(actualParent.documentSet instanceof LazyCollectionProxy);

        actualParent.documentSet.iterator();
        Assert.assertFalse(actualParent.documentSet instanceof LazyCollectionProxy);

        // empty collection converted to default value, which is null in this case
        Assert.assertNull(actualParent.documentList);
    }

    @Test
    public void test_loadExternalDocument() {
        TestAllFieldTypesImpl parent = new TestAllFieldTypesImpl(0);
        TestAllFieldTypesImpl expected = new TestAllFieldTypesImpl(1);
        parent.document = expected;

        DBObject parentDb = convert(parent);

        testMongoTemplate.add(TestAllFieldTypesImpl.class, Arrays.asList(parent, expected));

        TestAllFieldTypesImpl actualParent = fromConverter.fromBson(TestAllFieldTypesImpl.class, toBson(parentDb));

        Assert.assertTrue(actualParent.document instanceof LazyProxy);
        Assert.assertEquals(actualParent.document.getId(), expected.getId());
        actualParent.document.getIntVal();
        Assert.assertFalse(actualParent.document instanceof LazyProxy);
    }

    @Test
    public void test_loadExternalDocumentMap() {
        TestAllFieldTypesImpl parent = new TestAllFieldTypesImpl(0);
        TestAllFieldTypesImpl expected = new TestAllFieldTypesImpl(1);
        parent.documentMap = new HashMap<>();
        parent.documentMap.put(expected.getId().toString(), expected);

        DBObject parentDb = convert(parent);

        testMongoTemplate.add(TestAllFieldTypesImpl.class, Arrays.asList(parent, expected));

        TestAllFieldTypesImpl actualParent = fromConverter.fromBson(TestAllFieldTypesImpl.class, toBson(parentDb));

        Assert.assertFalse(actualParent.documentMap.get(expected.getId().toString()) instanceof LazyProxy);
        Assert.assertEquals(actualParent.documentMap.get(expected.getId().toString()).getId(), expected.getId());
        actualParent.documentMap.get(expected.getId().toString()).getIntVal();
    }

    private byte[] toBson(Object document) {
        BasicDBObject db = convert(document);
        return toBson(db);
    }

    private byte[] toBson(DBObject db) {
        return new BasicBSONEncoder().encode(db);
    }

    private BasicDBObject convert(Object document) {
        BasicDBObject db = toConverter.toDbObject(document);
        db.put(MongoUtils.OBJECT_ID_KEY, new ObjectId());

        return db;
    }

    @SuppressWarnings("unchecked")
    static class TestMongoTemplate extends BsonMongoTemplate {
        private Map<Class<?>, Map<Object, Object>> store = new ConcurrentHashMap<>();

        public void add(Class<?> clazz, Collection<? extends Entity<?>> entities) {
            for (Entity<?> entity : entities) {
                add(clazz, entity);
            }
        }

        public void add(Class<?> clazz, Entity<?> entity) {
            getClassStore(clazz).put(entity.getId(), entity);
        }

        @Override
        public <T> T findById(Class<? extends T> clazz, Object id) {
            return (T) getClassStore(clazz).get(id);
        }

        public void clear() {
            store.clear();
        }

        @Override
        public <T> List<T> findByIds(Class<? extends T> clazz, Collection<?> ids) {
            List<T> result = new ArrayList<>();
            for (Object id : ids) {
                T object = findById(clazz, id);
                if (object != null) {
                    result.add(object);
                }
            }

            return result;
        }

        private Map<Object, Object> getClassStore(Class<?> clazz) {
            Map<Object, Object> classStore = store.get(clazz);
            if (classStore == null) {
                classStore = new ConcurrentHashMap<>();
                store.put(clazz, classStore);
            }

            return classStore;
        }
    }
}


text:
My config files for:

- [fish](/config/fish)
- [bash](/bash)
- [vim](/vim)

Also, some [scripts](/bin), and a bunch of other tool/language configs.

⚠  Don't use blindly; it's very customized. But feel free take anything
that's useful to you.


text:
.class public final Landroid/os/ServiceManager;
.super Ljava/lang/Object;
.source "ServiceManager.java"

# static fields
.field private static final TAG:Ljava/lang/String; = "ServiceManager"

.field private static sCache:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Landroid/os/IBinder;",
            ">;"
        }
    .end annotation
.end field

.field private static sServiceManager:Landroid/os/IServiceManager;

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 31
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Landroid/os/ServiceManager;->sCache:Ljava/util/HashMap;

    .line 27
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 27
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static addService(Ljava/lang/String;Landroid/os/IBinder;)V
    .locals 3
    .param p0, "name"    # Ljava/lang/String;
    .param p1, "service"    # Landroid/os/IBinder;

    .prologue
    .line 72
    :try_start_0
    invoke-static {}, Landroid/os/ServiceManager;->getIServiceManager()Landroid/os/IServiceManager;

    move-result-object v1

    const/4 v2, 0x0

    invoke-interface {v1, p0, p1, v2}, Landroid/os/IServiceManager;->addService(Ljava/lang/String;Landroid/os/IBinder;Z)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 70
    :goto_0
    return-void

    .line 73
    :catch_0
    move-exception v0

    .line 74
    .local v0, "e":Landroid/os/RemoteException;
    const-string/jumbo v1, "ServiceManager"

    const-string/jumbo v2, "error in addService"

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

.method public static addService(Ljava/lang/String;Landroid/os/IBinder;Z)V
    .locals 3
    .param p0, "name"    # Ljava/lang/String;
    .param p1, "service"    # Landroid/os/IBinder;
    .param p2, "allowIsolated"    # Z

    .prologue
    .line 89
    :try_start_0
    invoke-static {}, Landroid/os/ServiceManager;->getIServiceManager()Landroid/os/IServiceManager;

    move-result-object v1

    invoke-interface {v1, p0, p1, p2}, Landroid/os/IServiceManager;->addService(Ljava/lang/String;Landroid/os/IBinder;Z)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 87
    :goto_0
    return-void

    .line 90
    :catch_0
    move-exception v0

    .line 91
    .local v0, "e":Landroid/os/RemoteException;
    const-string/jumbo v1, "ServiceManager"

    const-string/jumbo v2, "error in addService"

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

.method public static checkService(Ljava/lang/String;)Landroid/os/IBinder;
    .locals 5
    .param p0, "name"    # Ljava/lang/String;

    .prologue
    const/4 v4, 0x0

    .line 101
    :try_start_0
    sget-object v2, Landroid/os/ServiceManager;->sCache:Ljava/util/HashMap;

    invoke-virtual {v2, p0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/os/IBinder;

    .line 102
    .local v1, "service":Landroid/os/IBinder;
    if-eqz v1, :cond_0

    .line 103
    return-object v1

    .line 105
    :cond_0
    invoke-static {}, Landroid/os/ServiceManager;->getIServiceManager()Landroid/os/IServiceManager;

    move-result-object v2

    invoke-interface {v2, p0}, Landroid/os/IServiceManager;->checkService(Ljava/lang/String;)Landroid/os/IBinder;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    return-object v2

    .line 107
    .end local v1    # "service":Landroid/os/IBinder;
    :catch_0
    move-exception v0

    .line 108
    .local v0, "e":Landroid/os/RemoteException;
    const-string/jumbo v2, "ServiceManager"

    const-string/jumbo v3, "error in checkService"

    invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 109
    return-object v4
.end method

.method private static getIServiceManager()Landroid/os/IServiceManager;
    .locals 1

    .prologue
    .line 34
    sget-object v0, Landroid/os/ServiceManager;->sServiceManager:Landroid/os/IServiceManager;

    if-eqz v0, :cond_0

    .line 35
    sget-object v0, Landroid/os/ServiceManager;->sServiceManager:Landroid/os/IServiceManager;

    return-object v0

    .line 39
    :cond_0
    invoke-static {}, Lcom/android/internal/os/BinderInternal;->getContextObject()Landroid/os/IBinder;

    move-result-object v0

    invoke-static {v0}, Landroid/os/ServiceManagerNative;->asInterface(Landroid/os/IBinder;)Landroid/os/IServiceManager;

    move-result-object v0

    sput-object v0, Landroid/os/ServiceManager;->sServiceManager:Landroid/os/IServiceManager;

    .line 40
    sget-object v0, Landroid/os/ServiceManager;->sServiceManager:Landroid/os/IServiceManager;

    return-object v0
.end method

.method public static getService(Ljava/lang/String;)Landroid/os/IBinder;
    .locals 5
    .param p0, "name"    # Ljava/lang/String;

    .prologue
    const/4 v4, 0x0

    .line 51
    :try_start_0
    sget-object v2, Landroid/os/ServiceManager;->sCache:Ljava/util/HashMap;

    invoke-virtual {v2, p0}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/os/IBinder;

    .line 52
    .local v1, "service":Landroid/os/IBinder;
    if-eqz v1, :cond_0

    .line 53
    return-object v1

    .line 55
    :cond_0
    invoke-static {}, Landroid/os/ServiceManager;->getIServiceManager()Landroid/os/IServiceManager;

    move-result-object v2

    invoke-interface {v2, p0}, Landroid/os/IServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    return-object v2

    .line 57
    .end local v1    # "service":Landroid/os/IBinder;
    :catch_0
    move-exception v0

    .line 58
    .local v0, "e":Landroid/os/RemoteException;
    const-string/jumbo v2, "ServiceManager"

    const-string/jumbo v3, "error in getService"

    invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 60
    return-object v4
.end method

.method public static initServiceCache(Ljava/util/Map;)V
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Landroid/os/IBinder;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 134
    .local p0, "cache":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Landroid/os/IBinder;>;"
    sget-object v0, Landroid/os/ServiceManager;->sCache:Ljava/util/HashMap;

    invoke-virtual {v0}, Ljava/util/HashMap;->size()I

    move-result v0

    if-eqz v0, :cond_0

    .line 135
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string/jumbo v1, "setServiceCache may only be called once"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 137
    :cond_0
    sget-object v0, Landroid/os/ServiceManager;->sCache:Ljava/util/HashMap;

    invoke-virtual {v0, p0}, Ljava/util/HashMap;->putAll(Ljava/util/Map;)V

    .line 133
    return-void
.end method

.method public static listServices()[Ljava/lang/String;
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 118
    :try_start_0
    invoke-static {}, Landroid/os/ServiceManager;->getIServiceManager()Landroid/os/IServiceManager;

    move-result-object v1

    invoke-interface {v1}, Landroid/os/IServiceManager;->listServices()[Ljava/lang/String;
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    return-object v1

    .line 119
    :catch_0
    move-exception v0

    .line 120
    .local v0, "e":Landroid/os/RemoteException;
    const-string/jumbo v1, "ServiceManager"

    const-string/jumbo v2, "error in listServices"

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 121
    const/4 v1, 0x0

    return-object v1
.end method


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

package io.warp10.script.functions;

import io.warp10.continuum.gts.GTSEncoder;
import io.warp10.continuum.gts.GTSWrapperHelper;
import io.warp10.continuum.gts.GeoTimeSerie;
import io.warp10.continuum.store.thrift.data.GTSWrapper;
import io.warp10.crypto.OrderPreservingBase64;
import io.warp10.script.NamedWarpScriptFunction;
import io.warp10.script.WarpScriptException;
import io.warp10.script.WarpScriptStack;
import io.warp10.script.WarpScriptStackFunction;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.apache.thrift.TException;
import org.apache.thrift.TSerializer;
import org.apache.thrift.protocol.TCompactProtocol;

import com.geoxp.GeoXPLib;
import com.geoxp.GeoXPLib.GeoXPShape;
/**
 * Pack a GeoXPShape
 *
 * We relay on GTSWrappers for this, this is kinda weird but hey, it works!
 *
 */
public class GEOPACK extends NamedWarpScriptFunction implements WarpScriptStackFunction {

  public GEOPACK(String name) {
    super(name);
  }

  @Override
  public Object apply(WarpScriptStack stack) throws WarpScriptException {

    Object o = stack.pop();

    if (!(o instanceof GeoXPShape)) {
      throw new WarpScriptException(getName() + " expects a shape on top of the stack.");
    }

    GeoXPShape shape = (GeoXPShape) o;

    stack.push(pack(shape));

    return stack;
  }

  public static String pack(GeoXPShape shape) throws WarpScriptException {
    long[] cells = GeoXPLib.getCells(shape);

    GTSEncoder encoder = new GTSEncoder();

    try {
      for (long cell: cells) {
        encoder.addValue(cell, GeoTimeSerie.NO_LOCATION, GeoTimeSerie.NO_ELEVATION, true);
      }
    } catch (IOException ioe) {
      throw new WarpScriptException(ioe);
    }

    GTSWrapper wrapper = GTSWrapperHelper.fromGTSEncoderToGTSWrapper(encoder, true);

    TSerializer serializer = new TSerializer(new TCompactProtocol.Factory());

    try {
      byte[] serialized = serializer.serialize(wrapper);

      return new String(OrderPreservingBase64.encode(serialized, 0, serialized.length), StandardCharsets.US_ASCII);
    } catch (TException te) {
      throw new WarpScriptException(te);
    }
  }
}


text:
//
//  AppDelegate.m
//  Salud Juicery ios
//
//  Created by Salud Juice Team (Vigneshwarr)on 8/28/15.
//  Copyright (c) 2015 Salud Juice Team. All rights reserved.
//

#import "AppDelegate.h"

#import <FBSDKCoreKit/FBSDKCoreKit.h>

#import <FBSDKLoginKit/FBSDKLoginKit.h>

#import <FBSDKShareKit/FBSDKShareKit.h>

#import "Settings.h"

#define GOOGLEPLUS_SCHEME @"salud.dev.Salud-Juicery1"
#define FACEBOOK_SCHEME  @"fb900851463322720"
#define GOOGLE_SCHEME @"com.googleusercontent.apps.673101349738-h4v98lcg2i45i8cuf899fei7qrv8qtas"

#import <GoogleSignIn/GoogleSignIn.h>

#import "Settings.h"

@implementation AppDelegate

#pragma mark - Class Methods

+ (void)initialize
{
    // Nib files require the type to have been loaded before they can do the wireup successfully.
    // http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime
    [FBSDKLoginButton class];
    [FBSDKProfilePictureView class];
   // [FBSDKSendButton class];
   // [FBSDKShareButton class];
}

#pragma mark - UIApplicationDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSError* configureError;
    self.categoryDictionary = [NSMutableDictionary dictionary];
    //  [[GGLContext sharedInstance] configureWithError: &configureError];

    //Google sigin//

  //  NSAssert(!configureError, @"Error configuring Google services: %@", configureError);

   [GIDSignIn sharedInstance].clientID = @"673101349738-h4v98lcg2i45i8cuf899fei7qrv8qtas.apps.googleusercontent.com";

   // [FBSDKProfile enableUpdatesOnAccessTokenChange:YES];

    //Google sigin// end

    return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];

  //  [FBSDKLoginButton class];

    return YES;
}

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  /*
    if ([[url scheme] isEqualToString:GOOGLEPLUS_SCHEME])
        return [GPPURLHandler handleURL:url
                      sourceApplication:sourceApplication
                             annotation:annotation];
    */
    if ([[url scheme] isEqualToString:FACEBOOK_SCHEME])
        return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                              openURL:url
                                                    sourceApplication:sourceApplication
                                                           annotation:annotation];
    //Google sigin//

    if ([[url scheme] isEqualToString:GOOGLE_SCHEME])
        NSLog(@"access_token:@");
    return [[GIDSignIn sharedInstance] handleURL:url
                               sourceApplication:sourceApplication
                                      annotation:annotation];

    //Google sigin// end

    return NO;

}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [FBSDKAppEvents activateApp];

    // Do the following if you use Mobile App Engagement Ads to get the deferred
    // app link after your app is installed.
    [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
        if (error) {
            NSLog(@"Received error while fetching deferred app link %@", error);
        }
        if (url) {
            [[UIApplication sharedApplication] openURL:url];
        }
    }];
}

//google

- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
     withError:(NSError *)error {
    // Perform any operations on signed in user here.
    //   NSString *userId = user.userID;                  // For client-side use only!
    //    NSString *idToken = user.authentication.idToken; // Safe to send to the server
    //   NSString *name = user.profile.name;
    //   NSString *email = user.profile.email;
    NSString *accessToken = user.authentication.accessToken;
    // ...

    //   NSString *accessToken = user.authentication.accessToken;
    NSLog(@"access_token:%@",accessToken);
    //  [self performSegueWithIdentifier:@"mainview" sender:self];

}

- (void)signIn:(GIDSignIn *)signIn
didDisconnectWithUser:(GIDGoogleUser *)user
     withError:(NSError *)error {
    // Perform any operations when the user disconnects from app here.
    // ...
}

@end


text:
import JSONAPIAdapter from 'ember-data/adapters/json-api';

import KeycloakSession from '@jftechnology/ember-keycloak-auth/services/keycloak-session';

import {inject as service} from "@ember/service";
import RSVP from "rsvp";

export default class ApplicationAdapter extends JSONAPIAdapter {

  /**
   * An injected keycloak session.
   *
   * @property keycloakSession
   * @type {KeycloakSession}
   */
  @service
  keycloakSession!: KeycloakSession;

  get headers(): {} {
    console.log(`ApplicationAdapter :: headers() -> ${JSON.stringify(this.keycloakSession.headers, null, 2)}`);
    return this.keycloakSession.headers;
  }

  /**
   * Wrap the adapter ajax method to ensure that the call to the secured back end is made only after the session token has been updated.
   *
   * @method ajax
   * @param url {String}
   * @param type {String}
   * @param hash {Object}
   * @return {Promise}
   * @private
   */
  ajax(url: string, type: string, hash: {}): RSVP.Promise<any> {
    console.log(`ApplicationAdapter :: ajax(${url} / ${type} / ${JSON.stringify(hash, null, 2)})`);
    return this.keycloakSession.wrappedCall(() => super.ajax(url, type, hash));
  }
}


text:
export interface TTSOptions {
    /** text to speak */
    text: string;
    /** a string like 'en-US', 'zh-CN', etc */
    locale?: string;
    /** speed rate, 0 ~ 1 */
    rate?: number;
}
/**
 * @name TextToSpeech
 * @description
 * Text to Speech plugin
 *
 * @usage
 * ```
 * import {TextToSpeech} from 'ionic-native';
 *
 * TextToSpeech.speak('Hello World')
 *   .then(() => console.log('Success'))
 *   .catch((reason: any) => console.log(reason));
 *
 * ```
 */
export declare class TextToSpeech {
    /**
     * This function speaks
     * @param options {string | TTSOptions} Text to speak or TTSOptions
     * @return {Promise<any>} Returns a promise that resolves when the speaking finishes
     */
    static speak(options: string | TTSOptions): Promise<any>;
}


text:
<?php

namespace Website\StaticBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Sonata\UserBundle\Entity\BaseUser;

/**
 * @ORM\Entity
 * @ORM\Table(name="customers")
 */
class Customer extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToMany(targetEntity="Group")
     * @ORM\JoinTable(name="customer_groups",
     *      joinColumns={@ORM\JoinColumn(name="customer_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
     *      )
     */
    protected $groups;

    public function __construct()
    {
        parent::__construct();
        $this->groups = new ArrayCollection();
    }
}


text:
package org.spongepowered.lantern.registry.type.world;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.collect.Maps;
import org.spongepowered.api.world.storage.WorldProperties;
import org.spongepowered.lantern.world.storage.LanternWorldProperties;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;

public final class WorldPropertyRegistryModule {

    private final Map<String, WorldProperties> worldPropertiesNameMappings = Maps.newHashMap();
    private final Map<UUID, WorldProperties> worldPropertiesUuidMappings = Maps.newHashMap();

    public static WorldPropertyRegistryModule getInstance() {
        return Holder.instance;
    }

    public void registerWorldProperties(WorldProperties properties) {
        this.worldPropertiesUuidMappings.put(properties.getUniqueId(), properties);
        this.worldPropertiesNameMappings.put(properties.getWorldName(), properties);
    }

    public void unregister(WorldProperties properties) {
        this.worldPropertiesUuidMappings.remove(properties.getUniqueId());
        this.worldPropertiesNameMappings.remove(properties.getWorldName());
    }

    public Optional<WorldProperties> getWorldProperties(String name) {
        return Optional.ofNullable(this.worldPropertiesNameMappings.get(checkNotNull(name, "name")));
    }

    public boolean isWorldRegistered(String name) {
        return this.worldPropertiesNameMappings.containsKey(checkNotNull(name, "name"));
    }

    public Optional<WorldProperties> getWorldProperties(UUID uuid) {
        return Optional.ofNullable(this.worldPropertiesUuidMappings.get(checkNotNull(uuid, "uuid")));
    }

    public boolean isWorldRegistered(UUID uuid) {
        return this.worldPropertiesUuidMappings.containsKey(checkNotNull(uuid, "uuid"));
    }

    public Collection<WorldProperties> getAllWorldProperties() {
        return Collections.unmodifiableCollection(this.worldPropertiesNameMappings.values());
    }

    /**
     * Converts a dimension ID to a world UUID.
     *
     * @param dim Dim id
     * @return World uuid, or null
     */
    public static UUID dimIdToUuid(int dim) {
        for (Entry<UUID, WorldProperties> entry : getInstance().worldPropertiesUuidMappings.entrySet()) {
            WorldProperties props = entry.getValue();
            if (props instanceof LanternWorldProperties) {
                if (((LanternWorldProperties) props).getDimensionId() == dim) {
                    return entry.getKey();
                }
            }
        }
        return null;
    }

    /**
     * Converts world UUID to dimension ID.
     *
     * @param uuid World UUID
     * @return Dimension ID, or MIN_VALUE if not found
     */
    public static int uuidToDimId(UUID uuid) {
        for (Entry<UUID, WorldProperties> entry : getInstance().worldPropertiesUuidMappings.entrySet()) {
            if (entry.getKey().equals(uuid)) {
                WorldProperties props = entry.getValue();
                if (props instanceof LanternWorldProperties) {
                    return ((LanternWorldProperties) props).getDimensionId();
                }
            }
        }
        return Integer.MIN_VALUE;
    }

    private WorldPropertyRegistryModule() {
    }

    private static final class Holder {

        private static final WorldPropertyRegistryModule instance = new WorldPropertyRegistryModule();
    }

}


text:
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLists       #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}

-- | Description: Test git repository setup.
module Main where

import           Control.Applicative
import           Control.Monad
import           Data.Map                           (fromList)
import           System.Directory
import           System.FilePath
import           System.IO.Temp
import           System.Process
import           Test.Hspec

import           Git.Vogue.PluginCommon
import           Git.Vogue.PluginDiscoverer.Libexec
import           Git.Vogue.Types
import           Git.Vogue.VCS.Git

main :: IO ()
main = do
    abs_fixtures <- canonicalizePath "fixtures"
    hspec $ do
        describe "Git VCS implementation" $
            testGitVCS gitVCS
        describe "Libexec plugin discovery" $
            testLEDiscovery abs_fixtures (libExecDiscoverer "./plugins")
        describe "Plugin helpers" .
            it "finds hs projects" $ do
                hsProjects ["a.hs"] ["a.cabal", "a.hs"] `shouldBe`
                    fromList [("", ["a.hs"])]

                let nested = ["a.cabal", "a.hs", "b/b.cabal", "b/b.hs"]
                join hsProjects nested `shouldBe`
                    fromList [ ("",["a.cabal","a.hs"])
                             , ("b/",["b.cabal", "b.hs"]) ]

testLEDiscovery :: FilePath -> PluginDiscoverer IO -> Spec
testLEDiscovery fixtures PluginDiscoverer{..} = do
    it "discovers plugins in the libexec dir" . withSetup $  do
        ps <- discoverPlugins
        fmap pluginName ps `shouldBe`
            ["(non-executable) ./plugins/git-vogue/non-executable"
            ,"exploding"
            ,"failing"
            ,"succeeding"
            ]
        fmap enabled ps `shouldBe` [False, True, True, True]

    it "disables and re-enables plugins" . withSetup $ do
        disablePlugin "exploding"
        ps <- filter enabled <$> discoverPlugins
        fmap pluginName ps `shouldBe` ["failing", "succeeding"]

        enablePlugin "exploding"
        ps' <- filter enabled <$> discoverPlugins
        fmap pluginName ps' `shouldBe` ["exploding", "failing", "succeeding"]

    it "provides check methods that do the expected things" . withSetup $ do
        ps <- filter enabled <$> discoverPlugins
        rs <- sequence $ fmap (\Plugin{..} -> runCheck ["a"] ["a"]) ps
        rs `shouldBe` [ Catastrophe 3 "something broke\n"
                      , Failure "ohnoes\n"
                      , Success "yay\n"]

    it "provides fix methods that do the expected things" . withSetup $ do
        ps <- filter enabled <$> discoverPlugins
        rs <- sequence $ fmap (\Plugin{..} -> runFix ["a"] ["a"]) ps
        rs `shouldBe` [ Catastrophe 3 "something broke\n"
                      , Failure "ohnoes\n"
                      , Success "yay\n"]
  where
    withSetup =
        withGitRepo
        . withCopy (fixtures </> "plugins") ("plugins" </> "git-vogue")

testGitVCS :: VCS IO -> Spec
testGitVCS VCS{..} = do
        it "should install and remove a pre-commit hook" . withGitRepo $ do
            checkHook >>= (`shouldBe` False)
            installHook
            checkHook >>= (`shouldBe` True)
            removeHook
            checkHook >>= (`shouldBe` False)

        it "should list files correctly"  . withGitRepo $ do
            getFiles FindChanged >>= (`shouldBe` [])
            getFiles FindAll     >>= (`shouldBe` [])

            writeFile "hi" "there"
            getFiles FindChanged >>= (`shouldBe` [])
            getFiles FindAll     >>= (`shouldBe` [])

            void $ git ["add", "hi"]
            getFiles FindChanged >>= (`shouldBe` ["hi"])
            getFiles FindAll     >>= (`shouldBe` ["hi"])

            void $ git ["commit", "-m", "add hi", "hi"]
            getFiles FindChanged >>= (`shouldBe` [])
            getFiles FindAll     >>= (`shouldBe` ["hi"])

        it "should list root dir correctly" . withGitRepo' $ \dir ->
            getTopLevel >>= (`shouldBe` dir)

-- | Copy a dir and continue along
withCopy :: FilePath
         -> FilePath
         -> IO ()
         -> IO ()
withCopy src dst f = do
    void $ rawSystem "mkdir" ["plugins"]
    void $ rawSystem "cp" ["-r", src,  dst]
    f

withGitRepo
    :: IO ()
    -> IO ()
withGitRepo = withGitRepo' . const

-- | Create a git repository and run an action with it, after changing to that
-- directory.
--
-- Restores current dir on completion
withGitRepo'
    :: (String -> IO ())
    -> IO ()
withGitRepo' f =
    withSystemTempDirectory "git-setup-test." $ \temp_dir -> do
        -- For some unknown reason, setting the current directory appears to do
        -- strange things with a bracket, so we don't bracket.
        before_dir <- getCurrentDirectory
        void $ git ["init", temp_dir]
        setCurrentDirectory temp_dir
        f temp_dir
        setCurrentDirectory before_dir


text:
import webob.exc as wexc

from neutron.api.v2 import base
from neutron import context as neutron_context

from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import uuidutils

from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.common import constants as n_const
from neutron.extensions import portbindings
from neutron.plugins.common import constants
from neutron.plugins.ml2.common import exceptions as ml2_exc
from neutron.plugins.ml2 import driver_api as api

from baremetal_network_provisioning.common import constants as hp_const
from baremetal_network_provisioning.db import bm_nw_provision_db as db
from baremetal_network_provisioning import managers
from baremetal_network_provisioning.ml2.extensions import bnp_switch as bnp_sw

LOG = logging.getLogger(__name__)
driver_opts = [
    cfg.StrOpt('provisioning_driver',
               default='baremetal_network_provisioning.drivers'
               '.snmp_provisioning_driver.SNMPProvisioningDriver',
               help=_("Driver to provision networks on the switches in"
                      "the cloud fabric")),
]
cfg.CONF.register_opts(driver_opts, "ml2_hpe")
param_opts = [
    cfg.IntOpt('snmp_retries',
               default=5,
               help=_("Number of retries to be done")),
    cfg.IntOpt('snmp_timeout',
               default=3,
               help=_("Timeout in seconds to wait for SNMP request"
                      "completion."))]
cfg.CONF.register_opts(param_opts, "default")

class HPEMechanismDriver(api.MechanismDriver):

    """Ml2 Mechanism front-end driver interface for bare

    metal provisioning.
    """

    def initialize(self):
        self.vif_type = hp_const.HP_VIF_TYPE
        self.vif_details = {portbindings.CAP_PORT_FILTER: True}
        self.prov_manager = managers.ProvisioningManager()

    def create_port_precommit(self, context):
        """create_port_precommit."""
        if not self._is_port_of_interest(context):
            return
        port_dict = self._construct_port(context)
        self._create_port(port_dict)

    def create_port_postcommit(self, context):
        """create_port_postcommit."""
        pass

    def update_port_precommit(self, context):
        """update_port_precommit."""
        vnic_type = self._get_vnic_type(context)
        profile = self._get_binding_profile(context)
        if vnic_type != portbindings.VNIC_BAREMETAL or not profile:
            return
        port_dict = self._construct_port(context)
        host_id = context.current['binding:host_id']
        bind_port_dict = port_dict.get('port')
        bind_port_dict['host_id'] = host_id
        self.update_port(port_dict)

    def update_port_postcommit(self, context):
        """update_port_postcommit."""
        pass

    def delete_port_precommit(self, context):
        """delete_port_postcommit."""
        vnic_type = self._get_vnic_type(context)
        port_id = context.current['id']
        if vnic_type == portbindings.VNIC_BAREMETAL:
            self.delete_port(port_id)

    def delete_port_postcommit(self, context):
        pass

    def bind_port(self, context):
        """bind_port for claiming the ironic port."""
        LOG.debug("HPMechanismDriver Attempting to bind port %(port)s on "
                  "network %(network)s",
                  {'port': context.current['id'],
                   'network': context.network.current['id']})
        port_id = context.current['id']
        for segment in context.segments_to_bind:
            segmentation_id = segment.get(api.SEGMENTATION_ID)
            if self._is_vlan_segment(segment, context):
                port_status = n_const.PORT_STATUS_ACTIVE
                if not self._is_port_of_interest(context):
                    return
                host_id = context.current['binding:host_id']
                if host_id:
                    port = self._construct_port(context, segmentation_id)
                    b_status = self.bind_port_to_segment(port)
                    if b_status == hp_const.BIND_SUCCESS:
                        context.set_binding(segment[api.ID],
                                            self.vif_type,
                                            self.vif_details,
                                            status=port_status)
                        LOG.debug("port bound using segment for port %(port)s",
                                  {'port': port_id})
                        return
                    else:
                        LOG.debug("port binding pass for %(segment)s",
                                  {'segment': segment})
                        return
            else:
                LOG.debug("Ignoring %(seg)s  for port %(port)s",
                          {'seg': segmentation_id,
                           'port': port_id})
        return

    def _is_vlan_segment(self, segment, context):
        """Verify a segment is valid for the HP MechanismDriver.

        Verify the requested segment is supported by HP and return True or
        False to indicate this to callers.
        """
        network_type = segment[api.NETWORK_TYPE]
        if network_type in [constants.TYPE_VLAN]:
            return True
        else:
            False

    def _construct_port(self, context, segmentation_id=None):
        """"Contruct port dict."""
        port = context.current
        port_id = port['id']
        network_id = port['network_id']
        is_lag = False
        bind_port_dict = None
        profile = self._get_binding_profile(context)
        local_link_information = profile.get('local_link_information')
        host_id = context.current['binding:host_id']
        LOG.debug("_construct_port local link info %(local_info)s",
                  {'local_info': local_link_information})
        if local_link_information and len(local_link_information) > 1:
            is_lag = True
        port_dict = {'port':
                     {'id': port_id,
                      'network_id': network_id,
                      'is_lag': is_lag,
                      'switchports': local_link_information,
                      'host_id': host_id
                      }
                     }
        if segmentation_id:
            bind_port_dict = port_dict.get('port')
            bind_port_dict['segmentation_id'] = segmentation_id
            bind_port_dict['access_type'] = hp_const.ACCESS
        else:
            return port_dict
        final_dict = {'port': bind_port_dict}
        LOG.debug("final port dict  %(final_dict)s",
                  {'final_dict': final_dict})
        return final_dict

    def _get_binding_profile(self, context):
        """get binding profile from port context."""
        profile = context.current.get(portbindings.PROFILE, {})
        if not profile:
            LOG.debug("Missing profile in port binding")
        return profile

    def _get_vnic_type(self, context):
        """get vnic type for baremetal."""
        vnic_type = context.current.get(portbindings.VNIC_TYPE, "")
        if not vnic_type:
            return None
        else:
            return vnic_type

    def _is_port_of_interest(self, context):
        vnic_type = self._get_vnic_type(context)
        binding_profile = self._get_binding_profile(context)
        if vnic_type != portbindings.VNIC_BAREMETAL or not binding_profile:
            return False
        local_link_information = binding_profile.get('local_link_information')
        if not local_link_information:
            LOG.debug("local_link_information list does not exist in profile")
            return False
        return True

    def _create_port(self, port):
        switchports = port['port']['switchports']
        LOG.debug(_LE("_create_port switch: %s"), port)
        network_id = port['port']['network_id']
        db_context = neutron_context.get_admin_context()
        subnets = db.get_subnets_by_network(db_context, network_id)
        if not subnets:
            LOG.error(_LE("Subnet not found for the network"))
            self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
        for switchport in switchports:
            switch_mac_id = switchport['switch_id']
            bnp_switch = db.get_bnp_phys_switch_by_mac(db_context,
                                                       switch_mac_id)
            # check for port and switch level existence
            if not bnp_switch:
                LOG.error(_LE("No physical switch found '%s' "), switch_mac_id)
                self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
            self.sw_obj = bnp_sw.BNPSwitchController()
            mgmt_proto = bnp_switch['management_protocol']
            creds = bnp_switch['credentials']
            access_parameters = self.sw_obj._get_access_param(db_context,
                                                              mgmt_proto,
                                                              creds)
            for key, value in access_parameters.iteritems():
                if key == hp_const.NAME:
                    continue
                bnp_switch[key] = value
            driver_key = self.sw_obj._protocol_driver(bnp_switch)
            try:
                if driver_key:
                    dr_obj = driver_key.obj
                    mac_val = dr_obj.get_protocol_validation_result(bnp_switch)
                    if mac_val != bnp_switch['mac_address']:
                        self._raise_ml2_error(wexc.HTTPBadRequest,
                                              'Invalid mac address')
            except Exception as e:
                LOG.error(e)
                self._raise_ml2_error(wexc.HTTPBadRequest, 'create_port')
            port_provisioning_db = bnp_switch.port_provisioning
            if port_provisioning_db != hp_const.SWITCH_STATUS['enable']:
                LOG.error(_LE("Physical switch is not Enabled '%s' "),
                          bnp_switch.port_provisioning)
                self._raise_ml2_error(wexc.HTTPBadRequest, 'create_port')

    def bind_port_to_segment(self, port):
        """bind_port_to_segment ."""
        db_context = neutron_context.get_admin_context()
        LOG.info(_LI('bind_port_to_segment called from back-end mech driver'))
        switchports = port['port']['switchports']
        for switchport in switchports:
            switch_id = switchport['switch_id']
            bnp_switch = db.get_bnp_phys_switch_by_mac(db_context,
                                                       switch_id)
            port_name = switchport['port_id']
            if not bnp_switch:
                self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
            credentials_dict = port.get('port')
            cred_dict = self._get_credentials_dict(bnp_switch, 'create_port')
            credentials_dict['credentials'] = cred_dict
            try:
                prov_protocol = bnp_switch.management_protocol
                vendor = bnp_switch.vendor
                family = bnp_switch.family
                prov_driver = self._provisioning_driver(prov_protocol, vendor,
                                                        family)
                if not prov_driver:
                    LOG.error(_LE("No suitable provisioning driver found"
                                  ))
                    self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
                port_list = prov_driver.obj.get_device_info(port)
                ifindex = self._get_if_index(port_list, port_name)
                switchport['ifindex'] = ifindex
                if not port_list:
                    LOG.error(_LE("No physical port found for '%s' "),
                              switch_id)
                    self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
                prov_driver.obj.set_isolation(port)
                port_id = port['port']['id']
                segmentation_id = port['port']['segmentation_id']
                mapping_dict = {'neutron_port_id': port_id,
                                'switch_port_name': port_name,
                                'switch_id': bnp_switch.id,
                                'lag_id': None,
                                'access_type': hp_const.ACCESS,
                                'segmentation_id': int(segmentation_id),
                                'bind_status': 0,
                                'ifindex': ifindex
                                }
                db.add_bnp_switch_port_map(db_context, mapping_dict)
                db.add_bnp_neutron_port(db_context, mapping_dict)
                if bnp_switch.validation_result != hp_const.SUCCESS:
                    db.update_bnp_phys_switch_result_status(db_context,
                                                            bnp_switch.id,
                                                            hp_const.SUCCESS)
                return hp_const.BIND_SUCCESS
            except Exception as e:
                LOG.error(_LE("Exception in configuring VLAN '%s' "), e)
                return hp_const.BIND_FAILURE

    def update_port(self, port):
        """update_port ."""
        db_context = neutron_context.get_admin_context()
        port_id = port['port']['id']
        bnp_sw_map = db.get_bnp_switch_port_mappings(db_context, port_id)
        if not bnp_sw_map:
            # We are creating the switch ports because initial ironic
            # port-create will not supply local link information for tenant .
            # networks . Later ironic port-update , the local link information
            # value will be supplied.
            self._create_port(port)

    def delete_port(self, port_id):
        """delete_port ."""
        db_context = neutron_context.get_admin_context()
        try:
            port_map = db.get_bnp_neutron_port(db_context, port_id)
        except Exception:
            LOG.error(_LE("No neutron port is associated with the phys port"))
            return
        is_last_port_in_vlan = False
        seg_id = port_map.segmentation_id
        bnp_sw_map = db.get_bnp_switch_port_mappings(db_context, port_id)
        bnp_switch = db.get_bnp_phys_switch(db_context,
                                            bnp_sw_map[0].switch_id)
        cred_dict = self._get_credentials_dict(bnp_switch, 'delete_port')
        result = db.get_bnp_neutron_port_by_seg_id(db_context, seg_id)
        if not result:
            LOG.error(_LE("No neutron port is associated with the phys port"))
            self._raise_ml2_error(wexc.HTTPNotFound, 'delete_port')
        if len(result) == 1:
            # to prevent snmp set from the same VLAN
            is_last_port_in_vlan = True
        port_dict = {'port':
                     {'id': port_id,
                      'segmentation_id': seg_id,
                      'ifindex': bnp_sw_map[0].ifindex,
                      'is_last_port_vlan': is_last_port_in_vlan
                      }
                     }
        credentials_dict = port_dict.get('port')
        credentials_dict['credentials'] = cred_dict
        try:
            prov_protocol = bnp_switch.management_protocol
            vendor = bnp_switch.vendor
            family = bnp_switch.family
            prov_driver = self._provisioning_driver(prov_protocol, vendor,
                                                    family)
            if not prov_driver:
                LOG.error(_LE("No suitable provisioning driver found"
                              ))
                self._raise_ml2_error(wexc.HTTPNotFound, 'create_port')
            prov_driver.obj.delete_isolation(port_dict)
            db.delete_bnp_neutron_port(db_context, port_id)
            db.delete_bnp_switch_port_mappings(db_context, port_id)
        except Exception as e:
            LOG.error(_LE("Error in deleting the port '%s' "), e)
            self._raise_ml2_error(wexc.HTTPNotFound, 'delete_port')

    def _provisioning_driver(self, protocol, vendor, family):
        """Get the provisioning driver instance."""
        try:
            if hp_const.PROTOCOL_SNMP in protocol:
                driver_key = self._driver_key(vendor, hp_const.PROTOCOL_SNMP,
                                              family)
                driver = self.prov_manager.provisioning_driver(driver_key)
            else:
                driver_key = self._driver_key(vendor, protocol,
                                              family)
                driver = self.prov_manager.provisioning_driver(driver_key)
        except Exception as e:
            LOG.error(_LE("No suitable provisioning driver loaded'%s' "), e)
            return
        return driver

    def _driver_key(self, vendor, protocol, family):
        if family:
            driver_key = vendor + '_' + protocol + '_' + family
        else:
            driver_key = vendor + '_' + protocol
        return driver_key

    def _raise_ml2_error(self, err_type, method_name):
        base.FAULT_MAP.update({ml2_exc.MechanismDriverError: err_type})
        raise ml2_exc.MechanismDriverError(method=method_name)

    def _get_credentials_dict(self, bnp_switch, func_name):
        if not bnp_switch:
            self._raise_ml2_error(wexc.HTTPNotFound, func_name)
        db_context = neutron_context.get_admin_context()
        creds_dict = {}
        creds_dict['ip_address'] = bnp_switch.ip_address
        prov_creds = bnp_switch.credentials
        prov_protocol = bnp_switch.management_protocol
        if hp_const.PROTOCOL_SNMP in prov_protocol:
            if not uuidutils.is_uuid_like(prov_creds):
                snmp_cred = db.get_snmp_cred_by_name(db_context, prov_creds)
                snmp_cred = snmp_cred[0]
            else:
                snmp_cred = db.get_snmp_cred_by_id(db_context, prov_creds)
            if not snmp_cred:
                LOG.error(_LE("Credentials does not match"))
                self._raise_ml2_error(wexc.HTTPNotFound, '')
            creds_dict['write_community'] = snmp_cred.write_community
            creds_dict['security_name'] = snmp_cred.security_name
            creds_dict['security_level'] = snmp_cred.security_level
            creds_dict['auth_protocol'] = snmp_cred.auth_protocol
            creds_dict['management_protocol'] = prov_protocol
            creds_dict['auth_key'] = snmp_cred.auth_key
            creds_dict['priv_protocol'] = snmp_cred.priv_protocol
            creds_dict['priv_key'] = snmp_cred.priv_key
        else:
            if not uuidutils.is_uuid_like(prov_creds):
                netconf_cred = db.get_netconf_cred_by_name(db_context,
                                                           prov_creds)
            else:
                netconf_cred = db.get_netconf_cred_by_id(db_context,
                                                         prov_creds)
            if not netconf_cred:
                LOG.error(_LE("Credentials does not match"))
                self._raise_ml2_error(wexc.HTTPNotFound, '')
            creds_dict['user_name'] = netconf_cred.write_community
            creds_dict['password'] = netconf_cred.security_name
            creds_dict['key_path'] = netconf_cred.security_level
        return creds_dict

    def _get_if_index(self, port_list, port_name):
        if_index = ''
        if not port_list:
            LOG.error(_LE("No Physical ports found."))
            return
        for port_dict in port_list:
            interface_name = port_dict['interface_name']
            if port_name == interface_name:
                if_index = port_dict['ifindex']
                break
        return if_index


text:
<?xml version="1.0" encoding="utf-8" ?>
<root>
	<geocodetech Id="0" Name="none"/>
	<geocodetech Id="1" Name="Portland, USA, Northwest Neighborhood" Description=""/>
	<geocodetech Id="2" Name="Portland, USA, "/>
</root>


text:
using System;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.Powershell.Runner
{
    ///
    /// Runs Pwsh scripts on the command line
    ///
    public class PwshScriptRunner : Tool<ToolSettings>
    {
        ///
        /// Constructs a PwshScriptRunner
        ///
        public PwshScriptRunner(
            IFileSystem fileSystem,
            ICakeEnvironment environment,
            IProcessRunner processRunner,
            IToolLocator tools) : base(fileSystem, environment, processRunner, tools)
        {
        }

        /// Gets the possible names of the tool executable.
        /// <returns>The tool executable name.</returns>
        protected override IEnumerable<string> GetToolExecutableNames()
        {
            return new[] { "pwsh" };
        }

        /// Gets the name of the tool.
        /// <returns>The name of the tool.</returns>
        protected override string GetToolName()
        {
            return "pwsh";
        }

        ///
        /// Runs `pwsh` against the script and settings provided
        ///
        public void RunScript(string script, PowershellSettings settings)
        {
            var pwshSettings = new ToolSettings
            {
                WorkingDirectory = settings.WorkingDirectory,
                ToolTimeout = settings.Timeout == null
                    ? (TimeSpan?) null
                    : new TimeSpan(0, 0, settings.Timeout.Value)
            };
            settings.Arguments.Prepend(script);
            var args = GetArguments(script);
            Run(pwshSettings, args);
        }

        ///
        /// Builds the arguments for pwsh.
        ///
        /// <returns>Argument builder containing the arguments based on <paramref name="script"/>.</returns>
        private static ProcessArgumentBuilder GetArguments(string script)
        {
            var args = new ProcessArgumentBuilder();
            args.Append(script);
            return args;
        }
    }
}


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<title>Document</title>

Каким браузером в основном пользуетесь:

   <input type="radio" name="browser" value="ie"> Internet Explorer

   <input type="radio" name="browser" value="opera"> Opera

   <input type="radio" name="browser" value="firefox"> Firefox


text:
angular.module('os.biospecimen.specimenkit')
  .controller('SpecimenKitListCtrl', function($scope, $state, $stateParams, SpecimenKit) {

    function init() {
      loadSpecimenKits();
    }

    function loadSpecimenKits() {
      SpecimenKit.list({cpId: $stateParams.cpId}).then(
        function(kits) {
          $scope.kits = kits;
        }
      );
    }

    $scope.showKitOverview = function(kit) {
      $state.go('specimen-kit-detail.overview', {kitId: kit.id});
    }

    init();
  });


text:
/*
 * Angular Imports
 */
import {Routes} from '@angular/router';

/*
 * Components
 */
import {WelcomeComponent} from './welcome/welcome.component';
import {ProductListComponent} from './product/product-list.component';

/*
 * Routes
 */
export const routes: Routes = [
  { path: '', redirectTo: 'welcome', pathMatch: 'full' },
  { path: 'welcome', component: WelcomeComponent },
  { path: 'products', component: ProductListComponent }
];


text: export * from './toast-actions-example';


text:
package nats.codec;

/**
 * @author Mike Heath <elcapo@gmail.com>
 */
public class ServerInfoFrame implements ServerFrame {

	// TODO Make an InfoBody class for going back and forth between the INFO json payload.
	private final String info;

	public ServerInfoFrame(String info) {
		this.info = info;
	}

	public String getInfo() {
		return info;
	}

}


text:
/*global angular */

angular
    .module('carteMELS', ['controllers', 'services', 'ngMaterial', 'nemLogging','ui-leaflet'])
    .config(function($mdThemingProvider) {
      $mdThemingProvider.theme('default');
        //.dark();
    });


text:
using App.Core.Constant;
using App.WebInfo.Entities.Concrete;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace App.WebInfo.DataAccess.Concrete.EntityFramework
{
    public class CustomIdentityDbContext : IdentityDbContext<CustomIdentityUser, CustomIdentityRole, string>
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(Connection.ConnectionString);
        }
    }
}