text:
import re
import pandas as pd

def dot_checker(text):
    ''' This function checks if the text ends with a dot '''
    if not text.endswith("."):
        return "Warning: the description does not end with a dot"
    elif text.endswith(" .") or text.endswith("..") or text.endswith(". "):
        return "Warning: the description does not end properly"

def capitalize_checker(text):
    ''' This function checks if the initial letter of the text is capitalized '''
    if text[0].islower():
        return "Warning: the description initial letter is not capitalized"

def length_checker(text):
    ''' This function checks if the length of the text is less than 10 or more than 500 characters '''
    if len(text) < 10:
        return "Warning: the length of description is shorter than 10 characters"
    if len(text) > 500:
        return "Warning: the length of description is longer than 500 characters"
    if len(text) >= 10 and len(text) <= 500 and " " not in text:
        return "Warning: the description contains only one word"

def url_checker(text):
    ''' This function checks if the text contains an URL '''
    url_regex = re.compile("http|www.")
    if url_regex.search(text):
        return "Warning: the description contains an URL"

def names_checker(text, name):
    ''' This function checks if the text contains the tool name '''
    if "+" in name:
        name = name.replace("+", "\+")
    if "*" in name:
        name = name.replace("*", "\*")
    if "(" in name:
        name = name.replace("(", "\(")
    if ")" in name:
        name = name.replace(")", "\)")
    if "[" in name:
        name = name.replace("[", "\[")
    if "]" in name:
        name = name.replace("]", "\]")
    name_regex = re.compile(name, re.IGNORECASE)
    if name_regex.search(text):
        return "Warning: the description may contain the tool name"

def character_checker(text):
    ''' This function checks if the text contains some unwanted characters '''
    new_line_regex = re.compile("\n")
    carriage_return_regex = re.compile("↵")
    tab_regex = re.compile("\t")
    bullet_point_regex = re.compile("•")
    unknown_symbol_regex = re.compile("|�")

    error_list = []

    if new_line_regex.search(text):
        error_list.append("Warning: the description contains new lines")
    if carriage_return_regex.search(text):
        error_list.append("Warning: the description contains carriage returns")
    if tab_regex.search(text):
        error_list.append("Warning: the description contains tabs")
    if bullet_point_regex.search(text):
        error_list.append("Warning: the description contains bullet points")
    if unknown_symbol_regex.search(text):
        error_list.append("Warning: the description contains unknown symbols")

    return error_list

def dot_fixer(text):
    ''' This function calls dot_checker and returns a description with an ending dot if condition is TRUE '''
    if dot_checker(text):
        if text.endswith(" .") or text.endswith("..") or text.endswith(". "):
            return text.replace("..", ".").replace(" .", ".").replace(". ", ".")
        else:
            return text + "."

def capitalize_fixer(text):
    ''' This function calls capitalize_checker and returns an initial-capitalized description if condition is TRUE '''
    if capitalize_checker(text):
        return text[0].upper() + text[1:]

def character_fixer(text):
    ''' This function checks if the text contains some unwanted characters and removes them if needed'''
    new_line_regex = re.compile("\n")
    carriage_return_regex = re.compile("↵")
    tab_regex = re.compile("\t")
    bullet_point_regex = re.compile("•")
    unknown_symbol_regex = re.compile("|�")

    error_list = []

    if new_line_regex.search(text):
        text = text.replace("\n", " ")
    if carriage_return_regex.search(text):
        text = text.replace("↵", " ").replace("  ", " ")
    if tab_regex.search(text):
        text = text.replace("\t", " ").replace("  "," ")
    if bullet_point_regex.search(text):
        text = text.replace("•", ", ").replace("  "," ")
    if unknown_symbol_regex.search(text):
        text = text.replace("", "").replace("�", "")

    return text

def checker(text, name = None, dots_caps = True, length_check = True, url_check = True,
            names_check = True, character_check = True, character_fix=True):
    ''' This function checks if the given text (tool description and tool name) is written according the requirements:

    If dots_caps is False, the text is not checked /nor fixed if it has an ending dot and/or a capitalized initial
    If length_check is False, the text is not checked if its length is out of limits and the descriptions
    is made of more than one word
    If url_check is False, the text is not checked if it contains an URL
    If names_check is False, the text is not checked if it contains a tool name
    If character_check is False, the text is not checked if it contains unwanted characters '''

    name = "No name provided" if name is None else name
    # List of every errors in a description
    error = []
    if dots_caps:
        if dot_checker(text):
            error.append(dot_checker(text))
            text = dot_fixer(text)
        if capitalize_checker(text):
            error.append(capitalize_checker(text))
            text = capitalize_fixer(text)
    if length_check:
        if length_checker(text):
            error.append(length_checker(text))
    if url_check:
        if url_checker(text):
            error.append(url_checker(text))
    if names_check:
        if name == "No name provided":
            print "Warning: no names provided. Names cannot be checked"
        else:
            error.append(names_checker(text, name))
    if character_check:
        error += character_checker(text)
    if character_fix:
        text = character_fixer(text)
    # If no errors are reported, the empty list is returned
    if None in error:
        error.remove(None)
    return name, error, text

def data_iterator(texts, names=None, dot_caps_checking=True, url_checking=True, names_checking=True,
            length_checking=True, character_checking=True, character_fixing=True, to_file=True, file_name="Warnings"):
    '''This function iterates over the data frame/list/etc. and
    applies the checker function

    If dots_caps_cheking is False, the text is not checked /nor fixed if it has an ending dot and/or a capitalized initial
    If length_checking is False, the text is not checked if its length is out of limits and the descriptions
    is made of more than one word
    If url_checkomg is False, the text is not checked if it contains an URL
    If names_checking is False, the text is not checked if it contains a tool name
    If character_checking is False, the text is not checked if it contains unwanted characters
    If character_fixing is False, unwanted characters are not removed from the text
    If to_file is False, the output is not written to the file and just returned as a list of tuples'''
    error_list = []
    # checking if the names are given to the function
    if names is not None:
        # checking if the length of text list and name list is the same
        # if not, an error is raised
        if len(texts)==len(names):
            # iterating over the text list and applying checker function
            for i in range(len(texts)):
                checker_results = checker(texts[i], names[i], dots_caps=dot_caps_checking, url_check=url_checking,
                              names_check=names_checking, length_check=length_checking,
                              character_check=character_checking, character_fix=character_fixing)
                # adding the checker function results from the dictionary to the list
                error_list += [checker_results]
            # creating a dataframe from a full list of checker function results from all the items
            error_df = pd.DataFrame(error_list, columns=["Name", "Warning", "Fixed capitalized/dotted description"])
            # if to_file is True, results are written to the file
            if to_file:
                error_df.to_csv(file_name+".csv")
            # othewise, results are returned as a list of tuples with
            # the tool name and errors which occurred
            else:
                return error_df
        else:
            raise Exception("The length of two lists is different")
    # if names are not provided
    else:
        # iterating over the text list and applying checker function
        for i in range(len(texts)):
            checker_results = checker(texts[i], dots_caps=dot_caps_checking, url_check=url_checking,
                          names_check=names_checking, length_check=length_checking,
                          character_check=character_checking, character_fix=character_fixing)
            # adding the checker function results from the dictionary to the list
            error_list += [checker_results]
        # creating a dataframe from a full list of checker function results from all the items
        error_df = pd.DataFrame(error_list, columns=["Name", "Warning", "Fixed capitalized/dotted description"])
        # if to_file is True, results are written to the file
        if to_file:
            error_df.to_csv(file_name+"_no_name.csv")
        # othewise, results are returned as a list of tuples with the errors which occurred
        else:
            return error_df

def __number2bool(number):
    if number==1:
        return True
    else:
        return False

if __name__ == "__main__":
    import argparse
    parser = argparse.ArgumentParser(description = "Command line tool for checking tool descriptions")
    parser.add_argument("-m", "--mode", help="Mode of the checker: \"full\" - checks descriptions with their names;" \
                                            "\"parial\" - checks only the descriptions.")
    parser.add_argument("-one-file", "--one", help="Input descriptions and names from one file. "
                                                   "Usable only with mode \"full\".",
                        required=False, action = 'store_true')
    parser.add_argument("-d", "--descriptions", help="File with descriptions.")
    parser.add_argument("-n", "--names", help="File with description names.")
    parser.add_argument("-sentence", "--sentence_checker", help="Check if descriptions start with a capital letter and end"
                                                                " with a dot. Options: \"1\" to use the argument,"
                                                                " \"0\" for skipping the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-url", "--url_checker", help="Check if descriptions contain URLs. Options: \"1\" to use the argument, "
                                                      "\"0\" for skipping the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-name", "--name_check", help="Check if the description contains names. Options: \"1\" to use the argument, "
                                                      "\"0\" for skipping the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-length", "--length_check", help="Check if the description length is within the limits and "
                                                          "the descriptions is made of more than one word. "
                                                          "Options: \"1\" to use the argument, \"0\" for skipping the argument. "
                                                          "Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-character", "--character_check", help="Check if the description contains unwanted characters "
                                                                "Options: \"1\" to use the argument, \"0\" for skipping "
                                                                "the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-char-fix", "--character_fix", help="Check if the description contains unwanted characters and "
                                                             "remove them. Options: \"1\" to use the argument, \"0\" for "
                                                             "skipping the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-to-file", "--file", help="Write all the output to a .csv file. Options: \"1\" to use the argument, "
                                                   "\"0\" for skipping the argument. Default is 1.",
                        type=int, required=False, default=True)
    parser.add_argument("-filename", "--file_name", help="Choose the output file name if the argument -to-file is True. "
                                                         "Default is \"Warnings\".",
                        type=str, required=False, default="Warnings")

    args = vars(parser.parse_args())

    if args["mode"] == "full":
        if args["one"]:
            descriptions_names = pd.read_table(args["descriptions"], header=None, index_col=None)
            names = descriptions_names[0]
            descriptions = descriptions_names[1]

            print data_iterator(descriptions, names,
                                dot_caps_checking=__number2bool(args["sentence_checker"]),
                                url_checking=__number2bool(args["url_checker"]),
                                names_checking=__number2bool(args["name_check"]),
                                length_checking=__number2bool(args["length_check"]),
                                character_checking=__number2bool(args["character_check"]),
                                character_fixing=__number2bool(args["character_fix"]),
                                to_file=__number2bool(args["file"]),
                                file_name=args["file_name"])
        else:
            descriptions = pd.read_table(args["descriptions"], header=None, index_col=None)
            names = pd.read_table(args["names"], header=None, index_col=None)
            names = names[0]
            descriptions = descriptions[0]
            print data_iterator(descriptions, names,
                          dot_caps_checking=__number2bool(args["sentence_checker"]),
                          url_checking=__number2bool(args["url_checker"]),
                          names_checking=__number2bool(args["name_check"]),
                          length_checking=__number2bool(args["length_check"]),
                          character_checking=__number2bool(args["character_check"]),
                          character_fixing=__number2bool(args["character_fix"]),
                          to_file=__number2bool(args["file"]),
                          file_name=args["file_name"])
    elif args["mode"] == "partial":
        descriptions = pd.read_table(args["descriptions"], header=None, index_col=None)
        descriptions = descriptions[0]
        print data_iterator(descriptions,
                      dot_caps_checking=__number2bool(args["sentence_checker"]),
                      url_checking=__number2bool(args["url_checker"]),
                      names_checking=__number2bool(args["name_check"]),
                      length_checking=__number2bool(args["length_check"]),
                      character_checking=__number2bool(args["character_check"]),
                      character_fixing=__number2bool(args["character_fix"]),
                      to_file=__number2bool(args["file"]),
                      file_name=args["file_name"])
    else:
        print "Mode Error: The mode is wrong." \
              "\nUsage: python btcorrector.py <mode> <description file> <name file>" \
              "\n<mode>: \"full\" or \"partial\""


text:
package fastcgi

import (
	"bufio"
	"bytes"
	"io"
	"mime/multipart"
	"net"
	"net/http"
	"net/http/httputil"
	"net/textproto"
	"net/url"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"go.uber.org/zap"
)

// FCGIListenSockFileno describes listen socket file number.
const FCGIListenSockFileno uint8 = 0

// FCGIHeaderLen describes header length.
const FCGIHeaderLen uint8 = 8

// Version1 describes the version.
const Version1 uint8 = 1

// FCGINullRequestID describes the null request ID.
const FCGINullRequestID uint8 = 0

// FCGIKeepConn describes keep connection mode.
const FCGIKeepConn uint8 = 1

const (
	// BeginRequest is the begin request flag.
	BeginRequest uint8 = iota + 1
	// AbortRequest is the abort request flag.
	AbortRequest
	// EndRequest is the end request flag.
	EndRequest
	// Params is the parameters flag.
	Params
	// Stdin is the standard input flag.
	Stdin
	// Stdout is the standard output flag.
	Stdout
	// Stderr is the standard error flag.
	Stderr
	// Data is the data flag.
	Data
	// GetValues is the get values flag.
	GetValues
	// GetValuesResult is the get values result flag.
	GetValuesResult
	// UnknownType is the unknown type flag.
	UnknownType
	// MaxType is the maximum type flag.
	MaxType = UnknownType
)

const (
	// Responder is the responder flag.
	Responder uint8 = iota + 1
	// Authorizer is the authorizer flag.
	Authorizer
	// Filter is the filter flag.
	Filter
)

const (
	// RequestComplete is the completed request flag.
	RequestComplete uint8 = iota
	// CantMultiplexConns is the multiplexed connections flag.
	CantMultiplexConns
	// Overloaded is the overloaded flag.
	Overloaded
	// UnknownRole is the unknown role flag.
	UnknownRole
)

const (
	// MaxConns is the maximum connections flag.
	MaxConns string = "MAX_CONNS"
	// MaxRequests is the maximum requests flag.
	MaxRequests string = "MAX_REQS"
	// MultiplexConns is the multiplex connections flag.
	MultiplexConns string = "MPXS_CONNS"
)

const (
	maxWrite = 65500 // 65530 may work, but for compatibility
	maxPad   = 255
)

// for padding so we don't have to allocate all the time
// not synchronized because we don't care what the contents are
var pad [maxPad]byte

// client implements a FastCGI client, which is a standard for
// interfacing external applications with Web servers.
type client struct {
	rwc net.Conn
	// keepAlive bool // TODO: implement
	reqID  uint16
	stderr bool
	logger *zap.Logger
}

// Do made the request and returns a io.Reader that translates the data read
// from fcgi responder out of fcgi packet before returning it.
func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error) {
	writer := &streamWriter{c: c}
	writer.buf = bufPool.Get().(*bytes.Buffer)
	writer.buf.Reset()
	defer bufPool.Put(writer.buf)

	err = writer.writeBeginRequest(uint16(Responder), 0)
	if err != nil {
		return
	}

	writer.recType = Params
	err = writer.writePairs(p)
	if err != nil {
		return
	}

	writer.recType = Stdin
	if req != nil {
		_, err = io.Copy(writer, req)
		if err != nil {
			return nil, err
		}
	}
	err = writer.FlushStream()
	if err != nil {
		return nil, err
	}

	r = &streamReader{c: c}
	return
}

// clientCloser is a io.ReadCloser. It wraps a io.Reader with a Closer
// that closes the client connection.
type clientCloser struct {
	rwc net.Conn
	r   *streamReader
	io.Reader

	status int
	logger *zap.Logger
}

func (f clientCloser) Close() error {
	stderr := f.r.stderr.Bytes()
	if len(stderr) == 0 {
		return f.rwc.Close()
	}

	if f.status >= 400 {
		f.logger.Error("stderr", zap.ByteString("body", stderr))
	} else {
		f.logger.Warn("stderr", zap.ByteString("body", stderr))
	}

	return f.rwc.Close()
}

// Request returns a HTTP Response with Header and Body
// from fcgi responder
func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Response, err error) {
	r, err := c.Do(p, req)
	if err != nil {
		return
	}

	rb := bufio.NewReader(r)
	tp := textproto.NewReader(rb)
	resp = new(http.Response)

	// Parse the response headers.
	mimeHeader, err := tp.ReadMIMEHeader()
	if err != nil && err != io.EOF {
		return
	}
	resp.Header = http.Header(mimeHeader)

	if resp.Header.Get("Status") != "" {
		statusNumber, statusInfo, statusIsCut := strings.Cut(resp.Header.Get("Status"), " ")
		resp.StatusCode, err = strconv.Atoi(statusNumber)
		if err != nil {
			return
		}
		if statusIsCut {
			resp.Status = statusInfo
		}

	} else {
		resp.StatusCode = http.StatusOK
	}

	// TODO: fixTransferEncoding ?
	resp.TransferEncoding = resp.Header["Transfer-Encoding"]
	resp.ContentLength, _ = strconv.ParseInt(resp.Header.Get("Content-Length"), 10, 64)

	// wrap the response body in our closer
	closer := clientCloser{
		rwc:    c.rwc,
		r:      r.(*streamReader),
		Reader: rb,
		status: resp.StatusCode,
		logger: noopLogger,
	}
	if chunked(resp.TransferEncoding) {
		closer.Reader = httputil.NewChunkedReader(rb)
	}
	if c.stderr {
		closer.logger = c.logger
	}
	resp.Body = closer

	return
}

// Get issues a GET request to the fcgi responder.
func (c *client) Get(p map[string]string, body io.Reader, l int64) (resp *http.Response, err error) {

	p["REQUEST_METHOD"] = "GET"
	p["CONTENT_LENGTH"] = strconv.FormatInt(l, 10)

	return c.Request(p, body)
}

// Head issues a HEAD request to the fcgi responder.
func (c *client) Head(p map[string]string) (resp *http.Response, err error) {

	p["REQUEST_METHOD"] = "HEAD"
	p["CONTENT_LENGTH"] = "0"

	return c.Request(p, nil)
}

// Options issues an OPTIONS request to the fcgi responder.
func (c *client) Options(p map[string]string) (resp *http.Response, err error) {

	p["REQUEST_METHOD"] = "OPTIONS"
	p["CONTENT_LENGTH"] = "0"

	return c.Request(p, nil)
}

// Post issues a POST request to the fcgi responder. with request body
// in the format that bodyType specified
func (c *client) Post(p map[string]string, method string, bodyType string, body io.Reader, l int64) (resp *http.Response, err error) {
	if p == nil {
		p = make(map[string]string)
	}

	p["REQUEST_METHOD"] = strings.ToUpper(method)

	if len(p["REQUEST_METHOD"]) == 0 || p["REQUEST_METHOD"] == "GET" {
		p["REQUEST_METHOD"] = "POST"
	}

	p["CONTENT_LENGTH"] = strconv.FormatInt(l, 10)
	if len(bodyType) > 0 {
		p["CONTENT_TYPE"] = bodyType
	} else {
		p["CONTENT_TYPE"] = "application/x-www-form-urlencoded"
	}

	return c.Request(p, body)
}

// PostForm issues a POST to the fcgi responder, with form
// as a string key to a list values (url.Values)
func (c *client) PostForm(p map[string]string, data url.Values) (resp *http.Response, err error) {
	body := bytes.NewReader([]byte(data.Encode()))
	return c.Post(p, "POST", "application/x-www-form-urlencoded", body, int64(body.Len()))
}

// PostFile issues a POST to the fcgi responder in multipart(RFC 2046) standard,
// with form as a string key to a list values (url.Values),
// and/or with file as a string key to a list file path.
func (c *client) PostFile(p map[string]string, data url.Values, file map[string]string) (resp *http.Response, err error) {
	buf := &bytes.Buffer{}
	writer := multipart.NewWriter(buf)
	bodyType := writer.FormDataContentType()

	for key, val := range data {
		for _, v0 := range val {
			err = writer.WriteField(key, v0)
			if err != nil {
				return
			}
		}
	}

	for key, val := range file {
		fd, e := os.Open(val)
		if e != nil {
			return nil, e
		}
		defer fd.Close()

		part, e := writer.CreateFormFile(key, filepath.Base(val))
		if e != nil {
			return nil, e
		}
		_, err = io.Copy(part, fd)
		if err != nil {
			return
		}
	}

	err = writer.Close()
	if err != nil {
		return
	}

	return c.Post(p, "POST", bodyType, buf, int64(buf.Len()))
}

// SetReadTimeout sets the read timeout for future calls that read from the
// fcgi responder. A zero value for t means no timeout will be set.
func (c *client) SetReadTimeout(t time.Duration) error {
	if t != 0 {
		return c.rwc.SetReadDeadline(time.Now().Add(t))
	}
	return nil
}

// SetWriteTimeout sets the write timeout for future calls that send data to
// the fcgi responder. A zero value for t means no timeout will be set.
func (c *client) SetWriteTimeout(t time.Duration) error {
	if t != 0 {
		return c.rwc.SetWriteDeadline(time.Now().Add(t))
	}
	return nil
}

// Checks whether chunked is part of the encodings stack
func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" }

redpajama_set_name: RedPajamaGithub


text:
import factory

from tt_streams import factories

from . import models

class StoryFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Story

class StoryItemFactory(factories.StreamItemFactory):
    FACTORY_FOR = models.StoryItem

class VideoFactory(factory.django.DjangoModelFactory):
    FACTORY_FOR = models.Video

class VideoItemFactory(factories.StreamItemFactory):
    FACTORY_FOR = models.VideoItem


text:
package net.dev123.mblog.sina;

import net.dev123.commons.util.ParseUtil;
import net.dev123.entity.GeoLocation;
import net.dev123.entity.Location;
import net.dev123.exception.ExceptionCode;
import net.dev123.exception.LibException;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author Weiping Ye
 * @version 创建时间:2011-8-19 下午1:51:09
 **/
public class SinaGeoAdaptor {

	public static Location createLocationFromJson(String jsonStr)
			throws LibException {
		Location location = null;
		try {
			if ("[]".equals(jsonStr) || "{}".equals(jsonStr)) {
				return null;
			}
			JSONObject jsonObj = new JSONObject(jsonStr);
			if (!jsonObj.isNull("address")) {
				JSONObject jsonAddr = jsonObj.getJSONObject("address");
				location = new Location();
				location.setProvince(ParseUtil.getRawString("prov_name", jsonAddr));
				location.setCity(ParseUtil.getRawString("city_name", jsonAddr));
				location.setDistrict(ParseUtil.getRawString("district_name", jsonAddr));
				if (!jsonAddr.isNull("street")) {
					location.setStreet(ParseUtil.getRawString("street", jsonAddr));
				}
			}

		} catch (JSONException e) {
			throw new LibException(ExceptionCode.JSON_PARSE_ERROR, e);
		}
		return location;
	}
}


text:
package org.ike.wechat.core.menu.bean;

import org.apache.log4j.Logger;
import org.ike.wechat.core.IkeChat;

import java.util.ArrayList;
import java.util.List;

/**
 * Class Name: SelfButton
 * Create Date: 2016/6/26 15:18
 * Creator: Xuejia
 * Version: v1.0
 * Updater:
 * Date Time:
 * Description: 菜单按钮类
 */
public class Button {
    private String type;
    private String name;
    private String key;
    private String url;
    private String media_id;
    private List<Button> sub_button;
    private boolean isSub = false;

    public void addSubButton(Button button) {
        if (sub_button == null) {
            sub_button = new ArrayList<Button>();
        }
        button.isSub = true;
        if (!this.isSub) {
            sub_button.add(button);
        } else {
            Logger.getLogger(IkeChat.LOGGER_NAME).warn("子菜单添加失败,不允许向二级菜单中添加子菜单:" + button.toString());
        }
    }

    public Button() {
        this.sub_button = new ArrayList<Button>();
    }

    public Button(String type) {
        this.type = type;
    }

    public Button(String type, String name) {
        this(type);
        this.name = name;
    }

    public Button(String type, String name, String key) {
        this(type, name);
        this.key = key;
    }

    public Button(String type, String name, String key, String url) {
        this(type, name, key);
        this.url = url;
    }

    public Button(String type, String name, String key, String url, String media_id) {
        this(type, name, key, url);
        this.media_id = media_id;
    }

    public Button(String type, String name, String key, String url, String media_id, List<Button> sub_button) {
        this(type, name, key, url, media_id);
        this.sub_button = sub_button;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getMedia_id() {
        return media_id;
    }

    public void setMedia_id(String media_id) {
        this.media_id = media_id;
    }

    public List<Button> getSub_button() {
        return sub_button;
    }

    public void setSub_button(List<Button> sub_button) {
        this.sub_button = sub_button;
    }

    @Override
    public String toString() {
        return "SelfButton{" +
                "type='" + type + '\'' +
                ", name='" + name + '\'' +
                ", key='" + key + '\'' +
                ", url='" + url + '\'' +
                ", media_id='" + media_id + '\'' +
                ", sub_button=" + sub_button +
                ", isSub=" + isSub +
                '}';
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <title>Stand Alone Redirect Wizard</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css">


text:
<?php

namespace Balanced\Errors;

use Balanced\Errors\Error;

class CannotAssociateCard extends Error
{
    public static $codes = array('cannot-associate-card');
}


text:
class Equipment::Radius::AccountingProfileStartAttribute < Equipment::Radius::Attribute
  self.table_name='class4.radius_accounting_profile_start_attributes'
  has_paper_trail class_name: 'AuditLogItem'

  belongs_to :profile, class_name: Equipment::Radius::AccountingProfile, foreign_key: :profile_id

end


text:
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
    <customrules>
    </customrules>
    <fields>
		<field name="user_id" required="true" rule="userid" />
		<field name="password" required="true" />
    </fields>
</ruleset>


text:
package ocr

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// Invoice is a nested struct in ocr response
type Invoice struct {
	RotateType int        `json:"RotateType" xml:"RotateType"`
	InvoiceRoi InvoiceRoi `json:"InvoiceRoi" xml:"InvoiceRoi"`
	Items      []Item     `json:"Items" xml:"Items"`
}


text:
#import <CoreLocation/CoreLocation.h>
#import <Foundation/Foundation.h>
#import "BMKPoiSearchType.h"
#import "BMKTypes.h"
///路段类型枚举
typedef enum
{
    BMK_BUSLINE                 = 0,///公交
	BMK_SUBWAY                  = 1,///地铁
 	BMK_WAKLING                 = 2,///步行
}BMKTransitStepType;

typedef enum
{
	BMK_TRANSIT_TIME_FIRST = 3,		//较快捷(公交)
	BMK_TRANSIT_TRANSFER_FIRST = 4,	//少换乘(公交)
	BMK_TRANSIT_WALK_FIRST = 5,		//少步行(公交)
	BMK_TRANSIT_NO_SUBWAY = 6,		//不坐地铁
}BMKTransitPolicy;

typedef enum
{
    BMK_DRIVING_BLK_FIRST = -1, //躲避拥堵(自驾)
	BMK_DRIVING_TIME_FIRST = 0,	//最短时间(自驾)
	BMK_DRIVING_DIS_FIRST = 1,	//最短路程(自驾)
	BMK_DRIVING_FEE_FIRST,		//少走高速(自驾)

}BMKDrivingPolicy;

typedef enum
{
    BMK_DRIVING_REQUEST_TRAFFICE_TYPE_NONE = 0,                 //不带路况
    BMK_DRIVING_REQUEST_TRAFFICE_TYPE_PATH_AND_TRAFFICE = 1,    //道路和路况
}BMKDrivingRequestTrafficType;

///打车信息类
@interface BMKTaxiInfo : NSObject{
    NSString* _desc;
    int       _distance;
    int       _duration;
    float     _perKMPrice;
    int       _totalPrice;
}
///路线打车描述信息
@property (nonatomic, strong) NSString* desc;
///总路程,单位: 米
@property (nonatomic) int distance;
///总耗时,单位: 秒
@property (nonatomic) int duration;
///每千米单价,单位 元
@property (nonatomic) float perKMPrice;
///总价 , 单位: 元
@property (nonatomic) int totalPrice;

@end

///路线换乘方案里的交通工具信息类
@interface BMKVehicleInfo : NSObject{
    NSString* _uid;
    NSString* _title;
    int       _passStationNum;
    int       _totalPrice;
    int       _zonePrice;
}
///该交通路线的标识
@property (nonatomic, strong) NSString* uid;
///该交通路线的名称
@property (nonatomic, strong) NSString* title;
///该交通路线的所乘站数
@property (nonatomic) int passStationNum;
///该交通路线的全程价格
@property (nonatomic) int totalPrice;
///该交通路线的所乘区间的区间价格
@property (nonatomic) int zonePrice;
@end

///此类代表一个时间段,每个属性都是一个时间段。
@interface BMKTime : NSObject{
    int       _dates;
    int       _hours;
    int       _minutes;
    int       _seconds;

}

///时间段,单位(天)
@property (nonatomic) int dates;
///时间段,单位(小时)
@property (nonatomic) int hours;
///时间段,单位(分)
@property (nonatomic) int minutes;
///时间段,单位(秒)
@property (nonatomic) int seconds;
@end

///此类表示路线中的一节点,节点包括:路线起终点,公交站点等
@interface BMKRouteNode : NSObject{
    NSString*              _uid;
    NSString*              _title;
    CLLocationCoordinate2D _location;
}
///该节点uid
@property (nonatomic, strong) NSString* uid;
///该节点的名称
@property (nonatomic, strong) NSString* title;
///该节点的坐标
@property (nonatomic) CLLocationCoordinate2D location;
@end
///此类表示公交站点信息
@interface BMKBusStation : BMKRouteNode
@end

///此类表示路线中的一个路段(基类)
@interface BMKRouteStep : NSObject{
    int          _distance;
    int          _duration;
    BMKMapPoint* _points;
    int          _pointsCount;
}
///路段长度 单位: 米
@property (nonatomic) int distance;
///路段耗时 单位: 秒
@property (nonatomic) int duration;
///路段所经过的地理坐标集合
@property (nonatomic) BMKMapPoint* points;
///路段所经过的地理坐标集合内点的个数
@property (nonatomic) int pointsCount;

@end
///此类表示公交线路中的一个路段
@interface BMKBusStep : BMKRouteStep
@end
///此类表示公交换乘路线中的一个路段
@interface BMKTransitStep : BMKRouteStep{
    BMKRouteNode*        _entrace;
    BMKRouteNode*        _exit;
    NSString*            _instruction;
    BMKTransitStepType   _stepType;
    BMKVehicleInfo*      _vehicleInfo;
}
///路段入口信息
@property (nonatomic, strong) BMKRouteNode* entrace;
///路段出口信息
@property (nonatomic, strong) BMKRouteNode* exit;
///路段换乘说明
@property (nonatomic, strong) NSString* instruction;
///路段类型
@property (nonatomic) BMKTransitStepType stepType;
///当路段为公交路段或地铁路段时,可以获取交通工具信息
@property (nonatomic, strong) BMKVehicleInfo* vehicleInfo;
@end
///此类表示驾车路线中的一个路段
@interface BMKDrivingStep : BMKRouteStep{
    int                  _direction;
    BMKRouteNode*        _entrace;
    NSString*            _entraceInstruction;
    BMKRouteNode*        _exit;
    NSString*            _exitInstruction;
    NSString*            _instruction;
    int                  _numTurns;
}
///该路段起点方向值
@property (nonatomic) int direction;
///路段入口信息
@property (nonatomic, strong) BMKRouteNode* entrace;
///路段入口的指示信息
@property (nonatomic, strong) NSString* entraceInstruction;
///路段出口信息
@property (nonatomic, strong) BMKRouteNode* exit;
///路段出口指示信息
@property (nonatomic, strong) NSString* exitInstruction;
///路段总体指示信息
@property (nonatomic, strong) NSString* instruction;
///路段需要转弯数
@property (nonatomic) int numTurns;
///路段是否有路况信息
@property (nonatomic) BOOL hasTrafficsInfo;
///路段的路况信息,成员为NSNumber。0:无数据;1:畅通;2:缓慢;3:拥堵
@property (nonatomic, strong) NSArray* traffics;

@end
///此类表示步行路线中的一个路段
@interface BMKWalkingStep : BMKRouteStep{
    int                  _direction;
    BMKRouteNode*        _entrace;
    NSString*            _entraceInstruction;
    BMKRouteNode*        _exit;
    NSString*            _exitInstruction;
    NSString*            _instruction;
}
///该路段起点方向值
@property (nonatomic) int direction;
///路段入口信息
@property (nonatomic, strong) BMKRouteNode* entrace;
///获取该路段换乘说明
@property (nonatomic, strong) NSString* entraceInstruction;
///路段出口信息
@property (nonatomic, strong) BMKRouteNode* exit;
///获取该路段换乘说明
@property (nonatomic, strong) NSString* exitInstruction;
///获取该路段换乘说明
@property (nonatomic, strong) NSString* instruction;
@end

///此类表示路线数据结构的基类,表示一条路线,路线可能包括:路线规划中的换乘/驾车/步行路线
///此类为路线数据结构的基类,一般关注其子类对象即可,无需直接生成该类对象
@interface BMKRouteLine : NSObject{
    int                  _distance;
    BMKTime*             _duration;
    BMKRouteNode*        _starting;
    BMKRouteNode*        _terminal;
    NSString*            _title;
    NSArray*             _steps;
}
///路线长度 单位: 米
@property (nonatomic) int distance;
///路线耗时 单位: 秒
@property (nonatomic, strong) BMKTime* duration;
///路线起点信息
@property (nonatomic, strong) BMKRouteNode* starting;
///路线终点信息
@property (nonatomic, strong) BMKRouteNode* terminal;
///路线名称(预留字段,现为空)
@property (nonatomic, strong) NSString* title;
///路线中的所有路段,成员类型为BMKWalkingStep,BMKDrivingStep,BMKTransitStep
@property (nonatomic, strong) NSArray* steps;
@end
///此类表示一个换乘路线,换乘路线将根据既定策略调配多种交通工具
@interface BMKTransitRouteLine : BMKRouteLine
@end
///此类表示一条驾车路线
@interface BMKDrivingRouteLine : BMKRouteLine{
    bool                 _isSupportTraffic;//从2.7.0开始,废弃
    NSArray*             _wayPoints;
}
///该路线所在区域是否含有交通流量信息,从2.7.0开始,废弃
@property (nonatomic) bool isSupportTraffic;
///路线途经点列表,成员类型为BMKPlanNode
@property (nonatomic, strong) NSArray* wayPoints;
@end
///此类表示一条步行路线
@interface BMKWalkingRouteLine : BMKRouteLine
@end

///路线搜索地址结果类.当输入的起点或终点有多个地点选择时,或者选定的城市没有此地点,但其它城市有(驾乘或步行),返回该类的实例
@interface BMKSuggestAddrInfo : NSObject
{
	NSArray* _startPoiList;
	NSArray* _endPoiList;
	NSArray* _startCityList;
	NSArray* _endCityList;
    NSArray* _wayPointsPoiList;
    NSArray* _wayPointsCityList;
}
///起点POI列表,成员类型为BMKPoiInfo
@property (nonatomic, strong) NSArray* startPoiList;
///起点城市列表,成员类型为BMKCityListInfo,如果输入的地点在本城市没有而在其它城市有,则返回其它城市的信息
@property (nonatomic, strong) NSArray* startCityList;
///终点POI列表,成员类型为BMKPoiInfo
@property (nonatomic, strong) NSArray* endPoiList;
///终点城市列表,成员类型为BMKCityListInfo,如果输入的地点在本城市没有而在其它城市有,则返回其它城市的信息
@property (nonatomic, strong) NSArray* endCityList;
///途经点POI列表,成员类型为NSArray<BMKPoiInfo*>
@property (nonatomic, strong) NSArray* wayPointPoiList;
///途经点城市列表,成员类型为NSArray<BMKCityListInfo*>,如果输入的地点在本城市没有而在其它城市有,则返回其它城市的信息
@property (nonatomic, strong) NSArray* wayPointCityList;
@end

///此类表示公共交通信息查询结果
@interface BMKBusLineResult : NSObject{
    NSString* _busCompany;
    NSString* _busLineName;
    NSString* _uid;
    NSString* _startTime;
    NSString* _endTime;
    int       _isMonTicket;
    NSArray*  _busStations;
    NSArray*  _busSteps;
}
///公交公司名称
@property (nonatomic, strong) NSString* busCompany;
///公交线路名称
@property (nonatomic, strong) NSString* busLineName;
///公交线路uid
@property (nonatomic, strong) NSString* uid;
///公交路线首班车时间
@property (nonatomic, strong) NSString* startTime;
///公交路线末班车时间
@property (nonatomic, strong) NSString* endTime;
///公交是线是否有月票
@property (nonatomic) int isMonTicket;
///所有公交站点信息,成员类型为BMKBusStation
@property (nonatomic, strong) NSArray* busStations;
///公交路线分段信息,成员类型为BMKBusStep
@property (nonatomic, strong) NSArray* busSteps;
@end

///此类表示步行路线结果
@interface BMKWalkingRouteResult : NSObject{
    BMKTaxiInfo*        _taxiInfo;
    BMKSuggestAddrInfo* _suggestAddrResult;
    NSArray*            _routes;
}
///该路线打车信息
@property (nonatomic, strong) BMKTaxiInfo* taxiInfo;
///返回起点或终点的地址信息结果
@property (nonatomic, strong) BMKSuggestAddrInfo* suggestAddrResult;
///步行结果,现在只返回一条。成员类型为BMKWalkingRouteLine
@property (nonatomic, strong) NSArray* routes;
@end
///此类表示驾车路线结果
@interface BMKDrivingRouteResult : NSObject{
    BMKTaxiInfo*        _taxiInfo;
    BMKSuggestAddrInfo* _suggestAddrResult;
    NSArray*            _routes;
}
///该路线打车信息
@property (nonatomic, strong) BMKTaxiInfo* taxiInfo;
///返回起点或终点的地址信息结果
@property (nonatomic, strong) BMKSuggestAddrInfo* suggestAddrResult;
///驾车结果,支持多路线。成员类型为BMKDrivingRouteLine
@property (nonatomic, strong) NSArray* routes;
@end

@interface BMKTransitRouteResult : NSObject{
    BMKTaxiInfo*        _taxiInfo;
    BMKSuggestAddrInfo* _suggestAddrResult;
    NSArray*            _routes;
}
///该路线打车信息
@property (nonatomic, strong) BMKTaxiInfo* taxiInfo;
///返回起点或终点的地址信息结果
@property (nonatomic, strong) BMKSuggestAddrInfo* suggestAddrResult;
///方案数组,成员类型为BMKTransitRouteLine
@property (nonatomic, strong) NSArray* routes;

@end


text:
const {assoc, filter, mapObjIndexed, map, values, flatten, pipe} = require("ramda")
const addFilenameToLinks = require("./add-filename-to-links")
const getFileContents = require("./get-file-contents")
const pickHtmlFiles = require("./pick-html-files")
const shouldCheckLink = require("./should-check-link")
const handleLinks = require("./handle-links")
const isLinkBroken = require("./is-link-broken")
const extractLinks = require("./extract-links")
const extractAnchorTargets = require("./extract-anchor-targets")
const path = require("path")

function fileExists(files, filename) {
  // Remove leading slash before checking to match the Metalsmith files format
  if (filename.charAt(0) === "/") {
    filename = filename.slice(1)
  }

  // True if it exists in the files object
  if (filename in files) {
    return true
  }

  // Fallback for Windows paths
  const winPath = filename.split("/").join(path.sep)
  return winPath in files
}

function fileHasTarget(filesToTargets, filename, target) {
  // Remove leading slash before checking to match the Metalsmith files format
  if (filename.charAt(0) === "/") {
    filename = filename.slice(1)
  }

  if (!(filename in filesToTargets)) {
    filename = filename.split("/").join(path.sep)
  }

  // If we request no fragment, then it's available.
  if (!target) {
    return true
  }

  return filesToTargets[filename] && filesToTargets[filename].indexOf(target) >= 0
}

module.exports = (options) => {

  if (options == null) { options = {} }
  if (options === true) { options = {} } // Allow CLI to specify true
  if (options.warn == null) { options.warn = false }
  if (options.checkLinks == null) { options.checkLinks = true }
  if (options.checkImages == null) { options.checkImages = true }
  if (options.checkAnchors == null) { options.checkAnchors = false }
  if (options.allowRegex == null) { options.allowRegex = null }
  if (options.allowAnchors == null) { options.allowAnchors = true }
  if (options.baseURL == null) { options.baseURL = null }

  return (files) => {
    const normalized = files

    // Skip calculations if not needed
    let filesToTargets = null
    if (options.checkAnchors) {
      filesToTargets = pipe(
        pickHtmlFiles,
        map(getFileContents),
        map(extractAnchorTargets)
      )(normalized)
    }

    pipe(
      pickHtmlFiles,
      map(getFileContents),
      map(extractLinks),
      mapObjIndexed(addFilenameToLinks),
      values,
      flatten,
      filter(shouldCheckLink(options)),
      map(addBrokenStatus(files, filesToTargets, fileExists, fileHasTarget, options)),
      handleLinks(options)
    )(normalized)
  }
}

function addBrokenStatus(files, filesToTargets, fileExists, fileHasTarget, options) {
  return (link) => {
    const broken = isLinkBroken({
      files,
      filesToTargets,
      fileExists,
      fileHasTarget,
      link,
      options,
    })

    return assoc("broken", broken, link)
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Openbizx Cubi Application Platform
  LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  Copyright (c) 2005-2011, Openbiz Technology LLC
  Version $Id: ReleaseDetailForm.xml 3369 2012-05-31 06:13:56Z rockyswen@gmail.com $
-->
<EasyForm Name="ReleaseDetailForm" Class="ReleaseForm" inheritFrom="repository.release.widget.ReleaseDetailROForm"  Access="Repository.Manage">

    <ActionPanel>

        <Element Name="btn_download" Class="Button" Text="Download" CssClass="button_gray_w">
            <EventHandler Name="btn_download_onclick" Event="onclick" FunctionType="Page" Function="FileDownload({@:Elem[fld_Id].Value})"/>
        </Element>

		<Element Name="btn_spacer" Class="Spacer" width="10" />
		<Element Name="btn_edit" Class="Button" Text="Edit" CssClass="button_gray_m">
            <EventHandler Name="btn_close_onclick" Event="onclick" Function="switchForm(repository.release.widget.ReleaseEditForm,{@:Elem[fld_Id].Value})"/>
        </Element>
        <Element Name="btn_showlog" Class="Button" Text="Log" CssClass="button_gray_m">
            <EventHandler Name="btn_showlog_onclick" Event="onclick" Function="switchForm(repository.release.widget.ReleaseInstallLogForm,,release_id={@:Elem[fld_Id].Value})"/>
        </Element>
        <Element Name="btn_close" Class="Button" Text="Close" CssClass="button_gray_m">
            <EventHandler Name="btn_close_onclick" Event="onclick" Function="close()"/>
        </Element>
    </ActionPanel>
    <NavPanel>
    </NavPanel>
    <SearchPanel>
    </SearchPanel>
</EasyForm>


text:
package uk.ac.ebi.pride.jmztab.utils.errors;

import uk.ac.ebi.pride.jmztab.model.MZTabConstants;

import java.io.*;

/**
 * @author qingwei
 * @since 05/11/13
 */
public class WikiRun {
    private OutputStream out = System.out;

    private void writeLine(String content) throws IOException {
        out.write(content.getBytes());
        out.write(MZTabConstants.NEW_LINE.getBytes());
    }

    /**
     * print all error messages to wiki document.
     */
    private void printErrorMessage() throws Exception {
        MZTabErrorTypeMap errorMap = new MZTabErrorTypeMap();
        for (MZTabErrorType errorType : errorMap.getTypeMap().values()) {
            writeLine("|| *    Code*: || " + errorType.getCode() + " ||");
            writeLine("|| *   Level*: || " + errorType.getLevel() + " ||");
            writeLine("|| *Original*: || " + errorType.getOriginal() + " ||");
            writeLine("|| *   Cause*: || " + errorType.getCause() + " ||");
            writeLine("|| || ||");
            writeLine("|| || ||");
        }
    }

    private void printTabSplitFile(String header, String inFile) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(inFile));

        String line;
        String[] items;
        writeLine("|| *" + header + "* || *Identification* || *Quantification* ||");
        while ((line = reader.readLine()) != null) {
            items = line.split("\t");
            if (items.length == 1) {
                writeLine("|| || || " + items[0] + " ||");
            } else if (items.length == 2){
                writeLine("|| || " + items[0] + " || " + items[1] + " ||");
            }
        }

        reader.close();
    }

    /**
     * print summary table file to wiki document.
     */
    private void printSummaryTable() throws Exception {
        printTabSplitFile("Protein Section", "testset/protein_columns_in_summary.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Peptide Section", "testset/peptide_columns_in_summary.txt");
        writeLine("|| || || || ");
        printTabSplitFile("PSM Section", "testset/psm_columns_in_summary.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Small Molecule Section", "testset/smallmolecule_columns_in_summary.txt");
        writeLine("");
        writeLine("*Table 2*. Mandatory columns in mzTab 'Summary' files. Where noted, these columns " +
            "are mandatory for every study_variable[1-n] or every ms_run[1-n] reported in the file. Note" +
            " - any Quantification file type MAY include any of the Columns or Sections required for an Identification file type.");
        writeLine("");
        writeLine("");
    }

    /**
     * print complete table file to wiki document.
     */
    private void printCompleteTable() throws Exception {
        printTabSplitFile("Protein Section", "testset/protein_columns_in_complete.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Peptide Section", "testset/peptide_columns_in_complete.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Small Molecule Section", "testset/smallmolecule_columns_in_complete.txt");
        writeLine("");
        writeLine("*Table 3*. Mandatory columns in mzTab 'Complete' files. In addition, 'Complete' files " +
            "MUST also have all the items that are MANDATORY in a 'Summary' file (Table 2 above). Where noted, " +
            "these columns are mandatory for every assay[1-n], ms_run[1-n] or study_variable[1-n] reported in the file.");
        writeLine("");
        writeLine("");
    }

    /**
     * print optional table file to wiki document.
     */
    private void printOptionalTable() throws Exception {
        printTabSplitFile("Protein Section", "testset/protein_columns_in_optional.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Peptide Section", "testset/peptide_columns_in_optional.txt");
        writeLine("|| || || || ");
        printTabSplitFile("PSM Section", "testset/psm_columns_in_optional.txt");
        writeLine("|| || || || ");
        printTabSplitFile("Small Molecule Section", "testset/smallmolecule_columns_in_optional.txt");
        writeLine("");
        writeLine("*Table 4*. Optional fields in mzTab 'Complete' and 'Summary' files. ");
        writeLine("");
        writeLine("");
    }

    public static void main(String[] args) throws Exception {
        WikiRun run = new WikiRun();
        run.printErrorMessage();

//        run.printSummaryTable();
//        run.printCompleteTable();
//        run.printOptionalTable();
    }
}


text:
using System;
using System.Linq.Expressions;

namespace Dccelerator.UnExpressAssertion {
    sealed class ExceptionAsserter<TRequest> : AsserterBase<TRequest> {

        public ExceptionAsserter(TRequest request, string parameterName, LogAssertionDelegate log) : base(request, parameterName, log) {}

        /// <exception cref="Exception">Can't compile/invoke <paramref name="requestExpression" />.</exception>
        public ExceptionAsserter(Expression<Func<TRequest>> requestExpression, LogAssertionDelegate log) : base(requestExpression, log) {

        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <exception cref="InvalidOperationException">Than some assertion doesn mot meet.</exception>
        public override void Dispose() {
            if (!IsValid())
                throw new InvalidOperationException(ErrorMessage);
        }
    }
}


text:
package com.k2data.k2app.mybatis.handler;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.k2data.k2app.exception.K2Exception;
import com.k2data.k2app.utils.StringUtils;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;

import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * VARCHAR 存储 json 数据用到的 typeHandler
 *
 * @author lidong9144@163.com 17-3-21.
 */
public class JsonTypeHandler extends BaseTypeHandler<Object> {

    private ObjectMapper jsonObjectMapper = new ObjectMapper();

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType)
            throws SQLException {
        ps.setString(i, parseJson(parameter));
    }

    @Override
    public Object getNullableResult(ResultSet rs, String columnName) throws SQLException {
        return reflectJson(rs.getString(columnName));
    }

    @Override
    public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
        return reflectJson(rs.getString(columnIndex));
    }

    @Override
    public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
        return reflectJson(cs.getString(columnIndex));
    }

    private String parseJson(Object obj) {
        if (obj == null) {
            return null;
        }

        try {
            return jsonObjectMapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            throw new K2Exception(e);
        }
    }

    private Object reflectJson(String json) {
        if (StringUtils.isBlank(json)) {
            return null;
        }

        try {
            return jsonObjectMapper.readValue(json, Object.class);
        } catch (IOException e) {
            throw new K2Exception(e);
        }
    }

}


text:
This directory contains source data mapped to ontologies or web resources

###impc_mappings.yaml
Manually curated mappings of fields (codes, labels) to IRIs

###impc_procedures.json
procedures that cannot be web scraped as they are served as PDFs

###eco_map.yaml
Evidence Code to ECO curie map, manually generated

###biolink_vocabulary.yaml
Biolink model terms used to categorize things we ingest.


text:
using System;
using System.Reactive.Disposables;
using System.Reactive.Subjects;
using Akka.IO;
using v_1_1.Protocol;

namespace v_1_1
{
    public class ByteBuffer : ISubject<ByteString, string>
    {
        private IObserver<string> observer;
        private string buffer;

        public void OnNext(ByteString value)
        {
            buffer += value.DecodeString();

            int delimiterIndex;
            while (true)
            {
                delimiterIndex = FindDelimiter();
                if (delimiterIndex != -1)
                {
                    observer.OnNext(buffer);
                    DropBuffer(delimiterIndex + 4);
                }
                else
                {
                    break;
                }
            }
        }

        public void OnCompleted()
        {
            DropBuffer(buffer.Length);
            observer.OnCompleted();
        }

        public void OnError(Exception error)
        {
            DropBuffer(buffer.Length);
            observer.OnError(error);
        }

        public IDisposable Subscribe(IObserver<string> observer)
        {
            this.observer = observer;
            return Disposable.Empty;
        }

        private int FindDelimiter()
        {
            int bufferLength = buffer.Length;
            for (int i = 0; i < bufferLength - 2; i += 4)
            {
                switch ((byte)buffer[i])
                {
                    case Asci.CR:
                    {
                        if (buffer[i + 2] == Asci.CR && bufferLength > i + 3)
                        {
                            return i;
                        }
                        if (buffer[i - 2] == Asci.CR && bufferLength > i + 1)
                        {
                            return i - 2;
                        }
                        break;
                    }
                    case Asci.LF:
                    {
                        if (buffer[i + 2] == Asci.LF)
                        {
                            return i - 1;
                        }
                        if (buffer[i - 2] == Asci.LF)
                        {
                            return i - 3;
                        }
                        break;
                    }
                }
            }

            return -1;
        }

        private void DropBuffer(int count)
        {
            string cleanUpBuffer = buffer.Remove(0, count);
            buffer = cleanUpBuffer;
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Docums Mycol. 17(no. 65): 56 (1986)

#### Original name
Russula lutea f. montana Singer

### Remarks
null


text:
<?php

namespace App\Http\Controllers\Hrm;

use App\Models\Hrm\FreeDayModel;
use Illuminate\Http\Request;

class SettingController extends HrmController
{

    public function __construct(Request $request)
    {
        parent::__construct ( $request );

        $this->stash ['freeDays'] = FreeDayModel::freeDays ( 2019 );
    }

    public function index()
    {
        return $this->_respond ( 'hrm.setting.index' );
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {

        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {

        //
    }

    /**
     * Display the specified resource.
     *
     * @param int $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {

        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param int $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {

        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @param int $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {

        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param int $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {

        //
    }
}


text:
package org.pentaho.di.trans.steps.excelinput;

public enum SpreadSheetType {
  JXL( "Excel 97-2003 XLS (JXL)" ), POI( "Excel 2007 XLSX (Apache POI)" ),
    SAX_POI( "Excel 2007 XLSX (Apache POI Streaming)" ),
    ODS( "Open Office ODS (ODFDOM)" );

  private String description;

  /**
   * @param description
   */
  private SpreadSheetType( String description ) {
    this.description = description;
  }

  public String getDescription() {
    return description;
  }

  public static SpreadSheetType getStpreadSheetTypeByDescription( String description ) {
    for ( SpreadSheetType type : values() ) {
      if ( type.getDescription().equalsIgnoreCase( description ) ) {
        return type;
      }
    }
    return null;
  }
}


text:
import {Injectable} from 'angular2/core';

@Injectable()
export class LoadingMaskService {
    constructor() { }

    show() {
        this._getLoadingMaskElement().style.display = 'block';
        this._getLoadingMaskContainerElement().style.display = 'block';
    }

    hide() {
        this._getLoadingMaskElement().style.display = 'none';
        this._getLoadingMaskContainerElement().style.display = 'none';
    }

    private _getLoadingMaskElement(): HTMLElement {
        return <HTMLElement>document.getElementsByClassName('bs-loading-mask')[0];
    }

    private _getLoadingMaskContainerElement(): HTMLElement {
        return <HTMLElement>document.getElementsByClassName('bs-loading-mask-container')[0];
    }
}


text:
"""Tests for sorno_attach_realdate"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

import unittest

import sorno_attach_realdate

class AttachRealDateAppTestCase(unittest.TestCase):
    def setUp(self):
        self.args = lambda: None
        self.args.datetime_format = sorno_attach_realdate._datetime_format
        self.app = sorno_attach_realdate.AttachRealDateApp(self.args)

    def test_aggressive_process_lineWithNoDatetimeString_getItBack(self):
        line = "abc"
        self.assertEqual(
            line,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithDatetimeString(self):
        line = "hello 2006-01-02T15:04:05-0700 world"
        expected = "hello 2006-01-02T15:04:05-0700(2006-01-02 14:04:05) world"

        self.assertEqual(
            expected,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithShortDateString_originalLine(self):
        line = "hello 2006-11-02 world"

        self.assertEqual(
            line,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithDatetimeInQuotes(self):
        line = "hello '2006-01-02T15:04:05-0700' world"
        expected = "hello '2006-01-02T15:04:05-0700'(2006-01-02 14:04:05) world"

        self.assertEqual(
            expected,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithDatetimeInSpecialChars(self):
        line = "hello {'2006-01-02T15:04:05-0700'} world"
        expected = (
            "hello {'2006-01-02T15:04:05-0700'}(2006-01-02 14:04:05) world"
        )

        self.assertEqual(
            expected,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithDatetimeAndCharsInSpecialChars(self):
        line = "hello {'2006-01-02T15:04:05Z'} world"
        expected = (
            "hello {'2006-01-02T15:04:05Z'}(2006-01-02 07:04:05) world"
        )

        self.assertEqual(
            expected,
            self.app._aggressive_process(line),
        )

    def test_aggressive_process_lineWithDtWithNewlineAtTheEnd(self):
        line = "hello 2006-01-02T15:04:05-0700\n"
        expected = "hello 2006-01-02T15:04:05-0700(2006-01-02 14:04:05)\n"

        self.assertEqual(
            expected,
            self.app._aggressive_process(line),
        )


text:
/// <reference path="references.ts" />

module dChart {

    export interface IChart {

        elem:string;
        label:string;
        description:string;
        fontStyle:Utils.FontStyle;
        width:number;
        height:number;
        marginTop:number;
        marginLeft:number;
        marginBottom:number;
        marginRight:number;
        transition:Utils.Transition;
        dataSets:IDataSet[];
    }

    export interface IChart2DAxis {

        x:IAxis;
        y:IAxis;
    }

    export interface IChart2D extends IChart {

        axis:IChart2DAxis;
    }

    export interface IChart3DAxis {

        x:IAxis;
        y:IAxis;
        z:IAxis;
    }

    export interface IChart3D extends IChart {

        axis: IChart3DAxis;
    }

    export interface ISvgContainer {
        chart:D3.Selection;
        root:D3.Selection;
        axis:D3.Selection;
        data:D3.Selection;
        label:D3.Selection;
        legend:D3.Selection;
    }

    export interface IFontContainer {
        root:Utils.FontStyle;
        axis:Utils.FontStyle;
        ticks:Utils.FontStyle;
        legend:Utils.FontStyle;
        label:Utils.FontStyle;
        description:Utils.FontStyle;
    }

    export class Chart {

        _svg:ISvgContainer =  {
            chart:null,
            root:null,
            axis:null,
            data:null,
            label:null,
            legend:null
        };

        elem:Element;
        elemId:string;

        marginLeft:number = 50;
        marginRight:number = 10;
        marginTop:number = 20;
        marginBottom:number = 60;

        width:number = 400;
        height:number = 400;
        nettoWidth:number = 340;
        nettoHeight:number = 310;

        showTransition:boolean = false;
        transition:Utils.Transition = new Utils.Transition();

        label:string;
        description:string;

        _font:IFontContainer = {
            root: null,
            axis: null,
            ticks: null,
            legend: null,
            label: null,
            description: null
        };

        fontStyle:Utils.FontStyle = new Utils.FontStyle();

        dataSets:DataSet[] = [];

        format:any;

        constructor() {

            this.initialize();
            this.initializeFonts();
            this.initializeFormat();
        }

        clear() {

            if (this._svg.root) {
                this._svg.root.remove();
            }
        }

        initialize() {

        }

        initializeFormat() {

            this.setFormat(".2f");
        }

        initializeFonts() {

            this.fontStyle.fontFamily = this.fontStyle.fontFamily || "sans-serif";
            this.fontStyle.fontSize = this.fontStyle.fontSize || 11;
            this.fontStyle.fontWeight = this.fontStyle.fontWeight || "normal";
            this.fontStyle.stroke = this.fontStyle.stroke || "none";
            this.fontStyle.fill = this.fontStyle.fill || "black";

            this._font.root = this.fontStyle.clone();
            this._font.legend = this.fontStyle.clone();
            this._font.label = this.fontStyle.clone();
            this._font.description = this.fontStyle.clone();
            this._font.axis = this.fontStyle.clone();
            this._font.ticks = this.fontStyle.clone();

            this._font.label.fontWeight = "bold";
            this._font.ticks.fontSize -= 2;
        }

        setFormat(format:string) {

            this.format = d3.format(format);

            return this;
        }

        getPoint() {
            return new Point();
        }

        getSolver() {
            return new Utils.Solver();
        }

        redraw() {

            this.nettoWidth = this.width - this.marginLeft - this.marginRight;
            this.nettoHeight = this.height - this.marginTop - this.marginBottom;

            this._svg.root
                .attr("width", this.width)
                .attr("height", this.height)
                .attr("xmlns", "http://www.w3.org/2000/svg");

            this._svg.chart
                .attr("width", this.nettoWidth)
                .attr("height", this.nettoHeight)
                .attr("transform","translate("+ this.marginLeft +", "+ this.marginTop +")");

            this.redrawLabel();
            this.redrawAxis();
            this.redrawData();

            /*
                Apply the FontStyles
             */

            this._svg.chart
                .selectAll('text')
                .fontStyle(this.fontStyle);

            this._svg.chart
                .selectAll(".tick > text")
                .fontStyle(this._font.ticks);

            this._svg.label.select(".label")
                .fontStyle(this._font.label);

            this._svg.label.select(".description")
                .fontStyle(this._font.description);

            this._svg.legend.attr("transform", "translate("+ this.marginLeft +"," + this._font.legend.fontSize*0.5 + ")");
        }

        draw() {

            this.nettoWidth = this.width - this.marginLeft - this.marginRight;
            this.nettoHeight = this.height - this.marginTop - this.marginBottom;

            this.clear();

            this._svg.root = d3.select(this.elem)
                         .append("svg")
                         .attr("id", "dchart-" + this.elemId);

            this._svg.chart = this._svg.root.append("g")
                         .attr("class","dchart-container");

            this._svg.axis = this._svg.chart.append("g")
                .attr("class","dchart-container-axis");

            this._svg.data = this._svg.chart.append("g")
                .attr("class","dchart-container-data");

            this._svg.legend = this._svg.root.append("g")
                .attr("class","dchart-container-legend");

            this.drawLegend();
            this.drawLabel();
            this.drawAxis();
            this.drawData();

            this.redraw();
        }

        drawLabel() {

            this._svg.label = this._svg.root.append("g")
                .attr("class","dchart-container-label");

            this._svg.label.append("text")
                .attr("class","label");

            this._svg.label.append("text")
                .attr("class","description");
        }

        redrawLabel() {

            var description = this._svg.label.select(".description")
                .text(this.description)
                .attr("x", this.nettoWidth * 0.5 + this.marginLeft)
                .attr("y", this.height + this._font.label.fontSize*0.8)
                .attr("text-anchor", "middle");

            var label = this._svg.label.select(".label")
                .text(this.label)
                .attr("x", this.nettoWidth * 0.5 + this.marginLeft)
                .attr("y", this.height + this._font.label.fontSize*0.8)
                .attr("text-anchor", "middle");

            var descriptionOffset = 0,
                labelOffset = 0;

            if (this.description) {

                var descriptionDimen = description[0][0].getBBox();

                descriptionOffset -= descriptionDimen.height;
                labelOffset -= descriptionDimen.height;
            }

            if (this.label) {

                var labelDimen = label[0][0].getBBox();

                labelOffset -= labelDimen.height;
            }

            label.attr("transform", "translate(0,"+labelOffset+")");
            description.attr("transform", "translate(0,"+descriptionOffset+")");
        }

        drawLegend() {

            var legendDotRadius = this._font.legend.fontSize * 0.5,
                legendOffsetMin = 10,
                legendOffsetFactor = 0.03,
                legendOffset = this.nettoWidth * legendOffsetFactor > legendOffsetMin ? this.nettoWidth * legendOffsetFactor : legendOffsetMin,
                translateX = 0;

            this.dataSets.forEach((dataset:DataSet,k:number) => {

               if (dataset.showLegend === false) {
                   return;
               }

               var container =
                    this._svg.legend
                        .append("g")
                        .attr("height", legendDotRadius * 2),
                   symbolType = dataset.symbolStyle ? dataset.symbolStyle.type: "circle",
                   symbolPath = d3.svg.symbol().type(symbolType),
                   symbol = container
                    .append("path")
                    .attr("transform", "scale("+ legendDotRadius*0.18 +")")
                    .attr("x", 0)
                    .attr("y", 0)
                    .attr("d", symbolPath);

                if (dataset.symbolStyle) {
                    symbol.areaStyle(dataset.symbolStyle);
                }
                else if (dataset.areaStyle) {
                    symbol.areaStyle(dataset.areaStyle);
                }
                else {
                    symbol.style("stroke", "none");
                    symbol.style("fill", dataset.lineStyle.stroke);
                    symbol.style("fillOpacity", dataset.lineStyle.strokeOpacity);
                }

                container
                    .append("text")
                    .attr("x", legendDotRadius*1.5)
                    .attr("y", legendDotRadius*0.5)
                    .style("alignment-baseline", "middle")
                    .fontStyle(this._font.legend)
                    .text(dataset.label);

                if (k > 0) {
                    var allLegends = this._svg.legend.selectAll("g"),
                        prevLegend = allLegends[0][k - 1],
                        prevLegendDimen = prevLegend.getBBox();

                    translateX += prevLegendDimen.x + prevLegendDimen.width + legendOffset;
                }

                container.attr("transform", "translate (" + translateX + ")");

            });
        }

        redrawLegend() {

        }

        drawAxis() {

        }

        redrawAxis() {

        }

        drawData() {

        }

        redrawData() {

        }

        normalize(value:any) {

            if (value.hasOwnProperty("elem")) {
                this.elemId = value.elem;
                this.elem = document.getElementById(value.elem);
            }

            if (value.hasOwnProperty("label")) {
                this.label = value.label;
            }

            if (value.hasOwnProperty("description")) {
                this.description = value.description;
            }

            if (value.hasOwnProperty("width")) {
                this.width = parseFloat(value.width);
            }

            if (value.hasOwnProperty("height")) {
                this.height = parseFloat(value.height);
            }

            if (value.hasOwnProperty("marginTop")) {
                this.marginTop = parseFloat(value.marginTop);
            }

            if (value.hasOwnProperty("marginLeft")) {
                this.marginLeft = parseFloat(value.marginLeft);
            }

            if (value.hasOwnProperty("marginBottom")) {
                this.marginBottom = parseFloat(value.marginBottom);
            }

            if (value.hasOwnProperty("marginRight")) {
                this.marginRight = parseFloat(value.marginRight);
            }

            if (value.hasOwnProperty("showTransition")) {
                this.showTransition = true;
            }

            if (value.hasOwnProperty("format")) {
                this.setFormat(value.format);
            }

            if (value.hasOwnProperty("transition")) {

                var transition = new Utils.Transition();
                transition.normalize(value.transition);
                this.transition = transition;

                this.showTransition = true;
            }

            if (value.hasOwnProperty("fontStyle")) {

                this.fontStyle = this.fontStyle || new Utils.FontStyle();
                this.fontStyle.normalize(value.fontStyle);
                this.initializeFonts();
            }

            if (value.hasOwnProperty("dataSets")) {

                this.dataSets = [];

                value.dataSets.forEach((config) => {

                    var dataSet = new DataSet(this);
                    dataSet.normalize(config);
                    this.dataSets.push(dataSet);
                });
            }
        }

        recalculate() {

            this.dataSets.forEach((dataSet:DataSet) => {
                dataSet.calculate();
            });
        }

        unique(axis:string = "x") {

            var u = {}, a = [];

            this.dataSets.forEach(function(dataset) {

                var value = dataset.unique(axis);

                for(var i = 0, l = value.length; i < l; ++i){
                    if(u.hasOwnProperty(value[i])) {
                        continue;
                    }
                    a.push(value[i]);
                    u[value[i]] = 1;
                }
            });

            return a;
        }
    }

    export class Chart2D extends Chart {

        // TODO
        // xAxis:xAxis and yAxis:yAxis is causing error in WebStorm
        xAxis:any;
        yAxis:any;

        initialize() {

            this.xAxis = new xAxis(this);
            this.yAxis = new yAxis(this);
        }

        setFormat(format:string) {

            this.format = d3.format(format);
            this.xAxis.setFormat(format);
            this.yAxis.setFormat(format);

            return this;
        }

        getPoint() {
            return new Point();
        }

        getSolver() {
            return new Utils.Solver2D();
        }

        redraw() {

            this.nettoWidth = this.width - this.marginLeft - this.marginRight;
            this.nettoHeight = this.height - this.marginTop - this.marginBottom;

            this.xAxis.length = this.nettoWidth;
            this.xAxis.height = this.nettoHeight;
            this.yAxis.length = this.nettoHeight;
            this.yAxis.height = this.nettoWidth;

            super.redraw();
        }

        drawAxis() {

            var min = [this.min("x"),this.min("y")];
            var max = [this.max("x"),this.max("y")];

            this.xAxis.draw(this._svg.axis, min[0], max[0]);
            this.yAxis.draw(this._svg.axis, min[1], max[1]);
        }

        redrawAxis() {

            var min = [this.min("x"),this.min("y")];
            var max = [this.max("x"),this.max("y")];

            this.xAxis.redraw(min[0], max[0]);
            this.yAxis.redraw(min[1], max[1]);
        }

        drawData() {

        }

        redrawData() {

        }

        min(axis:string = "x") {
            return d3.min(this.dataSets, (dataSet:DataSet) => dataSet.min(axis));
        }

        max(axis:string = "x") {
            return d3.max(this.dataSets, (dataSet:DataSet) => dataSet.max(axis));
        }

        normalize(value:any) {
            super.normalize(value);

            if (value.hasOwnProperty("axis")) {

                var axis = value.axis;

                if (axis.hasOwnProperty("x")) {

                    this.xAxis.normalize(axis.x)
                }

                if (axis.hasOwnProperty("y")) {

                    this.yAxis.normalize(axis.y)
                }
            }
        }
    }

    export class Chart3D extends Chart {

        public dataSets:DataSet[] = [];

        depth:number = 400;

        xAxis:any;
        yAxis:any;
        zAxis:any;

        initialize() {

            this.xAxis = new xAxis(this);
            this.yAxis = new yAxis(this);
            this.zAxis = new zAxis(this);
        }

        setFormat(format:string) {

            this.format = d3.format(format);
            this.xAxis.setFormat(format);
            this.yAxis.setFormat(format);
            this.zAxis.setFormat(format);

            return this;
        }

        getPoint() {
            return new Point();
        }

        drawAxis() {
            var min = [this.min("x"),this.min("y"),this.min("z")];
            var max = [this.max("x"),this.max("y"),this.min("z")];

            this.xAxis.draw(this._svg.axis, min[0], max[0]);
            this.yAxis.draw(this._svg.axis, min[1], max[1]);
            this.zAxis.draw(this._svg.axis, min[2], max[2]);
        }

        redrawAxis() {
            var min = [this.min("x"),this.min("y"),this.min("z")];
            var max = [this.max("x"),this.max("y"),this.min("z")];

            this.xAxis.redraw(min[0], max[0]);
            this.yAxis.redraw(min[1], max[1]);
            this.zAxis.redraw(min[2], max[2]);
        }

        drawData() {

        }

        redrawData() {

        }

        min(axis:string = "x") {
            return d3.min(this.dataSets, (dataSet:DataSet) => dataSet.min(axis));
        }

        max(axis:string = "x") {
            return d3.max(this.dataSets, (dataSet:DataSet) => dataSet.max(axis));
        }

        normalize(value:any) {
            super.normalize(value);

            if (value.hasOwnProperty("axis")) {

                var axis = value.axis;

                if (axis.hasOwnProperty("x")) {

                    this.xAxis.normalize(axis.x)
                }

                if (axis.hasOwnProperty("y")) {

                    this.yAxis.normalize(axis.y)
                }

                if (axis.hasOwnProperty("z")) {

                    this.zAxis.normalize(axis.z)
                }
            }

            this.nettoWidth = this.width - this.marginLeft - this.marginRight;
            this.nettoHeight = this.height - this.marginTop - this.marginBottom;

            this.xAxis.length = this.nettoWidth;
            this.xAxis.height = this.nettoHeight;
            this.yAxis.length = this.nettoHeight;
            this.yAxis.height = this.nettoWidth;
            this.zAxis.length = this.depth;
            this.zAxis.height = this.depth;
        }
    }
}


text:
<?php

namespace App\Ship\Parents\Providers;

use Apiato\Core\Abstracts\Providers\MainServiceProvider as AbstractMainServiceProvider;

abstract class MainServiceProvider extends AbstractMainServiceProvider
{
    /**
     * Perform post-registration booting of services.
     */
    public function boot(): void
    {
        parent::boot();
    }

    /**
     * Register anything in the container.
     */
    public function register(): void
    {
        parent::register();
    }
}


text:
function checkSpeed(situation) {
    let speed = situation[0];
    let territory = situation[1].toLowerCase();
    let overSpeedLimit = isOver(speed, territory);
    if (overSpeedLimit) {
        if (overSpeedLimit > 40) {
            console.log('reckless driving');
        } else if (overSpeedLimit > 20) {
            console.log('excessive speeding');
        } else {
            console.log('speeding');
        }
    }

    function isOver(speed, territory) {
        switch (territory) {
            case 'motorway':
                return speed > 130 ? speed - 130 : false;
            case 'interstate':
                return speed > 90 ? speed - 90 : false;
            case 'city':
                return speed > 50 ? speed - 50 : false;
            case 'residential':
                return speed > 20 ? speed - 20 : false;
        }
    }
}

checkSpeed([40, 'city']);
checkSpeed([21, 'residential']);
checkSpeed([120, 'interstate']);
checkSpeed([200, 'motorway']);


text:
jQuery(document).ready(function($) {
    var showForm = function() {
        $("#signup_header").show();
        $("#support_form").show();

        $(".signupnow").hide();
        $("#support_form_submit_success").hide();
        $("#support_form_submit_failure").hide();

        $(".signup").slideDown();
    };

    var hideForm = function() {
        $(".signup").hide();
        $(".signupnow").show();
    };

    var showSuccessMessage = function() {
        $("#signup_header").hide();
        $("#support_form").hide();
        $("#support_form_submit_success").show();
    };

    var showFailureMessage = function() {
        $("#signup_header").hide();
        $("#support_form").hide();
        $("#support_form_submit_failure").show();
    };

    $(".signupnow").click(function(event) {
        showForm();
    });

    $(".signup .close").click(function(event) {
        hideForm();
    });

    $("#support_form_submit").click(function() {
        var name = $("#support_user_name").val();
        var email = $("#support_email_address").val();
        var query = $("#support_query").val();

        $.ajax({
            url: 'https://twstudios.zendesk.com/requests/embedded/create',
            method: 'POST',
            contentType: 'application/json',
            data: JSON.stringify({
                via_id: 48,
                locale_id: 1,
                set_tags: "web_widget",
                submitted_from: document.location.href,
                name: name,
                email: email,
                description: query
            })
        }).done(function() {
            showSuccessMessage();
        }).error(function() {
            showFailureMessage();
        });
    });
})


text:
<?xml version="1.0" encoding="UTF-8"?>
<extension id="xmlfield" status="released" xmlns="http://getsymphony.com/schemas/extension/1.0">
	<name>XML Field</name>
	<description>A textarea field that only accepts valid XML</description>
	<repo type="github">https://github.com/symphonists/xmlfield</repo>
	<url type="discuss">http://symphony-cms.com/discuss/thread/32815/</url>
	<types>
		<type>Field</type>
	</types>
	<authors>
		<author>
			<name github="symphonists" symphony="community">Symphony Community</name>
		</author>
	</authors>
	<releases>
		<release version="1.2.2" date="2014-06-25" min="2.4">
			- Clean-up
			- Set monospace font
		</release>
		<release version="1.2.1" date="2012-05-16" min="2.3" />
		<release version="1.2.0" date="2012-03-16" min="2.3" />
		<release version="1.1.0" date="2011-03-22" min="2.2" max="2.2.5" />
	</releases>
</extension>


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			classpath*:cn/**/restlet-conf/*.xml;
			classpath*:config/spring-conf/*.xml;
			classpath*:config/restlet-conf/*.xml;
		</param-value>
	</context-param>
	<!-- log4j config -->
	<context-param>
		<param-name>log4jConfigLocation</param-name>
		<param-value>classpath:log4j.properties</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<!-- Spring log4j 配置 -->
	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>

	<!-- Spring 刷新Introspector防止内存泄露 -->
	<listener>
		<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
	</listener>

	<filter>
		<filter-name>hibernateFilter</filter-name>
		<filter-class>cn.newcapec.framework.core.filter.OpenSessionInViewFilter</filter-class>
		<init-param>
			<param-name>singleSession</param-name>
			<param-value>false</param-value>
		</init-param>
	</filter>
	<servlet>
		<servlet-name>CXFService</servlet-name>
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>CXFService</servlet-name>
		<url-pattern>/services/*</url-pattern>
	</servlet-mapping>
	<!-- 多视图的 -->
	<servlet>
		<servlet-name>multiViewController</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath*:config/spring-conf/application-ecardcity-om.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>multiViewController</servlet-name>
		<url-pattern>/controller/*</url-pattern>
	</servlet-mapping>

	<filter-mapping>
		<filter-name>hibernateFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>

	<filter>
		<filter-name>pagerFilter</filter-name>
		<filter-class>cn.newcapec.framework.core.filter.PagerFilter</filter-class>
	</filter>

	<filter>
		<filter-name>requestEncodeFilter</filter-name>
		<filter-class>cn.newcapec.framework.core.filter.RequestEncodeFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>requestEncodeFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>pagerFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<servlet>
		<servlet-name>restlet</servlet-name>
		<servlet-class>com.noelios.restlet.ext.spring.SpringServerServlet</servlet-class>
		<init-param>
			<param-name>org.restlet.component</param-name>
			<param-value>component</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>restlet</servlet-name>
		<url-pattern>/restful/*</url-pattern>
	</servlet-mapping>

	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

	<welcome-file-list>
		<welcome-file>/index.jsp</welcome-file>
	</welcome-file-list>
</web-app>


text:
package com.penitence.util.transforms;

import com.penitence.model.BaseBean;
import com.penitence.util.BeanConvertUtil;
import com.penitence.util.interfaces.ConvertToMap;
import com.penitence.util.interfaces.ObjectTransform;

import java.util.Map;

/**
 * class using
 * create by 2016/8/28
 *
 * @version 1.0.0
 * @auther Penitence
 */
public class BaseBeanTransform implements ObjectTransform {
    private ConvertToMap convertToMap = new BeanConvertUtil();

    public BaseBeanTransform() {
    }

    public Object transformField(String field, Object value) {
        if(BaseBean.class.isAssignableFrom(value.getClass())) {
            this.convertToMap.registerTransform(BaseBean.class, new BaseBeanTransform());
            Map childrenResult = this.convertToMap.transformMap(value);
            return childrenResult;
        } else {
            return value;
        }
    }
}


text:
package org.objectweb.jtests.jms.conform.session;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.junit.Assert;
import org.junit.Test;
import org.objectweb.jtests.jms.framework.PTPTestCase;
import org.objectweb.jtests.jms.framework.TestConfig;

/**
 * Test sessions
 *

 * See JMS specifications, sec. 4.4 Session
 */
public class SessionTest extends PTPTestCase
{

   /**
    * Test that an attempt to call the recover() method on a
    * transacted  Session throws a
    * javax.jms.IllegalStateException.
    */
   @Test
   public void testRecoverTransactedSession()
   {
      try
      {
         // senderSession has been created as non transacted
         Assert.assertEquals(false, senderSession.getTransacted());
         // we create it again but as a transacted session
         senderSession = senderConnection.createQueueSession(true, 0);
         Assert.assertEquals(true, senderSession.getTransacted());
         senderSession.recover();
         Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
      }
      catch (javax.jms.IllegalStateException e)
      {
      }
      catch (java.lang.IllegalStateException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
      }
      catch (Exception e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e);
      }
   }

   /**
    * Test that a call to the rollback() method on a
    * transacted Session rollbacks all
    * the messages sent in the transaction.
    */
   @Test
   public void testRollbackTransactedSession()
   {
      try
      {
         // re-create senderSession as a transacted session
         senderSession = senderConnection.createQueueSession(true, 0);
         sender = senderSession.createSender(senderQueue);
         Assert.assertEquals(true, senderSession.getTransacted());

         TextMessage message = senderSession.createTextMessage();
         message.setText("testRollbackTransactedSession");
         // send a message within a transacted session
         sender.send(message);

         // rollback the transaction -> the sent message shouldn't be received
         senderSession.rollback();

         TextMessage m = (TextMessage)receiver.receiveNoWait();
         // test that no message has been received
         Assert.assertEquals(null, m);
      }
      catch (Exception e)
      {
         fail(e);
      }
   }

   /**
    * Test that a call to the rollback() method on a
    * transacted Session rollbacks all
    * the messages sent in the transaction.
    */
   @Test
   public void testCommitTransactedSession()
   {
      try
      {
         // re-create senderSession as a transacted session
         senderSession = senderConnection.createQueueSession(true, 0);
         sender = senderSession.createSender(senderQueue);
         Assert.assertEquals(true, senderSession.getTransacted());

         TextMessage message = senderSession.createTextMessage();
         message.setText("testCommitTransactedSession");
         // send a message within a transacted session
         sender.send(message);

         TextMessage m = (TextMessage)receiver.receiveNoWait();
         // test that no message has been received (the transaction has not been committed yet)
         Assert.assertEquals(null, m);

         // commit the transaction -> the sent message should be received
         senderSession.commit();

         m = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
         Assert.assertTrue(m != null);
         Assert.assertEquals("testCommitTransactedSession", m.getText());
      }
      catch (Exception e)
      {
         fail(e);
      }
   }

   /**
    * Test that an attempt to call the roolback() method on a
    * non transacted Session throws a
    * javax.jms.IllegalStateException.
    */
   @Test
   public void testRollbackNonTransactedSession()
   {
      try
      {
         // senderSession has been created as non transacted in the setUp() method
         Assert.assertEquals(false, senderSession.getTransacted());
         senderSession.rollback();
         Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
      }
      catch (javax.jms.IllegalStateException e)
      {
      }
      catch (java.lang.IllegalStateException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
      }
      catch (Exception e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e);
      }
   }

   /**
    * Test that an attempt to call the commit() method on a
    * non transacted Session throws a
    * javax.jms.IllegalStateException.
    */
   @Test
   public void testCommitNonTransactedSession()
   {
      try
      {
         // senderSession has been created as non transacted in the setUp() method
         Assert.assertEquals(false, senderSession.getTransacted());
         senderSession.commit();
         Assert.fail("Should raise an IllegalStateException, the session is not transacted.\n");
      }
      catch (javax.jms.IllegalStateException e)
      {
      }
      catch (java.lang.IllegalStateException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException.\n");
      }
      catch (Exception e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e);
      }
   }

   /**
    * Test that the getTransacted() method of a Session returns true
    * if the session is transacted, false else.
    */
   @Test
   public void testGetTransacted()
   {
      try
      {
         // senderSession has been created as non transacted
         Assert.assertEquals(false, senderSession.getTransacted());
         // we re-create senderSession as a transacted session
         senderSession = senderConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
         Assert.assertEquals(true, senderSession.getTransacted());
      }
      catch (Exception e)
      {
         fail(e);
      }
   }

   /**
    * Test that invoking the acknowledge() method of a received message
    * from a closed session must throw an IllegalStateException.
    */
   @Test
   public void testAcknowledge()
   {
      try
      {
         if (receiverSession != null)
         {
            receiverSession.close();
         }
         receiverSession = receiverConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
         receiver = receiverSession.createReceiver(receiverQueue);

         Message message = senderSession.createMessage();
         sender.send(message);

         Message m = receiver.receive(TestConfig.TIMEOUT);
         receiverSession.close();
         m.acknowledge();
         Assert.fail("sec. 4.4.1 Invoking the acknowledge method of a received message from a closed " + " session must throw an [javax.jms.]IllegalStateException.\n");
      }
      catch (javax.jms.IllegalStateException e)
      {
      }
      catch (JMSException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e);
      }
      catch (java.lang.IllegalStateException e)
      {
         Assert.fail("sec. 4.4.1 Invoking the acknowledge method of a received message from a closed " + "session must throw an [javax.jms.]IllegalStateException, "
                     + "[not a java.lang.IllegalStateException]");
      }
   }

   /**
    * Test that it is valid to use message objects created or received via the [closed] session with the
    * exception of a received message acknowledge() method.
    */
   @Test
   public void testUseMessage()
   {
      try
      {
         TextMessage message = senderSession.createTextMessage();
         message.setText("testUseMessage");
         sender.send(message);

         TextMessage m = (TextMessage)receiver.receive(TestConfig.TIMEOUT);
         receiverSession.close();
         Assert.assertEquals("testUseMessage", m.getText());
      }
      catch (Exception e)
      {
         Assert.fail("sec. 4.4.1 It is valid to continue to use message objects created or received via " + "the [closed] session.\n");
      }
   }

   /**
    * Test that an attempt to use a Session which has been closed
    * throws a javax.jms.IllegalStateException.
    */
   @Test
   public void testUsedClosedSession()
   {
      try
      {
         senderSession.close();
         senderSession.createMessage();
         Assert.fail("sec. 4.4.1 An attempt to use [a closed session] must throw a [javax.jms.]IllegalStateException.\n");
      }
      catch (javax.jms.IllegalStateException e)
      {
      }
      catch (JMSException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a " + e);
      }
      catch (java.lang.IllegalStateException e)
      {
         Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException");
      }
   }

   /**
    * Test that closing a closed session does not throw
    * an exception.
    */
   @Test
   public void testCloseClosedSession()
   {
      try
      {
         // senderSession is already started
         // we close it once
         senderSession.close();
         // we close it a second time
         senderSession.close();
      }
      catch (Exception e)
      {
         Assert.fail("sec. 4.4.1 Closing a closed session must NOT throw an exception.\n");
      }
   }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="org.koin.sample.android">

    <application
        android:name="org.koin.sample.androidx.MainApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">

        <activity android:name="org.koin.sample.androidx.main.MainActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="org.koin.sample.androidx.mvp.MVPActivity" />
        <activity android:name="org.koin.sample.androidx.mvvm.MVVMActivity" />
        <activity android:name="org.koin.sample.androidx.scope.ScopedActivityA" />
        <activity android:name="org.koin.sample.androidx.scope.ScopedActivityB" />
        <activity android:name="org.koin.sample.androidx.sdk.HostActivity" />
        <activity android:name="org.koin.sample.androidx.workmanager.WorkManagerActivity" />

        <activity android:name="org.koin.sample.androidx.components.sdk.SDKActivity" />
        <activity android:name="org.koin.sample.androidx.navigation.NavActivity" />

        <provider
                android:name="androidx.startup.InitializationProvider"
                android:authorities="${applicationId}.androidx-startup"
                android:exported="false"
                tools:node="merge">
            <!-- If you are using androidx.startup to initialize other components -->
            <meta-data
                    android:name="androidx.work.WorkManagerInitializer"
                    android:value="androidx.startup"
                    tools:node="remove" />
        </provider>

    </application>

</manifest>