/************************************************************************/
/*                                                                      */
/* This file is part of VDrift.                                         */
/*                                                                      */
/* VDrift is free software: you can redistribute it and/or modify       */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or    */
/* (at your option) any later version.                                  */
/*                                                                      */
/* VDrift is distributed in the hope that it will be useful,            */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
/* GNU General Public License for more details.                         */
/*                                                                      */
/* You should have received a copy of the GNU General Public License    */
/* along with VDrift.  If not, see <http://www.gnu.org/licenses/>.      */
/*                                                                      */
/************************************************************************/

#ifndef _GUIPAGE_H
#define _GUIPAGE_H

#include "graphics/scenenode.h"
#include "signalslot.h"

#include <map>
#include <vector>
#include <iosfwd>
#include <string>

class GuiLanguage;
class GuiWidget;
class GuiControl;
class GuiLabel;
class Font;
class Config;
class ContentManager;
class PathManager;

typedef std::map<std::string, Signal1<const std::string &>*> StrSignalMap;
typedef std::map<std::string, Slot2<int, std::vector<std::string> &>*> StrVecSlotMap;
typedef std::map<std::string, Slot1<const std::string &>*> StrSlotMap;
typedef std::map<std::string, Slot1<int>*> IntSlotMap;
typedef std::map<std::string, Slot0*> SlotMap;

class GuiPage
{
public:
	GuiPage();

	~GuiPage();

	bool Load(
		const std::string & path,
		const std::string & texpath,
		const float screenhwratio,
		const GuiLanguage & lang,
		const Font & font,
		const StrSignalMap & vsignalmap,
		const StrVecSlotMap & vnactionmap,
		const StrSlotMap & vactionmap,
		IntSlotMap nactionmap,
		SlotMap actionmap,
		ContentManager & content,
		std::ostream & error_output);

	void SetVisible(bool value);

	void SetAlpha(float value);

	/// execute game actions and update gui options
	void ProcessInput(
		float cursorx, float cursory,
		bool cursormoved, bool cursordown, bool cursorjustup,
		bool moveleft, bool moveright,
		bool moveup, bool movedown,
		bool select, bool cancel);

	/// tell all child widgets to do as update tick
	void Update(float dt);

	void SetLabelText(const std::map<std::string, std::string> & label_text);

	GuiLabel * GetLabel(const std::string & name);

	SceneNode & GetNode();

private:
	std::map <std::string, GuiLabel *> labels;
	std::vector <GuiControl *> controls;
	std::vector <GuiWidget *> widgets;
	GuiControl * default_control;
	GuiControl * active_control;
	SceneNode node;
	std::string name;

	// each control registers a ControlCB
	// which other controls can signal to focus(activate) it
	// it uses PAGE::SetActiveControl
	struct ControlCb
	{
		GuiPage * page;
		GuiControl * control;
		Slot0 action;

		ControlCb();
		ControlCb(const ControlCb & other);
		ControlCb & operator=(const ControlCb & other);
		void call();
	};
	// allow a conrol to signal slots with an extra parameter
	struct SignalVal
	{
		std::string value;
		Signal1<const std::string &> signal;
		Slot0 action;

		SignalVal();
		SignalVal(const SignalVal & other);
		SignalVal & operator=(const SignalVal & other);
		void call();
	};
	// allow a control list to signal slots with an extra parameter
	struct SignalValn
	{
		std::string value;
		Signal2<int, const std::string&> signal;
		Slot1<int> action;

		SignalValn();
		SignalValn(const SignalValn & other);
		SignalValn & operator=(const SignalValn & other);
		void call(int n);
	};
	std::vector<ControlCb> control_set;		// control focus callbacks
	std::vector<SignalVal> action_set;		// action value callbacks
	std::vector<SignalValn> action_setn;	// action value nth callbacks
	Signal0 onfocus, oncancel;				// page action signals

	void Clear(SceneNode & parentnode);

	void Clear();

	void SetActiveControl(GuiControl & control);
};

#endif


// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Author: liujisi@google.com (Pherl Liu)

#include <google/protobuf/compiler/java/java_generator_factory.h>

#include <google/protobuf/compiler/java/java_context.h>
#include <google/protobuf/compiler/java/java_enum_field.h>
#include <google/protobuf/compiler/java/java_extension.h>
#include <google/protobuf/compiler/java/java_extension_lite.h>
#include <google/protobuf/compiler/java/java_field.h>
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/compiler/java/java_message.h>
#include <google/protobuf/compiler/java/java_message_lite.h>
#include <google/protobuf/compiler/java/java_service.h>

namespace google {
namespace protobuf {
namespace compiler {
namespace java {

GeneratorFactory::GeneratorFactory() {}
GeneratorFactory::~GeneratorFactory() {}

// ===================================================================

ImmutableGeneratorFactory::ImmutableGeneratorFactory(Context* context)
    : context_(context) {}
ImmutableGeneratorFactory::~ImmutableGeneratorFactory() {}

MessageGenerator* ImmutableGeneratorFactory::NewMessageGenerator(
    const Descriptor* descriptor) const {
  if (HasDescriptorMethods(descriptor, context_->EnforceLite())) {
    return new ImmutableMessageGenerator(descriptor, context_);
  } else {
    return new ImmutableMessageLiteGenerator(descriptor, context_);
  }
}

ExtensionGenerator* ImmutableGeneratorFactory::NewExtensionGenerator(
    const FieldDescriptor* descriptor) const {
  if (HasDescriptorMethods(descriptor->file(), context_->EnforceLite())) {
    return new ImmutableExtensionGenerator(descriptor, context_);
  } else {
    return new ImmutableExtensionLiteGenerator(descriptor, context_);
  }
}

ServiceGenerator* ImmutableGeneratorFactory::NewServiceGenerator(
    const ServiceDescriptor* descriptor) const {
  return new ImmutableServiceGenerator(descriptor, context_);
}

}  // namespace java
}  // namespace compiler
}  // namespace protobuf
}  // namespace google


package manager

import (
	"testing"

	"github.com/micro/go-micro/v3/runtime"
	"github.com/micro/micro/v3/internal/namespace"
	"github.com/micro/micro/v3/profile"
	muruntime "github.com/micro/micro/v3/service/runtime"
)

func TestServices(t *testing.T) {
	testServices := []*runtime.Service{
		&runtime.Service{Name: "foo", Version: "2.0.0"},
		&runtime.Service{Name: "foo", Version: "1.0.0"},
		&runtime.Service{Name: "bar", Version: "latest"},
	}

	testNamespace := "foo"

	profile.Test.Setup(nil)
	rt := &testRuntime{}
	muruntime.DefaultRuntime = rt
	m := New().(*manager)

	// listNamespaces shoud always return the default namespace
	t.Run("DefaultNamespace", func(t *testing.T) {
		if ns, err := m.listNamespaces(); err != nil {
			t.Errorf("Unexpected error when listing service: %v", err)
		} else if len(ns) != 1 {
			t.Errorf("Expected one namespace, acutually got %v", len(ns))
		} else if ns[0] != namespace.DefaultNamespace {
			t.Errorf("Expected the default namespace to be %v but was got %v", namespace.DefaultNamespace, ns[0])
		}
	})

	// creating a service should not error
	t.Run("CreateService", func(t *testing.T) {
		for _, srv := range testServices {
			if err := m.createService(srv, &runtime.CreateOptions{Namespace: testNamespace}); err != nil {
				t.Fatalf("Unexpected error when creating service %v:%v: %v", srv.Name, srv.Version, err)
			}
		}
	})

	// Calling readServices with a blank service should return all the services in the namespace
	t.Run("ReadServices", func(t *testing.T) {
		srvs, err := m.readServices(testNamespace, &runtime.Service{})
		if err != nil {
			t.Fatalf("Unexpected error when reading services%v", err)
		}
		if len(srvs) != 3 {
			t.Errorf("Expected 3 services, got %v", len(srvs))
		}
	})

	// Calling readServices with a name should return any service with that name
	t.Run("ReadServicesWithName", func(t *testing.T) {
		srvs, err := m.readServices(testNamespace, &runtime.Service{Name: "foo"})
		if err != nil {
			t.Fatalf("Unexpected error when reading services%v", err)
		}
		if len(srvs) != 2 {
			t.Errorf("Expected 2 services, got %v", len(srvs))
		}
	})

	// Calling readServices with a name and version should only return the services with that name
	// and version
	t.Run("ReadServicesWithNameAndVersion", func(t *testing.T) {
		query := &runtime.Service{Name: "foo", Version: "1.0.0"}
		srvs, err := m.readServices(testNamespace, query)
		if err != nil {
			t.Fatalf("Unexpected error when reading services%v", err)
		}
		if len(srvs) != 1 {
			t.Errorf("Expected 1 service, got %v", len(srvs))
		}
	})

	// Calling delete service should remove the service with that name and version
	t.Run("DeleteService", func(t *testing.T) {
		query := &runtime.Service{Name: "foo", Version: "1.0.0"}
		if err := m.deleteService(testNamespace, query); err != nil {
			t.Fatalf("Unexpected error when reading services%v", err)
		}

		srvs, err := m.readServices(testNamespace, &runtime.Service{})
		if err != nil {
			t.Fatalf("Unexpected error when reading services%v", err)
		}
		if len(srvs) != 2 {
			t.Errorf("Expected 2 services, got %v", len(srvs))
		}
	})

	// a service created in one namespace shouldn't be returned when querying another
	t.Run("NamespaceScope", func(t *testing.T) {
		srv := &runtime.Service{Name: "apple", Version: "latest"}

		if err := m.createService(srv, &runtime.CreateOptions{Namespace: "random"}); err != nil {
			t.Fatalf("Unexpected error when creating service %v", err)
		}

		if srvs, err := m.readServices(testNamespace, srv); err != nil {
			t.Fatalf("Unexpected error when listing services %v", err)
		} else if len(srvs) != 0 {
			t.Errorf("Expected 0 services, got %v", len(srvs))
		}
	})
}


/*
    pybind11/buffer_info.h: Python buffer object interface

    Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>

    All rights reserved. Use of this source code is governed by a
    BSD-style license that can be found in the LICENSE file.
*/

#pragma once

#include "detail/common.h"

NAMESPACE_BEGIN(PYBIND11_NAMESPACE)

/// Information record describing a Python buffer object
struct buffer_info {
    void *ptr = nullptr;          // Pointer to the underlying storage
    ssize_t itemsize = 0;         // Size of individual items in bytes
    ssize_t size = 0;             // Total number of entries
    std::string format;           // For homogeneous buffers, this should be set to format_descriptor<T>::format()
    ssize_t ndim = 0;             // Number of dimensions
    std::vector<ssize_t> shape;   // Shape of the tensor (1 entry per dimension)
    std::vector<ssize_t> strides; // Number of entries between adjacent entries (for each per dimension)

    buffer_info() { }

    buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,
                detail::any_container<ssize_t> shape_in, detail::any_container<ssize_t> strides_in)
    : ptr(ptr), itemsize(itemsize), size(1), format(format), ndim(ndim),
      shape(std::move(shape_in)), strides(std::move(strides_in)) {
        if (ndim != (ssize_t) shape.size() || ndim != (ssize_t) strides.size())
            pybind11_fail("buffer_info: ndim doesn't match shape and/or strides length");
        for (size_t i = 0; i < (size_t) ndim; ++i)
            size *= shape[i];
    }

    template <typename T>
    buffer_info(T *ptr, detail::any_container<ssize_t> shape_in, detail::any_container<ssize_t> strides_in)
    : buffer_info(private_ctr_tag(), ptr, sizeof(T), format_descriptor<T>::format(), static_cast<ssize_t>(shape_in->size()), std::move(shape_in), std::move(strides_in)) { }

    buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t size)
    : buffer_info(ptr, itemsize, format, 1, {size}, {itemsize}) { }

    template <typename T>
    buffer_info(T *ptr, ssize_t size)
    : buffer_info(ptr, sizeof(T), format_descriptor<T>::format(), size) { }

    explicit buffer_info(Py_buffer *view, bool ownview = true)
    : buffer_info(view->buf, view->itemsize, view->format, view->ndim,
            {view->shape, view->shape + view->ndim}, {view->strides, view->strides + view->ndim}) {
        this->view = view;
        this->ownview = ownview;
    }

    buffer_info(const buffer_info &) = delete;
    buffer_info& operator=(const buffer_info &) = delete;

    buffer_info(buffer_info &&other) {
        (*this) = std::move(other);
    }

    buffer_info& operator=(buffer_info &&rhs) {
        ptr = rhs.ptr;
        itemsize = rhs.itemsize;
        size = rhs.size;
        format = std::move(rhs.format);
        ndim = rhs.ndim;
        shape = std::move(rhs.shape);
        strides = std::move(rhs.strides);
        std::swap(view, rhs.view);
        std::swap(ownview, rhs.ownview);
        return *this;
    }

    ~buffer_info() {
        if (view && ownview) { PyBuffer_Release(view); delete view; }
    }

private:
    struct private_ctr_tag { };

    buffer_info(private_ctr_tag, void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,
                detail::any_container<ssize_t> &&shape_in, detail::any_container<ssize_t> &&strides_in)
    : buffer_info(ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in)) { }

    Py_buffer *view = nullptr;
    bool ownview = false;
};

NAMESPACE_BEGIN(detail)

template <typename T, typename SFINAE = void> struct compare_buffer_info {
    static bool compare(const buffer_info& b) {
        return b.format == format_descriptor<T>::format() && b.itemsize == (ssize_t) sizeof(T);
    }
};

template <typename T> struct compare_buffer_info<T, detail::enable_if_t<std::is_integral<T>::value>> {
    static bool compare(const buffer_info& b) {
        return (size_t) b.itemsize == sizeof(T) && (b.format == format_descriptor<T>::value ||
            ((sizeof(T) == sizeof(long)) && b.format == (std::is_unsigned<T>::value ? "L" : "l")) ||
            ((sizeof(T) == sizeof(size_t)) && b.format == (std::is_unsigned<T>::value ? "N" : "n")));
    }
};

NAMESPACE_END(detail)
NAMESPACE_END(PYBIND11_NAMESPACE)


/*
Copyright IBM Corp. 2016 All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

		 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package bccsp

// RSA1024KeyGenOpts contains options for RSA key generation at 1024 security.
type RSA1024KeyGenOpts struct {
	Temporary bool
}

// Algorithm returns the key generation algorithm identifier (to be used).
func (opts *RSA1024KeyGenOpts) Algorithm() string {
	return RSA1024
}

// Ephemeral returns true if the key to generate has to be ephemeral,
// false otherwise.
func (opts *RSA1024KeyGenOpts) Ephemeral() bool {
	return opts.Temporary
}

// RSA2048KeyGenOpts contains options for RSA key generation at 2048 security.
type RSA2048KeyGenOpts struct {
	Temporary bool
}

// Algorithm returns the key generation algorithm identifier (to be used).
func (opts *RSA2048KeyGenOpts) Algorithm() string {
	return RSA2048
}

// Ephemeral returns true if the key to generate has to be ephemeral,
// false otherwise.
func (opts *RSA2048KeyGenOpts) Ephemeral() bool {
	return opts.Temporary
}

// RSA3072KeyGenOpts contains options for RSA key generation at 3072 security.
type RSA3072KeyGenOpts struct {
	Temporary bool
}

// Algorithm returns the key generation algorithm identifier (to be used).
func (opts *RSA3072KeyGenOpts) Algorithm() string {
	return RSA3072
}

// Ephemeral returns true if the key to generate has to be ephemeral,
// false otherwise.
func (opts *RSA3072KeyGenOpts) Ephemeral() bool {
	return opts.Temporary
}

// RSA4096KeyGenOpts contains options for RSA key generation at 4096 security.
type RSA4096KeyGenOpts struct {
	Temporary bool
}

// Algorithm returns the key generation algorithm identifier (to be used).
func (opts *RSA4096KeyGenOpts) Algorithm() string {
	return RSA4096
}

// Ephemeral returns true if the key to generate has to be ephemeral,
// false otherwise.
func (opts *RSA4096KeyGenOpts) Ephemeral() bool {
	return opts.Temporary
}


.i 150
.o 5
.p 150
.ilb x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 x60 x61 x62 x63 x64 x65 x66 x67 x68 x69 x70 x71 x72 x73 x74 x75 x76 x77 x78 x79 x80 x81 x82 x83 x84 x85 x86 x87 x88 x89 x90 x91 x92 x93 x94 x95 x96 x97 x98 x99 x100 x101 x102 x103 x104 x105 x106 x107 x108 x109 x110 x111 x112 x113 x114 x115 x116 x117 x118 x119 x120 x121 x122 x123 x124 x125 x126 x127 x128 x129 x130 x131 x132 x133 x134 x135 x136 x137 x138 x139 x140 x141 x142 x143 x144 x145 x146 x147 x148 x149
.ob y0 y1 y2 y3 y4
.type fr
00010-111-00100-1010-01-00110110100011001001--00101---001-10-0000011111-1-01-11-00100-1110111-101010011011-01010100000011100---1-00--010-0111101101000 01001
11100100-1110-10110-0001010001010111-0111-1101111-1110-10--0-1-100011-011101-110-000110--01-001-0010010011110-01110011--0010-00001011111-1001-010011-0 11111
11000011001-0100-100-1-11010--110-0010011-000010001110101101--0000--0-0-1-1--10-00-0-11000-1-1000-001-100-1-0010-1--001-1-0101-111000--1-100-001-00001 01111
00011-0-111110110100-101010101--00-00-00110000001011001100-01011-011101000-110100001-10-10-0010100-1-0001-111100001-11111-01000-01010-1-00-01011100110 00011
11100--10-111-00-000-1-10111010--010101-1001101-11--10001-1000110-0-0-1000101101001-0--10-000011-0---1101-0-01010-00-00101010-0010-10110011100-10-10-1 10110
1110110111001-000-00-0001-100-00-00---11000111-111101101000010-1001-101111001-1---1110-111000101-10110000100-0110010010101-011011101110100111001101100 00011
1-010-0-011-110-00000010-1---01--11110111010001000-0101010-00110100011-1-10001--011100-0-00101001-111--10-01-0000110-01-00111--1001--00-110100110110-- 11000
11011-01100001-0-11-101-11110-11101-1101-100-10011-1-1010010-011--00001001-0011101110-01010100-1010000110-00011----11-01101111100101100010-10-1-100000 11010
--1-1-01-110110001-100001101-1--111-1-0-0-0011-11-0011111-1101-001-101-00110110-011000011010-0---0011-10111-10-00--10-11011-01001-1-1111111-100011--00 10101
010----1111-01-0-11110-0--011011-1011010001000-1-01011010-101101110--010-11-010101110-10-101-011110-01100---01011-0-00-01010-10110110-0-10011-11-0-001 10100
11--11111000000001100-1-0110--110-1-11--0010111-100011000-01111-1100-10-0-10--0-100011111-110001111010111010-0--00-1-10110-0011-10-00--10-1-0001100-11 10000
11--0110---0--111000111111110100001101-01111011001-0-1110-111--100--1-0010-011001-000100-00010111-001100000-11001001110010011001100110111110-110110011 01111
011100010-111101001-1100-100-0001-0--0110--11111-0-1101101010-1--010-0-101-11-110---1010---1--00-01-101-11000100000-1-0101-01010000--100-1011000000011 10001
000001-1-100-1010-00--000100100-000100000000-0-010-000-01-0101-0100110111000-1000000--01-1--0-1-01100-000-101000100-111-1010-1-00----1111011----100011 11010
0010-110000011-1-001011-00-01-0-01001111-11110001-00101110101011-001-0100-000000-1-01-1---011111011---11101101-0011-101101001101-00-1000000--101101101 00110
11000-0010001-1011-0100011100000---0001011000-1011--0-011001111010111111----1-0101010-0-001011101000101110000001--1001-1-00101011101-1-1001-01001--0-- 01001
0000000---101111000-11-110-10010-1000-11-110101100010-000111010-00----10110-0-0-1-11-001100111110110010010-0010101-0100011100-000010111110-0-1----1010 00111
0-0000-0---0-11-1001--0100-00--1100110-1--11110-0010111--0-11000100-0101-01010-10--11010-00110--10--01-01111-10--10111011001001111110-1---0--101-01110 00111
-100-011000110011111-1-0--11101101-1--00--100110110111101-000-1111-11110010100-10---1011000--1-00--100-11-100100000--111-010-00110-110-11-00-010000101 01011
-0110-01-00110-1-1-1111011-1000001-101111-01011-00-0-0-0000110-1000000-000-10-111--111-0001-100111-011110000100--101111-0-10-10-011-10-01110011110101- 10101
11110--0-01110000-0--100110-1000110-1000-110101-1-001110-011011101101-0010---100--0011-1-1110-011-10100--010-1111111010-----000010010000-10--001011101 01111
1101011111100-0001-1110011011--001-10010-1110-0101-1-10-10000-01110-011-0---101111101010100--10001-1--10111--0100101-01-1-1-110101-10100-0-11101111000 00011
0101110-00-000011011100-1-0--1100-0110-11111111110011011-0-1001-0-11--101001-1000100100-0--10011-0000010-10001-101-010-111000011010-01111-100001101011 01000
1-1010000001000--001---1001110-010-001000-00-0101-010011010-0-0011--100-1000-000000-011110010-11-00111---1--1110-01001101-1101011100010100--110-011010 11110
110011--1110-000111101-11010011100-0010-0001010001000-010111011-11-01-0-1-10-111001000-001-1100-000-11111110-100-11-1111--11101--0100101111-0011-11111 00110
1000-0001100-100-100000-1111010--11001-0-0--0101-10000011-01-01110-101-1101011100001-1110000-10010-0110-00-0100001010-01001-111110101-11-1010100101011 11101
10011000-10-00-1-0-1-101010000100011-01-0110011-0--0-101-0111100101-01110-11-100110100100-00010-1011-001--00-1011-111000--01000000001111-1110-1-001000 11011
01011110011101-001-0-01110-001010-11-1110-000-11--01010111-1010----100101-110-01-110-1111100110001001000--10011000--110-01-01-1001111001-0110111-00100 01000
---00-0-0011001001-10011011-0-0011001110000001001011-10100100-10101-0--111100-1100--011-0----1-0110010-011101-11101-0-1-11001-01100-1-0-11-1101-01010- 01110
011-101101110100101--010-11-1--1100-0-0-010--001110-10-1-0-0-10-101110010000--01-10-1100-0-0101001-110110011111011-011-0-01-10-01-0-100110-101011-1-00 01101
0-1111101-10111---0-0--0-11-111001110010-0010-1011100-1010011-0--0101000000010--0-0-0111111-000010100011--110011001-1001001001010-110001-----1000-0--1 01010
11011001000-001011000-00101-11---0-0-10-001-101-11010000101-10101000--101011----11-010110000101--0--0000-0111-10110-11-00--0010101--1011101-00110001-1 00110
1-0-0-111-1111110101--0010110-111100011-10-0-1110001110--11-01-0000---00--000-0-10-1111-0-1-101100-100110--010101100001001--111110001000-001-1-0001-0- 11011
000111111010001-001000-01-1-001111-011100011--1011-0111-1111111100-1-1-1011000-00011010011101010---0-10-000-0-00111000-01-101111-11-1-111-101100011100 10011
-0001-1-10-00000--11100111-011001110--1000101-001101101-011-0010001010-01-11--0--1010-01001--0111111-1--000110-1-0---1001--11010-0-1110---00011-00-0-0 01111
00--00011101110000111-1000100100110100-100-0110-1100101-1-010---010101001010-110100100001--01-10--01--00011--1-1-1001100-0000110011110100-100011-1-1-1 01110
----10010101-001-0100101111010101101001-000-1--0001100-1001-1-0-010011-1-000-00-11-00001-00100101-11110011--1-1001-100-1011-111100000101---01-1-111101 10011
101101011-001001-001101000000011001-10100010--1-1--00-0-001110111110011-1111101101000-0011-1011000---11111-0-0101-10100-1-1000--0010001011010001100101 11010
1001-00001-111-000000101-11111-010-0100-11--01---11111-11-10-0000-0110111-100011-10011010101-00--1001---1010101011-0---110010101001110010-10-00111-0-1 11000
-00011-110101010110010-0-0--101000110011011111-0--00----1101101--11--000-101001-01-00101--1000-11--0110011000101-011-100110-10110110-110-0-0--0-1-1110 10011
1-00111-1-01010--00-01-1001100---0-10-100100100-10-10-00-1110010-1101-1--01011100000-1-011-0101100011---001-010-0-0111110101-1001-01-0100-1-101-00-101 00010
0-001--1110--00111-00-0-0--1000001--10-0-000-001001-0---11111111001-01100011100-0110110-11-10010--010-100-100---0011001-1001110001----000-10-1-1110000 11011
01-0--0--1-11110-0000-11-110-1110-110-000-1110101000001-010-1--0000011110110110011101--110110011000110110000--0-10000111-0-0001--11-00-101111100111-01 00000
0-110111110101--01----1000110-1-100000011011-0100010000----11-0001-1-001000011-01010110-0-0111-10-1--11-11011--1011010-011-10100100100--001-0101100-0- 00100
1111-00001-00011111000--0-11--10-011101011101-0-111011110110-0110-10110011--10000--010010010110-010-1-11-10--1001--10-10001000101100001011010101001010 10110
011011-1-0-010010111000110011001-1000-11101100-0111-10101101-10-1101010010-1-00111-01-1-1010-0---11-0010-00111-11001001-1001100--11-01010111-010101-11 00101
00-1-10001--01110001110100--1110-0-111100101101-0-10001110111011011100000-10-1-1-10011000000101001000-10000010101-0--1-0-01-111100001011001100-001-111 00110
00011-0-010011101111-11111-111--011-1110-100-11111110110---0101011011--1-010-1--011111-01101-101---011010-101000111--00--110-110--10-1-10---110101---0 00000
00-0-11-1101-111-1111101-0-100-0-11-000011000-1-0-00001-110010101-1001-000-00100000-01-11-011000--1101-101-0-11100--1101-001-10110--0000110-0-0-00111- 00111
000-1-0001-1--11110000-00-10-0-001001--1-110011-010111-0-110---0001-1-101010-0-10-0100-101100--0001-0-11-001101-0111-1-110-1-11-001-1011-0--1-1101-101 01000
11000-000-1-0100111011-00100-110111-00011-1-1-1--1-000100001-0-1-0-01-0-0001-11--01111-00-01-01-1--011000000100-01-0110-00100011-000-11-1000010-01000- 01000
0-0101100100001010-11010-111010-0-10101011--11011--0-0100101-111101110100110100--10010--1-11-101101-10110-00-0110100--11101--101--0011-10-0101111111-0 10100
001--0-1011111100-00-10--0--011-00--111-01--011101011-01-1011100-1111-01110011101-11--111100-1111110-11--100100-10-1-0110000110-00010110011101--01101- 00111
01001--00100-0111--0-0111--10-101101-0-0101--10--11101-0101-0-00-101-0-110--1-1010-00-1-1-001-01-101110100-111--1101111000-0-00-11-01011-1000000-10101 11111
-11--0--100-011-10-0111000--001-0-100-10-100-0-0-10110000-00--01--0001111-1-01100-001111100010110--0--11010111000-0111000001000100110001---00--1-0-010 01011
1010101110001-1-10-001110010010110-0000100-1-11101001-0110-11010-111101---001110-00-1--1110-0-0-10-10010-010111-10101000--11000-1000-10100-0-011-1-101 01111
1001000-0111100-1011101011100-111011110101111-00-0101-1--00-0--00110000-1011--1-10010011011101101111111110-11100-0100101101-110111-11111010100100--0-1 11000
0---1011011-001110-10110000-00-0--011-10100-010-1-001001-011-011--01010110-0001010-01001-0111010-1-01-01--101100-10-11-1-11-101-1-000011-010-0--0-00-- 01111
100100-11-0-00011-110100-0-111110-00-1000-111010-0-11-110100--0-001010100-1-0111-001-100---00000-10010-0-0-11110-10-1-111-01-1--01010-0011-10001010-10 10010
1-00-11-1110000000000-0-1001-1001010001110011-100-0-1011-0-010101-01110-1110101-011-00-11-11010011-1---0110111010000-01001001--0100100000--0110111001- 01101
-0-0110-00-1000101-1-11-11-0101-1-1110-10100111011-101-000111010-1-11101010-0-1010-1---11-11-1110011-11-1001011-00-0101--101100101-0-1001-01-11111-110 10010
1110000-01-011-01-10---0011-00-0-0011-110--00110-0-01001101101-000---11110010-1011-001-01000-01101-0100-011-11000110100111---0-110-0101000110-10101111 10001
-01-0100-010011-1-1-11-10111111-01-001-00011-10100-0000110111-01101-0100111-11-0-1000-00-00100100-10-0-0110-0--1111-101010-0100-110-00-010-1-011--10-0 10010
10-110101001-00-1-1000-11011-0111000100-0-10101100101101-01111111-1--0000110--1-01011-0111-010-1-0010-011011100011001-001-01--1010111011000-001101-010 01010
0111000-1-0010-001010-011000-00000-11--0---0-00011010-11-0-101111000-01-101110110--111--00-11-010101010101110100101-1-01--1-1111011011010010-011010100 11111
1-110-0-00110-0--11010111--00-10--1000----01110-010--000-1100-0010100-11--010100000111011000-10011-1110111-01001100110-01011111101011101001-01--11110- 00101
01101-1-0-0-110110--01101000111-01111111100-00-00-101-1-010--11100010--1000-00110-1--010010110111000100110-0-0010100-0000-1011-1-10101-00101001-011011 10000
010---1010-10-0001---00000010-1011000001011110-1-01000--000-0111100-0-010-1010-0100-000111-0100-1011010101110001110001110--111-11110-1-0010000000-1-11 11101
11-10100-11--1110011100-01--0-00001-100000000-100011-100011010-10-0-1000-11-001100110001-01-11110-1001-01--010101-0--0-001001010-1110101-----110011-0- 00101
1100010-0-0000111111-0111-11110-10011000111-10--1-11-0011-01000011-001-01-110-011-01-10110001--000--1101-00000-0001-000-0100-01-0-0010011-011110011101 01100
0101-1-11111110-11-0000-10010--1-11--1-11100-0000--111100110-000-0110--0111011001000100101-1111--0-11-11-10001-1100-10010110000100-001111-0010-0101010 10111
0-100-0101011010--00010010-0--0100011100100010--011100--001-0010000-011--1111110---10000011111010011111-0010011101101-11010010-0010010-0-0111-1000010- 11110
110011-0001100-0100---0010000-10011-0--110--01000010-1-1-110-1-10-001-0-011110-1-0011110011101-1111010101-011-1--10110-010-1-0100100111-1-00100011--1- 10010
11101-101-010100100-11011101111-00101000010100--01--101101-010-11-0101101-111-11-1-11100-100000--1-00111000001--111-11-1--101100-10010011111-1001--001 01110
1000101-10-001111001111010-011-1100011011-00111100111100101-11001-01100-101-100-0---0-111-01000-0-0100111111011111----1101000-1-1-1-010100000--000-110 11100
0110000-101001--011-01111000--0100111001--11001-0-10-0-0-0101000110101101101-00-010-01--10--0101111110-1111000-01-1010100001--010-0-00-1-0101-11001-00 00001
010-100011-011--11110-01110-001--1-0011-111011-1101-0001100101--1-10011-11010--1-1010-11001000100011-01010-11000-001100010000110111011---1-011100011-1 01100
01-0-1-001111011000-01011-1010-1-000-0000001101110-1-0000-1-1001-11--1100110-101101--100100101-0-101010-1110101-0-1001--01011-0100-0-0101-00-10010-010 10010
001011111111010-1-01101001110000--10-0101101100101-0001100-110111-001110111100-10000-11-01011-1101-01011-1-10-101010-01010--100-00001-0-00101-00111010 10111
-00111111-011111-01011110-1110-00-000-101001000001110-00111-0-011010-100-0-01001-10-1-0010-10101-0111110100101101011-00110-0-000110-000101101010-011-0 11000
1-1101-00-10-110101001--0-01011000-1011011111000-0100011100-10-10100-0111000001-0-00-10000101-010-00-000111001-1-01101011011001001-100100010-0011101-1 00011
110110-1-0--0-100110100011-100-1--0-000---011--0110111100001001110-101110-100---1110111010--011-0-01101000100011000--110-00010-11011100101001000001100 10111
101-101101100000110001001110-1-01101------1010-1100-0101000--0110--1-101--10--00110-10-00--011110001101--101-0000011001110001-000-110000-10101--000-11 11101
11100--0011111101101000111111100-00110111--1-11101001-01-101-01-01000-10010101010000-0-10-10-0000-11--11000011--0-10--010110--0000-0-11-10100--100-01- 10011
1001001-111-01-111-1-0011001111-101-10-1001111-000-0-1-00--000001011-11--1-010-010-111-1010-000101-111000-11-1111001-1111001---001-00011--00--01---000 10010
1101100110000100-0101--0100-00001-10-1000-0010-1-00-1-1-001110110111-011010-1011--000-00--010010-00110111-10-0-0101101-11001-1-10101-110-11100-0110001 11101
10-0010--00010-0--0010010101011100010001001-1-101110101001-0--000-1010110-101111101--0-0--1110000111100101100-110-1-0001-1100-010000-1101001000011100- 00011
1101-11011---011-10110-01-010010-01011010--111000-00-110-1000-11100101--1101--11-00100010000-000000-01-1-1-1101-0--11-0--011-101000-100-001111110-01-1 11000
-0000--11001110-100-100001010-01011-01111110-----00-11010111-1-0101-01110111-0000--101010100111-001-11-1011110100-00100-101000100-101-01110101110-0010 11000
--0000111-00-111-1-01-110-01-11-00000-010100001000---00-010-0-1--1-1-10101-10011110-11---1-100-110001111000101-0010-1101101--1001-10010--110---1-010-- 00011
101101001110-0--0-1--00001-01010-101-1001-10110-101-01010001100--100-0001110-0--0100-11010110-0000-1-1-01--010-010001111-01111111101101--00111011-01-0 10101
0--1-111-01001000--0-1--000-1101111111101010010111111-1-1-001-1100-00--0001100-10-110-11-1001--00111--00100-10010--110000000011001-1011100100011010100 10000
-00-10--01-110----1-00110-00-10-11--0-11-1-1000101--01-010110001101-11-100101100-1-11101-001100001-0-1000011-10100---101110000010000111--1-1--1011-1-0 00101
--10-01101-01-11111000-101-11-----111111--1-01101-1101011-10-010-11011-110110-1-0-011-0100-01-10-001-111-0--01011--10-00-000-111-10-000-00-101101-1-11 01110
10010110-010-01-00-0-1100--0-111--1111000-01-11-011-1-1-1000101110-1000-10111---100100-000101001-100-11-00100-0--1-1010100-0110-0101-11-1-01-1101100-- 11001
010-101-10101-001--001--011011--000101010111111--11-1-0011010-100-1-0110-1--00-1-00011-100011100010--0111-1--0001010110101010001--1-0010110-10010-1110 00101
0111-10100-01-0010-110010110--10110-1-0000-01-0110110011-0-010--1100010110-1-01001-01101110-0-00110-00-1-0-1-0--1----1-00-00-1110-1-000--110--1-100010 11001
0010-0--0001-0010-10--01001-001-01-1-10--00--0-11-010011-110111101100111-11101000-001111110-1--010-10010-11010100--0--1011010000-1--010101011001111--0 11011
11-110-100110--00--01-010101-0001010-11110-011-1000--101-01--0-000000011101010101010-0100-100-0-0111000-0-010100110101100-11-01010111-1-10-0000-111011 01110
-11000110-1011000011-1100111100-10-1-001010010-1-001-0--0110-0101-00111001-10110000001101010-10--01000-1101-10100--01100-110010011011011110-11-0-101-- 10011
00----11101-011011001011-1-01-111--11-1100-0-0010-1111010010-0-10100-11110-000-100011000--1---1-0-11-011----101110-1100010001--1101-1-1010111101011011 11111
010001-0-01010100100-1111110-110000--000--10-100-1101000100-101111-0101---10-00100-0011011-01111---1110000110-10-0100110011111011111100-0-11101---0101 00100
10-1-0-11110-0010101110--01000-1011-0111011-111-0-00111110010-11001-1001111110001-0010010011-010-01-01--110-00110100-----1110---1111-0000--010-0-11-10 00101
001-110-01-0011111111-1-----110011110000-111-0-001010-0000---01010-111-11011-1100111000100-11---00100-111-01101-111--00-01-110100--10-001110110010-111 01100
011-011-1-000---0010101011-10110-111010011011-1101000000-10111--10-11010-1-11--11000-10-10000-1-10001-0100-1-1-011010010001-11-000100001000001101-010- 00010
-111100001101--0-00011000-01-0--10--0001-11100-110--0011000110-00010-100-0011111-01-0111010001011000--0001000-110010-01010001110100101001011--101-10-1 11000
1-1100101000011--0-011100-1000011-0100110100011010-110--0000110010-01-1111011-01111-10010011110100011010--10-1-01-0-01101-11010-11-0010011000--00111-0 11010
10-100011--01110001110-1001-11000-0100-00-1--001-000--001110--01010-1100111-111111-100-0101-01-1--00-111--0001-100-100101100-00-1-01100---01010100010- 01010
1100-1011-1--00---1-11010100-0101010011100011011-11101101-1110101-1-1100---1100100-11000-010-10110100-1--110-1100110-1-111-00-001001-10101010--1011101 00000
10101101001000-0-1-11-100-001111001001010-101-101011011-1001001010--01-000111001-111111--00-10-01011-101-00-00000-00011011001101--111-10-1100000101010 10100
0-11101000-10-00101-0011-0---0001-01110-0-1-000-00100011-1101--0001-111-11-0011-1110-0--0001010111-011101101000-01100-100-01100101011000110-1001000011 11010
0--0-0--01110--0-10011001-11001011111-01101-101-1-0001-1101-0101010001010-11-0110010-0-0-0110000000010111-011--00011000-010-10-11001001-011001001-01-1 10100
110000111110101--0101-101--10000-001011-1010011010-111-110-001111000001--1001111--00-00--011-001-1-00--0011--11-101101-100-01-0--010101011-011---00101 01011
0-11-1000-111-101001--010-10110000-1--0--1-00--1000-011-0101-00100110-1-11100-00110--0011011-10111-0000111010-000101101-01-0101-01101-1111001000101100 00110
110100-1-10001-1110101--0001110--1101--1000010110111100-01011101-000011-0-111000110010011-00000011-1111100000-1-00111000110011100000-0111111011-011010 01000
00-0--010-011-0011-111111-0-111-11111011-1-111-1-00-1000000-1010--000--11001110-111110-1001-1--101100010-01100000-10101-110100100-0-11--010111-01-110- 10110
1-1111111--011101----1-101-00011011111-1110010011100--000010-1110111010-010110100-111111-1-001-01111-110-101--0111101011-00-0--1--011-010110-110001101 00010
01001-0010101011101-101-0-1000100110001--11101-00-0-111000-0--01-10010-0-1110-1-011-11110101-10010--1001-101-10011101-0-1-00-101-0000-01000-0010110100 01011
1-1-00001-001-111011001-0110000-0010011-0001110110-111-1-001-010111-00000-11000111-011111000-0-1110011001-101000-101-00-010-0101010110001011-0001-1100 00111
010010011-0-1000111-01-0-100010--01-01-10-0--01-1111-1--1-001100111001-0001-11-10010-1-00101-00--11000-11110100000-----1101011000-1-0000-100011-1-1-00 11100
11-1-01010110000-1-001-1111-11100-10-1011-01---110011011-111001-00000110-0101110111010110-0--01001101-001100-0-01001000---10010000-0011001011000101-0- 01000
01-11011-11110-0110000-000-1001-01-111--0-010-00100100111101--100--1--101000-11-1-10001-1000-1110001-1101100-0-010-1111-01011100001-11101-111111001001 01000
0101101-100-10001001-100-010-0--011-0000-1100-111--01110110-101-1001-0-00-01--111-0-0-0111-1010100100-0001-1110-1--01--1-11000-0--1-01011001-010001110 00000
010010000-1--10001-100-11-11--010000-001110110-0011-1001001111011-1110-1100--011000-11101010110--00110-0-11-0-1--0100-001-101011010-0110--0100--111011 01000
1-11010000100100010-1-0-10101-110100---1100-101111-00--100-001001-1000000101010-0-01-0111-11110011-1000101-11000-00-001110-10-0011-0-101--11-001000--- 00111
110-1--111101110111000011-00000-01-10-0100011---010010-111-1001111010-00-111-00010000011-1-11111010-10011110100--10-100010011-111-0--0011001-11--11111 00110
101111001111101110-100000011-011----0101001-0-011-011011-101001-1-----0010-01000-111-101--01001-0000000110--0-0111--010110101111010-01-1110-110-01-00- 01000
0-1000001100---11101-00-110110--0010101-00-1-10-10-0--1001011--011-1010111100-10-000111-0001110-1-0010-10010000-0100111001110001-1001100111100101001-- 00000
00100-00-1100110111-01010---101-110-100--111-1-11-000-0-000110--010001-01001-1001-11-0011010111-0001-0-10101-----0110010-0-011-010-0----01010-10111000 01101
101-10-0101-0-1001100010000-00001101100000-0100110010-01-001011-110-0010000-001-10-0-0--1--00100-00-0-001-10-1100-00-101-101--000-01-10101011110010111 11001
1--10-11---011-0--00001-000100-0001110-0--0-11-10-1--1-1-1100-1100-01110-101-100-111-0111-1011011000010000011111-0-1101111-11000--101000100000-001--11 11100
11-0-001000001111110101111---11-001100100110-10--0-0-101000-11000000111-0110-10001-10101-01011-010101011010-1--000-010110-00101100-100-0110-0010-0-0-- 11111
0-0-11-0-1-11--00-1011111100010--00101111100101-11100001-011-01-10--01010-11-000010101-1101-0-000111-10-01-0100110-1100010001-1100001---1101-1001000-0 11000
00010100-01-1001-1-0100101000001111001--0000111011100-00-110010-1100-010-10-0-111-1011100-100-110111-00-00010100010100-110010001-100-110000-011-0100-1 11011
111-10-01101-11-1011-01-0011-01001110010-10110010-11101110101111000100000011-11-000101001110000111110011-0100001-10101011001111111000--1-010100--001-0 10000
0-010011-111001010010-010101011-1-00-01100-000111110010010011011-0-0111-1011110010-0101-11-1-0010110010110000-101-0000111-10-000-010-10110100-01011000 00111
1-01001-110101111-01-100-010000001011101-10100111010011001-00-010100000-11010-0-1-0-1100101-010011101101-001-1-1111-1-100-1-1011110101-1-10110010-0111 11001
01111111-00-111111010000-00110111101100-01110010-010-001-000-1-10101110-10-00110-101-0101011011-1-0010011-1-00110--0-1110-01010001111--010011100111001 11001
0-011100--01000-1--00010--1-0--0--11-1-10001001-0000000-1-110000-001-10010000111001-01111-100000-10-11001110-1---1001000-01--10--110--0110011100010101 10100
11--11000--00010110000-1000-110-00-1--0-001100-1010000-101-00000-0001111001101100-000000--1001001000-001-1-0-0-1010011100-1-1010-01-110011-010-11-1101 00011
-0110-10-0-10111110110-011111100110110-1-1-111-100---1-111-1-1-111111101101100-00111-11-0000--1----001-0-1010001001-11000-01-00000100000--000111110--1 01111
00-0011-11---0--10101-010-100100001000110001-10-11001-11000101011-00-010110-101000-010-1--0110-01-011001101-0--000-0111110111-010---01100010-11011000- 10001
011000000-0011-0-00010-0-00110110--01000-01001-01-01001-010--10-1000-11-1-10001111101--00110-1100--0011110011-100011-11000011111-0-110100-0-001001-011 11010
0-0---0---01101-1-1111010101--100-0001001101-11--0-1-0-011101101111-0-1-10100-101-10-01-0-101-1--1001-01-000010-1-0-1001-10-00011101000-111100001-00-0 11000
0010110011001-11-00-01-0-111111-00010-01100001-0-11010100011-01-110111-11010-0010101-01-1000010-0-11-0-01101-101001-1---01-0111-000010010-1-1110110000 00100
11000-1011-11001001111001-100-0011111011111001-1----1-0011-110-1100-11-0001001--0-0-10-101--11110-00-0-1-01-01110010101-1100011-1010101-01110-01-01110 10110
10100100-01110100000-1000----01110000-00010011100010101010-111001000-0-01-1110111--00000-0-011100110001-11100111-0--01100111100100-10-011111111-11100- 10100
1000010-10010---010-10-10100100-10-1001--0-1001-0101--1--1100101-11101---001-1001-1011101-0011110---111111001001010--10-1000001-000110-111-00110011011 10001
00-00010-0100-0101111100011101101000-1100-0101110000-1-01101-0-00010100-0--0----10-11-010100-10110--11101110011-001--1-1-11-1-10-100-1-10-1-00100011-0 00100
-011111-10100--0001010-01--001000-0000-0-10010-01110-01001010101-010110010010-1110--11-10-011010-0-01011001101011-0100110-10001-10010100-110000-100001 00001
.e


#===============================================================================
# Copyright (c) 2015, Max Zwiessele
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#   list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.
#
# * Neither the name of GPy.plotting.gpy_plot.kernel_plots nor the names of its
#   contributors may be used to endorse or promote products derived from
#   this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#===============================================================================
import numpy as np
from . import plotting_library as pl
from .. import Tango
from .plot_util import update_not_existing_kwargs, helper_for_plot_data
from ...kern.src.kern import Kern, CombinationKernel

def plot_ARD(kernel, filtering=None, legend=False, canvas=None, **kwargs):
    """
    If an ARD kernel is present, plot a bar representation using matplotlib

    :param fignum: figure number of the plot
    :param filtering: list of names, which to use for plotting ARD parameters.
                      Only kernels which match names in the list of names in filtering
                      will be used for plotting.
    :type filtering: list of names to use for ARD plot
    """
    Tango.reset()

    ard_params = np.atleast_2d(kernel.input_sensitivity(summarize=False))
    bottom = 0
    last_bottom = bottom

    x = np.arange(kernel._effective_input_dim)

    parts = []
    def visit(x):
        if (not isinstance(x, CombinationKernel)) and isinstance(x, Kern):
            parts.append(x)
    kernel.traverse(visit)

    if filtering is None:
        filtering = [k.name for k in parts]

    bars = []
    kwargs = update_not_existing_kwargs(kwargs, pl().defaults.ard)

    if canvas is None:
        canvas, kwargs = pl().new_canvas(xlim=(-.5, kernel._effective_input_dim-.5), xlabel='input dimension', ylabel='ard contribution', **kwargs)

    for i in range(ard_params.shape[0]):
        if parts[i].name in filtering:
            c = Tango.nextMedium()
            bars.append(pl().barplot(canvas, x,
                                     ard_params[i,:], color=c,
                                     label=parts[i].name,
                                     bottom=bottom, **kwargs))
            last_bottom = ard_params[i,:]
            bottom += last_bottom
        else:
            print("filtering out {}".format(parts[i].name))

    #add_bar_labels(fig, ax, [bars[-1]], bottom=bottom-last_bottom)

    return pl().add_to_canvas(canvas, bars, legend=legend)

def plot_covariance(kernel, x=None, label=None,
             plot_limits=None, visible_dims=None, resolution=None,
             projection='2d', levels=20, **kwargs):
    """
    Plot a kernel covariance w.r.t. another x.

    :param array-like x: the value to use for the other kernel argument (kernels are a function of two variables!)
    :param plot_limits: the range over which to plot the kernel
    :type plot_limits: Either (xmin, xmax) for 1D or (xmin, xmax, ymin, ymax) / ((xmin, xmax), (ymin, ymax)) for 2D
    :param array-like visible_dims: input dimensions (!) to use for x. Make sure to select 2 or less dimensions to plot.
    :resolution: the resolution of the lines used in plotting. for 2D this defines the grid for kernel evaluation.
    :param {2d|3d} projection: What projection shall we use to plot the kernel?
    :param int levels: for 2D projection, how many levels for the contour plot to use?
    :param kwargs:  valid kwargs for your specific plotting library
    """
    X = np.ones((2, kernel._effective_input_dim)) * [[-3], [3]]
    _, free_dims, Xgrid, xx, yy, _, _, resolution = helper_for_plot_data(kernel, X, plot_limits, visible_dims, None, resolution)

    from numbers import Number
    if x is None:
        from ...kern.src.stationary import Stationary
        x = np.ones((1, kernel._effective_input_dim)) * (not isinstance(kernel, Stationary))
    elif isinstance(x, Number):
        x = np.ones((1, kernel._effective_input_dim))*x
    K = kernel.K(Xgrid, x)

    if projection == '3d':
        xlabel = 'X[:,0]'
        ylabel = 'X[:,1]'
        zlabel = "k(X, {!s})".format(np.asanyarray(x).tolist())
    else:
        xlabel = 'X'
        ylabel = "k(X, {!s})".format(np.asanyarray(x).tolist())
        zlabel = None

    canvas, kwargs = pl().new_canvas(projection=projection, xlabel=xlabel, ylabel=ylabel, zlabel=zlabel, **kwargs)

    if len(free_dims)<=2:
        if len(free_dims)==1:
            # 1D plotting:
            update_not_existing_kwargs(kwargs, pl().defaults.meanplot_1d)  # @UndefinedVariable
            plots = dict(covariance=[pl().plot(canvas, Xgrid[:, free_dims], K, label=label, **kwargs)])
        else:
            if projection == '2d':
                update_not_existing_kwargs(kwargs, pl().defaults.meanplot_2d)  # @UndefinedVariable
                plots = dict(covariance=[pl().contour(canvas, xx[:, 0], yy[0, :],
                                               K.reshape(resolution, resolution),
                                               levels=levels, label=label, **kwargs)])
            elif projection == '3d':
                update_not_existing_kwargs(kwargs, pl().defaults.meanplot_3d)  # @UndefinedVariable
                plots = dict(covariance=[pl().surface(canvas, xx, yy,
                                               K.reshape(resolution, resolution),
                                               label=label,
                                               **kwargs)])
        return pl().add_to_canvas(canvas, plots)

    else:
        raise NotImplementedError("Cannot plot a kernel with more than two input dimensions")


// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
void donotwarn();

int (^IFP) ();
int (^II) (int);
int test1() {
  int (^PFR) (int) = 0; // OK
  PFR = II;             // OK

  if (PFR == II)        // OK
    donotwarn();

  if (PFR == IFP)       // OK
    donotwarn();

  if (PFR == (int (^) (int))IFP) // OK
    donotwarn();

  if (PFR == 0)         // OK
    donotwarn();

  if (PFR)              // OK
    donotwarn();

  if (!PFR)             // OK
    donotwarn();

  return PFR != IFP;    // OK
}

int test2(double (^S)()) {
  double (^I)(int)  = (void*) S;
  (void*)I = (void *)S; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}

  void *pv = I;

  pv = S;

  I(1);

  return (void*)I == (void *)S;
}

int^ x; // expected-error {{block pointer to non-function type is invalid}}
int^^ x1; // expected-error {{block pointer to non-function type is invalid}} expected-error {{block pointer to non-function type is invalid}}

void test3() {
  char *^ y; // expected-error {{block pointer to non-function type is invalid}}
}

enum {NSBIRLazilyAllocated = 0};

int test4(int argc) {  // rdar://6251437
  ^{
    switch (argc) {
      case NSBIRLazilyAllocated:  // is an integer constant expression.
      default:
        break;
    }
  }();
  return 0;
}

void bar(void*);
// rdar://6257721 - reference to static/global is byref by default.
static int test5g;
void test5() {
  bar(^{ test5g = 1; });
}

// rdar://6405429 - __func__ in a block refers to the containing function name.
const char*test6() {
  return ^{
    return __func__;
  } ();
}

// radr://6732116 - block comparisons
void (^test7a)();
int test7(void (^p)()) {
  return test7a == p;
}

void test8() {
somelabel:
  ^{ goto somelabel; }();   // expected-error {{use of undeclared label 'somelabel'}}
}

void test9() {
  goto somelabel;       // expected-error {{use of undeclared label 'somelabel'}}
  ^{ somelabel: ; }();
}

void test10(int i) {
  switch (i) {
  case 41: ;
  ^{ case 42: ; }();     // expected-error {{'case' statement not in switch statement}}
  }
}

void test11(int i) {
  switch (i) {
  case 41: ;
    ^{ break; }();     // expected-error {{'break' statement not in loop or switch statement}}
  }

  for (; i < 100; ++i)
    ^{ break; }();     // expected-error {{'break' statement not in loop or switch statement}}
}

void (^test12f)(void);
void test12() {
  test12f = ^test12f;  // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
}

// rdar://6808730
void *test13 = ^{
  int X = 32;

  void *P = ^{
    return X+4;  // References outer block's "X", so outer block is constant.
  };
};

void test14() {
  int X = 32;
  static void *P = ^{  // expected-error {{initializer element is not a compile-time constant}}

    void *Q = ^{
      // References test14's "X": outer block is non-constant.
      return X+4;
    };
  };
}

enum { LESS };

void foo(long (^comp)()) { // expected-note{{passing argument to parameter 'comp' here}}
}

void (^test15f)(void);
void test15() {
  foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)' to parameter of type 'long (^)()'}}
}

__block int test16i;  // expected-error {{__block attribute not allowed, only allowed on local variables}}

void test16(__block int i) { // expected-error {{__block attribute not allowed, only allowed on local variables}}
  int size = 5;
  extern __block double extern_var; // expected-error {{__block attribute not allowed, only allowed on local variables}}
  static __block char * pch; // expected-error {{__block attribute not allowed, only allowed on local variables}}
  __block int a[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
  __block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
}

void f();

void test17() {
  void (^bp)(int);
  void (*rp)(int);
  void (^bp1)();
  void *vp = bp;

  f(1 ? bp : vp);
  f(1 ? vp : bp);
  f(1 ? bp : bp1);
  (void)(bp > rp); // expected-error {{invalid operands}}
  (void)(bp > 0); // expected-error {{invalid operands}}
  (void)(bp > bp); // expected-error {{invalid operands}}
  (void)(bp > vp); // expected-error {{invalid operands}}
  f(1 ? bp : rp); // expected-error {{incompatible operand types ('void (^)(int)' and 'void (*)(int)')}}
  (void)(bp == 1); // expected-error {{invalid operands to binary expression}}
  (void)(bp == 0);
  (void)(1 == bp); // expected-error {{invalid operands to binary expression}}
  (void)(0 == bp);
  (void)(bp < 1); // expected-error {{invalid operands to binary expression}}
  (void)(bp < 0); // expected-error {{invalid operands to binary expression}}
  (void)(1 < bp); // expected-error {{invalid operands to binary expression}}
  (void)(0 < bp); // expected-error {{invalid operands to binary expression}}
}

void test18() {
  void (^const  blockA)(void) = ^{ };  // expected-note {{variable 'blockA' declared const here}}
  blockA = ^{ }; // expected-error {{cannot assign to variable 'blockA' with const-qualified type 'void (^const)(void)}}
}

// rdar://7072507
int test19() {
  goto L0;       // expected-error {{cannot jump}}

  __block int x; // expected-note {{jump bypasses setup of __block variable}}
L0:
  x = 0;
  ^(){ ++x; }();
  return x;
}

// radr://7438948
void test20() {
  int n = 7;
  int vla[n]; // expected-note {{declared here}}
  int (*vm)[n] = 0; // expected-note {{declared here}}
  vla[1] = 4341;
  ^{
    (void)vla[1];  // expected-error {{cannot refer to declaration with a variably modified type inside block}}
    (void)(vm+1);  // expected-error {{cannot refer to declaration with a variably modified type inside block}}
  }();
}

// radr://7438948
void test21() {
  int a[7]; // expected-note {{declared here}}
  __block int b[10]; // expected-note {{declared here}}
  a[1] = 1;
  ^{
    (void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
    (void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
  }();
}

// rdar ://8218839
const char * (^func)(void) = ^{ return __func__; };
const char * (^function)(void) = ^{ return __FUNCTION__; };
const char * (^pretty)(void) = ^{ return __PRETTY_FUNCTION__; };


/*
 *
 * Copyright 2019 gRPC authors.
 *
 * 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 serviceconfig defines types and methods for operating on gRPC
// service configs.
//
// This package is EXPERIMENTAL.
package serviceconfig

// Config represents an opaque data structure holding a service config.
type Config interface {
	isServiceConfig()
}

// LoadBalancingConfig represents an opaque data structure holding a load
// balancing config.
type LoadBalancingConfig interface {
	isLoadBalancingConfig()
}

// ParseResult contains a service config or an error.  Exactly one must be
// non-nil.
type ParseResult struct {
	Config Config
	Err    error
}


# 前言 #

函数这个章节内容有点多，对于新手，也有些不好理解。建议各位多看几篇，多敲几次代码。

最后这是我的个人微信号，大家可以添加一下，交个朋友，一起讨论。

![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-07-070041.jpg)

# 目录 #

![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-10-07-%E5%87%BD%E6%95%B0.png)


<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage_Core
 * @copyright  Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

/**
 * Configuration for Design model
 *
 * @category   Mage
 * @package    Mage_Core
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class Mage_Core_Model_Design_Fallback
{
    /**
     * @var Mage_Core_Model_Design_Config
     */
    protected $_config = null;

    /**
     * @var Mage_Core_Model_Store
     */
    protected $_store = null;

    /**
     * Use for caching fallback schemes
     *
     * @var array
     */
    protected $_cachedSchemes = array();

    /**
     * Used to find circular dependencies
     *
     * @var array
     */
    protected $_visited;

    /**
     * Constructor
     * @param array $params
     */
    public function __construct(array $params = array())
    {
        $this->_config = isset($params['config']) ? $params['config'] : Mage::getModel('core/design_config');
    }

    /**
     * Retrieve store
     *
     * @return Mage_Core_Model_Store
     */
    public function getStore()
    {
        if ($this->_store === null) {
            return Mage::app()->getStore();
        }
        return $this->_store;
    }

    /**
     * @param string|integer|Mage_Core_Model_Store $store
     * @return $this
     */
    public function setStore($store)
    {
        if (!$store instanceof Mage_Core_Model_Store) {
            $store = Mage::app()->getStore($store);
        }
        $this->_store = $store;
        $this->_cachedSchemes = array();
        return $this;
    }

    /**
     * Get fallback scheme
     *
     * @param string $area
     * @param string $package
     * @param string $theme
     * @return array
     */
    public function getFallbackScheme($area, $package, $theme)
    {
        $cacheKey = $area . '/' . $package . '/' . $theme;

        if (!isset($this->_cachedSchemes[$cacheKey])) {
            if ($this->_isInheritanceDefined($area, $package, $theme)) {
                $scheme = $this->_getFallbackScheme($area, $package, $theme);
            } else {
                $scheme = $this->_getLegacyFallbackScheme();
            }

            $this->_cachedSchemes[$cacheKey] = $scheme;
        }

        return $this->_cachedSchemes[$cacheKey];
    }

    /**
     * Check if inheritance defined in theme config
     *
     * @param string $area
     * @param string $package
     * @param string $theme
     * @return bool
     */
    protected function _isInheritanceDefined($area, $package, $theme)
    {
        $path = $area . '/' . $package . '/' . $theme . '/parent';
        return $this->_config->getNode($path) !== false;
    }

    /**
     * Get fallback scheme according to theme config
     *
     * @param string $area
     * @param string $package
     * @param string $theme
     * @return array
     * @throws Mage_Core_Exception
     */
    protected function _getFallbackScheme($area, $package, $theme)
    {
        $scheme = array(array());
        $this->_visited = array();
        while ($parent = (string)$this->_config->getNode($area . '/' . $package . '/' . $theme . '/parent')) {
            $this->_checkVisited($area, $package, $theme);

            $parts = explode('/', $parent);
            if (count($parts) !== 2) {
                throw new Mage_Core_Exception('Parent node should be defined as "package/theme"');
            }
            list($package, $theme) = $parts;
            $scheme[] = array('_package' => $package, '_theme' => $theme);
        }

        return $scheme;
    }

    /**
     * Prevent circular inheritance
     *
     * @param string $area
     * @param string $package
     * @param string $theme
     * @throws Mage_Core_Exception
     */
    protected function _checkVisited($area, $package, $theme)
    {
        $path = $area . '/' . $package . '/' . $theme;
        if (in_array($path, $this->_visited)) {
            throw new Mage_Core_Exception(
                'Circular inheritance in theme ' . $package . '/' . $theme
            );
        }
        $this->_visited[] = $path;
    }

    /**
     * Get fallback scheme when inheritance is not defined (backward compatibility)
     *
     * @return array
     */
    protected function _getLegacyFallbackScheme()
    {
        return array(
            array(),
            array('_theme' => $this->_getFallbackTheme()),
            array('_theme' => Mage_Core_Model_Design_Package::DEFAULT_THEME),
        );
    }

    /**
     * Default theme getter
     * @return string
     */
    protected function _getFallbackTheme()
    {
        return $this->getStore()->getConfig('design/theme/default');
    }
}


Ne eblis trovi la privatan ŝlosilon de la uzanto %s

Vi ne rajtas forigi tiun privatan ŝlosilon

Ne eblis trovi la publikan ŝlosilon de la uzanto %s

Komuna nomo („CN“) ne kongruas kun la aktuala uzanto

Ne eblis trovi la publikan ŝlosilon de %s

Vi ne rajtas redakti la dosieron; certigu, ke vi unue ŝlosas ĝin kaj poste sendas la ĝustan ĵetonon

Nur la posedanto povas forigi la pridatuman dosieron

Tiu ne estas via privata ŝlosilo forigota

Provizas la bezonatan finpunkton por ebligi tutvojan ĉifradon. Tutvoja ĉifrado ankoraŭ estas en alfa-versio: ne uzu en produktado kaj uzu nur kun testdatumoj!


   /**
   *  Repeats source as long as condition holds emulating a while loop.
   * There is an alias for this method called 'whileDo' for browsers <IE9
   *
   * @param {Function} condition The condition which determines if the source will be repeated.
   * @param {Observable} source The observable sequence that will be run if the condition function returns true.
   * @returns {Observable} An observable sequence which is repeated as long as the condition holds.
   */
  var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
    isPromise(source) && (source = observableFromPromise(source));
    return enumerableWhile(condition, source).concat();
  };


import * as assert from 'assert'
import * as IO from '../src/IO'
import { monoidString, monoidSum } from '../src/Monoid'
import { pipe } from '../src/function'
import * as T from '../src/Task'
import * as _ from '../src/TaskThese'
import * as TH from '../src/These'
import { assertSeq, assertPar } from './util'
import { semigroupString } from '../src/Semigroup'

describe('TaskThese', () => {
  // -------------------------------------------------------------------------------------
  // pipeables
  // -------------------------------------------------------------------------------------

  it('map', async () => {
    const double = (n: number) => n * 2
    assert.deepStrictEqual(await pipe(_.right(1), _.map(double))(), TH.right(2))
  })

  it('bimap', async () => {
    const f = (e: string) => e + e
    const g = (a: number) => a + 1
    assert.deepStrictEqual(await pipe(_.right(1), _.bimap(f, g))(), TH.right(2))
    assert.deepStrictEqual(await pipe(_.left('a'), _.bimap(f, g))(), TH.left('aa'))
    assert.deepStrictEqual(await pipe(_.both('a', 1), _.bimap(f, g))(), TH.both('aa', 2))
  })

  it('mapLeft', async () => {
    const f = (e: string) => e + e
    assert.deepStrictEqual(await pipe(_.right(1), _.mapLeft(f))(), TH.right(1))
    assert.deepStrictEqual(await pipe(_.left('a'), _.mapLeft(f))(), TH.left('aa'))
    assert.deepStrictEqual(await pipe(_.both('a', 1), _.mapLeft(f))(), TH.both('aa', 1))
  })

  // -------------------------------------------------------------------------------------
  // instances
  // -------------------------------------------------------------------------------------

  describe('getApplicative', () => {
    it('Par', async () => {
      await assertSeq(_.getApplicative(T.ApplicativeSeq, semigroupString), { fromTask: _.fromTask }, (fa) => fa())
    })

    it('Seq', async () => {
      await assertPar(_.getApplicative(T.ApplicativePar, semigroupString), { fromTask: _.fromTask }, (fa) => fa())
    })
  })

  it('getSemigroup', async () => {
    const S = _.getSemigroup(monoidString, monoidSum)
    assert.deepStrictEqual(await S.concat(_.right(1), _.right(2))(), TH.right(3))
    assert.deepStrictEqual(await S.concat(_.right(1), _.left('a'))(), TH.both('a', 1))
    assert.deepStrictEqual(await S.concat(_.left('a'), _.left('b'))(), TH.left('ab'))
    assert.deepStrictEqual(await S.concat(_.right(1), _.both('a', 2))(), TH.both('a', 3))
    assert.deepStrictEqual(await S.concat(_.left('a'), _.both('b', 2))(), TH.both('ab', 2))
    assert.deepStrictEqual(await S.concat(_.both('a', 1), _.both('b', 2))(), TH.both('ab', 3))
  })

  describe('getMonad', () => {
    const M = _.getMonad(monoidString)
    it('map', async () => {
      const f = (n: number): number => n * 2
      assert.deepStrictEqual(await M.map(_.right(1), f)(), TH.right(2))
      assert.deepStrictEqual(await M.map(_.left('a'), f)(), TH.left('a'))
      assert.deepStrictEqual(await M.map(_.both('a', 1), f)(), TH.both('a', 2))
    })

    it('ap', async () => {
      const f = (n: number): number => n * 2
      assert.deepStrictEqual(await M.ap(_.right(f), _.right(1))(), TH.right(2))
    })

    it('chain', async () => {
      const f = (n: number) => (n > 2 ? _.both(`c`, n + 1) : n > 1 ? _.right(n * 2) : _.left(`b`))
      assert.deepStrictEqual(await M.chain(_.right(1), f)(), TH.left('b'))
      assert.deepStrictEqual(await M.chain(_.right(2), f)(), TH.right(4))

      assert.deepStrictEqual(await M.chain(_.left('a'), f)(), TH.left('a'))

      assert.deepStrictEqual(await M.chain(_.both('a', 1), f)(), TH.left('ab'))
      assert.deepStrictEqual(await M.chain(_.both('a', 2), f)(), TH.right(4))
      assert.deepStrictEqual(await M.chain(_.both('a', 3), f)(), TH.both('ac', 4))
    })
  })

  // -------------------------------------------------------------------------------------
  // constructors
  // -------------------------------------------------------------------------------------

  it('right', async () => {
    const x = await _.right(1)()
    assert.deepStrictEqual(x, TH.right(1))
  })

  it('left', async () => {
    const x = await _.left('a')()
    assert.deepStrictEqual(x, TH.left('a'))
  })

  it('both', async () => {
    const x = await _.both('a', 1)()
    assert.deepStrictEqual(x, TH.both('a', 1))
  })

  it('rightIO', async () => {
    const x = await _.rightIO(IO.of(1))()
    assert.deepStrictEqual(x, TH.right(1))
  })

  it('leftIO', async () => {
    const x = await _.leftIO(IO.of('a'))()
    assert.deepStrictEqual(x, TH.left('a'))
  })

  it('rightTask', async () => {
    const x = await _.rightTask(T.of(1))()
    assert.deepStrictEqual(x, TH.right(1))
  })

  it('leftTask', async () => {
    const x = await _.leftTask(T.of('a'))()
    assert.deepStrictEqual(x, TH.left('a'))
  })

  // -------------------------------------------------------------------------------------
  // destructors
  // -------------------------------------------------------------------------------------

  it('fold', async () => {
    const f = _.fold(
      (e) => T.of(`left ${e}`),
      (a) => T.of(`right ${a}`),
      (e, a) => T.of(`both ${e} ${a}`)
    )
    assert.deepStrictEqual(await pipe(_.right(1), f)(), 'right 1')
    assert.deepStrictEqual(await pipe(_.left('a'), f)(), 'left a')
    assert.deepStrictEqual(await pipe(_.both('a', 1), f)(), 'both a 1')
  })

  it('swap', async () => {
    assert.deepStrictEqual(await _.swap(_.right(1))(), TH.left(1))
    assert.deepStrictEqual(await _.swap(_.left('a'))(), TH.right('a'))
    assert.deepStrictEqual(await _.swap(_.both('a', 1))(), TH.both(1, 'a'))
  })

  it('toTuple', async () => {
    const f = _.toTuple('b', 2)
    assert.deepStrictEqual(await f(_.right(1))(), ['b', 1])
    assert.deepStrictEqual(await f(_.left('a'))(), ['a', 2])
    assert.deepStrictEqual(await f(_.both('a', 1))(), ['a', 1])
  })
})


/* clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
   used by gcrypt */
/* Cache invalidation loop is a fair test.  */
	li 5, 0
1:	icbi 5, 3
	addi 5, 5, 32
	cmpw 5, 4
	blt 1b


Removes a rule permanently

method

The http method to be used

url

Context: url

The url that the http request should be done on. Can be a relative one, starting with '/'. For example '/api/foo/bar'

body

Context: body

mimetype

Context: body

For post and put request you can send data with the request. Set the mimetype of that date here.

timeout

The timeout of this request in seconds.


# Tests for PERFORMANCE_SCHEMA

# This test verifies the correct behaviour in case of invalid
# usage of DMLs on the table replication_connection_status.

--disable_result_log
SELECT * FROM performance_schema.replication_connection_status
  LIMIT 1;

SELECT * FROM performance_schema.replication_connection_status
  WHERE received_transaction_set='FOO' OR last_error_message='BAR';
--enable_result_log

--error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO performance_schema.replication_connection_status
  SET received_transaction_set='FOO', last_error_message='BAR',
  thread_id=1, last_error_number=2;

--error ER_TABLEACCESS_DENIED_ERROR
UPDATE performance_schema.replication_connection_status
  SET last_error_number=12;

--error ER_TABLEACCESS_DENIED_ERROR
UPDATE performance_schema.replication_connection_status
  SET thread_id=12 WHERE received_transaction_set like "FOO";

--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM performance_schema.replication_connection_status
  WHERE last_error_number=1;

--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM performance_schema.replication_connection_status;

-- error ER_TABLEACCESS_DENIED_ERROR
LOCK TABLES performance_schema.replication_connection_status READ;
UNLOCK TABLES;

-- error ER_TABLEACCESS_DENIED_ERROR
LOCK TABLES performance_schema.replication_connection_status WRITE;
UNLOCK TABLES;


#
# Check if the index is appearing properly in the output file
#
RUN: llvm-nm -M %p/Inputs/libsimple_archive.a | FileCheck -check-prefix=CHECKIDX %s

CHECKIDX: Archive map
CHECKIDX: abcdefghijklmnopqrstuvwxyz12345678 in 1.o
CHECKIDX: main in 1.o
CHECKIDX: 1.o:
CHECKIDX: 00000000 D abcdefghijklmnopqrstuvwxyz12345678
CHECKIDX:          U fn1
CHECKIDX: 00000000 T main


form=词
tags=

各自寻思取。
更莫怨他人做。
如今剗地怕相逢，
愁多正在相逢处。
人前不敢分明语。
暗里频回顾。
罗襟滴泪无数。
匆匆又是空归去。


//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.

using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;

namespace Sce.Atf.Models
{
    ///
    /// Re-usable view model for a tree node with a tri-state check box. The check state is updated
    /// to reflect child checked states. If all children are checked, then parent is checked. If all
    /// children are unchecked, then parent is unchecked. If children are a mixture of checked and
    /// unchecked, then parent is indeterminate.
    public class CheckedTreeNode : INotifyPropertyChanged
    {
        ///
        /// Constructor
        public CheckedTreeNode()
            : this(null, null, true, true)
        {
        }

        ///
        /// Constructor
        /// <param name="value">The value of the tree node</param>
        public CheckedTreeNode(object value)
            : this(value, null, true, true)
        {
        }

        ///
        /// Constructor
        /// <param name="value">The value of the tree node</param>
        /// <param name="name">Name</param>
        /// <param name="isChecked">Checked state</param>
        /// <param name="isEnabled">Enabled/disabled state</param>
        public CheckedTreeNode(object value, string name, bool? isChecked, bool isEnabled)
        {
            Children = new ObservableCollection<CheckedTreeNode>();
            Children.CollectionChanged += Children_CollectionChanged;
            Value = value;
            Name = name;
            IsChecked = isChecked;
            IsEnabled = isEnabled;
        }

        ///
        /// Gets and sets the value of the tree node
        public object Value { get; set; }

        ///
        /// Gets the children of the tree node
        public ObservableCollection<CheckedTreeNode> Children { get; private set; }

        ///
        /// Gets and sets the parent of the tree node. Updates the checked state on set.
        public CheckedTreeNode Parent
        {
            get { return m_parent; }
            set
            {
                m_parent = value;
                if (m_parent != null)
                {
                    m_parent.VerifyCheckState();
                }
            }
        }

        ///
        /// Gets and sets the checked state. On set, updates the checked state of the parent and children,
        /// and raises the PropertyChanged event.
        public bool? IsChecked
        {
            get { return m_isChecked; }
            set { SetIsChecked(value, true, true); }
        }

        ///
        /// Gets and sets whether the checkbox is enabled/disabled. Raises the PropertyChanged event on set.
        public bool IsEnabled
        {
            get { return m_isEnabled; }
            set
            {
                m_isEnabled = value;
                OnPropertyChanged(s_isEnabledArgs);
            }
        }

        ///
        /// Gets and sets the name.  Raises the PropertyChanged event on set.
        public string Name
        {
            get { return m_name; }
            set
            {
                m_name = value;
                OnPropertyChanged(s_nameArgs);
            }
        }

        ///
        /// Occurs when a property value changes.
        public event PropertyChangedEventHandler PropertyChanged;

        ///
        /// Raises PropertyChanged event and performs custom actions
        /// <param name="e">PropertyChangedEventArgs containing event data</param>
        protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, e);
        }

        private void Children_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    foreach (var child in e.NewItems)
                        ((CheckedTreeNode)child).Parent = this;
                    break;
                case NotifyCollectionChangedAction.Remove:
                    foreach (var child in e.OldItems)
                        ((CheckedTreeNode)child).Parent = null;
                    break;
                case NotifyCollectionChangedAction.Reset:
                    foreach (var child in (System.Collections.IEnumerable)sender)
                        ((CheckedTreeNode)child).Parent = null;
                    break;
                default:
                    throw new NotSupportedException();
            }
        }

        private CheckedTreeNode m_parent;

        private bool? m_isChecked = null;
        private static readonly PropertyChangedEventArgs s_isCheckedArgs
            = ObservableUtil.CreateArgs<CheckedTreeNode>(x => x.IsChecked);

        private bool m_isEnabled;
        private static readonly PropertyChangedEventArgs s_isEnabledArgs
            = ObservableUtil.CreateArgs<CheckedTreeNode>(x => x.IsEnabled);

        private string m_name;
        private static readonly PropertyChangedEventArgs s_nameArgs
            = ObservableUtil.CreateArgs<CheckedTreeNode>(x => x.Name);

        private void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
        {
            if (value == m_isChecked)
                return;

            m_isChecked = value;

            if (updateChildren && m_isChecked.HasValue)
            {
                foreach (var child in Children)
                {
                    child.SetIsChecked(m_isChecked, true, false);
                }
            }

            if (updateParent && Parent != null)
                Parent.VerifyCheckState();

            OnPropertyChanged(s_isCheckedArgs);
        }

        private void VerifyCheckState()
        {
            bool? state = IsChecked;

            bool isFirst = true;
            foreach (var child in Children)
            {
                bool? current = child.IsChecked;
                if (isFirst)
                {
                    state = current;
                    isFirst = false;
                }
                else if (current != state)
                {
                    state = null;
                    break;
                }
            }

            SetIsChecked(state, false, true);
        }

    }
}


/***********************license start************************************
 * Copyright (c) 2003-2017 Cavium, Inc.
 * All rights reserved.
 *
 * License: one of 'Cavium License' or 'GNU General Public License Version 2'
 *
 * This file is provided under the terms of the Cavium License (see below)
 * or under the terms of GNU General Public License, Version 2, as
 * published by the Free Software Foundation. When using or redistributing
 * this file, you may do so under either license.
 *
 * Cavium License:  Redistribution and use in source and binary forms, with
 * or without modification, are permitted provided that the following
 * conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *  * Redistributions in binary form must reproduce the above
 *    copyright notice, this list of conditions and the following
 *    disclaimer in the documentation and/or other materials provided
 *    with the distribution.
 *
 *  * Neither the name of Cavium Inc. nor the names of its contributors may be
 *    used to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * This Software, including technical data, may be subject to U.S. export
 * control laws, including the U.S. Export Administration Act and its
 * associated regulations, and may be subject to export or import
 * regulations in other countries.
 *
 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS
 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY)
 * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A
 * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET
 * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE
 * ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES
 * WITH YOU.
 ***********************license end**************************************/

#include <linux/types.h>
#include <linux/vmalloc.h>

#include "common.h"

/**
 * zip_cmd_qbuf_alloc - Allocates a cmd buffer for ZIP Instruction Queue
 * @zip: Pointer to zip device structure
 * @q:   Queue number to allocate bufffer to
 * Return: 0 if successful, -ENOMEM otherwise
 */
int zip_cmd_qbuf_alloc(struct zip_device *zip, int q)
{
	zip->iq[q].sw_head = (u64 *)__get_free_pages((GFP_KERNEL | GFP_DMA),
						get_order(ZIP_CMD_QBUF_SIZE));

	if (!zip->iq[q].sw_head)
		return -ENOMEM;

	memset(zip->iq[q].sw_head, 0, ZIP_CMD_QBUF_SIZE);

	zip_dbg("cmd_qbuf_alloc[%d] Success : %p\n", q, zip->iq[q].sw_head);
	return 0;
}

/**
 * zip_cmd_qbuf_free - Frees the cmd Queue buffer
 * @zip: Pointer to zip device structure
 * @q:   Queue number to free buffer of
 */
void zip_cmd_qbuf_free(struct zip_device *zip, int q)
{
	zip_dbg("Freeing cmd_qbuf 0x%lx\n", zip->iq[q].sw_tail);

	free_pages((u64)zip->iq[q].sw_tail, get_order(ZIP_CMD_QBUF_SIZE));
}

/**
 * zip_data_buf_alloc - Allocates memory for a data bufffer
 * @size:   Size of the buffer to allocate
 * Returns: Pointer to the buffer allocated
 */
u8 *zip_data_buf_alloc(u64 size)
{
	u8 *ptr;

	ptr = (u8 *)__get_free_pages((GFP_KERNEL | GFP_DMA),
					get_order(size));

	if (!ptr)
		return NULL;

	memset(ptr, 0, size);

	zip_dbg("Data buffer allocation success\n");
	return ptr;
}

/**
 * zip_data_buf_free - Frees the memory of a data buffer
 * @ptr:  Pointer to the buffer
 * @size: Buffer size
 */
void zip_data_buf_free(u8 *ptr, u64 size)
{
	zip_dbg("Freeing data buffer 0x%lx\n", ptr);

	free_pages((u64)ptr, get_order(size));
}


# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for tensorflow.ops.tf.Cholesky."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np
from six.moves import xrange  # pylint: disable=redefined-builtin
import tensorflow as tf

class CholeskyOpTest(tf.test.TestCase):

  def _verifyCholeskyBase(self, sess, x, chol, verification):
    chol_np, verification_np = sess.run([chol, verification])
    self.assertAllClose(x, verification_np)
    self.assertShapeEqual(x, chol)
    # Check that the cholesky is lower triangular, and has positive diagonal
    # elements.
    if chol_np.shape[-1] > 0:
      chol_reshaped = np.reshape(chol_np, (-1, chol_np.shape[-2],
                                           chol_np.shape[-1]))
      for chol_matrix in chol_reshaped:
        self.assertAllClose(chol_matrix, np.tril(chol_matrix))
        self.assertTrue((np.diag(chol_matrix) > 0.0).all())

  def _verifyCholesky(self, x):
    # Verify that LL^T == x.
    with self.test_session() as sess:
      chol = tf.cholesky(x)
      verification = tf.batch_matmul(chol, chol, adj_x=False, adj_y=True)
      self._verifyCholeskyBase(sess, x, chol, verification)

  def testBasic(self):
    self._verifyCholesky(np.array([[4., -1., 2.], [-1., 6., 0], [2., 0., 5.]]))

  def testBatch(self):
    simple_array = np.array([[[1., 0.], [0., 5.]]])  # shape (1, 2, 2)
    self._verifyCholesky(simple_array)
    self._verifyCholesky(np.vstack((simple_array, simple_array)))
    odd_sized_array = np.array([[[4., -1., 2.], [-1., 6., 0], [2., 0., 5.]]])
    self._verifyCholesky(np.vstack((odd_sized_array, odd_sized_array)))

    #  Generate random positive-definite matrices.
    matrices = np.random.rand(10, 5, 5)
    for i in xrange(10):
      matrices[i] = np.dot(matrices[i].T, matrices[i])
    self._verifyCholesky(matrices)

  def testNonSquareMatrix(self):
    with self.assertRaises(ValueError):
      tf.cholesky(np.array([[1., 2., 3.], [3., 4., 5.]]))
    with self.assertRaises(ValueError):
      tf.cholesky(
          np.array([[[1., 2., 3.], [3., 4., 5.]], [[1., 2., 3.], [3., 4., 5.]]
                   ]))

  def testWrongDimensions(self):
    tensor3 = tf.constant([1., 2.])
    with self.assertRaises(ValueError):
      tf.cholesky(tensor3)
    with self.assertRaises(ValueError):
      tf.cholesky(tensor3)

  def testNotInvertible(self):
    # The input should be invertible.
    with self.test_session():
      with self.assertRaisesOpError("LLT decomposition was not successful. The"
                                    " input might not be valid."):
        # All rows of the matrix below add to zero
        self._verifyCholesky(
            np.array([[1., -1., 0.], [-1., 1., -1.], [0., -1., 1.]]))

  def testEmpty(self):
    self._verifyCholesky(np.empty([0, 2, 2]))
    self._verifyCholesky(np.empty([2, 0, 0]))

class CholeskyGradTest(tf.test.TestCase):
  _backprop_block_size = 32

  def getShapes(self, shapeList):
    return ((elem, int(np.floor(1.2 * elem))) for elem in shapeList)

  def testSmallMatrices(self):
    np.random.seed(0)
    shapes = self.getShapes([1, 2, 10])
    self.runFiniteDifferences(shapes)

  def testOneBlockMatrices(self):
    np.random.seed(0)
    shapes = self.getShapes([self._backprop_block_size + 1])
    self.runFiniteDifferences(
        shapes, dtypes=(tf.float32, tf.float64), scalarTest=True)

  def testTwoBlockMatrixFloat(self):
    np.random.seed(0)
    shapes = self.getShapes([2 * self._backprop_block_size + 1])
    self.runFiniteDifferences(shapes, dtypes=(tf.float32,), scalarTest=True)

  def testTwoBlockMatrixDouble(self):
    np.random.seed(0)
    shapes = self.getShapes([2 * self._backprop_block_size + 1])
    self.runFiniteDifferences(shapes, dtypes=(tf.float64,), scalarTest=True)

  def runFiniteDifferences(self,
                           shapes,
                           dtypes=(tf.float32, tf.float64),
                           scalarTest=False):
    with self.test_session(use_gpu=False):
      for shape in shapes:
        for batch in False, True:
          for dtype in dtypes:
            if not scalarTest:
              x = tf.constant(np.random.randn(shape[0], shape[1]), dtype)
              tensor = tf.matmul(x, tf.transpose(x)) / shape[0]
            else:
              # This is designed to be a faster test for larger matrices.
              x = tf.constant(np.random.randn(), dtype)
              R = tf.constant(np.random.randn(shape[0], shape[1]), dtype)
              e = tf.mul(R, x)
              tensor = tf.matmul(e, tf.transpose(e)) / shape[0]

            # Inner-most matrices in tensor are positive definite.
            if batch:
              tensor = tf.tile(tf.expand_dims(tensor, 0), [4, 1, 1])
            y = tf.cholesky(tensor)
            if scalarTest:
              y = tf.reduce_mean(y)
            error = tf.test.compute_gradient_error(x, x._shape_as_list(), y,
                                                   y._shape_as_list())
            tf.logging.info("error = %f", error)
            if dtype == tf.float64:
              self.assertLess(error, 1e-5)
            else:
              self.assertLess(error, 3e-3)

if __name__ == "__main__":
  tf.test.main()


/*
Copyright 2015 The Kubernetes Authors.

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 v1alpha1

import (
	"k8s.io/apimachinery/pkg/runtime/schema"
	kubeproxyconfigv1alpha1 "k8s.io/kube-proxy/config/v1alpha1"
)

// GroupName is the group name used in this package
const GroupName = "kubeproxy.config.k8s.io"

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

var (
	// localSchemeBuilder extends the SchemeBuilder instance with the external types. In this package,
	// defaulting and conversion init funcs are registered as well.
	localSchemeBuilder = &kubeproxyconfigv1alpha1.SchemeBuilder
	// AddToScheme is a global function that registers this API group & version to a scheme
	AddToScheme = localSchemeBuilder.AddToScheme
)

func init() {
	// We only register manually written functions here. The registration of the
	// generated functions takes place in the generated files. The separation
	// makes the code compile even when the generated files are missing.
	localSchemeBuilder.Register(addDefaultingFuncs)
}


// Copyright 2017-2019 Weald Technology Trading
//
// 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 ens

import (
	"fmt"
	"math/big"
	"time"

	"github.com/ethereum/go-ethereum/accounts/abi/bind"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/wealdtech/go-ens/v3/contracts/auctionregistrar"
)

// AuctionRegistrar is the structure for the auction registrar contract
type AuctionRegistrar struct {
	backend      bind.ContractBackend
	domain       string
	Contract     *auctionregistrar.Contract
	ContractAddr common.Address
}

// AuctionEntry is an auction entry
type AuctionEntry struct {
	State        string
	Deed         common.Address
	Registration time.Time
	Value        *big.Int
	HighestBid   *big.Int
}

// NewAuctionRegistrar creates a new auction registrar for a given domain
func NewAuctionRegistrar(backend bind.ContractBackend, domain string) (*AuctionRegistrar, error) {
	address, err := RegistrarContractAddress(backend, domain)
	if err != nil {
		return nil, err
	}

	return NewAuctionRegistrarAt(backend, domain, address)
}

// NewAuctionRegistrarAt creates an auction registrar for a given domain at a given address
func NewAuctionRegistrarAt(backend bind.ContractBackend, domain string, address common.Address) (*AuctionRegistrar, error) {
	contract, err := auctionregistrar.NewContract(address, backend)
	if err != nil {
		return nil, err
	}
	return &AuctionRegistrar{
		backend:      backend,
		domain:       domain,
		Contract:     contract,
		ContractAddr: address,
	}, nil
}

// State returns the state of a nam
func (r *AuctionRegistrar) State(name string) (string, error) {
	entry, err := r.Entry(name)
	if err != nil {
		return "", err
	}
	if entry == nil {
		return "", fmt.Errorf("no entry for %s", name)
	}
	return entry.State, nil
}

// Entry obtains a registrar entry for a name
func (r *AuctionRegistrar) Entry(domain string) (*AuctionEntry, error) {
	name, err := UnqualifiedName(domain, r.domain)
	if err != nil {
		return nil, fmt.Errorf("invalid name %s", domain)
	}

	labelHash, err := LabelHash(name)
	if err != nil {
		return nil, err
	}
	status, deedAddress, registration, value, highestBid, err := r.Contract.Entries(nil, labelHash)
	if err != nil {
		return nil, err
	}

	entry := &AuctionEntry{
		Deed:       deedAddress,
		Value:      value,
		HighestBid: highestBid,
	}
	entry.Registration = time.Unix(registration.Int64(), 0)
	switch status {
	case 0:
		entry.State = "Available"
	case 1:
		entry.State = "Bidding"
	case 2:
		// Might be won or owned
		registry, err := NewRegistry(r.backend)
		if err != nil {
			return nil, err
		}

		owner, err := registry.Owner(domain)
		if err != nil {
			return nil, err
		}

		if owner == UnknownAddress {
			entry.State = "Won"
		} else {
			entry.State = "Owned"
		}
	case 3:
		entry.State = "Forbidden"
	case 4:
		entry.State = "Revealing"
	case 5:
		entry.State = "Unavailable"
	default:
		entry.State = "Unknown"
	}

	return entry, nil
}

// Migrate migrates a domain to the permanent registrar
func (r *AuctionRegistrar) Migrate(opts *bind.TransactOpts, domain string) (*types.Transaction, error) {
	name, err := UnqualifiedName(domain, r.domain)
	if err != nil {
		return nil, fmt.Errorf("invalid name %s", domain)
	}

	labelHash, err := LabelHash(name)
	if err != nil {
		return nil, err
	}
	return r.Contract.TransferRegistrars(opts, labelHash)
}

// Release releases a domain
func (r *AuctionRegistrar) Release(opts *bind.TransactOpts, domain string) (*types.Transaction, error) {
	name, err := UnqualifiedName(domain, r.domain)
	if err != nil {
		return nil, fmt.Errorf("invalid name %s", domain)
	}

	labelHash, err := LabelHash(name)
	if err != nil {
		return nil, err
	}
	return r.Contract.ReleaseDeed(opts, labelHash)
}

// Owner obtains the owner of the deed that represents the name.
func (r *AuctionRegistrar) Owner(domain string) (common.Address, error) {
	name, err := UnqualifiedName(domain, r.domain)
	if err != nil {
		return UnknownAddress, err
	}

	entry, err := r.Entry(name)
	if err != nil {
		return UnknownAddress, err
	}

	deed, err := NewDeedAt(r.backend, entry.Deed)
	if err != nil {
		return UnknownAddress, err
	}
	return deed.Owner()
}

// SetOwner sets the owner of the deed that represents the name.
func (r *AuctionRegistrar) SetOwner(opts *bind.TransactOpts, domain string, address common.Address) (*types.Transaction, error) {
	name, err := UnqualifiedName(domain, r.domain)
	if err != nil {
		return nil, fmt.Errorf("invalid name %s", domain)
	}

	labelHash, err := LabelHash(name)
	if err != nil {
		return nil, err
	}
	return r.Contract.Transfer(opts, labelHash, address)
}

// ShaBid calculates the hash for a bid.
func (r *AuctionRegistrar) ShaBid(hash [32]byte, address common.Address, value *big.Int, salt [32]byte) ([32]byte, error) {
	return r.Contract.ShaBid(nil, hash, address, value, salt)
}