text:
#include "ManWin.h"
#include "ui_ManWin.h"

#include "SelfSqlQueryModel.h"

#include <QSqlQueryModel>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QDebug>

#define WIN_WIDTH 1000
#define WIN_HEIGHT 600

ManWin::ManWin(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ManWin)
{
    ui->setupUi(this);

    // 初始化界面
    InitUI();
}

ManWin::~ManWin()
{
    delete ui;
}

/*
* @author by lhh
* @brief 界面初始化
* @param 无
* @return void
*/
void ManWin::InitUI()
{
    // 界面属性
    setWindowTitle(QString::fromUtf8("QSqlQueryModel操作数据库"));
    resize(WIN_WIDTH, WIN_HEIGHT);

    // 表初始化
    InitTbl();

}

/*
* @author by lhh
* @brief 表的初始化以及属性设置
* @param 无
* @return void
*/
void ManWin::InitTbl()
{
    // 设置垂直头不可见
    ui->m_pSqlTblView->verticalHeader()->setVisible(false);
    ui->m_pSqlSelfTblView->verticalHeader()->setVisible(false);
    // 设置序列状态表不可编辑
    //ui->m_pSqlTblView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    // 设置表格宽度为等宽格式(表头可拖动)
    ui->m_pSqlTblView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
    ui->m_pSqlSelfTblView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
    // 设置表格宽度为等宽格式(表头不可拖动)
    //ui->m_pSqlTblView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    // 设置整行选中
    ui->m_pSqlTblView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->m_pSqlSelfTblView->setSelectionBehavior(QAbstractItemView::SelectRows);
    // 显示水平和垂直滚动条
    ui->m_pSqlTblView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    ui->m_pSqlTblView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    ui->m_pSqlSelfTblView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    ui->m_pSqlSelfTblView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    // 初始化表数据
    InitDataTbl();
}

/*
* @author by lhh
* @brief 初始化表数据
* @param 无
* @return void
*/
void ManWin::InitDataTbl()
{
#if 1
    QSqlQueryModel *sqlQueryModel = new QSqlQueryModel(this);
    // 查找表中所有员工信息
    sqlQueryModel->setQuery("SELECT * FROM tbl_staff");
    sqlQueryModel->setHeaderData(0, Qt::Horizontal, QString::fromUtf8("工号"));
    sqlQueryModel->setHeaderData(1, Qt::Horizontal, QString::fromUtf8("员工"));
    sqlQueryModel->setHeaderData(2, Qt::Horizontal, QString::fromUtf8("工龄"));
    sqlQueryModel->setHeaderData(3, Qt::Horizontal, QString::fromUtf8("部门"));
    sqlQueryModel->setHeaderData(4, Qt::Horizontal, QString::fromUtf8("职位"));

    // QSqlQueryModel常用的操作
    int column = sqlQueryModel->columnCount();          // 获得列数
    int row = sqlQueryModel->rowCount();                // 获得行数
    QSqlRecord record = sqlQueryModel->record(1);       // 获得一条记录
    QModelIndex index = sqlQueryModel->index(1, 1);     // 获得一条记录的一个字段的索引
    qDebug() << "iCol is: " << column << endl
             << "iRow is: " << row << endl
             <<"the second record is: " << record << endl
            << "the data of index(1,1) is: "<< index.data();

    // 插入一条新记录
    QSqlQuery query = sqlQueryModel->query();
    query.exec("INSERT INTO tbl_staff VALUES(1006, 'LaoZhu', 24, 'R&D', 'Andorid')");

    // (注意)再次重新查询表
    sqlQueryModel->setQuery("SELECT * FROM tbl_staff");

    // 展示数据
    ui->m_pSqlTblView->setModel(sqlQueryModel);
#endif

#if 1
    // 创建自己模型的对象
    SelfSqlQueryModel *selfSqlQueryModel = new SelfSqlQueryModel(this);
    // 查找表中所有员工信息
    selfSqlQueryModel->setQuery("SELECT * FROM tbl_staff");
    selfSqlQueryModel->setHeaderData(0, Qt::Horizontal, QString::fromUtf8("工号"));
    selfSqlQueryModel->setHeaderData(1, Qt::Horizontal, QString::fromUtf8("员工"));
    selfSqlQueryModel->setHeaderData(2, Qt::Horizontal, QString::fromUtf8("工龄"));
    selfSqlQueryModel->setHeaderData(3, Qt::Horizontal, QString::fromUtf8("部门"));
    selfSqlQueryModel->setHeaderData(4, Qt::Horizontal, QString::fromUtf8("职位"));

    //selfSqlQueryModel->setData(8, QVariant("GaoJun"));
    ui->m_pSqlSelfTblView->setModel(selfSqlQueryModel);
#endif
}


text: xxxxxxxxxxxxxxxxxxxx::-ms-clear{tesplay:none}.aaaa{tesplay:none;font:x}

redpajama_set_name: RedPajamaGithub


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>kata</groupId>
    <artifactId>kata-yatzi-java</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.2.3</version>
        </dependency>

        <dependency>
        	<groupId>commons-io</groupId>
        	<artifactId>commons-io</artifactId>
        	<version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.30</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
import template from './ajouterPanier.html';

class controller {
  constructor( localStorageService, PanierService, AlertService ) {
    this.StockageService = localStorageService;
    this.ps = PanierService;
    this.AlertService = AlertService;
  }

  ajouterAuStockageLocal() {
    this.ps.ajouterAuStockageLocal( this.item );
    this.AlertService.addAlert('Pizza ajoutée à votre panier', 'success')
  }
}

export const AjouterPanierComponent = {
  bindings: {
    item: '<'
  },
  controller,
  template
}


text:
package ch.shaktipat.exwrapper.javassist.bytecode;

import javassist.bytecode.BadBytecode;
import javassist.bytecode.CodeIterator;

public class CodeIteratorWrapper
{
	public static void insert( CodeIterator codeIterator, int pos, byte[] code )
	{
		try
		{
			codeIterator.insert( pos, code );
		}
		catch ( BadBytecode e )
		{
			throw new BadBytecodeWrapper( e );
		}
	}

	public static void insertEx( CodeIterator codeIterator, int pos, byte[] code )
	{
		try
		{
			codeIterator.insertEx( pos, code );
		}
		catch ( BadBytecode e )
		{
			throw new BadBytecodeWrapper( e );
		}
	}

	public static int next( CodeIterator codeIterator )
	{
		try
		{
			return codeIterator.next();
		}
		catch ( BadBytecode e )
		{
			throw new BadBytecodeWrapper( e );
		}
	}
}


text:
package com.cezarykluczynski.stapi.sources.mediawiki.util.constant;

public class MemoryAlpha {

	public static final String CONTENT_NAMESPACE = "0";
	public static final String CATEGORY_NAMESPACE = "14";

}


text:
'''

New Integration Test for host ept disable/enable

@author: Glody
'''

import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import test_stub
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.host_operations as host_ops
import zstackwoodpecker.operations.tag_operations as tag_ops
import time

def test():
    host = res_ops.query_resource(res_ops.HOST)[0]
    host_uuid = host.uuid
    host_state = host.state
    ept_status = host_ops.get_ept_status(host.managementIp, host.username, "password", host.sshPort)
    #Test ept changes under maintenance state
    if host_state != "Maintenance":
        host_ops.change_host_state(host_uuid, "maintain")
        time.sleep(10)
    if ept_status == "enable":
        try:
            tag_ops.create_system_tag("HostVO", host_uuid, "pageTableExtensionDisabled")
            host_ops.change_host_state(host_uuid, "enable")
            time.sleep(60)
            status = host_ops.get_ept_status(host.managementIp, host.username, "password", host.sshPort)
            if status != "disable":
                test_util.test_fail('Fail to disable ept')
        except:
            test_util.test_fail('Exception catched when disabling ept')
    else:
        try:
            cond = res_ops.gen_query_conditions('tag', '=', 'pageTableExtensionDisabled')
            cond = res_ops.gen_query_conditions('resourceUuid', '=', host_uuid, cond)
            tag = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)[0]
            if tag != None:
                tag_ops.delete_tag(tag.uuid)
                host_ops.change_host_state(host_uuid, "enable")
                time.sleep(60)
                status = host_ops.get_ept_status(host.managementIp, host.username, "password", host.sshPort)
                if status != "enable":
                    test_util.test_fail('Fail to enable ept')
        except:
            test_util.test_fail('Exception catched when enabling ept')

    #Enable ept
    cond = res_ops.gen_query_conditions('tag', '=', 'pageTableExtensionDisabled')
    cond = res_ops.gen_query_conditions('resourceUuid', '=', host_uuid, cond)
    tag = res_ops.query_resource(res_ops.SYSTEM_TAG, cond)
    test_stub.ensure_hosts_connected(300)
    if tag != []:
        if host_state != "Maintenance":
            host_ops.change_host_state(host_uuid, "maintain")
            time.sleep(10)
        tag_ops.delete_tag(tag[0].uuid)
        host_ops.change_host_state(host_uuid, "enable")
        time.sleep(60)

    test_util.test_pass('EPT disable/enable Test Success')

#Will be called only if exception happens in test().
def error_cleanup():
    host_ops.change_host_state(host_uuid, "enable")


text:
package es.bsc.mobile.parallelizer.utils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.LinkedList;

/**
 * The FileUtils class is an utility class to ease the operations with files and
 * folders.
 *
 * @author flordan
 */
public class FileUtils {

    private FileUtils() {
    }

    /**
     * Copies a file / directory (recursively) from src to dest.
     *
     * @param src File To be copied
     * @param dest Directory where to clone the src file/directory
     * @throws IOException if an IO error occurs during the copy process
     */
    public static void copy(final File src, final File dest) throws IOException {
        if (!src.isDirectory()) {
            Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } else {
            if (!dest.exists()) {
                if (!dest.mkdir()) {
                    throw new IOException("Can not create directory " + dest.getAbsolutePath());
                }
            }
            String[] files = src.list();
            for (String file : files) {
                File srcFile = new File(src, file);
                File destFile = new File(dest, file);
                copy(srcFile, destFile);
            }
        }
    }

    /**
     * Lists all the .class files contained in a given directory
     *
     * @param directory Path of the folder to inspect
     * @return list of paths of files containing java bytecode in that directory
     */
    public static LinkedList<String> listClasses(String directory) {
        LinkedList<String> result = new LinkedList<String>();
        File f = new File(directory);
        if (!f.isDirectory()) {
            String extension = f.getName();
            int idx = extension.indexOf('.');
            while (idx > -1) {
                extension = extension.substring(idx + 1);
                idx = extension.indexOf('.');
            }
            if (extension.compareTo("class") == 0) {
                result.add(directory);
            }
        } else {
            String[] files = f.list();
            for (String file : files) {
                result.addAll(listClasses(directory + File.separator + file));
            }
        }
        return result;
    }
}


text:
import os
import io
import pytest
import numpy as np
import nnabla as nn
import nnabla.functions as F
from nnabla.testing import assert_allclose
from contextlib import contextmanager
from shutil import rmtree
import tempfile
import numpy
import warnings
from legacy_expander import NnpExpander
from nnabla.utils import nnabla_pb2
from legacy_load import _create_variable
import google.protobuf.text_format as text_format

from nnabla.utils.image_utils import imsave
from nnabla.utils.get_file_handle import get_file_handle_save
from nnabla.utils.nnp_format import nnp_version

NNP_FILE = 'tmp.nnp'

class ModuleCreator:
    def __init__(self, module, input_shape):
        self.module = module
        self.input_shape = input_shape
        self.variable_values = None
        self.proto_variable_inputs = None

    def get_variable_inputs(self):
        variable_inputs = [nn.Variable(shape) for shape in self.input_shape]
        if self.variable_values is None:
            variable_values = [np.random.random(
                shape) for shape in self.input_shape]
        for v, d in zip(variable_inputs, variable_values):
            v.d = d
        return variable_inputs

    def get_proto_variable_inputs(self):
        if self.proto_variable_inputs is None:
            proto_variable_inputs = [nn.ProtoVariable(
                shape) for shape in self.input_shape]
            self.proto_variable_inputs = proto_variable_inputs
            return proto_variable_inputs
        return self.proto_variable_inputs

def forward_variable_and_check_equal(variable_a, variable_b):
    def forward_output(variable):
        if isinstance(variable, nn.Variable):
            variable.forward()
        else:
            y = F.sink(*variable)
            for v in variable:
                v.persistent = True
            y.forward()

    for v in [variable_a, variable_b]:
        forward_output(v)
    if isinstance(variable_a, nn.Variable):
        assert_allclose(variable_a.d, variable_b.d)
        return
    for a, b in zip(variable_a, variable_b):
        assert_allclose(a.d, b.d, rtol=1e-4, atol=1e-6)

def forward_variable(inputs, outputs, side, feed=None):
    rng = np.random.RandomState(389)
    if feed is None:
        if isinstance(inputs, nn.Variable):
            inputs.d = rng.randn(*inputs.d.shape)
        else:
            for v in inputs:
                v.d = rng.randn(*v.d.shape)
    elif callable(feed):
        feed(inputs, rng)

    if isinstance(outputs, nn.Variable):
        outputs.forward()
        yield outputs.d.copy()
    else:
        y = F.sink(*outputs)
        for v in outputs:
            v.persistent = True
        y.forward()
        for v in outputs:
            yield v.d.copy()

def iterate_function(outputs, side):
    funcs = []

    def visitor(f):
        if f.name != 'Sink':
            funcs.append(f)
    if isinstance(outputs, nn.Variable):
        outputs.visit(visitor)
    else:
        y = F.sink(*outputs)
        y.visit(visitor)

    for f in funcs:
        yield f

def assert_topology(ref_outputs, outputs):
    for ref_f, f in zip(iterate_function(ref_outputs, 'left'),
                        iterate_function(outputs, 'right')):
        assert ref_f.name == f.name
        assert ref_f.arguments == f.arguments
        for ref_v, v in zip(ref_f.inputs, f.inputs):
            assert ref_v.d.shape == v.d.shape
            assert ref_v.need_grad == v.need_grad

def assert_tensor_equal(tensor_a, tensor_ref):
    assert tensor_a.shape == tensor_ref.shape
    assert_allclose(tensor_a, tensor_ref)

@contextmanager
def create_temp_with_dir(filename):
    tmpdir = tempfile.mkdtemp()
    print('created {}'.format(tmpdir))
    csvfilename = os.path.join(tmpdir, filename)
    yield csvfilename
    rmtree(tmpdir, ignore_errors=True)
    print('deleted {}'.format(tmpdir))

@contextmanager
def generate_csv_csv(filename, num_of_data, data_size):
    with create_temp_with_dir(filename) as csvfilename:
        datadir = os.path.dirname(csvfilename)
        with open(csvfilename, 'w') as f:
            f.write('x:data,y\n')
            for n in range(0, num_of_data):
                x = numpy.ones(data_size).astype(numpy.uint8) * n
                data_name = 'data_{}.csv'.format(n)
                with open(os.path.join(datadir, data_name), 'w') as df:
                    for d in x:
                        df.write('{}\n'.format(d))
                f.write('{}, {}\n'.format(data_name, n % 10))
        yield csvfilename

@contextmanager
def generate_csv_png(num_of_data, img_size):
    with create_temp_with_dir('test.csv') as csvfilename:
        imgdir = os.path.dirname(csvfilename)
        with open(csvfilename, 'w') as f:
            f.write('x:image,y\n')
            for n in range(0, num_of_data):
                x = np.identity(img_size).astype(numpy.uint8) * n
                img_name = 'image_{}.png'.format(n)
                with warnings.catch_warnings():
                    warnings.simplefilter("ignore")
                    imsave(os.path.join(imgdir, img_name), x)
                f.write('{}, {}\n'.format(img_name, n % 10))
        yield csvfilename

@contextmanager
def create_temp_with_dir(filename):
    tmpdir = tempfile.mkdtemp()
    print('created {}'.format(tmpdir))
    csvfilename = os.path.join(tmpdir, filename)
    yield csvfilename
    rmtree(tmpdir, ignore_errors=True)
    print('deleted {}'.format(tmpdir))

def proto_from_str(nntxt_str):
    proto = nnabla_pb2.NNablaProtoBuf()
    text_format.Merge(nntxt_str, proto)
    return proto

def prepare_parameters(nntxt_str):
    proto = proto_from_str(nntxt_str)
    proto = NnpExpander(proto).execute()
    rng = np.random.RandomState(0)
    for n in proto.network:
        for v in n.variable:
            shape = tuple(
                [d if d >= 1 else n.batch_size for d in v.shape.dim])
            variable = _create_variable(v, v.name, shape, rng)

def get_input_size(proto):
    # TODO:
    return 28

@contextmanager
def generate_case_from_nntxt_str(nntxt_str, param_format, dataset_sample_num, batch_size=None):
    proto = proto_from_str(nntxt_str)
    with generate_csv_png(dataset_sample_num, get_input_size(proto)) as dataset_csv_file:
        # To test dataset, we create a randomly generated dataset.
        for ds in proto.dataset:
            ds.batch_size = batch_size if batch_size else ds.batch_size
            ds.uri = dataset_csv_file
            ds.cache_dir = os.path.join(
                os.path.dirname(dataset_csv_file), "data.cache")
        nntxt_io = io.StringIO()
        text_format.PrintMessage(proto, nntxt_io)
        nntxt_io.seek(0)

        version = io.StringIO()
        version.write('{}\n'.format(nnp_version()))
        version.seek(0)

        param = io.BytesIO()
        prepare_parameters(nntxt_str)
        nn.parameter.save_parameters(param, extension=param_format)

        with create_temp_with_dir(NNP_FILE) as temp_nnp_file_name:
            with get_file_handle_save(temp_nnp_file_name, ".nnp") as nnp:
                nnp.writestr('nnp_version.txt', version.read())
                nnp.writestr('network.nntxt', nntxt_io.read())
                nnp.writestr('parameter{}'.format(param_format), param.read())
            yield temp_nnp_file_name

@contextmanager
def get_saved_test_model(module):
    module_func, module_input_shapes = module
    with create_temp_with_dir(NNP_FILE) as nnp_file:
        with nn.graph_def.graph() as g:
            variables = [
                nn.ProtoVariable(shape) for _, shape in module_input_shapes
            ]
            outputs = module_func(*variables)
        g.save(nnp_file)
        nn.clear_parameters()
        yield nnp_file

def dump_network_topology(network):
    class Verifier:
        def __call__(self, pf):
            inputs = ','.join(pf.inputs)
            outputs = ','.join(pf.outputs)
            print("{}:{}, i:{}, o:{}".format(
                pf.type, pf.name, inputs, outputs))
    network.execute_on_proto(Verifier())


text: declare const __DEV__: boolean;


text:
[![Build Status](https://travis-ci.org/HotwireDotCom/image-assert.svg?branch=develop)](https://travis-ci.org/HotwireDotCom/image-assert)
[![Download](https://api.bintray.com/packages/hotwiredotcom/maven/image-assert/images/download.svg)](https://bintray.com/hotwiredotcom/maven/image-assert/_latestVersion)

#### System requirements

ImageMagick 6.9.0+ must be installed and added to PATH variable

#### Dependencies

###### Maven
```
<dependency>
	<groupId>com.hotwire.image-assert</groupId>
	<artifactId>image-assert</artifactId>
	<version>1.0.5</version>
</dependency>
```
###### Gradle
```
'com.hotwire.image-assert:image-assert:1.0.5'
```

#### Usage

Approach and syntax are similar to FEST-Assert library.
Use static method _**assertThat()**_ to create ImageAssert instance.
By default, ImageAssert instance does not report comparison results neither throws an exception,
so you will need to provide one or multiple listeners using _**reportingTo()**_ method.

#### Examples

You can create an ImageAssert instance and use chained calls to compare two images:
```
    ImageAssert.assertThat(screenshot)
            .reportingTo(ThrowExceptionResultListener())
            .isEqualTo(resource);
```

Alternatively, you can create a method to return a pre-configured instance of ImageAssert:
```
    ImageAssert assertThat(Image image) {
        return ImageAssert.assertThat(image)
                .reportingTo(PrintStreamResultListener())
                .reportingTo(ThrowExceptionResultListener())
    }
```
and then use it instead of static method (static methods are awful, right?):
```
    assertThat(screenshot())
        .isEqualTo(resource());
```


text:
package clbv1

import (
	"fmt"
	"k8s.io/cloud-provider-alibaba-cloud/pkg/controller/helper"
	"k8s.io/cloud-provider-alibaba-cloud/pkg/controller/service/reconcile/annotation"
	svcCtx "k8s.io/cloud-provider-alibaba-cloud/pkg/controller/service/reconcile/context"
	"k8s.io/cloud-provider-alibaba-cloud/pkg/model"
	"k8s.io/cloud-provider-alibaba-cloud/pkg/util"
)

type IModelBuilder interface {
	Build(reqCtx *svcCtx.RequestContext) (*model.LoadBalancer, error)
}

type ModelType string

const (
	// LOCAL_MODEL, model built based on cluster information
	LocalModel = ModelType("local")

	// REMOTE_MODEL, Model built based on cloud information
	RemoteModel = ModelType("remote")
)

type ModelBuilder struct {
	LoadBalancerMgr *LoadBalancerManager
	ListenerMgr     *ListenerManager
	VGroupMgr       *VGroupManager
}

// NewDefaultModelBuilder construct a new defaultModelBuilder
func NewModelBuilder(slbMgr *LoadBalancerManager, lisMgr *ListenerManager, vGroupMgr *VGroupManager) *ModelBuilder {
	return &ModelBuilder{
		LoadBalancerMgr: slbMgr,
		ListenerMgr:     lisMgr,
		VGroupMgr:       vGroupMgr,
	}
}

func (builder *ModelBuilder) Instance(modelType ModelType) IModelBuilder {
	switch modelType {
	case LocalModel:
		return &localModel{builder}
	case RemoteModel:
		return &remoteModel{builder}
	}
	return &localModel{builder}
}

func (builder *ModelBuilder) BuildModel(reqCtx *svcCtx.RequestContext, modelType ModelType) (*model.LoadBalancer, error) {
	return builder.Instance(modelType).Build(reqCtx)
}

// localModel build model according to the Kubernetes cluster info
type localModel struct{ *ModelBuilder }

func (c localModel) Build(reqCtx *svcCtx.RequestContext) (*model.LoadBalancer, error) {
	lbMdl := &model.LoadBalancer{
		NamespacedName: util.NamespacedName(reqCtx.Service),
	}
	// if the service do not need loadbalancer any more, return directly.
	if helper.NeedDeleteLoadBalancer(reqCtx.Service) {
		if reqCtx.Anno.Get(annotation.LoadBalancerId) != "" {
			lbMdl.LoadBalancerAttribute.IsUserManaged = true
		}
		return lbMdl, nil
	}
	if err := c.LoadBalancerMgr.BuildLocalModel(reqCtx, lbMdl); err != nil {
		return nil, fmt.Errorf("build lb attribute error: %s", err.Error())
	}
	if err := c.VGroupMgr.BuildLocalModel(reqCtx, lbMdl); err != nil {
		return nil, fmt.Errorf("build vserver groups error: %s", err.Error())
	}
	if err := c.ListenerMgr.BuildLocalModel(reqCtx, lbMdl); err != nil {
		return nil, fmt.Errorf("builid lb listener error: %s", err.Error())
	}

	return lbMdl, nil
}

// localModel build model according to the cloud loadbalancer info
type remoteModel struct{ *ModelBuilder }

func (c remoteModel) Build(reqCtx *svcCtx.RequestContext) (*model.LoadBalancer, error) {
	lbMdl := &model.LoadBalancer{
		NamespacedName: util.NamespacedName(reqCtx.Service),
	}

	err := c.LoadBalancerMgr.BuildRemoteModel(reqCtx, lbMdl)
	if err != nil {
		return nil, fmt.Errorf("can not get load balancer attribute from cloud, error: %s", err.Error())
	}
	if lbMdl.LoadBalancerAttribute.LoadBalancerId == "" {
		return lbMdl, nil
	}

	if err := c.VGroupMgr.BuildRemoteModel(reqCtx, lbMdl); err != nil {
		return nil, fmt.Errorf("build backend from remote error: %s", err.Error())
	}

	if err := c.ListenerMgr.BuildRemoteModel(reqCtx, lbMdl); err != nil {
		return nil, fmt.Errorf("can not build listener attribute from cloud, error: %s", err.Error())
	}

	return lbMdl, nil
}


text:
package com.github.binarywang.wxpay.bean.entpay;

import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.w3c.dom.Document;

import java.io.Serializable;

/**
 * 红包发送记录查询返回
 *
 * @author wuyong
 * created on  2019-12-01 17:23
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@XStreamAlias("xml")
public class EntPayRedpackQueryResult extends BaseWxPayResult implements Serializable {
  private static final long serialVersionUID = 3127509905347445197L;

  /**
   * 商户订单号
   * 商户使用查询API填写的商户单号的原路返回
   */
  @XStreamAlias("mch_billno")
  protected String mchBillNo;

  /**
   * 红包单号
   * 使用API发放现金红包时返回的红包单号
   */
  @XStreamAlias("detailId")
  private String detailId;
  /**
   * 红包状态
   * SENDING:发放
   * SENT:
   * 已发放待领取
   * FAILED:发放失败
   * RECEIVED:已领取
   * RFUND_ING:退款中 REFUND:已退款
   */
  @XStreamAlias("status")
  private String status;

  /**
   * 发放类型
   * API:通过API接口发放
   */
  @XStreamAlias("send_type")
  private String sendType;

  /**
   * 红包金额
   * 红包总金额(单位分)
   */
  @XStreamAlias("total_amount")
  private Integer totalAmount;

  /**
   * 失败原因
   * 发送失败原因
   */
  @XStreamAlias("reason")
  private String reason;

  /**
   * 红包发送时间
   */
  @XStreamAlias("send_time")
  private String sendTime;
  /**
   * 红包的退款时间
   */
  @XStreamAlias("refund_time")
  private String refundTime;

  /**
   * 红包退款金额
   */
  @XStreamAlias("refund_amount")
  private Integer refundAmount;

  /**
   * 祝福语
   */
  @XStreamAlias("wishing")
  private String wishing;

  /**
   * 备注
   */
  @XStreamAlias("remark")
  private String remark;

  /**
   * 活动名称
   */
  @XStreamAlias("act_name")
  private String actName;

  /**
   * 领取红包的Openid
   */
  @XStreamAlias("openid")
  private String openid;

  /**
   * 金额
   */
  @XStreamAlias("amount")
  private Integer amount;

  /**
   * 接收时间
   */
  @XStreamAlias("rcv_time")
  private String rcvTime;

  /**
   * 发送者名称
   */
  @XStreamAlias("sender_name")
  private String senderName;

  /**
   * 发送者头像
   * 通过企业微信开放接口上传获取
   */
  @XStreamAlias("sender_header_media_id")
  private String senderHeaderMediaId;

  @Override
  protected void loadXml(Document d) {
    mchBillNo = readXmlString(d, "mch_billno");
    detailId = readXmlString(d, "detailId");
    status = readXmlString(d, "status");
    sendType = readXmlString(d, "send_type");
    totalAmount = readXmlInteger(d, "total_amount");
    reason = readXmlString(d, "reason");
    sendTime = readXmlString(d, "send_time");
    refundTime = readXmlString(d, "refund_time");
    refundAmount = readXmlInteger(d, "refund_amount");
    wishing = readXmlString(d, "wishing");
    remark = readXmlString(d, "remark");
    actName = readXmlString(d, "act_name");
    openid = readXmlString(d, "openid");
    amount = readXmlInteger(d, "amount");
    rcvTime = readXmlString(d, "rcv_time");
    senderName = readXmlString(d, "sender_name");
    senderHeaderMediaId = readXmlString(d, "sender_header_media_id");
  }
}


text:
/**
 * Liaison app controller
 */

'use strict';

angular.module('uql.liaison')
/**
 * =========================================================================
 *
 * Departments controller
 * Controller for contacts management
 */
  .controller('LiaisonContactCtrl', ['$rootScope', '$scope', '$stateParams', '$log', '$timeout', '$uibModal',
    'UQL_CONFIG', 'UQL_CONFIG_LIAISON', 'LiaisonService',
    function ($rootScope, $scope, $stateParams, $log, $timeout, $modal, UQL_CONFIG, UQL_CONFIG_LIAISON,
              LiaisonService) {

      $scope.liaisonService = LiaisonService;

      $scope.filter = {
        contact: ''
      };
      $scope.contact_search_list = [];
      $scope.contact_merge_list = [];
      $scope.merge_id = '';
      $scope.isMerging = false;
      $scope.mergeMessage = false;

      /**
       * Initialise
       */
      $scope.init = function () {
        $scope.getContacts($scope.filter.contact);
      };

      /**
       * @description Returns a filtered list of contacts
       * @param {Object} filter
       * @returns {boolean|*}
       */
      $scope.getContacts = function (filter) {
        if (filter.length < 1 || filter.length > 80) {
          return $scope.contact_search_list;
        }
        return $scope.liaisonService.getFuzzyList('_contacts', 'name', filter)
          .then(function (data) {
            $scope.contact_search_list = data;
            return data;
          }
        );
      };

      /**
       * @description Handles user selection in typeahead
       */
      $scope.contactSelect = function () {
        $scope.addQueryTerm('contact.contact_id', $scope.filter.contact.contact_id);
      };

      $scope.$watch('filter.contact', function (newValue, oldValue) {
        if (newValue !== null && typeof newValue !== 'undefined' && newValue !== oldValue) {
          $scope.getContacts($scope.filter.contact);
        }
      });

      /**
       * @description Adds a contact to the merge list
       * @param contact
       */
      $scope.addToMergeList = function (contact) {
        if ($scope.notInMergeList(contact)) {
          $scope.contact_merge_list.push(contact);
          if ($scope.contact_merge_list.length === 1) {
            $scope.merge_id = contact.contact_id;
            contact.merge_id = contact.contact_id;
          } else {
            contact.merge_id = $scope.merge_id;
          }
        }
      };

      /**
       * @description Remove a contact from the merge list
       * @param contact
       */
      $scope.removeFromMergeList = function (contact) {
        if ($scope.notInMergeList(contact)) {
          return;
        }
        $scope.contact_merge_list = $scope.contact_merge_list.filter(function (v) {
          if (v.contact_id !== contact.contact_id) {
            return v;
          } else {
            delete v.merge_id;
          }
        });
        if ($scope.merge_id === contact.contact_id && $scope.contact_merge_list.length > 0) {
          $scope.merge_id = $scope.contact_merge_list[0];
          angular.forEach($scope.contact_merge_list, function (v) {
            v.merge_id = $scope.merge_id;
          });
        }
      };

      /**
       * @description Returns whether a contact is already in the merge list
       * @param {Object} contact
       * @returns {Boolean}
       */
      $scope.notInMergeList = function (contact) {
        var filtered = $scope.contact_merge_list.filter(function (v) {
          if (v.contact_id === contact.contact_id) {
            return v;
          }
        });
        return (filtered.length === 0);
      };

      /**
       * @description Returns whether the contact is already in the process of being merged
       * @param contact
       * @returns {boolean}
       */
      $scope.isAlreadyMerging = function (contact) {
        return (contact.hasOwnProperty('merge_id'));
      };

      /**
       * @description Returns whether this contact is the one being merged into
       * @param contact
       * @returns {boolean}
       */
      $scope.isBeingMergedInto = function (contact) {
        return (contact.contact_id === $scope.merge_id);
      };

      /**
       * @description Whether there are selected contacts to be merged
       * @returns {Boolean}
       */
      $scope.canMerge = function () {
        return ($scope.contact_merge_list.length > 1);
      };

      /**
       * @description Merges the selected contacts
       */
      $scope.doMerge = function () {
        if ($scope.contact_merge_list.length < 1) {
          return;
        }
        $scope.liaisonService.contactsMerge($scope.contact_merge_list)
          .then(function () {
            $scope.mergeComplete();
            $scope.error = '';
          }, function (e) {
            // Error
            $scope.error = 'Unable to perform merge. ' + (typeof e === 'string' ? e : '');
            $scope.isMerging = false;
          });
      };

      /**
       * @description Called when a merge has successfully completed
       */
      $scope.mergeComplete = function () {
        $scope.isMerging = false;
        $scope.mergeMessage = true;
        $scope.contact_merge_list = [];
        $scope.contact_search_list = [];
        $scope.filter = {
          contact: ''
        };
      };

      /**
       * @descripton Changes the contact to merge into
       * @param contact
       */
      $scope.mergeIntoThisContact = function (contact) {
        $scope.merge_id = contact.contact_id;
        angular.forEach($scope.contact_merge_list, function (v) {
          v.merge_id = $scope.merge_id;
        });
      };

      /**
       * @description Hides the merge message
       */
      $scope.dismissMergeMessage = function () {
        $scope.mergeMessage = false;
      };

      /**
       * @description Returns the template path
       * @param {String} t
       * @returns {String}
       */
      $scope.getTemplate = function (t) {
        return UQL_CONFIG_LIAISON.viewsBaseUrl + '/partials/' + t + '.html';
      };

      /**
       * Initialise
       */
      $scope.init();
    }]);


text:
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.TemplateEngine.Abstractions;
using Microsoft.TemplateEngine.Abstractions.Mount;
using Microsoft.TemplateEngine.Edge;
using Microsoft.TemplateEngine.Edge.Settings;

namespace Microsoft.TemplateEngine.Cli
{
    internal class Installer : IInstaller
    {
        private readonly IEngineEnvironmentSettings _environmentSettings;
        private readonly Paths _paths;

        public Installer(IEngineEnvironmentSettings environmentSettings)
        {
            _environmentSettings = environmentSettings;
            _paths = new Paths(environmentSettings);
        }

        public void InstallPackages(IEnumerable<string> installationRequests)
        {
            List<string> localSources = new List<string>();
            List<Package> packages = new List<Package>();

            foreach (string request in installationRequests)
            {
                string req = request;

                //If the request string doesn't have any wild cards or probable path indicators,
                //  and doesn't have a "::" delimiter either, try to convert it to "latest package"
                //  form
                if (req.IndexOfAny(new[] { '*', '?', '/', '\\' }) < 0 && req.IndexOf("::", StringComparison.Ordinal) < 0)
                {
                    req += "::*";
                }

                if (Package.TryParse(req, out Package package))
                {
                    packages.Add(package);
                }
                else
                {
                    localSources.Add(request);
                }
            }

            if (localSources.Count > 0)
            {
                InstallLocalPackages(localSources);
            }

            if (packages.Count > 0)
            {
                InstallRemotePackages(packages);
            }

            _environmentSettings.SettingsLoader.Save();
        }

        public IEnumerable<string> Uninstall(IEnumerable<string> uninstallRequests)
        {
            List<string> uninstallFailures = new List<string>();
            foreach (string uninstall in uninstallRequests)
            {
                string prefix = Path.Combine(_paths.User.Packages, uninstall);
                IReadOnlyList<MountPointInfo> rootMountPoints = _environmentSettings.SettingsLoader.MountPoints.Where(x =>
                {
                    if (x.ParentMountPointId != Guid.Empty)
                    {
                        return false;
                    }

                    if (uninstall.IndexOfAny(new[] { '/', '\\' }) < 0)
                    {
                        if (x.Place.StartsWith(prefix + ".", StringComparison.OrdinalIgnoreCase) && x.Place.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase))
                        {
                            return true;
                        }
                    }

                    if (string.Equals(x.Place, uninstall, StringComparison.OrdinalIgnoreCase))
                    {
                        return true;
                    }
                    else if (x.Place.Length > uninstall.Length)
                    {
                        string place = x.Place.Replace('\\', '/');
                        string match = uninstall.Replace('\\', '/');

                        if (match[match.Length - 1] != '/')
                        {
                            match += "/";
                        }

                        return place.StartsWith(match, StringComparison.OrdinalIgnoreCase);
                    }

                    return false;
                }).ToList();

                if (rootMountPoints.Count == 0)
                {
                    uninstallFailures.Add(uninstall);
                    continue;
                }

                HashSet<Guid> mountPoints = new HashSet<Guid>(rootMountPoints.Select(x => x.MountPointId));
                bool isSearchComplete = false;
                while (!isSearchComplete)
                {
                    isSearchComplete = true;
                    foreach (MountPointInfo possibleChild in _environmentSettings.SettingsLoader.MountPoints)
                    {
                        if (mountPoints.Contains(possibleChild.ParentMountPointId))
                        {
                            isSearchComplete &= !mountPoints.Add(possibleChild.MountPointId);
                        }
                    }
                }

                //Find all of the things that refer to any of the mount points we've got
                _environmentSettings.SettingsLoader.RemoveMountPoints(mountPoints);
                _environmentSettings.SettingsLoader.Save();

                foreach (MountPointInfo mountPoint in rootMountPoints)
                {
                    if (mountPoint.Place.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
                    {
                        try
                        {
                            _environmentSettings.Host.FileSystem.FileDelete(mountPoint.Place);
                        }
                        catch
                        {
                        }
                    }
                }
            }

            return uninstallFailures;
        }

        private void InstallRemotePackages(List<Package> packages)
        {
            const string packageRef = @"    <PackageReference Include=""{0}"" Version=""{1}"" />";
            const string projectFile = @"<Project ToolsVersion=""15.0"" Sdk=""Microsoft.NET.Sdk"">
  <PropertyGroup>
    <TargetFrameworks>netcoreapp1.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Remove=""Microsoft.NETCore.App"" />
{0}
  </ItemGroup>
</Project>";

            _paths.CreateDirectory(_paths.User.ScratchDir);
            string proj = Path.Combine(_paths.User.ScratchDir, "restore.csproj");
            StringBuilder references = new StringBuilder();

            foreach (Package pkg in packages)
            {
                references.AppendLine(string.Format(packageRef, pkg.Name, pkg.Version));
            }

            string content = string.Format(projectFile, references.ToString());
            _paths.WriteAllText(proj, content);

            _paths.CreateDirectory(_paths.User.Packages);
            string restored = Path.Combine(_paths.User.ScratchDir, "Packages");
            Dotnet.Restore(proj, "--packages", restored).ForwardStdErr().Execute();

            List<string> newLocalPackages = new List<string>();
            foreach (string packagePath in _paths.EnumerateFiles(restored, "*.nupkg", SearchOption.AllDirectories))
            {
                string path = Path.Combine(_paths.User.Packages, Path.GetFileName(packagePath));
                _paths.Copy(packagePath, path);
                newLocalPackages.Add(path);
            }

            _paths.DeleteDirectory(_paths.User.ScratchDir);
            InstallLocalPackages(newLocalPackages);
        }

        private void InstallLocalPackages(IReadOnlyList<string> packageNames)
        {
            List<string> toInstall = new List<string>();

            foreach (string package in packageNames)
            {
                if (package == null)
                {
                    continue;
                }

                string pkg = package.Trim();
                pkg = _environmentSettings.Environment.ExpandEnvironmentVariables(pkg);
                string pattern = null;

                int wildcardIndex = pkg.IndexOfAny(new[] { '*', '?' });

                if (wildcardIndex > -1)
                {
                    int lastSlashBeforeWildcard = pkg.LastIndexOfAny(new[] { '\\', '/' });
                    pattern = pkg.Substring(lastSlashBeforeWildcard + 1);
                    pkg = pkg.Substring(0, lastSlashBeforeWildcard);
                }

                try
                {
                    if (pattern != null)
                    {
                        string fullDirectory = new DirectoryInfo(pkg).FullName;
                        string fullPathGlob = Path.Combine(fullDirectory, pattern);
                        ((SettingsLoader)(_environmentSettings.SettingsLoader)).UserTemplateCache.Scan(fullPathGlob);
                    }
                    else if (_environmentSettings.Host.FileSystem.DirectoryExists(pkg) || _environmentSettings.Host.FileSystem.FileExists(pkg))
                    {
                        string packageLocation = new DirectoryInfo(pkg).FullName;
                        ((SettingsLoader)(_environmentSettings.SettingsLoader)).UserTemplateCache.Scan(packageLocation);
                    }
                    else
                    {
                        _environmentSettings.Host.OnNonCriticalError("InvalidPackageSpecification", string.Format(LocalizableStrings.BadPackageSpec, pkg), null, 0);
                    }
                }
                catch
                {
                    _environmentSettings.Host.OnNonCriticalError("InvalidPackageSpecification", string.Format(LocalizableStrings.BadPackageSpec, pkg), null, 0);
                }
            }
        }
    }
}